summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-10-15 08:19:50 -0500
committerInstrumental <jonathan.gathman@att.com>2019-10-15 08:35:35 -0500
commit1296352d8eafee57f982a4342ad79ada4aa56d28 (patch)
tree355cdb89d85530a861319f892b0f24236e6adc50
parentbdce7667a6e272e2fa32e298d957a0d9090c5bc9 (diff)
Sonar Fixes, Formatting
Issue-ID: AAF-1019 Change-Id: Ica49d9e7323aad9622ff9d95cc21b87430c22c54 Signed-off-by: Instrumental <jonathan.gathman@att.com>
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java58
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java14
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java18
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java14
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java36
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java22
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java34
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java38
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java62
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java46
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java22
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java52
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java104
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java36
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java32
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java30
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java60
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java30
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java10
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java24
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java20
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java20
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_ApprovalSetTest.java32
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_Pending.java4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_URApprovalSet.java4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_BatchDataViewTest.java4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchLoopTest.java4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchTest.java4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_CacheChange.java16
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Creator.java12
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Cred.java46
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java14
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Role.java22
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_Batch.java14
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchException.java8
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchPrincipal.java6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_CassBatch.java14
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java86
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Bytification.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CIDAO.java10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cacheable.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java28
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java50
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java26
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java34
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAOException.java6
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO_RO.java10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java28
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Streamer.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Touchable.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCertDAO.java12
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java24
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedNSDAO.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java12
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java202
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java36
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java28
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java50
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheableData.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java28
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ConfigDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java42
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java14
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java46
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java28
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java14
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java68
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java70
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java60
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Status.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java56
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java126
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java164
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java22
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java24
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java12
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java14
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java20
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedDAO.java12
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassAccess.java10
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassDAOImpl.java12
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_DAOException.java20
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java32
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java54
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java10
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCertDAOTest.java4
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCredDAOTest.java4
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedNSDAOTest.java4
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedPermDAOTest.java32
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedRoleDAO.java42
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedUserRoleDAO.java46
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ApprovalDAO.java66
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ArtiDAO.java68
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CacheInfoDAO.java94
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CertDAOTest.java88
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ConfigDAOTest.java68
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_DelegateDAO.java42
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_FutureDAO.java78
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_HistoryDAO.java90
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_LocateDAO.java88
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_Namespace.java18
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_NsDAO.java134
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_OAuthTokenDAO.java64
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_PermDAO.java134
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_RoleDAO.java138
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_UserRoleDAO.java100
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_CassExecutor.java44
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_Function.java686
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_PermLookup.java154
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLocator.java38
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLur.java70
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java80
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectCertIdentity.java14
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectLocatorCreator.java14
-rw-r--r--auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectRegistrar.java10
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java30
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/LocalCAImpl.java6
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java20
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java24
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java40
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java46
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java32
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java16
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java22
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java20
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java24
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java24
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertDrop.java4
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertRenew.java4
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertReq.java10
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java24
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade.java46
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade1_0.java10
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeFactory.java6
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java60
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper.java10
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java12
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java14
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java90
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/Code.java6
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java16
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java54
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java28
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java24
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java142
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainTest.java4
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainWithIssuerTest.java4
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java36
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertReqTest.java4
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertRespTest.java4
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java66
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java24
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java46
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java52
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/DeprecatedCMD.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/MessageException.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Param.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Cache.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Mgmt.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Session.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java18
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java28
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsers.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java18
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/NS.java6
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java26
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java22
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByNS.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByName.java18
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByRole.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Perm.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java20
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java22
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNS.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNameOnly.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java20
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByRole.java20
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java22
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Role.java4
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java20
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java20
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java14
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java16
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java8
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/User.java4
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/HMangrStub.java6
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java34
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java6
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BasicAuth.java10
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java40
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Help.java24
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java16
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java16
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java14
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java16
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java34
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java10
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java16
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java4
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java6
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java8
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Responsible.java6
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java22
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java16
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java16
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByNS.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java16
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java26
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java12
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java14
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java24
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java20
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java24
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java36
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java14
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java34
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java24
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java20
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java30
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java14
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java6
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java46
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java30
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java30
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java42
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java18
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java10
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java176
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java6
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java20
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java28
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java110
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java8
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java22
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java36
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java42
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java12
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java20
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java20
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java18
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java28
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java14
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java48
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java10
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java6
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java32
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java22
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java46
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java16
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java4
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java12
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/common/test/JU_Define.java4
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java2
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransFilter.java12
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransImpl.java38
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_NullTrans.java74
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java20
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java8
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java32
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/log4j/test/JU_Log4jAccessAppender.java26
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_Organization.java12
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/CredCompare.java8
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/JU_RequestCheck.java6
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/MultiCompare.java14
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java10
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java8
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/PermCompare.java8
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RoleCompare.java8
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RolePermCompare.java8
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RosettaCompare.java20
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/UserRoleCompare.java8
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch.java32
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch1.java32
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterRoute.java6
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content.java226
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content1.java18
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Pair.java6
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Route.java12
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_RouteReport.java4
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Routes.java20
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_TypedCode.java26
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Version.java16
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java20
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java32
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java10
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/JU_Mask.java12
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java6
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java14
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java8
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgWarnings.java4
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java22
-rw-r--r--auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java12
-rw-r--r--auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgIdentity.java4
-rw-r--r--auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrgWarnings.java4
-rw-r--r--auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Identities.java10
-rw-r--r--auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_Passwords.java8
-rw-r--r--auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java14
-rw-r--r--auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java4
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java48
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/ContentCode.java4
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Controls.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java26
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java14
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java12
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java8
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java100
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java36
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java4
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java16
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java10
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java64
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java18
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java24
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java24
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java42
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredHistory.java46
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/Home.java8
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java22
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLandingAction.java10
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java40
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java48
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java16
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java8
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java18
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java20
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java22
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java20
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java18
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java26
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java16
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java50
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java16
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java28
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java32
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java22
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java46
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java18
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java16
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java14
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/WebCommand.java40
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/AbsCell.java8
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/ButtonCell.java8
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/CheckBoxCell.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RadioCell.java8
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java8
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TableData.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextAndRefCell.java6
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextCell.java10
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextInputCell.java10
-rw-r--r--auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextToolTipCell.java10
-rw-r--r--auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_FormTest.java4
-rw-r--r--auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_TableTest.java4
-rw-r--r--auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/table/JU_UICellTest.java4
-rw-r--r--auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java30
-rw-r--r--auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java24
-rw-r--r--auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java8
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java36
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java4
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java8
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java44
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java8
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java16
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java20
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java26
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java6
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java54
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java4
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java4
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java8
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java4
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java26
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java14
-rw-r--r--auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java4
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java44
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java20
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OACode.java8
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java8
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2FormHttpTafResp.java12
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java10
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java4
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java4
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectOAFacadeImpl.java4
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade.java12
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade1_0.java8
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeFactory.java8
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java54
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper.java10
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java22
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect.java4
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java6
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoader.java4
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java6
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java24
-rw-r--r--auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OCreds.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_DirectOAuthTAF.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OACodeTest.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FilterTest.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FormHttpTafRespTest.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_DirectOAFacadeImplTest.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_OAFacadeFactory.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_Mapper1_0Test.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_MapperIntrospect1_0Test.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_JSONPermLoaderFactoryTest.java4
-rw-r--r--auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_OCredsTest.java4
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java42
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java936
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzService.java244
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/Code.java8
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/MayChange.java6
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java10
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java24
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java72
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Delegate.java48
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java42
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java48
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Multi.java12
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_NS.java128
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java128
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Roles.java134
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_User.java24
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_UserRole.java38
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade.java82
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeFactory.java6
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java294
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade_2_0.java4
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper.java14
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java96
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java34
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Approval.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Creds.java8
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Delegate.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_History.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_NS.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Perms.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Roles.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_User.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_UserRole.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/facade/JU_AuthzFacadeImpl.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/mapper/JU_Mapper_2_0.java4
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_BaseServiceImpl.java24
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_ServiceImpl_createUserCred.java16
-rw-r--r--auth/auth-service/src/test/java/org/onap/aaf/auth/service/validation/test/JU_ServiceValidator.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java28
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java2
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java32
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java26
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java26
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java74
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java36
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java76
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java40
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java36
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java20
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java20
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java2
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java48
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java24
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java162
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java30
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java40
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java8
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java36
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java22
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java22
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java22
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java10
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java14
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java60
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java26
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java20
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java18
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java6
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java8
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java32
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java16
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java46
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java20
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java8
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java14
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java36
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java12
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java46
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java38
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java10
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java38
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java28
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java22
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java22
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java4
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java10
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java8
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java18
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java12
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java20
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java4
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java2
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java16
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java12
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java10
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java52
-rw-r--r--cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java16
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java22
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java12
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java4
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java70
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java8
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java10
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java12
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java56
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java34
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java4
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java20
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java4
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java8
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java28
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java22
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java20
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java24
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java6
-rw-r--r--cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java50
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java22
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java16
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java12
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java6
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java66
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java10
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java8
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java10
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java22
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java4
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java18
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java12
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java24
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java6
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java16
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java26
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java26
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java8
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java8
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java4
-rw-r--r--cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/AES.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java102
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Access.java32
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java40
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java44
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java44
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java36
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java40
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java40
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java70
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java172
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java26
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/User.java26
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java108
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java16
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java36
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java40
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java20
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java58
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java38
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java36
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java16
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java28
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java22
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java44
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java24
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java36
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java46
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java48
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java58
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java46
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java12
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java16
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java74
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java6
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java4
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java10
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java14
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java8
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java22
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java18
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java22
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java82
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java40
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java26
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java22
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java8
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java16
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java12
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java12
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java10
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java34
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java20
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java8
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java14
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java52
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java8
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java10
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java12
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java8
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java6
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java32
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java16
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java12
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java6
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java4
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java20
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java20
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java4
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java6
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java12
-rw-r--r--cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java56
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java54
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java44
-rw-r--r--cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java58
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java28
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java8
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java22
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java8
-rw-r--r--cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java18
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java9
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/Api.java146
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java12
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java16
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java8
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java56
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java26
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java4
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java186
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java62
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java55
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java38
-rw-r--r--misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java12
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java60
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxEval.java4
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java26
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java10
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java28
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Nulls.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Out.java10
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java26
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java10
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java46
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parse.java14
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/ParseException.java4
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java12
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java30
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java22
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java36
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java28
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaEnv.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java32
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldBlob.java8
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDate.java6
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDateTime.java6
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldHexBinary.java6
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldMarshal.java10
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldNumeric.java6
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldString.java6
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ListIterator.java10
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java4
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java16
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java8
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java146
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java152
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java12
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java6
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java38
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java40
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java42
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java18
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java8
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java26
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java18
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java18
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java12
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java64
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java14
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java14
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java4
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java12
910 files changed, 11187 insertions, 11181 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
index f361e750..b5ff59b1 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
@@ -7,9 +7,9 @@
* 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.
@@ -73,12 +73,12 @@ public abstract class Batch {
protected static final String STARS = "*****";
- protected static Cluster cluster;
+ protected static Cluster cluster;
protected static AuthzEnv env;
protected static Session session;
protected static Set<String> specialNames;
protected static List<String> specialDomains;
- protected static boolean dryRun;
+ protected static boolean dryRun;
protected static String batchEnv;
private static File logdir;
@@ -88,12 +88,12 @@ public abstract class Batch {
protected static final String MAX_EMAILS="MAX_EMAILS";
protected static final String VERSION="VERSION";
public static final String GUI_URL="GUI_URL";
-
+
protected final Organization org;
protected String version;
protected static final Date now = new Date();
protected static final Date never = new Date(0);
-
+
protected Batch(AuthzEnv env) throws APIException, IOException, OrganizationException {
if (batchEnv != null) {
env.info().log("Redirecting to ",batchEnv,"environment");
@@ -149,22 +149,22 @@ public abstract class Batch {
}
}
}
-
+
version = env.getProperty(VERSION,Config.AAF_DEFAULT_API_VERSION);
}
protected abstract void run(AuthzTrans trans);
protected void _close(AuthzTrans trans) {}
-
+
public String[] args() {
return env.get(ssargs);
}
-
+
public boolean isDryRun()
{
return dryRun;
}
-
+
public boolean isSpecial(String user) {
if(user==null) {
return false;
@@ -230,7 +230,7 @@ public abstract class Batch {
return (organization);
}
-
+
public static Row executeDeleteQuery(Statement stmt) {
Row row = null;
if (!dryRun) {
@@ -240,7 +240,7 @@ public abstract class Batch {
return (row);
}
-
+
public static int acquireRunLock(String className) {
Boolean testEnv = true;
String envStr = env.getProperty("AFT_ENVIRONMENT");
@@ -320,7 +320,7 @@ public abstract class Batch {
}
return (1);
}
-
+
private static void deleteLock( String className) {
Row row = session.execute( String.format( "DELETE FROM authz.run_lock WHERE class = '%s' IF EXISTS", className ) ).one();
if (! row.getBool("[applied]")) {
@@ -336,7 +336,7 @@ public abstract class Batch {
}
}
}
-
+
protected static File logDir() {
if(logdir == null) {
String ld = env.getProperty(LOG_DIR);
@@ -351,7 +351,7 @@ public abstract class Batch {
if(!logdir.exists()) {
logdir.mkdirs();
}
- }
+ }
return logdir;
}
protected int count(String str, char c) {
@@ -386,13 +386,13 @@ public abstract class Batch {
sbos.getBuffer().append(s);
sbos.getBuffer().append(' ');
}
-
+
InputStream is = null;
String filename;
String propLoc;
try {
Define.set(access);
-
+
if(access.getProperty(Config.CADI_PROP_FILES)==null) {
File f = new File("authBatch.props");
try {
@@ -424,7 +424,7 @@ public abstract class Batch {
}
env = new AuthzEnv(access);
-
+
transferVMProps(env, CASS_ENV, "DRY_RUN", "NS", "Organization");
// Be able to change Environments
@@ -446,7 +446,7 @@ public abstract class Batch {
Batch batch = null;
AuthzTrans trans = env.newTrans();
-
+
TimeTaken tt = trans.start("Total Run", Env.SUB);
try {
int len = args.length;
@@ -459,23 +459,23 @@ public abstract class Batch {
if (len > 0) {
System.arraycopy(args, 1, nargs, 0, len);
}
-
+
env.put(ssargs = env.staticSlot("ARGS"), nargs);
-
+
/*
* Add New Batch Programs (inherit from Batch) here
*/
-
+
// Might be a Report, Update or Temp Batch
Class<?> cls = null;
String classifier = "";
-
+
String[] pkgs = new String[] {
"org.onap.aaf.auth.batch.update",
"org.onap.aaf.auth.batch.reports",
"org.onap.aaf.auth.batch.temp"
};
-
+
String ebp = env.getProperty("EXTRA_BATCH_PKGS");
if(ebp!=null) {
String[] ebps = Split.splitTrim(':', ebp);
@@ -484,12 +484,12 @@ public abstract class Batch {
System.arraycopy(ebps,0,temp,pkgs.length,ebps.length);
pkgs = temp;
}
-
+
for(String p : pkgs) {
try {
cls = ClassLoader.getSystemClassLoader().loadClass(p + '.' + toolName);
int lastDot = p.lastIndexOf('.');
- if(p.length()>0 || p.length()!=lastDot) {
+ if(p.length()>0 || p.length()!=lastDot) {
StringBuilder sb = new StringBuilder();
sb.append(Character.toUpperCase(p.charAt(++lastDot)));
while(++lastDot<p.length()) {
@@ -508,15 +508,15 @@ public abstract class Batch {
batch = (Batch) cnst.newInstance(trans);
env.info().log("Begin", classifier, toolName);
}
-
-
+
+
if (batch == null) {
trans.error().log("No Batch named", toolName, "found");
}
/*
* End New Batch Programs (inherit from Batch) here
*/
-
+
}
if (batch != null) {
try {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java
index dbb2dc31..38e3c2fe 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ package org.onap.aaf.auth.batch;
public class BatchException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = -3877245367723491192L;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java
index 0bc58add..510fc2b8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
public class BatchPrincipal extends TaggedPrincipal {
private final String name;
-
+
public BatchPrincipal(final String name) {
this.name = "batch:"+name;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java
index 1fc16e4e..9606242e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,7 +39,7 @@ public abstract class CassBatch extends Batch {
super(trans.env());
// Flow all Env Logs to Log4j
Log4JLogTarget.setLog4JEnv(log4JName, env);
-
+
TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
try {
session = cluster.connect();
@@ -75,7 +75,7 @@ public abstract class CassBatch extends Batch {
}
throw e;
}
- }
+ }
return null;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java
index e8961f14..f7bf3248 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ public class ApprovalSet {
private DataView dataview;
protected FutureDAO.Data fdd;
protected List<ApprovalDAO.Data> ladd;
-
+
public ApprovalSet(final GregorianCalendar start, final String target, final DataView dv) {
dataview = dv;
fdd = new FutureDAO.Data();
@@ -46,7 +46,7 @@ public class ApprovalSet {
fdd.start = start.getTime();
ladd = new ArrayList<>();
}
-
+
protected void setConstruct(final ByteBuffer bytes) {
fdd.construct = bytes;
}
@@ -54,11 +54,11 @@ public class ApprovalSet {
protected void setMemo(final String memo) {
fdd.memo = memo;
}
-
+
protected void setExpires(final GregorianCalendar expires) {
fdd.expires = expires.getTime();
}
-
+
public Result<Void> write(AuthzTrans trans) {
StringBuilder errs = null;
if(ladd == null || ladd.isEmpty()) {
@@ -89,7 +89,7 @@ public class ApprovalSet {
public boolean hasApprovals() {
return !ladd.isEmpty();
}
-
+
public Set<String> approvers() {
Set<String> rv = new HashSet<>();
for(ApprovalDAO.Data app : ladd) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java
index c197f7f2..018f9493 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/DataView.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,7 @@ import org.onap.aaf.auth.layer.Result;
/**
* I have become convinced that Data for Apps is modeled by abstract access methods against multiple data
- * sources. With the insistence of JUnits, it becomes much more paramount to create a model which can
+ * sources. With the insistence of JUnits, it becomes much more paramount to create a model which can
* 1) be easily loaded from Disk "Test Data" without resorting to complex "mokito" schemes
* 2) tested in Memory
* 3) combined for REAL time by running Cached Memory
@@ -42,14 +42,14 @@ import org.onap.aaf.auth.layer.Result;
* c) JSON
* d) XML
* 5) persisted Globally through a store like Cassandra
- *
+ *
* But in the end, it looks like:
* 1) Data Structures
- * 2) Find the Data Structures by various means, accounting for
+ * 2) Find the Data Structures by various means, accounting for
* a) Multiple Responses
* b) Errors from the deepest level, made available through the call stack
- * 3)
- *
+ * 3)
+ *
* @author jonathan.gathman
*
*/
@@ -63,11 +63,11 @@ public interface DataView {
// Inserts
public Result<ApprovalDAO.Data> insert(final AuthzTrans trans, final ApprovalDAO.Data add);
public Result<FutureDAO.Data> insert(final AuthzTrans trans, final FutureDAO.Data add);
-
+
// Deletes
public Result<ApprovalDAO.Data> delete(final AuthzTrans trans, final ApprovalDAO.Data add);
public Result<FutureDAO.Data> delete(final AuthzTrans trans, final FutureDAO.Data add);
-
+
// Clear any buffers
public void flush();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java
index d91c42c0..654c2bbc 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Loader.java
@@ -8,9 +8,9 @@
* 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.
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java
index 9a666981..04083d9e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java
@@ -9,9 +9,9 @@
* 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.
@@ -31,11 +31,11 @@ import org.onap.aaf.misc.env.util.Chrono;
public class Pending {
public static final String REMIND = "remind";
-
+
int qty;
boolean hasNew;
Date earliest;
-
+
/**
* Use this constructor to indicate when last Notified
* @param lastNotified
@@ -74,32 +74,32 @@ public class Pending {
public void inc() {
++qty;
}
-
+
public void inc(Pending value) {
- qty+=value.qty;
- if(earliest==null) {
+ qty += value.qty;
+ if(earliest == null) {
earliest = value.earliest;
- } else if(value.earliest!=null && value.earliest.before(earliest)) {
+ } else if(value.earliest != null && value.earliest.before(earliest)) {
earliest = value.earliest;
}
}
public void earliest(Date lastnotified) {
- if(lastnotified==null) {
+ if(lastnotified == null) {
hasNew=true;
- } else if (earliest==null || lastnotified.before(earliest)) {
+ } else if (earliest == null || lastnotified.before(earliest)) {
earliest = lastnotified;
}
}
-
+
public int qty() {
return qty;
}
-
+
public Date earliest() {
return earliest;
}
-
+
public boolean newApprovals() {
return hasNew;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java
index 1884262f..0b8006cb 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Ticket.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,7 +29,7 @@ import org.onap.aaf.auth.batch.helpers.Future;
public class Ticket {
public final Future f;
public final Set<Approval> approvals;
-
+
public Ticket(Future future) {
this.f = future;
approvals = new HashSet<>();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
index da13e84c..6b9e5e0b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
@@ -7,9 +7,9 @@
* 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.
@@ -57,9 +57,9 @@ public class URApprovalSet extends ApprovalSet {
expires.setTime(urdd.expires);
}
setExpires(expires);
- setTargetKey(urdd.user+'|'+urdd.role);
+ setTargetKey(urdd.user + '|' + urdd.role);
setTargetDate(urdd.expires);
-
+
Result<RoleDAO.Data> r = dv.roleByName(trans, urdd.role);
if(r.notOKorIsEmpty()) {
throw new CadiException(r.errorString());
@@ -81,10 +81,10 @@ public class URApprovalSet extends ApprovalSet {
if(found==null) {
throw new CadiException(String.format("User '%s' in Role '%s' does not exist", urdd.user,urdd.role));
}
-
+
// Primarily, Owners are responsible, unless it's owned by self
boolean isOwner = false;
- Result<List<UserRoleDAO.Data>> owners = dv.ursByRole(trans, urdd.ns+".owner");
+ Result<List<UserRoleDAO.Data>> owners = dv.ursByRole(trans, urdd.ns + ".owner");
if(owners.isOK()) {
for(UserRoleDAO.Data owner : owners.value) {
if(urdd.user.equals(owner.user)) {
@@ -114,7 +114,7 @@ public class URApprovalSet extends ApprovalSet {
}
}
}
-
+
private void setTargetDate(Date expires) {
fdd.target_date = expires;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
index a9029626..470cfb1e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
@@ -9,9 +9,9 @@
* 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.
@@ -55,7 +55,7 @@ public class Approval implements CacheChange.Data {
public static TreeMap<UUID,List<Approval>> byTicket = new TreeMap<>();
public static List<Approval> list = new LinkedList<>();
private static final CacheChange<Approval> cache = new CacheChange<>();
-
+
public final ApprovalDAO.Data add;
private String role;
@@ -109,8 +109,8 @@ public class Approval implements CacheChange.Data {
}
}
};
-
- public Approval(UUID id, UUID ticket, String approver,// Date last_notified,
+
+ public Approval(UUID id, UUID ticket, String approver,// Date last_notified,
String user, String memo, String operation, String status, String type, long updated) {
add = new ApprovalDAO.Data();
add.id = id;
@@ -124,7 +124,7 @@ public class Approval implements CacheChange.Data {
add.updated = new Date(updated);
role = roleFromMemo(memo);
}
-
+
public static String roleFromMemo(String memo) {
if (memo==null) {
return null;
@@ -156,31 +156,31 @@ public class Approval implements CacheChange.Data {
public static int load(Trans trans, Session session, Creator<Approval> creator, Visitor<Approval> visitor) {
int count = 0;
try {
- count+=call(trans,session,creator.query(null), creator, visitor);
+ count += call(trans,session,creator.query(null), creator, visitor);
} finally {
trans.info().log("Found",count,"Approval Records");
}
return count;
}
-
+
public static int load(Trans trans, Session session, Creator<Approval> creator ) {
int count = 0;
try {
- count+=call(trans,session,creator.query(null), creator, FullLoad);
+ count += call(trans,session,creator.query(null), creator, FullLoad);
} finally {
trans.info().log("Found",count,"Approval Records");
}
return count;
}
-
+
public static int loadUsers(Trans trans, Session session, Set<String> users, Visitor<Approval> visitor) {
int total = 0;
for(String user : users) {
- total+=call(trans,session,String.format("%s WHERE user='%s';",v2_0_17.select(), user),v2_0_17,visitor);
+ total += call(trans,session,String.format("%s WHERE user='%s';",v2_0_17.select(), user),v2_0_17,visitor);
}
return total;
}
-
+
public static void row(CSV.RowSetter crs, Approval app) {
crs.row("approval",app.add.id,app.add.ticket,app.add.user,app.role,app.add.memo);
}
@@ -201,14 +201,14 @@ public class Approval implements CacheChange.Data {
tt.done();
}
}
-
+
@Override
public void expunge() {
List<Approval> la = byApprover.get(getApprover());
if (la!=null) {
la.remove(this);
}
-
+
la = byUser.get(getUser());
if (la!=null) {
la.remove(this);
@@ -288,11 +288,11 @@ public class Approval implements CacheChange.Data {
add.ticket=null;
add.status="lapsed";
}
-
+
public String getRole() {
return role;
}
-
+
public String toString() {
return getUser() + ' ' + getMemo();
}
@@ -310,12 +310,12 @@ public class Approval implements CacheChange.Data {
}
}
}
-
+
public static void resetLocalData() {
cache.resetLocalData();
}
-
+
public static int sizeForDeletion() {
return cache.cacheSize();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java
index 9906f499..156cb097 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/BatchDataView.java
@@ -9,9 +9,9 @@
* 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.
@@ -57,7 +57,7 @@ public class BatchDataView implements DataView {
public Session getSession(AuthzTrans trans){
return session;
}
-
+
public Result<NsDAO.Data> ns(AuthzTrans trans, String id) {
NS n;
TimeTaken tt = trans.start("Get NS by ID %s", Trans.SUB, id);
@@ -66,14 +66,14 @@ public class BatchDataView implements DataView {
} finally {
tt.done();
}
-
+
if(n==null || n.ndd==null) {
return Result.err(Result.ERR_Backend,"Namespace '%s' does not exist", id);
}
return Result.ok(n.ndd);
}
-
+
@Override
public Result<RoleDAO.Data> roleByName(AuthzTrans trans, String name) {
Role r = Role.byName.get(name);
@@ -116,22 +116,22 @@ public class BatchDataView implements DataView {
StringBuilder sb = cqlBatch.inc();
sb.append("DELETE from authz.future WHERE id = ");
sb.append(fdd.id.toString());
- return Result.ok(fdd);
+ return Result.ok(fdd);
}
-
+
@Override
public Result<ApprovalDAO.Data> delete(AuthzTrans trans, ApprovalDAO.Data add) {
StringBuilder sb = cqlBatch.inc();
sb.append("DELETE from authz.approval WHERE id = ");
sb.append(add.id.toString());
- return Result.ok(add);
+ return Result.ok(add);
}
@Override
public Result<ApprovalDAO.Data> insert(AuthzTrans trans, ApprovalDAO.Data add) {
StringBuilder sb = cqlBatch.inc();
- sb.append("INSERT INTO authz.approval (id,approver,memo,operation,status,ticket,type,user) VALUES (");
+ sb.append("INSERT INTO authz.approval (id,approver,memo,operation,status,ticket,type,user) VALUES (");
sb.append(add.id.toString());
sb.append(COMMA_QUOTE);
sb.append(add.approver);
@@ -154,7 +154,7 @@ public class BatchDataView implements DataView {
@Override
public Result<FutureDAO.Data> insert(AuthzTrans trans, FutureDAO.Data fdd) {
StringBuilder sb = cqlBatch.inc();
- sb.append("INSERT INTO authz.future (id,construct,expires,memo,start,target,target_key,target_date) VALUES (");
+ sb.append("INSERT INTO authz.future (id,construct,expires,memo,start,target,target_key,target_date) VALUES (");
sb.append(fdd.id.toString());
sb.append(',');
fdd.construct.hasArray();
@@ -178,7 +178,7 @@ public class BatchDataView implements DataView {
sb.append(QUOTE_PAREN_SEMI);
return Result.ok(fdd);
}
-
+
@Override
public void flush() {
cqlBatch.flush();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java
index d62c7781..ccfb1c5f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,7 +47,7 @@ public class CQLBatch {
hasAdded = sb.length();
return sb;
}
-
+
private boolean end() {
if(sb.length()==hasAdded) {
return false;
@@ -57,7 +57,7 @@ public class CQLBatch {
return true;
}
}
-
+
public ResultSet execute() {
if(end()) {
if(sleep>0) {
@@ -66,17 +66,19 @@ public class CQLBatch {
try {
Thread.sleep(left);
} catch (InterruptedException e) {
- Access.NULL.log(e); // Keep code check idiocy at bay
+ // PER ORACLE, this isn't actually needed, but Sonar idiocy
+ // requires something or flags as error.
+ return null;
}
}
- last = System.currentTimeMillis()+sleep;
+ last = System.currentTimeMillis() + sleep;
}
return session.execute(sb.toString());
} else {
return null;
}
}
-
+
public ResultSet execute(boolean dryRun) {
ResultSet rv = null;
if(dryRun) {
@@ -86,10 +88,12 @@ public class CQLBatch {
try {
Thread.sleep(left);
} catch (InterruptedException e) {
- Access.NULL.log(e); // Keep code check idiocy at bay
+ // PER ORACLE, this isn't actually needed, but Sonar idiocy
+ // requires something or flags as error.
+ return null;
}
}
- last = System.currentTimeMillis()+sleep;
+ last = System.currentTimeMillis() + sleep;
}
end();
} else {
@@ -98,7 +102,7 @@ public class CQLBatch {
sb.setLength(0);
return rv;
}
-
+
public ResultSet singleExec(StringBuilder query, boolean dryRun) {
if(dryRun) {
return null;
@@ -106,10 +110,10 @@ public class CQLBatch {
return session.execute(query.toString());
}
}
-
+
public void touch(String table, int begin, int end, boolean dryRun) {
StringBuilder sb = begin();
- for(int i=begin;i<end;++i) {
+ for(int i=begin; i<end; ++i) {
sb.append("UPDATE cache SET touched=dateof(now()) WHERE name='");
sb.append(table);
sb.append("' AND seg=");
@@ -118,11 +122,11 @@ public class CQLBatch {
}
execute(dryRun);
}
-
- public void sleep(int j) {
+
+ public void sleep(long j) {
sleep = j*1000;
}
-
+
public String toString() {
return sb.toString();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java
index 9cd7341c..9bb2fa32 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatchLoop.java
@@ -8,9 +8,9 @@
* 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.
@@ -23,7 +23,7 @@ package org.onap.aaf.auth.batch.helpers;
public class CQLBatchLoop {
private static final int MAX_CHARS = (50 * 1024)/2;
-
+
private final CQLBatch cqlBatch;
private final int maxBatch;
private final StringBuilder sb;
@@ -52,17 +52,17 @@ public class CQLBatchLoop {
/**
* Assume this is another line in the Batch
* @return
- */
+ */
public StringBuilder inc() {
- if((i>=maxBatch || current.length()+sb.length()>MAX_CHARS)&&(i>0)) {
-
- cqlBatch.execute(dryRun);
+ if((i>=maxBatch || current.length() + sb.length() > MAX_CHARS) && (i > 0)) {
+
+ cqlBatch.execute(dryRun);
i = -1;
incBatch();
}
- if(i<0) {
+ if(i < 0) {
cqlBatch.begin();
- i=0;
+ i = 0;
}
if(current.length() > MAX_CHARS) {
cqlBatch.singleExec(current, dryRun);
@@ -74,23 +74,23 @@ public class CQLBatchLoop {
++total;
return current;
}
-
+
/**
* Close up when finished.
*/
public void flush() {
- if(current.length()+sb.length()>MAX_CHARS) {
- if(i>0) {
+ if(current.length() + sb.length() > MAX_CHARS) {
+ if(i > 0) {
cqlBatch.execute(dryRun);
incBatch();
}
- if(current.length()>0) {
+ if(current.length() > 0) {
cqlBatch.singleExec(current, dryRun);
current.setLength(0);
incBatch();
}
} else {
- if(i<0) {
+ if(i < 0) {
cqlBatch.begin();
}
sb.append(current);
@@ -98,23 +98,23 @@ public class CQLBatchLoop {
cqlBatch.execute(dryRun);
incBatch();
}
- i=-1;
+ i = -1;
}
private void incBatch() {
++batches;
if(showProgress) {
System.out.print('.');
- if(batches%70==0) {
+ if(batches%70 == 0) {
System.out.println();
- }
+ }
}
}
public int total() {
return total;
}
-
+
public int batches() {
return batches;
}
@@ -124,7 +124,7 @@ public class CQLBatchLoop {
batches = 0;
i = -1;
}
-
+
public String toString() {
return cqlBatch.toString();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java
index 84d7b5a2..a623945c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java
@@ -8,9 +8,9 @@
* 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.
@@ -27,24 +27,24 @@ import java.util.List;
public class CacheChange<T extends CacheChange.Data> {
private List<T> removed;
-
+
public CacheChange() {
removed = new ArrayList<>();
}
-
- @FunctionalInterface
+
+ @FunctionalInterface
interface Data {
public abstract void expunge();
}
-
+
public final void delayedDelete(T t) {
removed.add(t);
}
-
+
public final List<T> getRemoved() {
return removed;
}
-
+
public final void resetLocalData() {
if (removed==null || removed.isEmpty()) {
return;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java
index a4e4112f..d1389432 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,11 +26,11 @@ import com.datastax.driver.core.Row;
public abstract class Creator<T> {
public abstract T create(Row row);
public abstract String select();
-
+
public String suffix() {
return "";
}
-
+
public String query(String where) {
StringBuilder sb = new StringBuilder(select());
if (where!=null) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
index 6f23c515..49309004 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
@@ -8,9 +8,9 @@
* 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.
@@ -22,7 +22,6 @@
package org.onap.aaf.auth.batch.helpers;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
@@ -53,13 +52,13 @@ public class Cred {
public final String id;
public final List<Instance> instances;
public final String ns;
-
+
public Cred(String id) {
this.id = id;
instances = new ArrayList<>();
ns=Question.domain2ns(id);
}
-
+
public static class Instance {
public final int type;
public final Date expires,written;
@@ -67,7 +66,7 @@ public class Cred {
public final String tag;
public List<Note> notes;
-
+
public Instance(int type, Date expires, Integer other, long written, String tag) {
this.type = type;
this.expires = expires;
@@ -75,7 +74,7 @@ public class Cred {
this.written = new Date(written);
this.tag = tag;
}
-
+
/**
* Usually returns Null...
* @return
@@ -83,23 +82,23 @@ public class Cred {
public List<Note> notes() {
return notes;
}
-
+
public void addNote(int level, String note) {
if(notes==null) {
notes=new ArrayList<>();
- }
+ }
notes.add(new Note(level,note));
}
-
+
public String toString() {
return expires.toString() + ": " + type + ' ' + tag;
}
}
-
+
public static class Note {
public final int level;
public final String note;
-
+
public Note(int level, String note) {
this.level = level;
this.note = note;
@@ -127,7 +126,7 @@ public class Cred {
return last;
}
-
+
public Set<Integer> types() {
Set<Integer> types = new HashSet<>();
for (Instance i : instances) {
@@ -148,7 +147,7 @@ public class Cred {
trans.info().log( "query: " + query );
TimeTaken tt = trans.start("Read Creds", Env.REMOTE);
-
+
ResultSet results;
try {
Statement stmt = new SimpleStatement( query );
@@ -190,7 +189,7 @@ public class Cred {
}
public static void add(
- final String id,
+ final String id,
final int type,
final Date timestamp,
final int other,
@@ -203,10 +202,10 @@ public class Cred {
data.put(id, cred);
}
cred.instances.add(new Instance(type, timestamp, other, written/1000,tag));
-
- List<Cred> lscd = byNS.get(cred.ns);
+
+ List<Cred> lscd = byNS.get(cred.ns);
if (lscd==null) {
- lscd=new ArrayList<>();
+ lscd=new ArrayList<>();
byNS.put(cred.ns,lscd);
}
boolean found = false;
@@ -222,10 +221,10 @@ public class Cred {
}
- /**
+ /**
* Count entries in Cred data.
* Note, as opposed to other methods, need to load the whole cred table for the Types.
- * @param numbuckets
+ * @param numbuckets
* @return
*/
public static CredCount count(int numbuckets) {
@@ -246,7 +245,7 @@ public class Cred {
public int x509Added[];
public int x509Expired[];
public Date dates[];
-
+
public CredCount(int numbuckets) {
raw = new int[numbuckets];
basic_auth = new int[numbuckets];
@@ -263,17 +262,17 @@ public class Cred {
gc.set(GregorianCalendar.SECOND,0);
gc.set(GregorianCalendar.MILLISECOND,0);
gc.add(GregorianCalendar.MILLISECOND, -1); // last milli of month
- for (int i=1;i<numbuckets;++i) {
+ for (int i = 1; i < numbuckets; ++i) {
dates[i] = gc.getTime();
gc.add(GregorianCalendar.MONTH, -1);
}
-
+
}
-
+
public void inc(int type, Date start, Date expires) {
- for (int i=0;i<dates.length-1;++i) {
+ for (int i = 0; i < dates.length - 1; ++i) {
if (start.before(dates[i])) {
- if ((type==CredDAO.CERT_SHA256_RSA)&&(start.after(dates[i+1]))) {
+ if ((type == CredDAO.CERT_SHA256_RSA)&&(start.after(dates[i + 1]))) {
++x509Added[i];
}
if (expires.after(dates[i])) {
@@ -297,15 +296,15 @@ public class Cred {
}
public long authCount(int idx) {
- return (long)basic_auth[idx]+basic_auth_256[idx];
+ return (long)basic_auth[idx] + basic_auth_256[idx];
}
-
+
public long x509Count(int idx) {
return cert[idx];
}
}
-
+
public void row(final CSV.Writer csvw, final Instance inst) {
csvw.row("cred",id,ns,Integer.toString(inst.type),Chrono.dateOnlyStamp(inst.expires),
inst.expires.getTime(),inst.tag);
@@ -316,10 +315,9 @@ public class Cred {
inst.expires.getTime(),inst.tag,reason);
}
- static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS");
public static void batchDelete(StringBuilder sb, List<String> row) {
Long l = Long.parseLong(row.get(5));
- String date = sdf.format(new Date(l));
+ String date = Chrono.batchFmt.format(new Date(l));
sb.append("DELETE from authz.cred WHERE id='");
sb.append(row.get(1));
sb.append("' AND type=");
@@ -331,7 +329,7 @@ public class Cred {
// sb.append(" AND expires=dateof(maxtimeuuid(");
// sb.append(row.get(5));
// sb.append("));\n");
-
+
}
public String toString() {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
index c7d4e7d4..bb3a3e94 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
@@ -9,9 +9,9 @@
* 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.
@@ -47,7 +47,7 @@ public class ExpireRange {
public final Range approveDelete ;
private Range delRange;
-
+
public ExpireRange(final Access access) {
ranges = new HashMap<>();
intervalDates = new HashMap<>();
@@ -58,8 +58,8 @@ public class ExpireRange {
List<Range> lcred = getRangeList("cred");
List<Range> lur = getRangeList("ur");
List<Range> lx509 = getRangeList("x509");
-
-
+
+
/*
Range(Name, ReportingLevel, PeopleInterval, AppInterval, Start(Type,Qty) End(Type,Qty) )
Interval of -1 Means "only once"
@@ -70,25 +70,25 @@ public class ExpireRange {
lur.add(delRange);
lcred.add(delRange);
lx509.add(delRange);
-
+
lcred.add(new Range(ONE_WEEK ,3,-1,1,0,0,GregorianCalendar.WEEK_OF_MONTH,1));
lcred.add(new Range(TWO_WEEK ,2,-1,-1,GregorianCalendar.WEEK_OF_MONTH,1,GregorianCalendar.WEEK_OF_MONTH,2));
lcred.add(new Range(ONE_MONTH,1,7,7,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1));
lcred.add(new Range(TWO_MONTH,1,-1,-1,GregorianCalendar.MONTH,1,GregorianCalendar.MONTH,2));
-
+
lur.add( new Range(ONE_MONTH,1,-1,-1,0,0,GregorianCalendar.MONTH,1));
// Comment out until we can get some more clear actions in place for GUI
// lur.add( new Range(ONE_MONTH,1,-1,-1,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1));
// lur.add( new Range(ONE_WEEK,2,-1,1,0,0,GregorianCalendar.WEEK_OF_MONTH,1));
-
+
lx509.add(new Range(ONE_MONTH,1,-1,-1,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1));
}
}
-
+
public Range newFutureRange() {
return new Range("Approval",7,7,1,0,0,GregorianCalendar.MONTH,1);
}
-
+
public Set<String> names() {
Set<String> names = new HashSet<>();
for(List<Range> lr : ranges.values()) {
@@ -99,7 +99,7 @@ public class ExpireRange {
return names;
}
-
+
private synchronized List<Range> getRangeList(final String key) {
List<Range> rv = ranges.get(key);
if(rv==null) {
@@ -108,7 +108,7 @@ public class ExpireRange {
}
return rv;
}
-
+
public class Range {
private final String name;
private final int reportingLevel;
@@ -117,11 +117,11 @@ public class ExpireRange {
private final Date start;
private final Date end;
private final Date lowerValid;
-
+
public Range(
- final String name, final int reportingLevel,
- final int peopleInterval, final int appInterval,
- final int startGCType, final int startQty,
+ final String name, final int reportingLevel,
+ final int peopleInterval, final int appInterval,
+ final int startGCType, final int startQty,
final int endGCType,final int endQty) {
this.name = name;
this.reportingLevel = reportingLevel;
@@ -135,7 +135,7 @@ public class ExpireRange {
gc.add(startGCType, startQty);
}
start = gc.getTime();
-
+
if(endGCType<0) {
gc.set(GregorianCalendar.YEAR, 1);
} else {
@@ -143,7 +143,7 @@ public class ExpireRange {
gc.add(endGCType, endQty);
}
end = gc.getTime();
-
+
if(endGCType<0) {
gc.set(GregorianCalendar.YEAR, -1);
@@ -154,11 +154,11 @@ public class ExpireRange {
lowerValid = gc.getTime();
}
-
+
public String name() {
return name;
}
-
+
public int reportingLevel() {
return reportingLevel;
}
@@ -190,11 +190,11 @@ public class ExpireRange {
public Date getStart() {
return start;
}
-
+
public Date getEnd() {
return end;
}
-
+
public boolean inRange(final Date date) {
if(date==null) {
return false;
@@ -226,6 +226,6 @@ public class ExpireRange {
public Date now() {
return now;
}
-
+
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
index fd0de1fc..4bbab9d3 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
@@ -9,9 +9,9 @@
* 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.
@@ -51,7 +51,7 @@ import com.datastax.driver.core.Statement;
public class Future implements CacheChange.Data, Comparable<Future> {
public static final Map<UUID,Future> data = new TreeMap<>();
public static final Map<String,List<Future>> byRole = new TreeMap<>();
-
+
public final FutureDAO.Data fdd;
public final String role; // derived
private static final CacheChange<Future> cache = new CacheChange<>();
@@ -106,27 +106,27 @@ public class Future implements CacheChange.Data, Comparable<Future> {
}
this.role = role;
}
-
+
public final UUID id() {
return fdd.id;
}
-
+
public final String memo() {
return fdd.memo;
}
-
+
public final String target() {
return fdd.target;
}
-
+
public final Date start() {
return fdd.start;
}
-
+
public final Date expires() {
return fdd.expires;
}
-
+
public static void load(Trans trans, Session session, Creator<Future> creator) {
load(trans,session,creator, f -> {
data.put(f.fdd.id,f);
@@ -149,7 +149,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
} finally {
tt.done();
}
-
+
int count = 0;
tt = trans.start("Process Futures", Env.SUB);
try {
@@ -181,7 +181,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
}
return rv;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.helpers.CacheChange.Data#resetLocalData()
*/
@@ -207,7 +207,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
public static void resetLocalData() {
cache.resetLocalData();
}
-
+
public static int sizeForDeletion() {
return cache.cacheSize();
}
@@ -215,7 +215,7 @@ public class Future implements CacheChange.Data, Comparable<Future> {
public static boolean pendingDelete(Future f) {
return cache.contains(f);
}
-
+
public static void row(CSV.Writer cw, Future f) {
cw.row("future",f.fdd.id,f.fdd.target,f.fdd.expires,f.role,f.fdd.memo);
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java
index dfacd81b..67203af2 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java
@@ -9,9 +9,9 @@
* 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.
@@ -49,28 +49,28 @@ public class LastNotified {
private Session session;
public static final Date NEVER = new Date(0);
private static final String SELECT = "SELECT user,target,key,last FROM authz.notified";
-
+
public LastNotified(Session session) {
this.session = session;
}
-
+
public void add(Set<String> users) {
StringBuilder query = new StringBuilder();
startQuery(query);
int cnt = 0;
for(String user : users) {
- if(++cnt>1) {
+ if(++cnt > 1) {
query.append(',');
}
query.append('\'');
query.append(user);
query.append('\'');
- if(cnt>=30) {
+ if(cnt >= 30) {
endQuery(query);
add(session.execute(query.toString()),lastNotifiedVar, (x,y) -> false);
query.setLength(0);
startQuery(query);
- cnt=0;
+ cnt = 0;
}
}
if(cnt>0) {
@@ -81,7 +81,7 @@ public class LastNotified {
/**
* Note: target_key CAN also contain a Pipe.
- *
+ *
* @param user
* @param target
* @param targetkey
@@ -91,12 +91,12 @@ public class LastNotified {
String key = user + '|' + target + '|' + (targetkey==null?"":targetkey);
return lastNotified(key);
}
-
+
public Date lastNotified(String key) {
Date d = lastNotifiedVar.get(key);
return d==null?NEVER:d;
}
-
+
private Date add(ResultSet result, Map<String, Date> lastNotified, MarkDelete md) {
Date last = null;
Row r;
@@ -104,7 +104,7 @@ public class LastNotified {
r = iter.next();
String ttKey = r.getString(1) + '|' +
r.getString(2);
-
+
String fullKey = r.getString(0) + '|' +
ttKey;
last=r.getTimestamp(3);
@@ -118,7 +118,7 @@ public class LastNotified {
}
return last;
}
-
+
@FunctionalInterface
private interface MarkDelete {
boolean process(String fullKey, Date last);
@@ -167,7 +167,7 @@ public class LastNotified {
}
public static String newKey(UserRole ur) {
- return "ur|" + ur.user() + '|'+ur.role();
+ return "ur|" + ur.user() + '|' + ur.role();
}
public static String newKey(Cred cred, Instance inst) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
index e76f5235..bf1338f5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
@@ -9,9 +9,9 @@
* 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.
@@ -62,9 +62,9 @@ public class NS implements Comparable<NS> {
ndd.description = description;
ndd.parent = parent;
ndd.type = type;
- // ndd.attrib =
+ // ndd.attrib =
}
-
+
public static void load(Trans trans, Session session, Creator<NS> creator) {
load(trans,session,
"select name, description, parent, type, scope from authz.ns;"
@@ -72,10 +72,10 @@ public class NS implements Comparable<NS> {
, v -> data.put(v.ndd.name,v)
);
}
-
+
public static void loadOne(Trans trans, Session session, Creator<NS> creator, String ns) {
load(trans,session,
- ("select name, description, parent, type, scope from authz.ns WHERE name='"+ns+"';")
+ ("select name, description, parent, type, scope from authz.ns WHERE name='" + ns + "';")
,creator
, v -> data.put(v.ndd.name,v)
);
@@ -84,7 +84,7 @@ public class NS implements Comparable<NS> {
public static void load(Trans trans, Session session, Creator<NS> creator, Visitor<NS> visitor) {
load(trans,session,creator.query(null),creator, visitor);
}
-
+
public void row(final CSV.Writer csvw, String tag) {
csvw.row(tag,ndd.name,ndd.type,ndd.parent);
}
@@ -102,7 +102,7 @@ public class NS implements Comparable<NS> {
} finally {
tt.done();
}
-
+
try {
Iterator<Row> iter = results.iterator();
@@ -136,7 +136,7 @@ public class NS implements Comparable<NS> {
tt.done();
}
}
-
+
public String toString() {
return ndd.name;
}
@@ -161,21 +161,21 @@ public class NS implements Comparable<NS> {
public int compareTo(NS o) {
return ndd.name.compareTo(o.ndd.name);
}
-
+
public static class NSSplit {
public String ns;
public String other;
public NSSplit(String s, int dot) {
ns = s.substring(0,dot);
- other = s.substring(dot+1);
+ other = s.substring(dot + 1);
}
}
public static NSSplit deriveParent(String dotted) {
if (dotted==null) {
return null;
}
- for (int idx = dotted.lastIndexOf('.');idx>=0; idx=dotted.lastIndexOf('.',idx-1)) {
- if (data.get(dotted.substring(0, idx))!=null) {
+ for (int idx = dotted.lastIndexOf('.');idx >= 0; idx = dotted.lastIndexOf('.',idx - 1)) {
+ if (data.get(dotted.substring(0, idx)) != null) {
return new NSSplit(dotted,idx);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
index a2cba259..16c40952 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
@@ -9,9 +9,9 @@
* 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.
@@ -50,14 +50,14 @@ public class NsAttrib {
return "select ns,key,value from authz.ns_attrib";
}
};
-
-
+
+
public NsAttrib(String ns, String key, String value) {
this.ns = ns;
this.key = key;
this.value = value;
}
-
+
public static void load(Trans trans, Session session, Creator<NsAttrib> creator, Visitor<NsAttrib> visitor) {
trans.info().log( "query: " + creator.select() );
ResultSet results;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java
index e69ef51d..3f750fb8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java
@@ -9,9 +9,9 @@
* 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.
@@ -50,7 +50,7 @@ public class Role implements Comparable<Role> {
public RoleDAO.Data rdd;
private String full;
private String encode;
-
+
public Role(String full) {
rdd = new RoleDAO.Data();
rdd.ns = "";
@@ -59,7 +59,7 @@ public class Role implements Comparable<Role> {
rdd.perms = new HashSet<>();
this.full = full;
}
-
+
public Role(String ns, String name, String description,Set<String> perms) {
rdd = new RoleDAO.Data();
rdd.ns = ns;
@@ -69,18 +69,18 @@ public class Role implements Comparable<Role> {
this.full = null;
this.encode = null;
}
-
+
public String encode() {
if (encode==null) {
encode = rdd.ns + '|' + rdd.name;
- }
+ }
return encode;
}
public String fullName() {
if (full==null) {
full = rdd.ns + '.' + rdd.name;
- }
+ }
return full;
}
@@ -95,7 +95,7 @@ public class Role implements Comparable<Role> {
private static void load(Trans trans, Session session, String query) {
trans.info().log( "query: " + query );
TimeTaken tt = trans.start("Read Roles", Env.REMOTE);
-
+
ResultSet results;
try {
Statement stmt = new SimpleStatement( query );
@@ -123,7 +123,7 @@ public class Role implements Comparable<Role> {
trans.info().log("Found",data.size(),"roles");
}
}
-
+
public static long count(Trans trans, Session session) {
String query = "select count(*) from authz.role LIMIT 1000000;";
trans.info().log( "query: " + query );
@@ -166,11 +166,11 @@ public class Role implements Comparable<Role> {
public static String fullName(String role) {
return role.replace('|', '.');
}
-
+
public static void stageRemove(Role r) {
deleteRoles.add(r);
}
-
+
public static void executeRemove() {
for (Role p : deleteRoles) {
keys.remove(p.encode);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java
index dd24d7d9..ae46253c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java
@@ -57,7 +57,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
// CACHE Calling
private static final String LOG_FMT = "%s UserRole - %s: %s-%s (%s, %s) expiring %s";
private static final String REPLAY_FMT = "%s|%s|%s|%s|%s\n";
- private static final String DELETE_FMT = "# %s\n"+ REPLAY_FMT;
+ private static final String DELETE_FMT = "# %s\n" + REPLAY_FMT;
private static final List<UserRole> data = new ArrayList<>();
private static final SortedMap<String,List<UserRole>> byUser = new TreeMap<>();
@@ -81,7 +81,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
}
};
- public UserRole(String user, String ns, String rname, Date expires) {
+ public UserRole(String user, String ns, String rname, Date expires) {
urdd = new UserRoleDAO.Data();
urdd.user = user;
urdd.role = ns + '.' + rname;
@@ -114,7 +114,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static void load(Trans trans, Session session, Creator<UserRole> creator) {
load(trans,session,creator,null,new DataLoadVisitor());
}
-
+
public static void load(Trans trans, Session session, Creator<UserRole> creator, Visitor<UserRole> visitor ) {
load(trans,session,creator,null,visitor);
}
@@ -122,19 +122,19 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static void loadOneRole(Trans trans, Session session, Creator<UserRole> creator, String role, Visitor<UserRole> visitor) {
load(trans,session,creator,"role='" + role +"' ALLOW FILTERING;",visitor);
}
-
+
public static void loadOneUser(Trans trans, Session session, Creator<UserRole> creator, String user, Visitor<UserRole> visitor ) {
- load(trans,session,creator,"user='"+ user +'\'',visitor);
+ load(trans,session,creator,"user='" + user + '\'',visitor);
}
public static void load(Trans trans, CSV csv, Creator<UserRole> creator, Visitor<UserRole> visitor) throws IOException, CadiException {
// public UserRole(String user, String role, String ns, String rname, Date expires) {
- csv.visit( row ->
+ csv.visit( row ->
visitor.visit(new UserRole(row.get(1),row.get(2),row.get(3),row.get(4),
new Date(Long.parseLong(row.get(6)))))
);
}
-
+
private static void load(Trans trans, Session session, Creator<UserRole> creator, String where, Visitor<UserRole> visitor) {
String query = creator.query(where);
trans.debug().log( "query: " + query );
@@ -189,30 +189,30 @@ public class UserRole implements Cloneable, CacheChange.Data {
lur.add(ur);
}
}
-
+
public int totalLoaded() {
return totalLoaded;
}
-
+
public int deleted() {
return deleted;
}
-
+
@Override
public void expunge() {
data.remove(this);
-
+
List<UserRole> lur = byUser.get(urdd.user);
if (lur!=null) {
lur.remove(this);
}
-
+
lur = byRole.get(urdd.role);
if (lur!=null) {
lur.remove(this);
}
}
-
+
public static void setDeleteStream(PrintStream ds) {
urDelete = ds;
}
@@ -238,27 +238,27 @@ public class UserRole implements Cloneable, CacheChange.Data {
public UserRoleDAO.Data urdd() {
return urdd;
}
-
+
public String user() {
return urdd.user;
}
-
+
public String role() {
return urdd.role;
}
-
+
public String ns() {
return urdd.ns;
}
-
+
public String rname() {
return urdd.rname;
}
-
+
public Date expires() {
return urdd.expires;
}
-
+
public void expires(Date time) {
urdd.expires = time;
}
@@ -296,7 +296,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
cache.delayedDelete(this);
++deleted;
}
-
+
/**
* Calls expunge() for all deleteCached entries
@@ -304,7 +304,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static void resetLocalData() {
cache.resetLocalData();
}
-
+
public void row(final CSV.Writer csvw, String tag) {
csvw.row(tag,user(),role(),ns(),rname(),Chrono.dateOnlyStamp(expires()),expires().getTime());
}
@@ -312,7 +312,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
public void row(final CSV.Writer csvw, String tag, String reason) {
csvw.row(tag,user(),role(),ns(),rname(),Chrono.dateOnlyStamp(expires()),expires().getTime(),reason);
}
-
+
public static Data row(List<String> row) {
Data data = new Data();
data.user = row.get(1);
@@ -350,7 +350,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
sb.append(role());
sb.append("';\n");
}
-
+
public void batchUpdateExpires(StringBuilder sb) {
sb.append("UPDATE authz.user_role SET expires='");
sb.append(Chrono.dateTime(expires()));
@@ -364,7 +364,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
public static String histMemo(String fmt, List<String> row) {
String reason;
if(row.size()>7) { // Reason included
- reason = String.format("%s removed from %s because %s",
+ reason = String.format("%s removed from %s because %s",
row.get(1),row.get(2),row.get(7));
} else {
reason = String.format(fmt, row.get(1),row.get(2), row.get(5));
@@ -373,7 +373,7 @@ public class UserRole implements Cloneable, CacheChange.Data {
}
public static String histSubject(List<String> row) {
- return row.get(1) + '|' + row.get(2);
+ return row.get(1) + '|' + row.get(2);
}
public static void clear() {
@@ -381,6 +381,6 @@ public class UserRole implements Cloneable, CacheChange.Data {
byUser.clear();
byRole.clear();
cache.resetLocalData();
-
+
}
} \ No newline at end of file
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java
index 38a76477..e1b2e01b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,14 +22,14 @@ package org.onap.aaf.auth.batch.helpers;
public interface Visitor<T> {
void visit(T t);
-
+
public static class Multi<T> implements Visitor<T> {
private final Visitor<T>[] visitors;
@SafeVarargs
public Multi(Visitor<T> ... vs) {
visitors = vs;
}
-
+
@Override
public void visit(T t) {
for(Visitor<T> v : visitors) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java
index e2d86947..59b03f6a 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java
@@ -9,9 +9,9 @@
* 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.
@@ -48,7 +48,7 @@ public class X509 {
public final String x500;
public final String x509;
public ByteBuffer serial;
-
+
public X509(String ca, String id, String x500, String x509, ByteBuffer serial) {
this.ca = ca;
this.id = id;
@@ -56,12 +56,12 @@ public class X509 {
this.x509 = x509;
this.serial = serial;
}
-
+
public static void load(Trans trans, Session session, Visitor<X509> visitor) {
load(trans,session, "" , visitor);
}
-
+
public static void load(Trans trans, Session session, String where, Visitor<X509> visitor) {
load(trans,session, visitor,"select ca, id, x500, x509, serial from authz.x509 " + where +';');
}
@@ -70,7 +70,7 @@ public class X509 {
private static void load(Trans trans, Session session, Visitor<X509> visitor, String query) {
trans.info().log( "query: " + query );
TimeTaken tt = trans.start("Read X509", Env.REMOTE);
-
+
ResultSet results;
try {
Statement stmt = new SimpleStatement( query );
@@ -97,7 +97,7 @@ public class X509 {
trans.info().log("Found",count,"X509 Certificates");
}
}
-
+
public static long count(Trans trans, Session session) {
String query = "select count(*) from authz.x509 LIMIT 1000000;";
trans.info().log( "query: " + query );
@@ -111,7 +111,7 @@ public class X509 {
tt.done();
}
}
-
+
public void row(CSV.Writer cw, X509Certificate x509Cert) {
cw.row("x509",ca,Hash.toHex(serial.array()),Chrono.dateOnlyStamp(x509Cert.getNotAfter()),x500);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
index d7d97ad8..78c6ae3a 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Analyze.java
@@ -9,9 +9,9 @@
* 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.
@@ -75,8 +75,8 @@ public class Analyze extends Batch {
private static final int total=0;
private static final int pending=1;
private static final int approved=2;
-
-
+
+
public static final String NEED_APPROVALS = "NeedApprovals";
private static final String EXTEND = "Extend";
private static final String EXPIRED_OWNERS = "ExpiredOwners";
@@ -92,11 +92,11 @@ public class Analyze extends Batch {
private Range futureRange;
private final String sdate;
private LastNotified ln;
-
+
public Analyze(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
try {
TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
@@ -105,13 +105,13 @@ public class Analyze extends Batch {
} finally {
tt.done();
}
-
+
minOwners=1;
- // Create Intermediate Output
+ // Create Intermediate Output
writerList = new HashMap<>();
-
+
expireRange = new ExpireRange(trans.env().access());
sdate = Chrono.dateOnlyStamp(now);
for( List<Range> lr : expireRange.ranges.values()) {
@@ -130,7 +130,7 @@ public class Analyze extends Batch {
}
}
}
-
+
// Setup New Approvals file
futureRange = expireRange.newFutureRange();
File file = new File(logDir(),NEED_APPROVALS + sdate +CSV);
@@ -138,14 +138,14 @@ public class Analyze extends Batch {
needApproveCW = approveCSV.writer();
needApproveCW.row(INFO,NEED_APPROVALS,sdate,1);
writerList.put(NEED_APPROVALS,needApproveCW);
-
+
// Setup Extend Approvals file
file = new File(logDir(),EXTEND + sdate +CSV);
CSV extendCSV = new CSV(env.access(),file);
extendCW = extendCSV.writer();
extendCW.row(INFO,EXTEND,sdate,1);
writerList.put(EXTEND,extendCW);
-
+
// Load full data of the following
ln = new LastNotified(session);
@@ -158,17 +158,17 @@ public class Analyze extends Batch {
protected void run(AuthzTrans trans) {
TimeTaken tt;
AuthzTrans noAvg = trans.env().newTransNoAvg();
-
+
////////////////////
// Load all Notifieds, and either add to local Data, or mark for Deletion.
ln.loadAll(noAvg,expireRange.approveDelete,deleteCW);
-
+
// Hold Good Tickets to keyed User/Role for UserRole Step
Map<String,Ticket> mur = new TreeMap<>();
try {
Approval.load(trans, session, Approval.v2_0_17);
-
+
////////////////////
final Map<UUID,Ticket> goodTickets = new TreeMap<>();
tt = trans.start("Analyze Expired Futures",Trans.SUB);
@@ -193,7 +193,7 @@ public class Analyze extends Batch {
} finally {
tt.done();
}
-
+
Set<String> approvers = new TreeSet<>();
tt = trans.start("Connect Approvals with Futures",Trans.SUB);
try {
@@ -209,7 +209,7 @@ public class Analyze extends Batch {
} else {
// for users and approvers still valid
String user = appr.getUser();
-
+
if(org.isRevoked(noAvg, appr.getApprover())) {
deleteCW.comment("Approver ID is revoked");
Approval.row(deleteCW, appr);
@@ -225,16 +225,16 @@ public class Analyze extends Batch {
} finally {
tt.done();
}
-
- /* Run through all Futures, and see if
+
+ /* Run through all Futures, and see if
* 1) they have been executed (no longer valid)
- * 2) The current Approvals indicate they can proceed
+ * 2) The current Approvals indicate they can proceed
*/
Map<String,Pending> pendingApprs = new HashMap<>();
Map<String,Pending> pendingTemp = new HashMap<>();
-
+
String approver;
-
+
tt = trans.start("Analyze Good Tickets",Trans.SUB);
try {
for(Ticket ticket : goodTickets.values()) {
@@ -244,7 +244,7 @@ public class Analyze extends Batch {
case "user_role":
int state[][] = new int[3][3];
int type;
-
+
for(Approval appr : ticket.approvals) {
switch(appr.getType()) {
case "owner":
@@ -276,13 +276,13 @@ public class Analyze extends Batch {
++state[type][unknown];
}
}
-
+
// To Approve:
// Always must have at least 1 owner
if((state[owner][total]>0 && state[owner][approved]>0) &&
// If there are no Supervisors, that's ok
- (state[supervisor][total]==0 ||
- // But if there is a Supervisor, they must have approved
+ (state[supervisor][total]==0 ||
+ // But if there is a Supervisor, they must have approved
(state[supervisor][approved]>0))) {
UserRoleDAO.Data urdd = new UserRoleDAO.Data();
try {
@@ -307,7 +307,7 @@ public class Analyze extends Batch {
}
} finally {
if("user_role".equals(ticket.f.fdd.target)) {
- String key = ticket.f.fdd.target_key;
+ String key = ticket.f.fdd.target_key;
if(key!=null) {
mur.put(key, ticket);
}
@@ -319,7 +319,7 @@ public class Analyze extends Batch {
}
// Good Tickets no longer needed
goodTickets.clear();
-
+
/**
* Decide to Notify about Approvals, based on activity/last Notified
*/
@@ -328,11 +328,11 @@ public class Analyze extends Batch {
GregorianCalendar gc = new GregorianCalendar();
gc.add(GregorianCalendar.DAY_OF_WEEK, 5);
Date remind = gc.getTime();
-
+
for(Entry<String, Pending> es : pendingApprs.entrySet()) {
Pending p = es.getValue();
- if(p.newApprovals()
- || p.earliest() == LastNotified.NEVER // yes, equals.
+ if(p.newApprovals()
+ || p.earliest() == LastNotified.NEVER // yes, equals.
|| p.earliest().after(remind)) {
p.row(needApproveCW,es.getKey());
}
@@ -340,22 +340,22 @@ public class Analyze extends Batch {
} finally {
tt.done();
}
-
+
// clear out Approval Intermediates
pendingTemp = null;
pendingApprs = null;
} finally {
}
-
+
/**
- Run through User Roles.
+ Run through User Roles.
Owners are treated specially in next section.
Regular roles are checked against Date Ranges. If match Date Range, write out to appropriate file.
- */
-
+ */
+
try {
Role.load(trans, session);
-
+
try {
tt = trans.start("Analyze UserRoles, storing Owners",Trans.SUB);
Set<String> specialCommented = new HashSet<>();
@@ -391,7 +391,7 @@ public class Analyze extends Batch {
return;
}
// Just let expired UserRoles sit until deleted
- if(futureRange.inRange(ur.expires())&&(!mur.containsKey(ur.user() + '|' + ur.role()))) {
+ if(futureRange.inRange(ur.expires())&&(!mur.containsKey(ur.user() + '|' + ur.role()))) {
// Cannot just delete owners, unless there is at least one left. Process later
if ("owner".equals(ur.rname())) {
Set<UserRole> urs = owners.get(ur.role());
@@ -418,11 +418,11 @@ public class Analyze extends Batch {
tt.done();
}
mur.clear();
-
+
/**
Now Process Owners, one owner Role at a time, ensuring one is left,
- preferably a good one. If so, process the others as normal.
-
+ preferably a good one. If so, process the others as normal.
+
Otherwise, write to ExpiredOwners Report
*/
tt = trans.start("Analyze Owners Separately",Trans.SUB);
@@ -432,7 +432,7 @@ public class Analyze extends Batch {
final CSV ownerCSV = new CSV(env.access(),file);
CSV.Writer expOwner = ownerCSV.writer();
expOwner.row(INFO,EXPIRED_OWNERS,sdate,2);
-
+
try {
for (Set<UserRole> sur : owners.values()) {
int goodOwners = 0;
@@ -441,7 +441,7 @@ public class Analyze extends Batch {
++goodOwners;
}
}
-
+
for (UserRole ur : sur) {
if (goodOwners >= minOwners) {
Range r = writeAnalysis(noAvg, ur);
@@ -473,14 +473,14 @@ public class Analyze extends Batch {
Role.clear();
UserRole.clear();
}
-
+
/**
* Check for Expired Credentials
*/
try {
// Load Cred. We don't follow Visitor, because we have to gather up everything into Identity Anyway
Cred.load(trans, session);
-
+
tt = trans.start("Analyze Expired Credentials",Trans.SUB);
try {
for (Cred cred : Cred.data.values()) {
@@ -509,7 +509,7 @@ public class Analyze extends Batch {
} finally {
Cred.clear();
}
-
+
////////////////////
tt = trans.start("Analyze Expired X509s",Trans.SUB);
try {
@@ -529,7 +529,7 @@ public class Analyze extends Batch {
noAvg.info().log(e);
}
}
-
+
private Approval findApproval(UserRole ur) {
Approval existing = null;
List<Approval> apprs = Approval.byUser.get(ur.user());
@@ -537,7 +537,7 @@ public class Analyze extends Batch {
for(Approval appr : apprs) {
if(ur.role().equals(appr.getRole()) &&
appr.getMemo().contains(Chrono.dateOnlyStamp(ur.expires()))) {
- existing = appr;
+ existing = appr;
}
}
}
@@ -555,7 +555,7 @@ public class Analyze extends Batch {
} catch (OrganizationException e) {
i=null;
}
- if(r.needsContact(lnd,i)) {
+ if(r.needsContact(lnd,i)) {
CSV.Writer cw = writerList.get(r.name());
if(cw!=null) {
ur.row(cw,UserRole.UR);
@@ -564,7 +564,7 @@ public class Analyze extends Batch {
}
return r;
}
-
+
private void writeAnalysis(AuthzTrans noAvg, Cred cred, Instance inst) {
if(cred!=null && inst!=null) {
Range r = expireRange.getRange("cred", inst.expires);
@@ -577,7 +577,7 @@ public class Analyze extends Batch {
} catch (OrganizationException e) {
i=null;
}
- if(r.needsContact(lnd,i)) {
+ if(r.needsContact(lnd,i)) {
CSV.Writer cw = writerList.get(r.name());
if(cw!=null) {
cred.row(cw,inst);
@@ -606,7 +606,7 @@ public class Analyze extends Batch {
}
}
}
-
+
@Override
protected void _close(AuthzTrans trans) {
session.close();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java
index 880173b9..a6c49f08 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/ApprovedRpt.java
@@ -8,9 +8,9 @@
* 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.
@@ -49,18 +49,18 @@ import com.datastax.driver.core.Statement;
public class ApprovedRpt extends Batch {
-
+
private static final String APPR_RPT = "ApprovedRpt";
private static final String CSV = ".csv";
private Date now;
private Writer approvedW;
private CSV historyR;
private static String yr_mon;
-
+
public ApprovedRpt(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
try {
// TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
@@ -69,15 +69,15 @@ public class ApprovedRpt extends Batch {
// } finally {
// tt.done();
// }
-
+
now = new Date();
String sdate = Chrono.dateOnlyStamp(now);
File file = new File(logDir(),APPR_RPT + sdate +CSV);
CSV csv = new CSV(env.access(),file);
approvedW = csv.writer(false);
-
+
historyR = new CSV(env.access(),args()[1]).setDelimiter('|');
-
+
yr_mon = args()[0];
} finally {
tt0.done();
@@ -86,7 +86,7 @@ public class ApprovedRpt extends Batch {
@Override
protected void run(AuthzTrans trans) {
- try {
+ try {
// ResultSet results;
// Statement stmt = new SimpleStatement( "select dateof(id), approver, status, user, type, memo from authz.approved;" );
// results = session.execute(stmt);
@@ -132,15 +132,15 @@ public class ApprovedRpt extends Batch {
}
}
});
-
+
} catch (Exception e) {
trans.info().log(e);
}
}
-
+
private void write(String a_or_d, List<String> row) {
String[] target = Split.splitTrim('|', row.get(4));
-
+
if(target.length>1) {
UUID id = UUID.fromString(row.get(0));
Date date = Chrono.uuidToDate(id);
@@ -166,7 +166,7 @@ public class ApprovedRpt extends Batch {
}
}
-
+
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
index bd56fc2e..82542e15 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,20 +45,20 @@ import org.onap.aaf.misc.env.util.Chrono;
public class NotInOrg extends Batch {
-
+
private static final String NOT_IN_ORG = "NotInOrg";
private static final String CSV = ".csv";
private static final String INFO = "info";
private Map<String, CSV.Writer> writerList;
- private Map<String, CSV.Writer> whichWriter;
+ private Map<String, CSV.Writer> whichWriter;
private Date now;
private Writer notInOrgW;
private Writer notInOrgDeleteW;
-
+
public NotInOrg(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
try {
TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
@@ -67,11 +67,11 @@ public class NotInOrg extends Batch {
} finally {
tt.done();
}
-
+
// Load Cred. We don't follow Visitor, because we have to gather up everything into Identity Anyway
Cred.load(trans, session);
- // Create Intermediate Output
+ // Create Intermediate Output
writerList = new HashMap<>();
whichWriter = new TreeMap<>();
@@ -82,7 +82,7 @@ public class NotInOrg extends Batch {
notInOrgW = csv.writer(false);
notInOrgW.row(INFO,NOT_IN_ORG,Chrono.dateOnlyStamp(now),0);
writerList.put(NOT_IN_ORG,notInOrgW);
-
+
// These will have been double-checked by the Organization, and can be deleted immediately.
String fn = NOT_IN_ORG+"Delete";
file = new File(logDir(),fn + sdate +CSV);
@@ -90,7 +90,7 @@ public class NotInOrg extends Batch {
notInOrgDeleteW = csvDelete.writer(false);
notInOrgDeleteW.row(INFO,fn,Chrono.dateOnlyStamp(now),0);
writerList.put(NOT_IN_ORG,notInOrgW);
-
+
} finally {
tt0.done();
}
@@ -102,7 +102,7 @@ public class NotInOrg extends Batch {
Map<String,Boolean> checked = new TreeMap<String, Boolean>();
trans.info().log("Process Organization Identities");
trans.info().log("User Roles");
-
+
final AuthzTrans transNoAvg = trans.env().newTransNoAvg();
UserRole.load(trans, session, UserRole.v2_0_11, ur -> {
try {
@@ -113,9 +113,9 @@ public class NotInOrg extends Batch {
trans.error().log(e, "Error Decrypting X509");
}
});
-
+
trans.info().log("Checking for Creds without IDs");
-
+
for (Cred cred : Cred.data.values()) {
if(!check(transNoAvg,checked, cred.id)) {
CSV.Writer cw = whichWriter(transNoAvg, cred.id);
@@ -124,13 +124,13 @@ public class NotInOrg extends Batch {
}
}
}
-
+
} catch (OrganizationException e) {
trans.info().log(e);
}
}
-
-
+
+
private Writer whichWriter(AuthzTrans transNoAvg, String id) {
Writer w = whichWriter.get(id);
if(w==null) {
@@ -146,7 +146,7 @@ public class NotInOrg extends Batch {
Boolean rv = checked.get(id);
if(rv==null) {
if(isSpecial(id)) { // do not check against org... too important to delete.
- return true;
+ return true;
}
Organization org = trans.org();
if(org != null) {
@@ -160,7 +160,7 @@ public class NotInOrg extends Batch {
return rv;
}
-
+
@Override
protected void _close(AuthzTrans trans) {
session.close();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
index 54cb7378..981f300d 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
@@ -7,9 +7,9 @@
* 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.
@@ -134,7 +134,7 @@ import org.onap.aaf.misc.env.util.Chrono;
}
urgent = false;
-
+
sb.setLength(0);
fhh = new File(footer_html);
if(!fhh.exists()) {
@@ -153,14 +153,14 @@ import org.onap.aaf.misc.env.util.Chrono;
}
noAvg = trans.env().newTransNoAvg();
- cqlBatch = new CQLBatch(noAvg.debug(),session);
+ cqlBatch = new CQLBatch(noAvg.debug(),session);
cbl = new CQLBatchLoop(cqlBatch,50,dryRun);
-
+
lastN = new LastNotified(session);
}
/*
- * Note: We try to put things related to Notify as Main Class in Run, where we might have put in
+ * Note: We try to put things related to Notify as Main Class in Run, where we might have put in
* Constructor, so that we can have other Classes call just the "notify" method.
*/
@Override
@@ -175,7 +175,7 @@ import org.onap.aaf.misc.env.util.Chrono;
NotifyBody.load(env.access());
- // Create Intermediate Output
+ // Create Intermediate Output
File logDir = logDir();
Set<File> notifyFile = new HashSet<>();
if(args().length>0) {
@@ -219,14 +219,14 @@ import org.onap.aaf.misc.env.util.Chrono;
e.printStackTrace();
}
- }
+ }
// now create Notification
for(NotifyBody nb : NotifyBody.getAll()) {
int count = notify(noAvg, nb);
trans.info().printf("Emailed %d for %s",count,nb.name());
}
-
+
//
// Do Pending Approval Notifies. We do this separately, because we are consolidating
// all the new entries, etc.
@@ -238,7 +238,7 @@ import org.onap.aaf.misc.env.util.Chrono;
csvList.add(new CSV(access,f));
}
}
-
+
Map<String,Pending> mpending = new TreeMap<>();
Holder<Integer> count = new Holder<>(0);
for(CSV approveCSV : csvList) {
@@ -261,7 +261,7 @@ import org.onap.aaf.misc.env.util.Chrono;
count.set(count.get()+1);
} catch (ParseException e) {
trans.error().log(e);
- }
+ }
break;
}
});
@@ -272,23 +272,23 @@ import org.onap.aaf.misc.env.util.Chrono;
}
}
trans.info().printf("Read %d Reminder Rows", count.get());
-
+
NotifyPendingApprBody npab = new NotifyPendingApprBody(access);
GregorianCalendar gc = new GregorianCalendar();
gc.add(GregorianCalendar.DAY_OF_MONTH, 7); // Get from INFO?
Date oneWeek = gc.getTime();
CSV.Saver rs = new CSV.Saver();
-
+
TimeTaken tt = trans.start("Obtain Last Notifications for Approvers", Trans.SUB);
try {
lastN.add(mpending.keySet());
} finally {
tt.done();
}
-
+
Pending p;
-
+
tt = trans.start("Notify for Pending", Trans.SUB);
List<String> idList = new ArrayList<>();
String id;
@@ -336,7 +336,7 @@ import org.onap.aaf.misc.env.util.Chrono;
String run = nb.type()+nb.name();
String test = dryRun?run:null;
-
+
ONE_EMAIL:
for(String id : nb.users()) {
toList.clear();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java
index bcdd4401..072363f0 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/PrepExtend.java
@@ -7,9 +7,9 @@
* 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.
@@ -51,9 +51,9 @@ public class PrepExtend extends Batch {
/**
* Create a list of Creds and UserRoles to extend
* Note: Certificates cannot be renewed in this way.
- *
+ *
* Arguments From (0 = today, -2 = 2 weeks back) and To (weeks from today)
- *
+ *
* @param trans
* @throws APIException
* @throws IOException
@@ -80,15 +80,15 @@ public class PrepExtend extends Batch {
protected void run(AuthzTrans trans) {
GregorianCalendar gc = new GregorianCalendar();
Date now = gc.getTime();
-
+
int ifrom = 0;
int ito = 4;
-
+
for(int i=0; i< args().length;++i) {
switch(args()[i]) {
case "-from":
if(args().length>i+1) {
- ifrom = Integer.parseInt(args()[i++ +1]);
+ ifrom = Integer.parseInt(args()[i++ +1]);
}
break;
case "-to":
@@ -102,23 +102,23 @@ public class PrepExtend extends Batch {
System.err.println("Invalid -from param");
return;
}
-
+
if(ito<=0 || ito>24 || ifrom>ito) {
System.err.println("Invalid -to param");
return;
}
-
+
// Make sure to is Zero based from today.
if(ifrom<0) {
ito+= ifrom*-1;
}
-
+
gc.add(GregorianCalendar.WEEK_OF_MONTH, ifrom);
Date from = gc.getTime();
-
+
gc.add(GregorianCalendar.WEEK_OF_MONTH, ito /* with From calculated in */);
Date to = gc.getTime();
-
+
try {
File file = new File(logDir(), PREP_EXTEND + Chrono.dateOnlyStamp(now) + CSV);
final CSV puntCSV = new CSV(env.access(),file);
@@ -128,7 +128,7 @@ public class PrepExtend extends Batch {
try {
trans.info().log("Process UserRoles for Extending");
/**
- Run through User Roles.
+ Run through User Roles.
If match Date Range, write out to appropriate file.
*/
UserRole.load(trans, session, UserRole.v2_0_11, ur -> {
@@ -136,7 +136,7 @@ public class PrepExtend extends Batch {
ur.row(cw,UserRole.UR);
}
});
-
+
trans.info().log("Process BasicAuth for Extending");
TimeTaken tt0 = trans.start("Load Credentials", Env.REMOTE);
try {
@@ -148,7 +148,7 @@ public class PrepExtend extends Batch {
/**
- Run through Creds.
+ Run through Creds.
If match Date Range, write out to appropriate file.
*/
Map<Integer,Instance> imap = new HashMap<>();
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
index 6c95f02e..04814e01 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
@@ -8,9 +8,9 @@
* 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.
@@ -53,13 +53,13 @@ public abstract class NotifyBody {
protected Map<String,List<List<String>>> rows;
protected final String env;
protected final String gui_url;
-
+
private final String name;
private final String type;
private String date;
private int escalation;
private int count;
-
+
public NotifyBody(Access access, final String type, final String name) {
rows = new TreeMap<>();
this.name = name;
@@ -70,7 +70,7 @@ public abstract class NotifyBody {
env = access.getProperty("CASS_ENV","DEVL");
gui_url = access.getProperty("GUI_URL", "");
}
-
+
public void store(List<String> row) {
if(!row.isEmpty()) {
if("info".equals(row.get(0))) {
@@ -84,7 +84,7 @@ public abstract class NotifyBody {
} else if(type.equals(row.get(0))) {
String user = user(row);
if(user!=null) {
- List<List<String>> lss = rows.get(user);
+ List<List<String>> lss = rows.get(user);
if(lss == null) {
lss = new ArrayList<>();
rows.put(user,lss);
@@ -98,25 +98,25 @@ public abstract class NotifyBody {
public String name() {
return name;
}
-
+
public String type() {
return type;
}
-
+
public String date() {
return date;
}
public int escalation() {
return escalation;
}
-
+
public Set<String> users() {
return rows.keySet();
}
-
+
/**
* ID must be set from Row for Email lookup
- *
+ *
* @param trans
* @param n
* @param id
@@ -124,30 +124,30 @@ public abstract class NotifyBody {
* @return
*/
public abstract boolean body(AuthzTrans trans, StringBuilder sb, int indent, Notify n, String id);
-
+
/**
* Return "null" if user not found in row... Code will handle.
* @param row
* @return
*/
protected abstract String user(List<String> row);
-
+
/**
* Provide a context-sensitive Subject, which includes ENV as well as details
- *
+ *
* @return
*/
public abstract String subject();
/**
* Record the fact that a particular Notification was marked as "sent" by Emailer.
- *
+ *
* @param trans
* @param approver
* @param ln
*/
public abstract void record(AuthzTrans trans, StringBuilder query, String id, List<String> notified, LastNotified ln);
-
+
/**
* Get Notify Body based on key of
* type|name
@@ -155,10 +155,10 @@ public abstract class NotifyBody {
public static NotifyBody get(String key) {
return bodyMap.get(key);
}
-
+
/**
* Return set of loaded NotifyBodies
- *
+ *
*/
public static Collection<NotifyBody> getAll() {
// Note: The same Notify Body is entered several times with different keys.
@@ -167,11 +167,11 @@ public abstract class NotifyBody {
set.addAll(bodyMap.values());
return set;
}
-
+
/**
- * @param propAccess
- * @throws URISyntaxException
- *
+ * @param propAccess
+ * @throws URISyntaxException
+ *
*/
public static void load(Access access) throws APIException, IOException {
// class load available NotifyBodies
@@ -199,7 +199,7 @@ public abstract class NotifyBody {
File dir = new File(url.getFile());
for( String f : dir.list()) {
if(f.endsWith(".class")) {
- classNames.add(pkg.getName()+'.'+f.substring(0,f.length()-6));
+ classNames.add(pkg.getName() + '.' + f.substring(0,f.length() - 6));
}
}
}
@@ -210,8 +210,8 @@ public abstract class NotifyBody {
Constructor<?> cst = c.getConstructor(Access.class);
NotifyBody nb = (NotifyBody)cst.newInstance(access);
if(nb!=null) {
- bodyMap.put("info|"+nb.name, nb);
- bodyMap.put(nb.type+'|'+nb.name, nb);
+ bodyMap.put("info|" + nb.name, nb);
+ bodyMap.put(nb.type+'|' + nb.name, nb);
}
}
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
@@ -221,14 +221,14 @@ public abstract class NotifyBody {
}
protected void print(StringBuilder sb, int indent, Object ... objs) {
- for(int i=0;i<indent;++i) {
+ for(int i = 0; i < indent; ++i) {
sb.append(' ');
}
for(Object o : objs) {
sb.append(o.toString());
}
}
-
+
protected void println(StringBuilder sb, int indent, Object ... objs) {
print(sb,indent,objs);
sb.append('\n');
@@ -246,15 +246,15 @@ public abstract class NotifyBody {
}
return current; // use to set prev...
}
-
+
protected void printCell(StringBuilder sb, int indent, String current) {
println(sb,indent,"<td>",current,"</td>");
}
-
+
public synchronized void inc() {
++count;
}
-
+
public int count() {
return count;
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
index 67013a9a..1ef83441 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
@@ -9,9 +9,9 @@
* 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.
@@ -35,16 +35,16 @@ public abstract class NotifyCredBody extends NotifyBody {
private final String explanation;
private final String instruction;
-
+
public NotifyCredBody(Access access, String name) {
super(access,"cred",name);
-
+
// Default
explanation = "The following Credentials that you are responsible for "
+ "are expiring on the dates shown. <br><br>"
;
-
- instruction = "<br><h3>Instructions for 'Password':</h3><ul>"
+
+ instruction = "<br><h3>Instructions for 'Password':</h3><ul>"
+ "<li><b><i>Click</i></b> on the Fully Qualified ID to ADD a new Password</li>"
+ "<li><b>REMEMBER!</b> You are not finished until you <ol>"
+ "<li><b>CHANGE <i>ALL</i></b> the configurations on <b><i>ALL</i></b> your processes!!</li>"
@@ -52,7 +52,7 @@ public abstract class NotifyCredBody extends NotifyBody {
+ "<li>IF there is a WARNING, click the link for more information</li>"
+ "</ul>";
}
-
+
/**
* Default Dynamic Text. Override is expected
* @return
@@ -67,15 +67,15 @@ public abstract class NotifyCredBody extends NotifyBody {
print(sb,indent,dynamic());
println(sb,indent,instruction);
println(sb,indent,"<table>");
- indent+=2;
+ indent += 2;
println(sb,indent,"<tr>");
- indent+=2;
+ indent += 2;
println(sb,indent,"<th>Fully Qualified ID</th>");
println(sb,indent,"<th>Unique ID</th>");
println(sb,indent,"<th>Type</th>");
println(sb,indent,"<th>Expires</th>");
println(sb,indent,"<th>Warnings</th>");
- indent-=2;
+ indent -= 2;
println(sb,indent,"</tr>");
String theid;
String type;
@@ -97,13 +97,13 @@ public abstract class NotifyCredBody extends NotifyBody {
type = "Unknown, see AAF GUI";
break;
}
- theid = "<a href=\""+n.guiURL+"/creddetail?ns="+row.get(2)+"\">"+theid+"</a>";
+ theid = "<a href=\"" + n.guiURL + "/creddetail?ns=" + row.get(2) + "\">" + theid + "</a>";
gc.setTimeInMillis(Long.parseLong(row.get(5)));
expires = Chrono.niceUTCStamp(gc);
info = row.get(6);
- //TODO get Warnings
+ //TODO get Warnings
warnings = "";
-
+
println(sb,indent,"<tr>");
indent+=2;
printCell(sb,indent,theid);
@@ -116,10 +116,10 @@ public abstract class NotifyCredBody extends NotifyBody {
}
indent-=2;
println(sb,indent,"</table>");
-
+
return true;
}
-
+
@Override
public void record(AuthzTrans trans, StringBuilder query, String id, List<String> notified, LastNotified ln) {
for(List<String> row : rows.get(id)) {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java
index 76a44166..cfb0f3c8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,7 +47,7 @@ public class NotifyPendingApprBody extends NotifyBody {
rv = true;
break; // only one
}
-
+
return rv;
}
@@ -64,7 +64,7 @@ public class NotifyPendingApprBody extends NotifyBody {
return String.format("AAF Pending Approval Notification (ENV: %s)",env);
}
-
+
@Override
public void record(AuthzTrans trans, StringBuilder query, String id, List<String> notified, LastNotified lastN) {
for(String n : notified) {
@@ -72,7 +72,7 @@ public class NotifyPendingApprBody extends NotifyBody {
lastN.update(query,n,"pending","");
}
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.batch.reports.bodies.NotifyBody#store(java.util.List)
*/
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java
index d4c0463f..1c1a25a5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneMonthNotifyCredBody.java
@@ -9,9 +9,9 @@
* 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.
@@ -29,12 +29,12 @@ public class OneMonthNotifyCredBody extends NotifyCredBody {
public OneMonthNotifyCredBody(Access access) {
super(access, ExpireRange.ONE_MONTH);
}
-
+
@Override
public String subject() {
return String.format("AAF One Month Credential Notification (ENV: %s)",env);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.batch.reports.bodies.NotifyCredBody#dynamic()
*/
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java
index 3362a251..bd7a0dfd 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/OneWeekNotifyCredBody.java
@@ -9,9 +9,9 @@
* 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.
@@ -34,7 +34,7 @@ public class OneWeekNotifyCredBody extends NotifyCredBody {
public String subject() {
return String.format("AAF Final Week Credential Notification (ENV: %s)",env);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.batch.reports.bodies.NotifyCredBody#dynamic()
*/
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java
index 1a047754..d986e580 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoMonthNotifyCredBody.java
@@ -8,9 +8,9 @@
* 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.
@@ -29,7 +29,7 @@ public class TwoMonthNotifyCredBody extends NotifyCredBody {
public TwoMonthNotifyCredBody(Access access) {
super(access, ExpireRange.TWO_MONTH);
}
-
+
@Override
public String subject() {
return String.format("AAF Two Month Credential Notification (ENV: %s)",env);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java
index a802bb4e..0264d349 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java
@@ -8,9 +8,9 @@
* 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.
@@ -33,7 +33,7 @@ public class TwoWeeksNotifyCredBody extends NotifyCredBody {
public String subject() {
return String.format("AAF Two Week Credential Notification (ENV: %s)",env);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.batch.reports.bodies.NotifyCredBody#dynamic()
*/
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java
index e2d052ac..e3164571 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/temp/DataMigrateDublin.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,11 +52,11 @@ import com.datastax.driver.core.Row;
public class DataMigrateDublin extends Batch {
private final SecureRandom sr;
private final AuthzTrans noAvg;
-
+
public DataMigrateDublin(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
noAvg = env.newTransNoAvg();
noAvg.setUser(new BatchPrincipal("Migrate"));
@@ -71,7 +71,7 @@ public class DataMigrateDublin extends Batch {
} finally {
tt0.done();
}
-
+
sr = new SecureRandom();
}
@@ -97,7 +97,7 @@ public class DataMigrateDublin extends Batch {
switch(type) {
case CredDAO.BASIC_AUTH:
case CredDAO.BASIC_AUTH_SHA256:
- String key = row.getString(0) + '|' + type + '|' + Hash.toHex(row.getBytesUnsafe(3).array());
+ String key = row.getString(0) + '|' + type + '|' + Hash.toHex(row.getBytesUnsafe(3).array());
String btag = ba_tag.get(key);
if(btag == null) {
if(tag==null || tag.isEmpty()) {
@@ -108,7 +108,7 @@ public class DataMigrateDublin extends Batch {
}
ba_tag.put(key, btag);
}
-
+
if(!btag.equals(tag)) {
update(cbl,row,btag);
}
@@ -129,9 +129,9 @@ public class DataMigrateDublin extends Batch {
cbl.flush();
trans.info().printf("Processes %d cred records, updated %d records in %d batches.", count, cbl.total(), cbl.batches());
count = 0;
-
+
cbl.reset();
-
+
trans.info().log("Add Serial to X509 Creds");
rs = session.execute("SELECT ca, id, x509 FROM authz.x509");
iter = rs.iterator();
@@ -164,18 +164,18 @@ public class DataMigrateDublin extends Batch {
trans.error().log(e);
}
}
-
+
private static class CredInfo {
public final String id;
public final int type;
public final Date expires;
-
+
public CredInfo(String id, int type, Date expires) {
this.id = id;
this.type = type;
this.expires = expires;
}
-
+
public void update(CQLBatchLoop cbl, String newtag) {
StringBuilder sb = cbl.inc();
sb.append("UPDATE authz.cred SET tag='");
@@ -189,7 +189,7 @@ public class DataMigrateDublin extends Batch {
sb.append("));");
}
}
-
+
private void update(CQLBatchLoop cbl, Row row, String newtag) {
StringBuilder sb = cbl.inc();
sb.append("UPDATE authz.cred SET tag='");
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java
index 43e234b2..c63a8a9f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Approvals.java
@@ -7,9 +7,9 @@
* 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.
@@ -63,7 +63,7 @@ public class Approvals extends Batch {
private final String sdate;
private static final String CSV = ".csv";
private static final String APPROVALS_NEW = "ApprovalsNew";
-
+
public Approvals(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
now = new GregorianCalendar();
@@ -95,13 +95,13 @@ public class Approvals extends Batch {
trans.error().printf("CSV File %s does not exist",f.getAbsolutePath());
}
}
-
+
File file = new File(logDir(),APPROVALS_NEW + sdate +CSV);
CSV approveCSV = new CSV(env.access(),file);
napproveCW = approveCSV.writer();
napproveCW.row("info",APPROVALS_NEW,sdate,1);
-
+
}
@Override
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java
index c65130cf..86381008 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Extend.java
@@ -8,9 +8,9 @@
* 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.
@@ -56,11 +56,11 @@ public class Extend extends Batch {
private List<File> extFiles;
private final int extendBy;
private int gcType;
-
+
public Extend(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
noAvg = env.newTransNoAvg();
noAvg.setUser(new BatchPrincipal("Extend"));
@@ -73,14 +73,14 @@ public class Extend extends Batch {
} finally {
tt.done();
}
- cqlBatch = new CQLBatch(noAvg.info(),session);
+ cqlBatch = new CQLBatch(noAvg.info(),session);
} finally {
tt0.done();
}
gcType = GregorianCalendar.WEEK_OF_YEAR;
int weeks = 4;
-
+
Set<String> cmd = new HashSet<>();
for(int i=0; i< args().length;++i) {
if("-weeks".equals(args()[i])) {
@@ -91,13 +91,13 @@ public class Extend extends Batch {
cmd.add(args()[i]);
}
}
-
+
if(weeks<1 || weeks > 24) {
throw new APIException("Invalid --weeks");
}
extendBy = weeks;
- // Create Intermediate Output
+ // Create Intermediate Output
File logDir = logDir();
extFiles = new ArrayList<>();
if(cmd.isEmpty()) {
@@ -107,7 +107,7 @@ public class Extend extends Batch {
extFiles.add(new File(logDir, fn));
}
}
-
+
// Load Cred. We don't follow Visitor, because we have to gather up everything into Identity Anyway
// to find the last one.
}
@@ -130,7 +130,7 @@ public class Extend extends Batch {
CSV csv = new CSV(env.access(),f);
try {
csv.visit(new CSV.Visitor() {
- final Holder<Integer> hi = new Holder<>(0);
+ final Holder<Integer> hi = new Holder<>(0);
@Override
public void visit(List<String> row) throws IOException, CadiException {
@@ -199,12 +199,12 @@ public class Extend extends Batch {
e.printStackTrace();
}
}
-
+
// Cleanup, if required.
cqlBatch.execute(dryRun);
}
-
+
@Override
protected void _close(AuthzTrans trans) {
trans.info().log("End " + this.getClass().getSimpleName() + " processing" );
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
index 89fbfacc..087ab952 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
@@ -7,9 +7,9 @@
* 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.
@@ -76,9 +76,7 @@ public class Remove extends Batch {
} finally {
tt2.done();
}
- cqlBatch = new CQLBatch(noAvg.info(),session);
-
-
+ cqlBatch = new CQLBatch(noAvg.info(),session);
} finally {
tt0.done();
}
@@ -87,7 +85,7 @@ public class Remove extends Batch {
@Override
protected void run(AuthzTrans trans) {
- // Create Intermediate Output
+ // Create Intermediate Output
File logDir = logDir();
List<File> remove = new ArrayList<>();
@@ -116,7 +114,7 @@ public class Remove extends Batch {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
hdd.yr_mon = Integer.parseInt(sdf.format(new Date()));
- try {
+ try {
final CQLBatchLoop cbl = new CQLBatchLoop(cqlBatch,50,dryRun);
for(File f : remove) {
trans.info().log("Processing ",f.getAbsolutePath(),"for Deletions");
@@ -140,9 +138,9 @@ public class Remove extends Batch {
ur.set(true);
}
//TODO If deleted because Role is no longer there, double check...
-
+
UserRole.batchDelete(cbl.inc(),row);
- hdd.target=UserRoleDAO.TABLE;
+ hdd.target=UserRoleDAO.TABLE;
hdd.subject=UserRole.histSubject(row);
hdd.memo=UserRole.histMemo(memoFmt.get(), row);
historyDAO.createBatch(cbl.inc(), hdd);
@@ -152,7 +150,7 @@ public class Remove extends Batch {
cred.set(true);
}
Cred.batchDelete(cbl.inc(),row);
- hdd.target=CredDAO.TABLE;
+ hdd.target=CredDAO.TABLE;
hdd.subject=Cred.histSubject(row);
hdd.memo=Cred.histMemo(memoFmt.get(), orgName,row);
historyDAO.createBatch(cbl.inc(), hdd);
@@ -162,7 +160,7 @@ public class Remove extends Batch {
x509.set(true);
}
X509.batchDelete(cbl.inc(),row);
- hdd.target="x509";
+ hdd.target="x509";
hdd.subject=X509.histSubject(row);
hdd.memo=X509.histMemo(memoFmt.get(),row);
historyDAO.createBatch(cbl.inc(), hdd);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java
index e2580ae8..b0db0a79 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java
@@ -9,9 +9,9 @@
* 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.
@@ -53,7 +53,7 @@ public class Upload extends Batch {
public Upload(AuthzTrans trans) throws APIException, IOException, OrganizationException {
super(trans.env());
trans.info().log("Starting Connection Process");
-
+
TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
try {
TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
@@ -62,9 +62,9 @@ public class Upload extends Batch {
} finally {
tt.done();
}
-
+
cqlBatch = new CQLBatch(LogTarget.NULL,session);
-
+
feeds=new HashMap<>();
new Feed(feeds,"ns",1,"name,description,parent,scope=int,type=int",300);
new Feed(feeds,"notified",3,"user,target,key,last",300);
@@ -114,7 +114,7 @@ public class Upload extends Batch {
trans.info().log(msg);
System.out.println(msg);
CQLBatchLoop cbl = new CQLBatchLoop(cqlBatch,feed.batchSize,dryRun).showProgress();
-
+
try {
if(file.exists()) {
CSV csv = new CSV(trans.env().access(),file).setDelimiter('|');
@@ -135,7 +135,7 @@ public class Upload extends Batch {
}
}
}
-
+
@Override
protected void _close(AuthzTrans trans) {
session.close();
@@ -162,7 +162,7 @@ public class Upload extends Batch {
}
feeds.put(feed,this);
}
-
+
public String getName() {
return name;
}
@@ -198,7 +198,7 @@ public class Upload extends Batch {
break;
default:
values.append('\'');
- values.append(value.replaceAll("'","''"));
+ values.append(value.replaceAll("'","''"));
values.append('\'');
}
} else switch(type) {
@@ -210,7 +210,7 @@ public class Upload extends Batch {
default:
values.append(value);
break;
-
+
}
}
}
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_ApprovalSetTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_ApprovalSetTest.java
index 10f7a2be..438e14b8 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_ApprovalSetTest.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_ApprovalSetTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,20 +55,20 @@ import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Session;
public class JU_ApprovalSetTest {
-
+
@Mock
AuthzTrans trans;
@Mock
Cluster cluster;
@Mock
PropAccess access;
-
+
@Mock
ApprovalSet actionObj;
@Mock
DataView dv;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -82,7 +82,7 @@ public class JU_ApprovalSetTest {
Mockito.doReturn(Mockito.mock(TimeTaken.class)).when(trans).start(Mockito.anyString(),Mockito.anyInt());
Mockito.doReturn(sessionObj).when(cluster).connect("authz");
Mockito.doReturn(psObj).when(sessionObj).prepare(Mockito.anyString());
-
+
Mockito.doReturn(Mockito.mock(ColumnDefinitions.class)).when(psObj).getVariables();
Mockito.doReturn(Mockito.mock(PreparedId.class)).when(psObj).getPreparedId();
Mockito.doReturn(Mockito.mock(Properties.class)).when(access).getProperties();
@@ -95,23 +95,23 @@ public class JU_ApprovalSetTest {
e.printStackTrace();
}
}
-
+
@Test
public void testPuntDate() {
actionObj.write(trans);
ApprovalDAO.Data dataObj = new ApprovalDAO.Data();
-
+
Result<FutureDAO.Data> rs1 = new Result<FutureDAO.Data>(null,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(FutureDAO.Data.class));
Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(ApprovalDAO.Data.class));
actionObj.ladd.add(dataObj);
Result<Void> retVal = actionObj.write(trans);
-
+
rs1 = new Result<FutureDAO.Data>(null,1,"test",new Object[0]);
Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(ApprovalDAO.Data.class));
retVal = actionObj.write(trans);
assertTrue("Security - test".equals(retVal.details));
-
+
actionObj.ladd.add(dataObj);
retVal = actionObj.write(trans);
assertTrue(retVal.details.contains("Security - test"));
@@ -119,32 +119,32 @@ public class JU_ApprovalSetTest {
Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(FutureDAO.Data.class));
retVal = actionObj.write(trans);
assertTrue(retVal.details.contains("Security - test"));
-
+
actionObj.setConstruct(null);
actionObj.setExpires(new GregorianCalendar());
actionObj.setMemo("");
actionObj.ladd = null;
actionObj.write(trans);
}
-
+
@Test
public void testHasApprovals() {
assertFalse(actionObj.hasApprovals());
-
+
ApprovalDAO.Data dataObj = new ApprovalDAO.Data();
actionObj.ladd.add(dataObj);
assertTrue(actionObj.hasApprovals());
}
-
+
@Test
public void testApprovers() {
Set<String> retVal = actionObj.approvers();
assertTrue(retVal.size() == 0);
-
+
ApprovalDAO.Data dataObj = new ApprovalDAO.Data();
actionObj.ladd.add(dataObj);
retVal = actionObj.approvers();
assertTrue(retVal.size() == 1);
-
+
}
}
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_Pending.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_Pending.java
index eca5ed7c..85d346ba 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_Pending.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_Pending.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_URApprovalSet.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_URApprovalSet.java
index dd9527a1..0adbd9fb 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_URApprovalSet.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_URApprovalSet.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_BatchDataViewTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_BatchDataViewTest.java
index b918c31d..2ddd984b 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_BatchDataViewTest.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_BatchDataViewTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchLoopTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchLoopTest.java
index aef5d22c..4e60a65a 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchLoopTest.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchLoopTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchTest.java
index a826a983..3c8f33d7 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchTest.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/JU_CQLBatchTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java
index 1b41f9ee..16e48089 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java
@@ -7,9 +7,9 @@
* 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.
@@ -61,7 +61,7 @@ public class JU_Approval {
Assert.assertEquals("org.onap.ns.admin",
Approval.roleFromMemo(Approval.RE_VALIDATE_ADMIN + "org.onap.ns]"));
Assert.assertEquals("org.onap.ns.owner", Approval.roleFromMemo(Approval.RE_VALIDATE_OWNER + "org.onap.ns]"));
- Assert.assertEquals("org.onap.ns.member", Approval.roleFromMemo(Approval.RE_APPROVAL_IN_ROLE
+ Assert.assertEquals("org.onap.ns.member", Approval.roleFromMemo(Approval.RE_APPROVAL_IN_ROLE
+ "bob] + [org.onap.ns.member] - Expires 2018-12-25"));
}
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_CacheChange.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_CacheChange.java
index 27d2d3cc..50305d00 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_CacheChange.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_CacheChange.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,13 +40,13 @@ import org.junit.Test;
public class JU_CacheChange {
CacheChange cc;
-
-
+
+
@Before
public void setUp() {
cc = new CacheChange();
}
-
+
@Test
public void testDelayedDelete() {
cc.delayedDelete(null);
@@ -57,19 +57,19 @@ public class JU_CacheChange {
List list = cc.getRemoved();
Assert.assertNotNull(list);
}
-
+
@Test
public void testResetLocalData() {
cc.resetLocalData();
}
-
+
@Test
public void testCacheSize() {
int size;
size = cc.cacheSize();
Assert.assertEquals(0, size);
}
-
+
@Test
public void testContains() {
boolean containsBools;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Creator.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Creator.java
index 2a266f54..c8c27b14 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Creator.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Creator.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,7 +38,7 @@ import static org.mockito.Mockito.*;
import org.junit.Test;
public class JU_Creator {
-
+
CreatorStub creatorStub;
private class CreatorStub extends Creator{
@@ -54,14 +54,14 @@ public class JU_Creator {
// TODO Auto-generated method stub
return "Select"; //Changed from null to Select
}
-
+
}
-
+
@Before
public void setUp() {
creatorStub = new CreatorStub();
}
-
+
@Test
public void testQuery() {
creatorStub.select();
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Cred.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Cred.java
index 05a41667..db80bbf4 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Cred.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Cred.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,7 +50,7 @@ import java.util.Date;
import org.junit.Test;
public class JU_Cred {
-
+
private ByteArrayOutputStream outStream;
private ByteArrayOutputStream errStream;
Cred cred;
@@ -78,43 +78,43 @@ public class JU_Cred {
prop.setProperty(Config.AAF_ROOT_NS, "org.onap.aaf");
prop.setProperty(Config.AAF_ROOT_COMPANY,"test");
Define.set(prop);
-
+
instance = new Instance(12, date, integer, 125642678910L,"234");
cred = new Cred("myid1234@aaf.att.com");
}
-
+
@Test
- public void testLast() { //TODO: set instances
+ public void testLast() { //TODO: set instances
Assert.assertNull(cred.last(null));
}
-
+
@Test
- public void testTypes() { //TODO: set instances
+ public void testTypes() { //TODO: set instances
Assert.assertNotNull(cred.types());
}
-
+
@Test
- public void testCount() { //TODO: set instances
+ public void testCount() { //TODO: set instances
Assert.assertNotNull(cred.count(3));
}
-
+
@Test
- public void testToString() { //TODO: set instances
+ public void testToString() { //TODO: set instances
Assert.assertEquals("myid1234@aaf.att.com[]", cred.toString());
}
-
+
@Test
- public void testHashCode() { //TODO: set instances
+ public void testHashCode() { //TODO: set instances
Assert.assertEquals(-1619358251, cred.hashCode());
}
-
+
@Test
- public void testEquals() { //TODO: set instances
+ public void testEquals() { //TODO: set instances
Assert.assertEquals(true, cred.equals("myid1234@aaf.att.com"));
}
-
+
@Test
- public void testInc() {
+ public void testInc() {
Date begin = new Date(date.getTime() - 10);
Date after = new Date(date.getTime() + 10);
cc.inc(-1, begin, after);
@@ -122,17 +122,17 @@ public class JU_Cred {
cc.inc(2, begin, after);
cc.inc(200, begin, after);
}
-
+
@Test
- public void testAuthCount() { //TODO: set instances
+ public void testAuthCount() { //TODO: set instances
Assert.assertEquals(0, cc.authCount(1));
}
-
+
@Test
- public void testX509Count() { //TODO: set instances
+ public void testX509Count() { //TODO: set instances
Assert.assertEquals(0, cc.x509Count(0));
}
-
+
@After
public void cleanUp() {
System.setErr(System.err);
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java
index 81b7c965..77eafc4b 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,18 +35,18 @@ public class JU_ExpireRange {
public void test() {
ExpireRange expRange = new ExpireRange(new PropAccess());
Date now = expRange.now();
-
+
Set<String> names=expRange.names();
assertTrue(names.contains("OneMonth"));
assertTrue(names.contains("OneWeek"));
assertTrue(names.contains("Delete"));
assertFalse(names.contains(null));
assertFalse(names.contains("bogus"));
-
+
ExpireRange.Range r;
GregorianCalendar gc = new GregorianCalendar();
String[] all = new String[] {"ur","cred"};
-
+
// Test 3 weeks prior
gc.setTime(now);
gc.add(GregorianCalendar.WEEK_OF_MONTH,-3);
@@ -55,7 +55,7 @@ public class JU_ExpireRange {
assertNotNull(r);
assertEquals("Delete",r.name());
}
-
+
// Test 1 week prior
gc.setTime(now);
gc.add(GregorianCalendar.WEEK_OF_MONTH,-1);
@@ -63,7 +63,7 @@ public class JU_ExpireRange {
r = expRange.getRange(rs, gc.getTime());
assertNull(r);
}
-
+
// Test Today
r = expRange.getRange("cred", now);
assertNotNull(r);
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java
index 7a94b9f8..0adea2c5 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java
index 3d71614b..e72b55ea 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Role.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Role.java
index ad53e0e1..050f681b 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Role.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Role.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,11 +31,11 @@ import org.onap.aaf.auth.batch.helpers.Role;
import junit.framework.Assert;
public class JU_Role {
-
+
Role shortRole;
Role longRole;
Set set;
-
+
@Before
public void setUp() {
set = new HashSet();
@@ -47,36 +47,36 @@ public class JU_Role {
public void testEncode() {
Assert.assertEquals("ns|name", longRole.encode());
}
-
+
@Test
public void testFullName() {
Assert.assertEquals("ns.name", longRole.fullName());
Assert.assertEquals("full", shortRole.fullName());
-
+
longRole.fullName("test");
}
-
+
@Test
public void testToString() {
Assert.assertEquals("ns|name", longRole.toString());
}
-
+
@Test
public void testHashCode() {
Assert.assertEquals(-2043567518, longRole.hashCode());
}
-
+
@Test
public void testEquals() {
Assert.assertEquals(false, longRole.equals(longRole));
}
-
+
@Test
public void testCompareTo() {
Assert.assertEquals(-14, longRole.compareTo(shortRole));
Assert.assertEquals(14, shortRole.compareTo(longRole));
}
-
+
@Test
public void testStageRemove() {
longRole.stageRemove(shortRole);
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java
index 50833d0f..efda1af9 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_Batch.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_Batch.java
index 1ef6f3b8..49cedaf2 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_Batch.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_Batch.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,7 +48,7 @@ public class JU_Batch {
AuthzEnv env;
Batch batch;
-
+
private class BatchStub extends Batch {
protected BatchStub(AuthzEnv env) throws APIException, IOException, OrganizationException {
@@ -59,17 +59,17 @@ public class JU_Batch {
@Override
protected void run(AuthzTrans trans) {
// TODO Auto-generated method stub
-
+
}
@Override
protected void _close(AuthzTrans trans) {
// TODO Auto-generated method stub
-
+
}
}
-
+
@Before
public void setUp() throws OrganizationException {
env = new AuthzEnv();
@@ -82,7 +82,7 @@ public class JU_Batch {
env.setProperty("CASS_ENV", "test");
env.setProperty("test.VERSION", "test.VERSION");
}
-
+
@Test
public void testIsSpecial() throws APIException, IOException, OrganizationException {
//BatchStub bStub = new BatchStub(env);
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchException.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchException.java
index 47a7c278..823ee282 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchException.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchException.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,12 +41,12 @@ public class JU_BatchException {
BatchException bExcept4;
BatchException bExcept5;
Throwable throwable;
-
+
@Before
public void setUp() {
throwable = new Throwable();
}
-
+
@Test
public void testBatchException() {
bExcept1 = new BatchException();
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchPrincipal.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchPrincipal.java
index 4e5ad675..1271d7ce 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchPrincipal.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchPrincipal.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ import org.junit.Test;
public class JU_BatchPrincipal {
BatchPrincipal bPrincipal;
-
+
@Test
public void testBatchPrincipal() {
bPrincipal = new BatchPrincipal("name");
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_CassBatch.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_CassBatch.java
index dfb30819..6f2bcd1a 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_CassBatch.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_CassBatch.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,9 +39,9 @@ import java.io.IOException;
import org.junit.Test;
public class JU_CassBatch {
-
+
AuthzTrans aTrans;
-
+
private class CassBatchStub extends CassBatch {
protected CassBatchStub(AuthzTrans trans, String log4jName)
@@ -53,11 +53,11 @@ public class JU_CassBatch {
@Override
protected void run(AuthzTrans trans) {
// TODO Auto-generated method stub
-
+
}
-
+
}
-
+
@Before
public void setUp() throws APIException, IOException, OrganizationException {
aTrans = mock(AuthzTrans.class);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java
index d0e4eaab..de0efdfd 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,14 +54,14 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
protected static final int ASSIGNMENT_COMMAS = 2;
protected static final int WHERE_ANDS = 3;
- private Cluster cluster;
+ private Cluster cluster;
/*
* From DataStax
* com.datastax.driver.core.Session
- A session holds connections to a Cassandra cluster, allowing it to be queried. Each session maintains multiple connections to the cluster nodes,
- provides policies to choose which node to use for each query (round-robin on all nodes of the cluster by default), and handles retries for
+ A session holds connections to a Cassandra cluster, allowing it to be queried. Each session maintains multiple connections to the cluster nodes,
+ provides policies to choose which node to use for each query (round-robin on all nodes of the cluster by default), and handles retries for
failed query (when it makes sense), etc...
- Session instances are thread-safe and usually a single instance is enough per application. However, a given session can only be set to one
+ Session instances are thread-safe and usually a single instance is enough per application. However, a given session can only be set to one
keyspace at a time, so one instance per keyspace is necessary.
*/
private Session session;
@@ -76,7 +76,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
private static final Deque<ResetRequest> resetDeque = new ConcurrentLinkedDeque<ResetRequest>();
private static boolean resetTrigger = false;
private static long nextAvailableReset = 0;
-
+
public AbsCassDAO(TRANS trans, String name, Cluster cluster, String keyspace, Class<DATA> dataClass) {
this.name = name;
this.cluster = cluster;
@@ -95,7 +95,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
owningDAO = aDao;
this.dataClass = dataClass;
}
-
+
// Not used since 2015
// public static void setSessionSlot(Slot slot) {
// sessionSlot = slot;
@@ -117,7 +117,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
/**
* Create a PSInfo and create Prepared Statement
- *
+ *
* @param trans
* @param theCQL
* @param loader
@@ -137,7 +137,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
} else {
crud = CRUD.read;
}
-
+
int idx = 0, count=0;
while ((idx=cql.indexOf('?',idx))>=0) {
++idx;
@@ -145,14 +145,14 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
size=count;
}
-
+
public synchronized void reset() {
ps = null;
}
-
+
private synchronized BoundStatement ps(TransStore trans) throws APIException, IOException {
/* From Datastax
- You should prepare only once, and cache the PreparedStatement in your application (it is thread-safe).
+ You should prepare only once, and cache the PreparedStatement in your application (it is thread-safe).
If you call prepare multiple times with the same query string, the driver will log a warning.
*/
if (ps==null) {
@@ -173,7 +173,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
/**
* Execute a Prepared Statement by extracting from DATA object
- *
+ *
* @param trans
* @param text
* @param data
@@ -194,7 +194,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
/**
* Execute a Prepared Statement on Object[] key
- *
+ *
* @param trans
* @param text
* @param objs
@@ -211,15 +211,15 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
tt.done();
}
}
-
- /*
+
+ /*
* Note:
- *
+ *
*/
/**
* Execute a Prepared Statement by extracting from DATA object
- *
+ *
* @param trans
* @param text
* @param data
@@ -231,15 +231,15 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
/*
* "execute" (and executeAsync)
* Executes the provided query.
- This method blocks until at least some result has been received from the database. However,
- for SELECT queries, it does not guarantee that the result has been received in full. But it
- does guarantee that some response has been received from the database, and in particular
+ This method blocks until at least some result has been received from the database. However,
+ for SELECT queries, it does not guarantee that the result has been received in full. But it
+ does guarantee that some response has been received from the database, and in particular
guarantee that if the request is invalid, an exception will be thrown by this method.
Parameters:
statement - the CQL query to execute (that can be any Statement).
Returns:
- the result of the query. That result will never be null but can be empty (and will
+ the result of the query. That result will never be null but can be empty (and will
be for any non SELECT query).
*/
return Result.ok(getSession(trans).execute(
@@ -254,7 +254,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
/**
* Execute a Prepared Statement on Object[] key
- *
+ *
* @param trans
* @param text
* @param objs
@@ -281,12 +281,12 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
*/
public Result<List<DATA>> read(TRANS trans, String text, Object[] key) {
TimeTaken tt = trans.start(text,Env.REMOTE);
-
+
ResultSet rs;
try {
rs = getSession(trans).execute(key==null?ps(trans):ps(trans).bind(key));
-/// TEST CODE for Exception
-// boolean force = true;
+/// TEST CODE for Exception
+// boolean force = true;
// if (force) {
// Map<InetSocketAddress, Throwable> misa = new HashMap<>();
// //misa.put(new InetSocketAddress(444),new Exception("no host was tried"));
@@ -301,20 +301,20 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
} finally {
tt.done();
}
-
+
return extract(loader,rs,null /*let Array be created if necessary*/,dflt);
}
-
+
public Result<List<DATA>> read(TRANS trans, String text, DATA data) {
return read(trans,text, loader.extract(data, size, crud));
}
-
+
public Object[] keyFrom(DATA data) {
return loader.extract(data, size, CRUD.delete); // Delete is key only
}
/*
- * Note: in case PSInfos are deleted, we want to remove them from list. This is not expected,
+ * Note: in case PSInfos are deleted, we want to remove them from list. This is not expected,
* but we don't want a data leak if it does. Finalize doesn't have to happen quickly
*/
@Override
@@ -339,7 +339,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
} else {
DATA d;
List<DATA> data = indata==null?new ArrayList<>(rows.size()):indata;
-
+
for (Row row : rows) {
try {
d = loader.load(dataClass.newInstance(),row);
@@ -353,7 +353,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
return Result.ok(data);
}
}
-
+
private static final String NEW_CASSANDRA_SESSION_CREATED = "New Cassandra Session Created";
private static final String NEW_CASSANDRA_CLUSTER_OBJECT_CREATED = "New Cassandra Cluster Object Created";
private static final String NEW_CASSANDRA_SESSION = "New Cassandra Session";
@@ -363,14 +363,14 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
//package on purpose
Session session;
long timestamp;
-
+
public ResetRequest(Session session) {
this.session = session;
timestamp = System.currentTimeMillis();
}
}
-
+
public static final void primePSIs(TransStore trans) throws APIException, IOException {
for (AbsCassDAO<? extends TransStore, ?>.PSInfo psi : psinfos) {
if (psi.ps==null) {
@@ -378,7 +378,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
}
}
-
+
public final Session getSession(TransStore trans) throws APIException, IOException {
// SessionFilter unused since 2015
// Try to use Trans' session, if exists
@@ -388,12 +388,12 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
// return sess;
// }
// }
-
+
// If there's an owning DAO, use it's session
- if (owningDAO!=null) {
+ if (owningDAO!=null) {
return owningDAO.getSession(trans);
}
-
+
// OK, nothing else works... get our own.
if (session==null || resetTrigger) {
Cluster tempCluster = null;
@@ -414,7 +414,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
}
}
-
+
if (reset || session == null) {
TimeTaken tt = trans.start(NEW_CASSANDRA_SESSION, Env.SUB);
try {
@@ -458,7 +458,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
return session;
}
-
+
public final boolean reportPerhapsReset(TransStore trans, Exception e) {
if (owningDAO!=null) {
return owningDAO.reportPerhapsReset(trans, e);
@@ -468,7 +468,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
trans.warn().printf("Session Reset called for %s by %s ",session==null?"":session,e==null?"Mgmt Command":e.getClass().getName());
resetDeque.addFirst(new ResetRequest(session));
rv = resetTrigger = true;
- }
+ }
trans.error().log(e);
return rv;
}
@@ -494,7 +494,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
protected void wasModified(TRANS trans, CRUD modified, DATA data, String ... override) {
}
-
+
protected interface Accept<DATA> {
public boolean ok(DATA data);
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Bytification.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Bytification.java
index 965ee2c2..617f7727 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Bytification.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Bytification.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CIDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CIDAO.java
index b148e87a..13bd350b 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CIDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CIDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,7 +30,7 @@ public interface CIDAO<TRANS extends Trans> {
/**
* Touch the date field for given Table
- *
+ *
* @param trans
* @param name
* @return
@@ -39,9 +39,9 @@ public interface CIDAO<TRANS extends Trans> {
/**
* Read all Info entries, and set local Date objects
- *
+ *
* This is to support regular data checks on the Database to speed up Caching behavior
- *
+ *
*/
public abstract Result<Void> check(TRANS trans);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cacheable.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cacheable.java
index 818ae148..18946829 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cacheable.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cacheable.java
@@ -8,9 +8,9 @@
* 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.
@@ -24,9 +24,9 @@ package org.onap.aaf.auth.dao;
/**
* Interface to obtain Segment Integer from DAO Data
* for use in Caching mechanism
- *
+ *
* This should typically be obtained by getting the Hash of the key, then using modulus on the size of segment.
- *
+ *
* @author Jonathan
*
*/
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java
index 5605d653..a3fe1757 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java
@@ -9,9 +9,9 @@
* 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.
@@ -40,7 +40,7 @@ import org.onap.aaf.misc.env.Trans;
public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<TRANS,DATA> {
// Java does not allow creation of Arrays with Generics in them...
protected final CIDAO<TRANS> info;
-
+
private static Timer infoTimer;
private Object cache[];
public final int segSize;
@@ -73,7 +73,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
}
return h%segSize;
}
-
+
public void add(String key, List<DATA> data) {
@SuppressWarnings("unchecked")
Map<String,Dated> map = ((Map<String,Dated>)cache[cacheIdx(key)]);
@@ -105,21 +105,21 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
public interface Getter<D> {
public abstract Result<List<D>> get();
};
-
+
// TODO utilize Segmented Caches, and fold "get" into "reads"
@SuppressWarnings("unchecked")
public Result<List<DATA>> get(TRANS trans, String key, Getter<DATA> getter) {
List<DATA> ld = null;
Result<List<DATA>> rld = null;
-
+
int cacheIdx = cacheIdx(key);
Map<String, Dated> map = ((Map<String,Dated>)cache[cacheIdx]);
-
+
// Check for saved element in cache
Dated cached = map.get(key);
// Note: These Segment Timestamps are kept up to date with DB
Date dbStamp = info.get(trans, name,cacheIdx);
-
+
// Check for cache Entry and whether it is still good (a good Cache Entry is same or after DBEntry, so we use "before" syntax)
if (cached!=null && dbStamp!=null && dbStamp.before(cached.timestamp)) {
ld = (List<DATA>)cached.data;
@@ -139,7 +139,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
* @param dao
*/
public static void startCleansing(AuthzEnv env, CachedDAO<?,?,?> ... dao) {
- for (CachedDAO<?,?,?> d : dao) {
+ for (CachedDAO<?,?,?> d : dao) {
for (int i=0;i<d.segSize;++i) {
startCleansing(env, d.table()+i);
}
@@ -150,11 +150,11 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
public static<T extends Trans> void startRefresh(AuthzEnv env, CIDAO<AuthzTrans> cidao) {
if (infoTimer==null) {
infoTimer = new Timer("CachedDAO Info Refresh Timer");
- int minRefresh = 10*1000*60; // 10 mins Integer.parseInt(env.getProperty(CACHE_MIN_REFRESH_INTERVAL,"2000")); // 2 second minimum refresh
+ int minRefresh = 10*1000*60; // 10 mins Integer.parseInt(env.getProperty(CACHE_MIN_REFRESH_INTERVAL,"2000")); // 2 second minimum refresh
infoTimer.schedule(new Refresh(env,cidao, minRefresh), 1000, minRefresh); // note: Refresh from DB immediately
}
}
-
+
public static void stopTimer() {
Cache.stopTimer();
if (infoTimer!=null) {
@@ -162,21 +162,21 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
infoTimer = null;
}
}
-
+
private static final class Refresh extends TimerTask {
private static final int MAXREFRESH = 2*60*10000; // 20 mins
private AuthzEnv env;
private CIDAO<AuthzTrans> cidao;
private int minRefresh;
private long lastRun;
-
+
public Refresh(AuthzEnv env, CIDAO<AuthzTrans> cidao, int minRefresh) {
this.env = env;
this.cidao = cidao;
this.minRefresh = minRefresh;
lastRun = System.currentTimeMillis()-MAXREFRESH-1000;
}
-
+
@Override
public void run() {
// Evaluate whether to refresh based on transaction rate
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java
index cf410d0b..4e2cd72a 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,25 +30,25 @@ import org.onap.aaf.misc.env.Trans;
/**
* CachedDAO
- *
- * Cache the response of "get" of any DAO.
- *
- * For simplicity's sake, at this time, we only do this for single Object keys
- *
+ *
+ * Cache the response of "get" of any DAO.
+ *
+ * For simplicity's sake, at this time, we only do this for single Object keys
+ *
* @author Jonathan
*
* @param <DATA>
*/
-public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extends Cacheable>
+public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extends Cacheable>
extends Cached<TRANS,DATA> implements DAO_RO<TRANS,DATA>{
-// private final String dirty_str;
-
+// private final String dirty_str;
+
private final D dao;
public CachedDAO(D dao, CIDAO<TRANS> info, int segsize, long expireIn) {
super(info, dao.table(), segsize, expireIn);
-
- // Instantiate a new Cache per DAO name (so separate instances use the same cache)
+
+ // Instantiate a new Cache per DAO name (so separate instances use the same cache)
this.dao = dao;
//read_str = "Cached READ for " + dao.table();
// dirty_str = "Cache DIRTY on " + dao.table();
@@ -56,8 +56,8 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
((CassDAOImpl<?,?>)dao).cache = this;
}
}
-
- public static<T extends Trans, DA extends DAO<T,DT>, DT extends Cacheable>
+
+ public static<T extends Trans, DA extends DAO<T,DT>, DT extends Cacheable>
CachedDAO<T,DA,DT> create(DA dao, CIDAO<T> info, int segsize, long expireIn) {
return new CachedDAO<T,DA,DT>(dao,info, segsize, expireIn);
}
@@ -68,7 +68,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
list.add(data);
super.add(key,list);
}
-
+
// public void invalidate(TRANS trans, Object ... objs) {
// TimeTaken tt = trans.start(dirty_str, Env.SUB);
// try {
@@ -122,7 +122,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
this.dao = dao;
this.objs = objs;
}
-
+
/**
* Separated into single call for easy overloading
* @return
@@ -130,7 +130,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
public Result<List<DATA>> call() {
return dao.read(trans, objs);
}
-
+
@Override
public final Result<List<DATA>> get() {
return call();
@@ -144,7 +144,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
@Override
public Result<List<DATA>> read(final TRANS trans, final Object ... objs) {
- DAOGetter getter = new DAOGetter(trans,dao,objs);
+ DAOGetter getter = new DAOGetter(trans,dao,objs);
return get(trans, keyFromObjs(objs),getter);
// if (ld!=null) {
// return Result.ok(ld);//.emptyList(ld.isEmpty());
@@ -156,9 +156,9 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
// return getter.result;
}
- // Slight Improved performance available when String and Obj versions are known.
+ // Slight Improved performance available when String and Obj versions are known.
public Result<List<DATA>> read(final String key, final TRANS trans, final Object[] objs) {
- DAOGetter getter = new DAOGetter(trans,dao,objs);
+ DAOGetter getter = new DAOGetter(trans,dao,objs);
return get(trans, key, getter);
// if (ld!=null) {
// return Result.ok(ld);//.emptyList(ld.isEmpty());
@@ -169,7 +169,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
// }
// return getter.result;
}
-
+
@Override
public Result<List<DATA>> read(TRANS trans, DATA data) {
return read(trans,dao.keyFrom(data));
@@ -202,24 +202,24 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
data.invalidate(this);
return rv;
}
-
+
@Override
public void close(TRANS trans) {
if (dao!=null) {
dao.close(trans);
}
}
-
+
@Override
public String table() {
return dao.table();
}
-
+
public D dao() {
return dao;
}
-
+
public void invalidate(TRANS trans, DATA data) {
if (info.touch(trans, dao.table(),data.invalidate(this)).notOK()) {
trans.error().log("Cannot touch CacheInfo for Role");
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
index c5ad4599..4246d314 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
@@ -7,9 +7,9 @@
* 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.
@@ -93,7 +93,7 @@ public class CassAccess {
cb.withCredentials(str, env.decryptor().decrypt(epass));
}
}
-
+
str = env.getProperty(pre+CASSANDRA_RESET_EXCEPTIONS,env.getProperty(CASSANDRA_RESET_EXCEPTIONS,null));
if (str!=null) {
env.init().log("Cass ResetExceptions = ",str );
@@ -101,7 +101,7 @@ public class CassAccess {
resetExceptions.add(new Resettable(env,ex));
}
}
-
+
str = env.getProperty(Config.CADI_LATITUDE);
Double lat = str!=null && !str.isEmpty()?Double.parseDouble(str):null;
str = env.getProperty(Config.CADI_LONGITUDE);
@@ -109,9 +109,9 @@ public class CassAccess {
if (lat == null || lon == null) {
throw new APIException(Config.CADI_LATITUDE + " and/or " + Config.CADI_LONGITUDE + " are not set");
}
-
+
env.init().printf("Service Latitude,Longitude = %f,%f",lat,lon);
-
+
str = env.getProperty(pre+CASSANDRA_CLUSTERS,env.getProperty(CASSANDRA_CLUSTERS,"localhost"));
env.init().printf("Cass Clusters = '%s'\n",str );
String[] machs = Split.split(',', str);
@@ -124,7 +124,7 @@ public class CassAccess {
if (minfo.length>0) {
cpoints[i]=minfo[0];
}
-
+
if (minfo.length>3) {
if (minfo[1].equals(bestDC)) {
++numInBestDC;
@@ -143,9 +143,9 @@ public class CassAccess {
}
}
}
-
+
cb.addContactPoints(cpoints);
-
+
if (bestDC!=null) {
// 8/26/2016 Management has determined that Accuracy is preferred over speed in bad situations
// Local DC Aware Load Balancing appears to have the highest normal performance, with the best
@@ -166,11 +166,11 @@ public class CassAccess {
cb.withSocketOptions(new SocketOptions().setReadTimeoutMillis(6500000));
return cb.build();
}
-
+
private static class Resettable {
private Class<? extends Exception> cls;
private List<String> messages;
-
+
@SuppressWarnings("unchecked")
public Resettable(Env env, String propData) throws APIException {
if (propData!=null && propData.length()>1) {
@@ -195,7 +195,7 @@ public class CassAccess {
}
}
}
-
+
public boolean matches(Exception ex) {
if (ex.getClass().equals(cls)) {
if (messages!=null) {
@@ -210,7 +210,7 @@ public class CassAccess {
return false;
}
}
-
+
public static final boolean isResetException(Exception e) {
if (e==null) {
return true;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java
index 68ec2e8b..bb4e2103 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -62,7 +62,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
protected final String U_TEXT = getClass().getSimpleName() + " UPDATE";
protected final String D_TEXT = getClass().getSimpleName() + " DELETE";
private String table;
-
+
protected final ConsistencyLevel readConsistency;
protected final ConsistencyLevel writeConsistency;
@@ -71,7 +71,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
protected PSInfo updatePS;
protected PSInfo deletePS;
protected boolean async=false;
-
+
// Setteable only by CachedDAO
protected Cached<?, ?> cache;
@@ -89,7 +89,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
readConsistency = read;
writeConsistency = write;
}
-
+
/**
* A Constructor to share Session with other DAOs.
*
@@ -113,18 +113,18 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
public final String[] setCRUD(TRANS trans, String table, Class<?> dc,Loader<DATA> loader) {
return setCRUD(trans, table, dc, loader, -1);
}
-
+
public final String[] setCRUD(TRANS trans, String table, Class<?> dc,Loader<DATA> loader, int max) {
Field[] fields = dc.getDeclaredFields();
int end = max>=0 && max<fields.length?max:fields.length;
// get keylimit from a non-null Loader
int keylimit = loader.keylimit();
-
+
StringBuilder sbfc = new StringBuilder();
StringBuilder sbq = new StringBuilder();
StringBuilder sbwc = new StringBuilder();
StringBuilder sbup = new StringBuilder();
-
+
if (keylimit>0) {
for (int i=0;i<end;++i) {
if (i>0) {
@@ -148,18 +148,18 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
sbwc.append("=?");
}
}
-
+
createPS = new PSInfo(trans, "INSERT INTO " + table + " ("+ sbfc +") VALUES ("+ sbq +");",loader,writeConsistency);
-
+
readPS = new PSInfo(trans, SELECT_SP + sbfc + " FROM " + table + WHERE + sbwc + ';',loader,readConsistency);
-
+
// Note: UPDATES can't compile if there are no fields besides keys... Use "Insert"
if (sbup.length()==0) {
updatePS = createPS; // the same as an insert
} else {
updatePS = new PSInfo(trans, UPDATE_SP + table + " SET " + sbup + WHERE + sbwc + ';',loader,writeConsistency);
}
-
+
deletePS = new PSInfo(trans, "DELETE FROM " + table + WHERE + sbwc + ';',loader,writeConsistency);
}
return new String[] {sbfc.toString(), sbq.toString(), sbup.toString(), sbwc.toString()};
@@ -191,7 +191,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
}
}
-
+
/**
* Given a DATA object, extract the individual elements from the Data into an Object Array for the
* execute element.
@@ -231,7 +231,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
}
return readPS.read(trans, R_TEXT, key);
}
-
+
public Result<DATA> readPrimKey(TRANS trans, Object ... key) {
if (readPS==null) {
return Result.err(Result.ERR_NotImplemented,READ_IS_DISABLED,getClass().getSimpleName());
@@ -267,7 +267,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
return Result.err(rs);
}
}
-
+
wasModified(trans, CRUD.update, data);
return Result.ok();
}
@@ -286,7 +286,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
if (rd.isEmpty()) {
return Result.err(Status.ERR_NotFound,"Not Found");
}
- for (DATA d : rd.value) {
+ for (DATA d : rd.value) {
if (async) {
Result<ResultSetFuture> rs = deletePS.execAsync(trans, D_TEXT, d);
if (rs.notOK()) {
@@ -316,7 +316,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
}
return Result.ok();
}
-
+
public final Object[] keyFrom(DATA data) {
return createPS.keyFrom(data);
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO.java
index 38759075..8d9185ba 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAOException.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAOException.java
index 7871e875..5045f6ec 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAOException.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAOException.java
@@ -8,9 +8,9 @@
* 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.
@@ -25,7 +25,7 @@ package org.onap.aaf.auth.dao;
public class DAOException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = 1527904125585539823L;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO_RO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO_RO.java
index ca4277e1..b8f3448c 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO_RO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/DAO_RO.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,11 +28,11 @@ import org.onap.aaf.misc.env.Trans;
/**
* DataAccessObject - ReadOnly
- *
+ *
* It is useful to have a ReadOnly part of the interface for CachedDAO
- *
+ *
* Normal DAOs will implement full DAO
- *
+ *
* @author Jonathan
*
* @param <DATA>
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java
index 4a078f90..93203810 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,11 +40,11 @@ public abstract class Loader<DATA> {
public Loader(int keylimit) {
this.keylimit = keylimit;
}
-
+
public int keylimit() {
return keylimit;
}
-
+
protected abstract DATA load(DATA data, Row row);
protected abstract void key(DATA data, int idx, Object[] obj);
protected abstract void body(DATA data, int idx, Object[] obj);
@@ -74,7 +74,7 @@ public abstract class Loader<DATA> {
}
return rv;
}
-
+
public static void writeString(DataOutputStream os, String s) throws IOException {
if (s==null) {
os.writeInt(-1);
@@ -90,11 +90,11 @@ public abstract class Loader<DATA> {
}
}
}
-
-
+
+
/**
* We use bytes here to set a Maximum
- *
+ *
* @param is
* @param MAX
* @return
@@ -118,10 +118,10 @@ public abstract class Loader<DATA> {
/**
* Write a set with proper sizing
- *
+ *
* Note: at the moment, this is just String. Probably can develop system where types
* are supported too... but not now.
- *
+ *
* @param os
* @param set
* @throws IOException
@@ -137,7 +137,7 @@ public abstract class Loader<DATA> {
}
}
-
+
public static Set<String> readStringSet(DataInputStream is, byte[] buff) throws IOException {
int l = is.readInt();
if (l<0) {
@@ -149,7 +149,7 @@ public abstract class Loader<DATA> {
}
return set;
}
-
+
public static List<String> readStringList(DataInputStream is, byte[] buff) throws IOException {
int l = is.readInt();
if (l<0) {
@@ -162,7 +162,7 @@ public abstract class Loader<DATA> {
return list;
}
- /**
+ /**
* Write a map
* @param os
* @param map
@@ -198,7 +198,7 @@ public abstract class Loader<DATA> {
os.writeInt(magic);
os.writeInt(version);
}
-
+
public static int readHeader(DataInputStream is, final int magic, final int version) throws IOException {
if (is.readInt()!=magic) {
throw new IOException("Corrupted Data Stream");
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Streamer.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Streamer.java
index af3567eb..a072289f 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Streamer.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Streamer.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Touchable.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Touchable.java
index 0fcda19c..2707f7a0 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Touchable.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Touchable.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCertDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCertDAO.java
index c0a2c49c..9b86f80c 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCertDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCertDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,19 +33,19 @@ public class CachedCertDAO extends CachedDAO<AuthzTrans, CertDAO, CertDAO.Data>
public CachedCertDAO(CertDAO dao, CIDAO<AuthzTrans> info, long expiresIn) {
super(dao, info, CertDAO.CACHE_SEG, expiresIn);
}
-
+
/**
* Pass through Cert ID Lookup
- *
+ *
* @param trans
* @param ns
* @return
*/
-
+
public Result<List<CertDAO.Data>> readID(AuthzTrans trans, final String id) {
return dao().readID(trans, id);
}
-
+
public Result<List<CertDAO.Data>> readX500(AuthzTrans trans, final String x500) {
return dao().readX500(trans, x500);
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java
index a8a3796a..9c55d464 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java
@@ -8,9 +8,9 @@
* 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.
@@ -35,7 +35,7 @@ import org.onap.aaf.auth.layer.Result;
public class CachedCredDAO extends CachedDAO<AuthzTrans, CredDAO, CredDAO.Data> {
private final ReadID readID;
private final ReadID readIDBath;
-
+
public CachedCredDAO(CredDAO dao, CIDAO<AuthzTrans> info, long expiresIn) {
super(dao, info, CredDAO.CACHE_SEG, expiresIn);
if(FileGetter.isLoaded) {
@@ -52,12 +52,12 @@ public class CachedCredDAO extends CachedDAO<AuthzTrans, CredDAO, CredDAO.Data>
@Override
public Result<List<Data>> read(AuthzTrans trans, final String id) {
DAOGetter getter = new DAOGetter(trans,dao()) {
- @Override
+ @Override
public Result<List<CredDAO.Data>> call() {
return dao().readID(trans, id);
}
};
-
+
Result<List<CredDAO.Data>> lurd = get(trans, id, getter);
if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserNotFound,"No User Cred found");
@@ -65,17 +65,17 @@ public class CachedCredDAO extends CachedDAO<AuthzTrans, CredDAO, CredDAO.Data>
return lurd;
}
};
-
+
readIDBath = new ReadID() {
@Override
public Result<List<Data>> read(AuthzTrans trans, final String id) {
DAOGetter getter = new DAOGetter(trans,dao()) {
- @Override
+ @Override
public Result<List<CredDAO.Data>> call() {
return dao().readIDBAth(trans, id);
}
};
-
+
Result<List<CredDAO.Data>> lurd = get(trans, id, getter);
if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserNotFound,"No User Cred found");
@@ -85,18 +85,18 @@ public class CachedCredDAO extends CachedDAO<AuthzTrans, CredDAO, CredDAO.Data>
};
}
}
-
+
/**
* Pass through Cred Lookup
- *
+ *
* Unlike Role and Perm, we don't need or want to cache these elements... Only used for NS Delete.
- *
+ *
* @param trans
* @param ns
* @return
*/
public Result<List<CredDAO.Data>> readNS(AuthzTrans trans, final String ns) {
-
+
return dao().readNS(trans, ns);
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedNSDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedNSDAO.java
index e639767c..df089d00 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedNSDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedNSDAO.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java
index 13180ab1..7ea7dd75 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,12 +44,12 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
return dao.readNS(trans, ns);
}
};
-
+
Result<List<Data>> lurd = get(trans, ns, getter);
if (lurd.isOKhasData()) {
return lurd;
} else {
-
+
}
// if (getter.result==null) {
// if (lurd==null) {
@@ -66,7 +66,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
}
/**
- *
+ *
* @param trans
* @param ns
* @param type
@@ -78,7 +78,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
return dao.readByType(trans, ns, type);
}
};
-
+
// Note: Can reuse index1 here, because there is no name collision versus response
Result<List<Data>> lurd = get(trans, ns+'|'+type, getter);
if (lurd.isOK() && lurd.isEmpty()) {
@@ -86,10 +86,10 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
}
return lurd;
}
-
+
/**
* Add desciption to this permission
- *
+ *
* @param trans
* @param ns
* @param type
@@ -98,12 +98,12 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
* @param description
* @return
*/
- public Result<Void> addDescription(AuthzTrans trans, String ns, String type,
+ public Result<Void> addDescription(AuthzTrans trans, String ns, String type,
String instance, String action, String description) {
//TODO Invalidate?
return dao().addDescription(trans, ns, type, instance, action, description);
}
-
+
public Result<Void> addRole(AuthzTrans trans, PermDAO.Data perm, RoleDAO.Data role) {
Result<Void> rv = dao().addRole(trans,perm,role.encode());
if (trans.debug().isLoggable())
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java
index 99fac2da..b90c3579 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,7 +43,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
return dao.readNS(trans, ns);
}
};
-
+
Result<List<Data>> lurd = get(trans, ns, getter);
if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_RoleNotFound,"No Role found");
@@ -57,7 +57,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
return dao().readName(trans, name);
}
};
-
+
Result<List<Data>> lurd = get(trans, name, getter);
if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_RoleNotFound,"No Role found");
@@ -87,10 +87,10 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
invalidate(trans, rd);
return rv;
}
-
+
/**
* Add description to this role
- *
+ *
* @param trans
* @param ns
* @param name
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java
index c1aa9017..c3f353e0 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,7 +42,7 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
}
/**
- * Special Case.
+ * Special Case.
* User Roles by User are very likely to be called many times in a Transaction, to validate "May User do..."
* Pull result, and make accessible by the Trans, which is always keyed by User.
* @param trans
@@ -71,7 +71,7 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
return lurd;
}
-
+
public Result<List<Data>> readByRole(AuthzTrans trans, final String role) {
DAOGetter getter = new DAOGetter(trans,dao()) {
public Result<List<Data>> call() {
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java
index a8c86fa5..702f989a 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,107 +42,105 @@ import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.util.CSV;
public class FileGetter {
- private static final String AAF_FILEGETTER = "aaf_filegetter";
- public static boolean isLoaded = false;
- private static FileGetter singleton;
+ private static final String AAF_FILEGETTER = "aaf_filegetter";
+ public static boolean isLoaded = false;
+ private static FileGetter singleton;
+
+ private Map<String,List<CredDAO.Data>> data;
+ private SimpleDateFormat sdf;
+ private FileGetter(Access access) {
+ if(access!=null) {
+ String filename = access.getProperty(AAF_FILEGETTER,null);
+ if((filename!=null)&&(!isLoaded)) {
+ data = new TreeMap<>();
+ sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS");
+ CSV csv = new CSV(access, filename).setDelimiter('|');
+ try {
+ access.log(Level.INIT, "Loading Filebased Cred from",filename);
+ csv.visit(row -> {
+ if(row.size()<1) {
+ access.log(Level.INIT, "Bad Row");
+ }
+ int type;
+ try {
+ type =Integer.parseInt(row.get(1));
+ } catch(Exception e) {
+ access.log(Level.INIT, e, "skipping ", row.get(0));
+ return;
+ }
+ if(CredDAO.CERT_SHA256_RSA == type) {
+ return;
+ }
+ CredDAO.Data cdd = new CredDAO.Data();
+ cdd.id=row.get(0);
+ cdd.type = type;
+ try {
+ cdd.expires = sdf.parse(row.get(2));
+ cdd.cred = ByteBuffer.wrap(Hash.fromHex(row.get(3)));
+ cdd.notes= row.get(4);
+ cdd.ns = row.get(5);
+ cdd.other = Integer.parseInt(row.get(6));
+ if(row.size()>8) {
+ cdd.tag = row.get(8);
+ } else {
+ cdd.tag = "";
+ }
+ List<CredDAO.Data> lcdd = data.get(cdd.id);
+ if(lcdd == null) {
+ lcdd = new ArrayList<>();
+ data.put(cdd.id, lcdd);
+ }
+ lcdd.add(cdd);
+ } catch (ParseException e) {
+ access.log(Level.INIT, e);
+ }
+
+ });
+ access.printf(Level.INIT, "Filebased Cred finished...");
+ isLoaded = true;
+ } catch( CadiException | IOException e) {
+ access.log(Level.ERROR, e);
+ }
+ }
+ }
+ }
+
+ public static synchronized FileGetter singleton(Access access) {
+ if(singleton==null) {
+ singleton = new FileGetter(access);
+ }
+ return singleton;
+
+ }
+ public Getter<CredDAO.Data> getter(String id) {
+ return new FGetter(id);
+ }
+ private static List<CredDAO.Data> EMPTY = new ArrayList<>();
+ public class FGetter implements Getter<CredDAO.Data> {
+ private final List<CredDAO.Data> lcdd;
+ public FGetter(final String id) {
+ lcdd = data.get(id);
+ }
+ @Override
+ public Result<List<Data>> get() {
+ return Result.ok(lcdd==null?EMPTY:lcdd);
+ }
+ }
- private Map<String,List<CredDAO.Data>> data;
- private SimpleDateFormat sdf;
- private FileGetter(Access access) {
- if(access!=null) {
- String filename = access.getProperty(AAF_FILEGETTER,null);
- if((filename!=null)&&(!isLoaded)) {
- data = new TreeMap<>();
- sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS");
- CSV csv = new CSV(access, filename).setDelimiter('|');
- try {
- access.log(Level.INIT, "Loading Filebased Cred from",filename);
- csv.visit(row -> {
- if(row.size()<1) {
- access.log(Level.INIT, "Bad Row");
- }
- int type;
- try {
- type =Integer.parseInt(row.get(1));
- } catch(Exception e) {
- access.log(Level.INIT, e, "skipping ", row.get(0));
- return;
- }
- if(CredDAO.CERT_SHA256_RSA == type) {
- return;
- }
- CredDAO.Data cdd = new CredDAO.Data();
- cdd.id=row.get(0);
- cdd.type = type;
- try {
- cdd.expires = sdf.parse(row.get(2));
- cdd.cred = ByteBuffer.wrap(Hash.fromHex(row.get(3)));
- cdd.notes= row.get(4);
- cdd.ns = row.get(5);
- cdd.other = Integer.parseInt(row.get(6));
- if(row.size()>8) {
- cdd.tag = row.get(8);
- } else {
- cdd.tag = "";
- }
- List<CredDAO.Data> lcdd = data.get(cdd.id);
- if(lcdd == null) {
- lcdd = new ArrayList<>();
- data.put(cdd.id, lcdd);
- }
- lcdd.add(cdd);
-
- } catch (ParseException e) {
- access.log(Level.INIT, e);
- }
-
- });
- access.printf(Level.INIT, "Filebased Cred finished...");
- isLoaded = true;
- } catch( CadiException | IOException e) {
- access.log(Level.ERROR, e);
- }
-
- }
- }
- }
+ public static void main(String[] args) {
+ PropAccess access = new PropAccess(args);
+ access.setProperty(AAF_FILEGETTER,"/Users/jg1555/cred.dat");
+ FileGetter fg = FileGetter.singleton(access);
- public static synchronized FileGetter singleton(Access access) {
- if(singleton==null) {
- singleton = new FileGetter(access);
- }
- return singleton;
-
- }
- public Getter<CredDAO.Data> getter(String id) {
- return new FGetter(id);
- }
- private static List<CredDAO.Data> EMPTY = new ArrayList<>();
- public class FGetter implements Getter<CredDAO.Data> {
- private final List<CredDAO.Data> lcdd;
- public FGetter(final String id) {
- lcdd = data.get(id);
- }
- @Override
- public Result<List<Data>> get() {
- return Result.ok(lcdd==null?EMPTY:lcdd);
- }
- }
-
- public static void main(String[] args) {
- PropAccess access = new PropAccess(args);
- access.setProperty(AAF_FILEGETTER,"/Users/jg1555/cred.dat");
- FileGetter fg = FileGetter.singleton(access);
-
- for(String id : new String[] {"m01891@aaf.att.com","bogus"}) {
- Getter<CredDAO.Data> g = fg.getter(id);
- Result<List<CredDAO.Data>> r = g.get();
- if(r.isOKhasData()) {
- for(CredDAO.Data cdd : r.value) {
- System.out.println(cdd);
- }
- }
- }
- }
+ for(String id : new String[] {"m01891@aaf.att.com","bogus"}) {
+ Getter<CredDAO.Data> g = fg.getter(id);
+ Result<List<CredDAO.Data>> r = g.get();
+ if(r.isOKhasData()) {
+ for(CredDAO.Data cdd : r.value) {
+ System.out.println(cdd);
+ }
+ }
+ }
+ }
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java
index 5583dc03..139e85a9 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java
@@ -9,9 +9,9 @@
* 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.
@@ -48,7 +48,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
public static final String PENDING = "pending";
public static final String DENIED = "denied";
public static final String APPROVED = "approved";
-
+
private static final String TABLE = "approval";
private static final String TABLELOG = "approved";
private HistoryDAO historyDAO;
@@ -58,7 +58,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
private PSInfo psByStatus;
private static final int KEYLIMIT = 1;
-
+
public ApprovalDAO(AuthzTrans trans, Cluster cluster, String keyspace) {
super(trans, ApprovalDAO.class.getSimpleName(),cluster,keyspace,Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
historyDAO = new HistoryDAO(trans, this);
@@ -83,14 +83,14 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
public String operation;
public Date updated;
}
-
+
private static class ApprovalLoader extends Loader<Data> {
public static final ApprovalLoader deflt = new ApprovalLoader(KEYLIMIT);
-
+
public ApprovalLoader(int keylimit) {
super(keylimit);
}
-
+
@Override
public Data load(Data data, Row row) {
data.id = row.getUUID(0);
@@ -101,7 +101,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
data.status = row.getString(5);
data.memo = row.getString(6);
data.operation = row.getString(7);
- // This is used to get "WRITETIME(STATUS)" from Approval, which gives us an "updated"
+ // This is used to get "WRITETIME(STATUS)" from Approval, which gives us an "updated"
if (row.getColumnDefinitions().size()>8) {
// Rows reported in MicroSeconds
data.updated = new Date(row.getLong(8)/1000);
@@ -125,19 +125,19 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
obj[++idx]=data.memo;
obj[++idx]=data.operation;
}
- }
-
+ }
+
private void init(AuthzTrans trans) {
String[] helpers = setCRUD(trans, TABLE, Data.class, ApprovalLoader.deflt,8);
- psByUser = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
+ psByUser = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
" WHERE user = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
obj[idx]=data.user;
}
}, readConsistency);
-
- psByApprover = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
+
+ psByApprover = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
" WHERE approver = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
@@ -145,7 +145,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
}
}, readConsistency);
- psByTicket = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
+ psByTicket = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
" WHERE ticket = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
@@ -153,7 +153,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
}
}, readConsistency);
- psByStatus = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
+ psByStatus = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE +
" WHERE status = ?", new ApprovalLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
@@ -177,7 +177,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
if (rs.notOK()) {
return Result.err(rs);
}
- return Result.ok(data);
+ return Result.ok(data);
}
@@ -195,7 +195,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
public Result<List<ApprovalDAO.Data>> readByStatus(AuthzTrans trans, String status) {
return psByStatus.read(trans, R_TEXT, new Object[]{status});
- }
+ }
/* (non-Javadoc)
* @see org.onap.aaf.auth.dao.CassDAOImpl#delete(com.att.inno.env.TransStore, java.lang.Object, boolean)
@@ -209,7 +209,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
}
ApprovalLoader.deflt.load(data, rd.value.one());
}
- if (APPROVED.equals(data.status) || DENIED.equals(data.status)) {
+ if (APPROVED.equals(data.status) || DENIED.equals(data.status)) {
StringBuilder sb = new StringBuilder("BEGIN BATCH\n");
sb.append("INSERT INTO ");
sb.append(TABLELOG);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java
index e0c0c0d4..08de28ec 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,16 +43,16 @@ import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Row;
/**
- * CredDAO manages credentials.
+ * CredDAO manages credentials.
* @author Jonathan
* Date: 7/19/13
*/
public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
public static final String TABLE = "artifact";
-
+
private HistoryDAO historyDAO;
private PSInfo psByMechID,psByMachine, psByNs;
-
+
public ArtiDAO(AuthzTrans trans, Cluster cluster, String keyspace) {
super(trans, ArtiDAO.class.getSimpleName(),cluster, keyspace, Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
init(trans);
@@ -78,7 +78,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
public Date expires;
public int renewDays;
public Set<String> sans;
-
+
// // Getters
public Set<String> type(boolean mutable) {
if (type == null) {
@@ -104,7 +104,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
ArtifactLoader.deflt.marshal(this,new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
ArtifactLoader.deflt.unmarshal(this, toDIS(bb));
@@ -118,7 +118,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
private static class ArtifactLoader extends Loader<Data> implements Streamer<Data>{
public static final int MAGIC=95829343;
public static final int VERSION=1;
- public static final int BUFF_SIZE=48; // Note:
+ public static final int BUFF_SIZE=48; // Note:
public static final ArtifactLoader deflt = new ArtifactLoader(KEYLIMIT);
public ArtifactLoader(int keylimit) {
@@ -225,10 +225,10 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
if (historyDAO==null) {
historyDAO = new HistoryDAO(trans,this);
}
-
+
String[] helpers = setCRUD(trans, TABLE, Data.class, ArtifactLoader.deflt);
- psByMechID = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
+ psByMechID = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE mechid = ?", new ArtifactLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
@@ -236,7 +236,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
}
},readConsistency);
- psByMachine = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
+ psByMachine = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE machine = ?", new ArtifactLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
@@ -244,7 +244,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
}
},readConsistency);
- psByNs = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
+ psByNs = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE ns = ?", new ArtifactLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
@@ -253,8 +253,8 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
},readConsistency);
}
-
-
+
+
public Result<List<Data>> readByMechID(AuthzTrans trans, String mechid) {
return psByMechID.read(trans, R_TEXT, new Object[]{mechid});
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
index eea3c4c2..6a32a365 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
@@ -9,9 +9,9 @@
* 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.
@@ -69,7 +69,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
public static final Map<String,Date[]> info = new ConcurrentHashMap<>();
private static CacheUpdate cacheUpdate;
-
+
// Hold current time stamps from Tables
private final Date startTime;
private final boolean cacheNotify;
@@ -79,7 +79,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
// Data Definition, matches Cassandra DM
//////////////////////////////////////////
private static final int KEYLIMIT = 2;
-
+
public CacheInfoDAO(AuthzTrans trans, Cluster cluster, String keyspace) throws APIException, IOException {
super(trans, CacheInfoDAO.class.getSimpleName(),cluster,keyspace,Data.class,TABLE,readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
startTime = new Date();
@@ -94,8 +94,8 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
cacheNotify = noK8s(trans);
}
- /**
- * Need a different point to point cache clear strategy for K8s...
+ /**
+ * Need a different point to point cache clear strategy for K8s...
* @param trans
* @return
*/
@@ -124,11 +124,11 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
private static class InfoLoader extends Loader<Data> {
public static final InfoLoader dflt = new InfoLoader(KEYLIMIT);
-
+
public InfoLoader(int keylimit) {
super(keylimit);
}
-
+
@Override
public Data load(Data data, Row row) {
// Int more efficient
@@ -151,7 +151,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
obj[idx]=data.touched;
}
}
-
+
public static synchronized <T extends Trans> void startUpdate(AuthzEnv env, HMangr hman, SecuritySetter<HttpURLConnection> ss, String ip, int port) {
if (cacheUpdate==null) {
cacheUpdate = new CacheUpdate(env,hman,ss, ip,port);
@@ -176,15 +176,15 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
private SecuritySetter<HttpURLConnection> ss;
private final String authority;
public boolean go = true;
-
+
public CacheUpdate(AuthzEnv env, HMangr hman, SecuritySetter<HttpURLConnection> ss, String ip, int port) {
this.env = env;
this.hman = hman;
this.ss = ss;
-
+
this.authority = ip+':'+port;
}
-
+
private static class Transfer {
public String table;
public int segs[];
@@ -198,7 +198,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
private AuthzTrans trans;
private String type;
private String segs;
-
+
public CacheClear(AuthzTrans trans) {
this.trans = trans;
}
@@ -207,7 +207,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
type = es.getKey();
segs = es.getValue().toString();
}
-
+
@Override
public Integer code(Rcli<?> client) throws APIException, CadiException {
URI to = client.getURI();
@@ -222,11 +222,11 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
return total;
}
}
-
+
private class IntHolder {
private int[] raw;
HashSet<Integer> set;
-
+
public IntHolder(int ints[]) {
raw = ints;
set = null;
@@ -234,7 +234,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
public void add(int[] ints) {
if (set==null) {
set = new HashSet<>();
-
+
for (int i=0;i<raw.length;++i) {
set.add(raw[i]);
}
@@ -270,7 +270,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
return sb.toString();
}
}
-
+
@Override
public void run() {
do {
@@ -279,7 +279,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
if (data==null) {
continue;
}
-
+
int count = 0;
CacheClear cc = null;
Map<String,IntHolder> gather = null;
@@ -319,7 +319,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
sb.append(count);
if (count==1) {
sb.append(" entry for ");
- } else {
+ } else {
sb.append(" entries for ");
}
int peers = count<=0?0:cc.total/count;
@@ -354,13 +354,13 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
/* (non-Javadoc)
* @see org.onap.aaf.auth.dao.cass.CIDAO#touch(org.onap.aaf.auth.env.test.AuthzTrans, java.lang.String, int)
*/
-
+
@Override
public Result<Void> touch(AuthzTrans trans, String name, int ... seg) {
/////////////
// Direct Service Cache Invalidation
/////////////
- // ConcurrentQueues are open-ended. We don't want any Memory leaks
+ // ConcurrentQueues are open-ended. We don't want any Memory leaks
// Note: we keep a separate counter, because "size()" on a Linked Queue is expensive
if (cacheNotify && cacheUpdate!=null) {
try {
@@ -389,7 +389,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
sb.append(name);
sb.append("' AND seg = ");
sb.append(s);
- sb.append(";\n");
+ sb.append(";\n");
if (first) {
first =false;
} else {
@@ -425,7 +425,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
} finally {
tt.done();
}
-
+
String lastName = null;
Date[] dates = null;
for (Row row : rs.all()) {
@@ -451,7 +451,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
}
return Result.ok();
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.dao.cass.CIDAO#get(java.lang.String, int)
*/
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheableData.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheableData.java
index be7c44ae..0b0ca7fa 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheableData.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheableData.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,10 +26,10 @@ import org.onap.aaf.auth.dao.Cached;
import org.onap.aaf.auth.dao.CachedDAO;
public abstract class CacheableData implements Cacheable {
- // WARNING: DON'T attempt to add any members here, as it will
+ // WARNING: DON'T attempt to add any members here, as it will
// be treated by system as fields expected in Tables
protected int seg(Cached<?,?> cache, Object ... fields) {
return cache==null?0:cache.invalidate(CachedDAO.keyFromObjs(fields));
}
-
+
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java
index 6c23938f..59248868 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,18 +43,18 @@ import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Row;
/**
- * CredDAO manages credentials.
+ * CredDAO manages credentials.
* @author Jonathan
* Date: 7/19/13
*/
public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
public static final String TABLE = "x509";
public static final int CACHE_SEG = 0x40; // yields segment 0x0-0x3F
-
+
private HistoryDAO historyDAO;
private CIDAO<AuthzTrans> infoDAO;
private PSInfo psX500,psID;
-
+
public CertDAO(AuthzTrans trans, Cluster cluster, String keyspace) throws APIException, IOException {
super(trans, CertDAO.class.getSimpleName(),cluster, keyspace, Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
init(trans);
@@ -66,10 +66,10 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
infoDAO = ciDao;
init(trans);
}
-
+
public static final int KEYLIMIT = 2;
public static class Data extends CacheableData implements Bytification {
-
+
public String ca;
public BigInteger serial;
public String id;
@@ -82,14 +82,14 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
seg(cache,ca,serial)
};
}
-
+
@Override
public ByteBuffer bytify() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
CertLoader.deflt.marshal(this,new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
CertLoader.deflt.unmarshal(this, toDIS(bb));
@@ -99,7 +99,7 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
private static class CertLoader extends Loader<Data> implements Streamer<Data>{
public static final int MAGIC=85102934;
public static final int VERSION=1;
- public static final int BUFF_SIZE=48; // Note:
+ public static final int BUFF_SIZE=48; // Note:
public static final CertLoader deflt = new CertLoader(KEYLIMIT);
public CertLoader(int keylimit) {
@@ -133,7 +133,7 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
obj[++idx] = data.x500;
obj[++idx] = data.x509;
-
+
}
@Override
@@ -172,7 +172,7 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
}
}
}
-
+
public Result<List<CertDAO.Data>> read(AuthzTrans trans, Object ... key) {
// Translate BigInteger to Byte array for lookup
return super.read(trans, key[0],ByteBuffer.wrap(((BigInteger)key[1]).toByteArray()));
@@ -194,9 +194,9 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
psX500 = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE x500 = ?", CertLoader.deflt,readConsistency);
-
+
}
-
+
public Result<List<Data>> readX500(AuthzTrans trans, String x500) {
return psX500.read(trans, R_TEXT, new Object[]{x500});
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ConfigDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ConfigDAO.java
index 9f402adc..1228fce5 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ConfigDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ConfigDAO.java
@@ -9,9 +9,9 @@
* 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.
@@ -40,7 +40,7 @@ import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Row;
/**
- * CredDAO manages credentials.
+ * CredDAO manages credentials.
* @author Jonathan
* Date: 6/25/18
*/
@@ -49,7 +49,7 @@ public class ConfigDAO extends CassDAOImpl<AuthzTrans,ConfigDAO.Data> {
public static final int CACHE_SEG = 0x40; // yields segment 0x0-0x3F
public static final int KEYLIMIT = 2;
private PSInfo psName;
-
+
public ConfigDAO(AuthzTrans trans, Cluster cluster, String keyspace) throws APIException, IOException {
super(trans, ConfigDAO.class.getSimpleName(),cluster, keyspace, Data.class,TABLE_NAME, readConsistency(trans,TABLE_NAME), writeConsistency(trans,TABLE_NAME));
init(trans);
@@ -69,7 +69,7 @@ public class ConfigDAO extends CassDAOImpl<AuthzTrans,ConfigDAO.Data> {
private static class ConfigLoader extends Loader<Data> implements Streamer<Data>{
public static final int MAGIC=2673849;
public static final int VERSION=1;
- public static final int BUFF_SIZE=48;
+ public static final int BUFF_SIZE=48;
public static final ConfigLoader deflt = new ConfigLoader(KEYLIMIT);
public ConfigLoader(int keylimit) {
@@ -113,14 +113,14 @@ public class ConfigDAO extends CassDAOImpl<AuthzTrans,ConfigDAO.Data> {
data.value = readString(is,buff);
}
}
-
+
private void init(AuthzTrans trans) throws APIException, IOException {
String[] helpers = setCRUD(trans, TABLE_NAME, Data.class, ConfigLoader.deflt);
psName = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE_NAME +
" WHERE name = ?", ConfigLoader.deflt,readConsistency);
}
-
+
/**
* Log Modification statements to History
@@ -133,7 +133,7 @@ public class ConfigDAO extends CassDAOImpl<AuthzTrans,ConfigDAO.Data> {
protected void wasModified(AuthzTrans trans, CRUD modified, Data data, String ... override) {
// not an auditable table.
}
-
+
public Result<List<Data>> readName(AuthzTrans trans, String name) {
return psName.read(trans, R_TEXT, new Object[]{name});
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
index 5acc836e..137969e6 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
@@ -8,9 +8,9 @@
* 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.
@@ -46,7 +46,7 @@ import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Row;
/**
- * CredDAO manages credentials.
+ * CredDAO manages credentials.
* @author Jonathan
* Date: 7/19/13
*/
@@ -60,13 +60,13 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
public static final int BASIC_AUTH_SHA256 = 2;
public static final int CERT_SHA256_RSA =200;
public static final SecureRandom srand = new SecureRandom();
-
+
private HistoryDAO historyDAO;
private CIDAO<AuthzTrans> infoDAO;
private PSInfo psNS;
private PSInfo psID;
private PSInfo psIDBath;
-
+
public CredDAO(AuthzTrans trans, Cluster cluster, String keyspace) throws APIException, IOException {
super(trans, CredDAO.class.getSimpleName(),cluster, keyspace, Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
init(trans);
@@ -81,7 +81,7 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
public static final int KEYLIMIT = 3;
public static class Data extends CacheableData implements Bytification {
-
+
public String id;
public Integer type;
public Date expires;
@@ -98,14 +98,14 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
seg(cache,id) // cache is for all entities
};
}
-
+
@Override
public ByteBuffer bytify() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
CredLoader.deflt.marshal(this,new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
CredLoader.deflt.unmarshal(this, toDIS(bb));
@@ -119,7 +119,7 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
public static class CredLoader extends Loader<Data> implements Streamer<Data>{
public static final int MAGIC=153323443;
public static final int VERSION=2;
- public static final int BUFF_SIZE=48; // Note:
+ public static final int BUFF_SIZE=48; // Note:
public static final CredLoader deflt = new CredLoader(KEYLIMIT);
public CredLoader(int keylimit) {
@@ -132,10 +132,10 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
data.type = row.getInt(1); // NOTE: in datastax driver, If the int value is NULL, 0 is returned!
data.expires = row.getTimestamp(2);
data.other = row.getInt(3);
- data.ns = row.getString(4);
+ data.ns = row.getString(4);
data.tag = row.getString(5);
data.notes = row.getString(6);
- data.cred = row.getBytesUnsafe(7);
+ data.cred = row.getBytesUnsafe(7);
return data;
}
@@ -163,7 +163,7 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
public void marshal(Data data, DataOutputStream os) throws IOException {
writeHeader(os,MAGIC,VERSION);
writeString(os, data.id);
- os.writeInt(data.type);
+ os.writeInt(data.type);
os.writeLong(data.expires==null?-1:data.expires.getTime());
os.writeInt(data.other==null?0:data.other);
writeString(os, data.ns);
@@ -185,14 +185,14 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
byte[] buff = new byte[BUFF_SIZE];
data.id = readString(is,buff);
data.type = is.readInt();
-
+
long l = is.readLong();
data.expires = l<0?null:new Date(l);
data.other = is.readInt();
data.ns = readString(is,buff);
data.tag = readString(is,buff);
data.notes = readString(is,buff);
-
+
int i = is.readInt();
data.cred=null;
if (i>=0) {
@@ -213,16 +213,16 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
if (infoDAO==null) {
infoDAO = new CacheInfoDAO(trans,this);
}
-
+
String[] helpers = setCRUD(trans, TABLE, Data.class, CredLoader.deflt);
-
+
psNS = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE ns = ?", CredLoader.deflt,readConsistency);
-
+
psID = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE id = ?", CredLoader.deflt,readConsistency);
-
+
// NOTE: (type) in ((1),(2)) is valid for Cass 2.1.14. After 2.1.14, more obvious
// syntax of type in (1,2) is available
// ALSO, 1 & 2 STAND FOR BASIC_AUTH (MD5) AND BASIC_AUTH_SHA256(with salt).
@@ -232,7 +232,7 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
psIDBath = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE id = ? and (type) in ((1),(2))", CredLoader.deflt,readConsistency);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.dao.CassDAOImpl#create(org.onap.aaf.misc.env.TransStore, java.lang.Object)
*/
@@ -252,11 +252,11 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
public Result<List<Data>> readNS(AuthzTrans trans, String ns) {
return psNS.read(trans, R_TEXT, new Object[]{ns});
}
-
+
public Result<List<Data>> readID(AuthzTrans trans, String id) {
return psID.read(trans, R_TEXT, new Object[]{id});
}
-
+
public Result<List<Data>> readIDBAth(AuthzTrans trans, String id) {
return psIDBath.read(trans, R_TEXT, new Object[] {id});
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java
index e7749bd5..1f7afb8c 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java
@@ -9,9 +9,9 @@
* 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.
@@ -47,7 +47,7 @@ public class DelegateDAO extends CassDAOImpl<AuthzTrans, DelegateDAO.Data> {
public static final String TABLE = "delegate";
private PSInfo psByDelegate;
private static final int KEYLIMIT = 1;
-
+
public DelegateDAO(AuthzTrans trans, Cluster cluster, String keyspace) {
super(trans, DelegateDAO.class.getSimpleName(),cluster,keyspace,Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
init(trans);
@@ -57,8 +57,8 @@ public class DelegateDAO extends CassDAOImpl<AuthzTrans, DelegateDAO.Data> {
super(trans, DelegateDAO.class.getSimpleName(),aDao,Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
init(trans);
}
-
-
+
+
public static class Data implements Bytification {
public String user;
public String delegate;
@@ -70,13 +70,13 @@ public class DelegateDAO extends CassDAOImpl<AuthzTrans, DelegateDAO.Data> {
DelegateLoader.dflt.marshal(this,new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
DelegateLoader.dflt.unmarshal(this, toDIS(bb));
}
}
-
+
private static class DelegateLoader extends Loader<Data> implements Streamer<Data>{
public static final int MAGIC=0xD823ACF2;
public static final int VERSION=1;
@@ -87,7 +87,7 @@ public class DelegateDAO extends CassDAOImpl<AuthzTrans, DelegateDAO.Data> {
public DelegateLoader(int keylimit) {
super(keylimit);
}
-
+
@Override
public Data load(Data data, Row row) {
data.user = row.getString(0);
@@ -126,8 +126,8 @@ public class DelegateDAO extends CassDAOImpl<AuthzTrans, DelegateDAO.Data> {
data.delegate = readString(is,buff);
data.expires = new Date(is.readLong());
}
- }
-
+ }
+
private void init(AuthzTrans trans) {
String[] helpers = setCRUD(trans, TABLE, Data.class, DelegateLoader.dflt);
psByDelegate = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
index eafdb884..15c2b557 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
@@ -9,9 +9,9 @@
* 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.
@@ -38,9 +38,9 @@ import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
/**
- * FutureDAO stores Construction information to create
+ * FutureDAO stores Construction information to create
* elements at another time.
- *
+ *
* @author Jonathan
* 8/20/2013
*/
@@ -152,7 +152,7 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
return Result.err(rs);
}
wasModified(trans, CRUD.create, data, null, id);
- return Result.ok(data);
+ return Result.ok(data);
}
/**
@@ -172,10 +172,10 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
hd.target = TABLE;
hd.subject = subject?override[1]:"";
hd.memo = memo?String.format("%s by %s", override[0], hd.user):data.memo;
-
+
if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
}
-
+
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
index 82874ce9..c994dd53 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,16 +40,16 @@ import com.datastax.driver.core.Row;
/**
* History
- *
+ *
* Originally written PE3617
* @author Jonathan
- *
+ *
* History is a special case, because we don't want Updates or Deletes... Too likely to mess up history.
- *
+ *
* Jonathan 9-9-2013 - Found a problem with using "Prepare". You cannot prepare anything with a "now()" in it, as
* it is evaluated once during the prepare, and kept. That renders any use of "now()" pointless. Therefore
* the Create function needs to be run fresh everytime.
- *
+ *
* Fixed in Cassandra 1.2.6 https://issues.apache.org/jira/browse/CASSANDRA-5616
*
*/
@@ -84,7 +84,7 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
public String memo;
public ByteBuffer reconstruct;
}
-
+
public static class HistLoader extends Loader<Data> {
public HistLoader(int keylimit) {
super(keylimit);
@@ -118,10 +118,10 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
obj[++idx]=data.subject;
obj[++idx]=data.memo;
// obj[++idx]=data.detail;
- obj[++idx]=data.reconstruct;
+ obj[++idx]=data.reconstruct;
}
};
-
+
private void init(AuthzTrans trans) {
// Loader must match fields order
defLoader = new HistLoader(KEYLIMIT);
@@ -130,9 +130,9 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
// Need a specialty Creator to handle the "now()"
// 9/9/2013 - Jonathan - Just great... now() is evaluated once on Client side, invalidating usage (what point is a now() from a long time in the past?
// Unless this is fixed, we're putting in non-prepared statement
- // Solved in Cassandra. Make sure you are running 1.2.6 Cassandra or later. https://issues.apache.org/jira/browse/CASSANDRA-5616
+ // Solved in Cassandra. Make sure you are running 1.2.6 Cassandra or later. https://issues.apache.org/jira/browse/CASSANDRA-5616
replace(CRUD.create, new PSInfo(trans, "INSERT INTO history (" + helpers[FIELD_COMMAS] +
- ") VALUES(now(),?,?,?,?,?,?,?)",
+ ") VALUES(now(),?,?,?,?,?,?,?)",
new HistLoader(0) {
@Override
protected void key(Data data, int idx, Object[] obj) {
@@ -140,9 +140,9 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
},writeConsistency)
);
// disable(CRUD.Create);
-
+
replace(CRUD.read, new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] +
- " FROM history WHERE id = ?", defLoader,readConsistency)
+ " FROM history WHERE id = ?", defLoader,readConsistency)
// new HistLoader(2) {
// @Override
// protected void key(Data data, int idx, Object[] obj) {
@@ -153,12 +153,12 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
);
disable(CRUD.update);
disable(CRUD.delete);
-
- readByUser = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] +
+
+ readByUser = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] +
" FROM history WHERE user = ?", defLoader,readConsistency);
- readBySubject = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] +
+ readBySubject = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] +
" FROM history WHERE subject = ? and target = ? ALLOW FILTERING", defLoader,readConsistency);
- readByYRMN = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] +
+ readByYRMN = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] +
" FROM history WHERE yr_mon = ?", defLoader,readConsistency);
async(true); //TODO dropping messages with Async
}
@@ -169,9 +169,9 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
// Sonar claims that SimpleDateFormat is not thread safe, so we can't be static
data.yr_mon = Integer.parseInt(new SimpleDateFormat("yyyyMM").format(now));
// data.day_time = Integer.parseInt(dayTimeFormat.format(now));
- return data;
+ return data;
}
-
+
public void createBatch(StringBuilder sb, Data data) {
sb.append("INSERT INTO history (");
sb.append(helpers[FIELD_COMMAS]);
@@ -213,7 +213,7 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
}
return extract(defLoader,rs.value,null,yyyymm.length>0?new YYYYMM(yyyymm):dflt);
}
-
+
public Result<List<Data>> readBySubject(AuthzTrans trans, String subject, String target, int ... yyyymm) {
if (yyyymm.length==0) {
return Result.err(Status.ERR_BadData, "No or invalid yyyymm specified");
@@ -224,7 +224,7 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
}
return extract(defLoader,rs.value,null,yyyymm.length>0?new YYYYMM(yyyymm):dflt);
}
-
+
private class YYYYMM implements Accept<Data> {
private int[] yyyymm;
public YYYYMM(int yyyymm[]) {
@@ -240,7 +240,7 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
}
return false;
}
-
+
};
-
+
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
index 478cceb0..3fad6a7a 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,14 +44,14 @@ import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Row;
/**
- * LocateDAO manages credentials.
+ * LocateDAO manages credentials.
* @author Jonathan
* Date: 10/11/17
*/
public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
public static final String TABLE = "locate";
private AbsCassDAO<AuthzTrans, Data>.PSInfo psName;
-
+
public LocateDAO(AuthzTrans trans, Cluster cluster, String keyspace) throws APIException, IOException {
super(trans, LocateDAO.class.getSimpleName(),cluster, keyspace, Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
init(trans);
@@ -61,10 +61,10 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
super(trans, LocateDAO.class.getSimpleName(), adao, Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
init(trans);
}
-
+
public static final int KEYLIMIT = 3;
public static class Data implements Bytification {
-
+
public String name;
public String hostname;
public int port;
@@ -87,14 +87,14 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
}
return subprotocol;
}
-
+
@Override
public ByteBuffer bytify() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
LocateLoader.deflt.marshal(this,new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
LocateLoader.deflt.unmarshal(this, toDIS(bb));
@@ -122,8 +122,8 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
private static class LocateLoader extends Loader<Data> implements Streamer<Data>{
public static final int MAGIC=85102934;
public static final int VERSION=1;
- public static final int BUFF_SIZE=48; // Note:
-
+ public static final int BUFF_SIZE=48; // Note:
+
public static final LocateLoader deflt = new LocateLoader(KEYLIMIT);
public LocateLoader(int keylimit) {
super(keylimit);
@@ -188,7 +188,7 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
writeString(os,s);
}
}
-
+
writeString(os,data.port_key==null?"":data.port_key.toString());
}
@@ -207,7 +207,7 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
data.latitude = is.readFloat();
data.longitude = is.readFloat();
data.protocol = readString(is,buff);
-
+
int size = is.readInt();
data.subprotocol = new HashSet<>(size);
for (int i=0;i<size;++i) {
@@ -221,7 +221,7 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
}
}
}
-
+
public Result<List<LocateDAO.Data>> readByName(AuthzTrans trans, String service) {
return psName.read(trans, "Read By Name", new Object[] {service});
}
@@ -235,7 +235,7 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
psName = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE name = ?", new LocateLoader(1),readConsistency);
}
-
+
/**
* Log Modification statements to History
*
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java
index 192887b9..3e669483 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java
@@ -7,9 +7,9 @@
* 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.
@@ -49,7 +49,7 @@ public class Namespace implements Bytification {
public Integer type;
public String parent;
public Namespace() {}
-
+
public Namespace(NsDAO.Data ndd) {
name = ndd.name;
description = ndd.description;
@@ -62,7 +62,7 @@ public class Namespace implements Bytification {
}
}
}
-
+
public Namespace(NsDAO.Data ndd,List<String> owner, List<String> admin) {
name = ndd.name;
this.owner = owner;
@@ -108,7 +108,7 @@ public class Namespace implements Bytification {
DataInputStream is = CassDAOImpl.toDIS(bb);
/*int version = */Loader.readHeader(is,MAGIC,VERSION);
// If Version Changes between Production runs, you'll need to do a switch Statement, and adequately read in fields
-
+
byte[] buff = new byte[BUFF_SIZE];
name = Loader.readString(is, buff);
type = is.readInt();
@@ -116,7 +116,7 @@ public class Namespace implements Bytification {
owner = Loader.readStringList(is,buff);
description = Loader.readString(is,buff);
parent = Loader.readString(is,buff);
-
+
}
/* (non-Javadoc)
@@ -126,7 +126,7 @@ public class Namespace implements Bytification {
public int hashCode() {
return name.hashCode();
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java
index 10e7844c..24bd01de 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,9 +54,9 @@ import com.datastax.driver.core.exceptions.DriverException;
/**
* NsDAO
- *
+ *
* Data Access Object for Namespace Data
- *
+ *
* @author Jonathan
*
*/
@@ -73,7 +73,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
private static final String APPLY_BATCH = "\nAPPLY BATCH;\n";
private static final String SQSCCR = "';\n";
private static final String SQCSQ = "','";
-
+
private HistoryDAO historyDAO;
private CacheInfoDAO infoDAO;
private PSInfo psNS;
@@ -97,7 +97,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
private static final int KEYLIMIT = 1;
/**
* Data class that matches the Cassandra Table "role"
- *
+ *
* @author Jonathan
*/
public static class Data extends CacheableData implements Bytification {
@@ -135,19 +135,19 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
NSLoader.deflt.marshal(this,new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
NSLoader.deflt.unmarshal(this,toDIS(bb));
}
-
+
@Override
public String toString() {
return name;
}
-
+
}
-
+
private void init(AuthzTrans trans) throws APIException, IOException {
// Set up sub-DAOs
if (historyDAO==null) {
@@ -158,19 +158,19 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
}
String[] helpers = setCRUD(trans, TABLE, Data.class, NSLoader.deflt,4/*need to skip attrib */);
-
+
psNS = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE parent = ?", new NSLoader(1),readConsistency);
}
-
+
private static final class NSLoader extends Loader<Data> implements Streamer<Data> {
public static final int MAGIC=250935515;
public static final int VERSION=1;
public static final int BUFF_SIZE=48;
public static final NSLoader deflt = new NSLoader(KEYLIMIT);
-
+
public NSLoader(int keylimit) {
super(keylimit);
}
@@ -198,7 +198,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
obj[++idx]=data.description;
obj[++idx]=data.parent;
}
-
+
@Override
public void marshal(Data data, DataOutputStream os) throws IOException {
writeHeader(os,MAGIC,VERSION);
@@ -221,7 +221,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public void unmarshal(Data data, DataInputStream is) throws IOException {
/*int version = */readHeader(is,MAGIC,VERSION);
// If Version Changes between Production runs, you'll need to do a switch Statement, and adequately read in fields
-
+
byte[] buff = new byte[BUFF_SIZE];
data.name = readString(is, buff);
data.type = is.readInt();
@@ -237,7 +237,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
}
}
-
+
@Override
public Result<Data> create(AuthzTrans trans, Data data) {
String ns = data.name;
@@ -253,8 +253,8 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
stmt.append(APPLY_BATCH);
try {
getSession(trans).execute(stmt.toString());
-//// TEST CODE for Exception
-// boolean force = true;
+//// TEST CODE for Exception
+// boolean force = true;
// if (force) {
// throw new com.datastax.driver.core.exceptions.NoHostAvailableException(new HashMap<>());
//// throw new com.datastax.driver.core.exceptions.AuthenticationException(new InetSocketAddress(9999),"Sample Message");
@@ -293,7 +293,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
attribUpdateStmt(stmt, ns, es.getKey(),es.getValue());
}
}
-
+
// No point in deleting... insert overwrites...
// for (Entry<String, String> es : remoteAttr.entrySet()) {
// str = localAttr.get(es.getKey());
@@ -320,7 +320,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
@Override
public Result<List<Data>> read(AuthzTrans trans, Data data) {
Result<List<Data>> rld = super.read(trans, data);
-
+
if (rld.isOKhasData()) {
for (Data d : rld.value) {
// Note: Map is null at this point, save time/mem by assignment
@@ -375,17 +375,17 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
return super.delete(trans, data, reread);
}
-
+
public Result<Map<String,String>> readAttribByNS(AuthzTrans trans, String ns) {
Map<String,String> map = new HashMap<>();
TimeTaken tt = trans.start("readAttribByNS " + ns, Env.REMOTE);
try {
- ResultSet rs = getSession(trans).execute("SELECT key,value FROM "
- + TABLE_ATTRIB
+ ResultSet rs = getSession(trans).execute("SELECT key,value FROM "
+ + TABLE_ATTRIB
+ " WHERE ns='"
+ ns
+ "';");
-
+
for (Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
Row r = iter.next();
map.put(r.getString(0), r.getString(1));
@@ -403,12 +403,12 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
Set<String> set = new HashSet<>();
TimeTaken tt = trans.start("readNsBykey " + key, Env.REMOTE);
try {
- ResultSet rs = getSession(trans).execute("SELECT ns FROM "
- + TABLE_ATTRIB
+ ResultSet rs = getSession(trans).execute("SELECT ns FROM "
+ + TABLE_ATTRIB
+ " WHERE key='"
+ key
+ "';");
-
+
for (Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
Row r = iter.next();
set.add(r.getString(0));
@@ -431,7 +431,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
return Result.err(Result.ERR_Backend, CassAccess.ERR_ACCESS_MSG);
}
}
-
+
private StringBuilder attribInsertStmt(StringBuilder sb, String ns, String key, String value) {
sb.append("INSERT INTO ");
sb.append(TABLE_ATTRIB);
@@ -457,7 +457,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
sb.append("';");
return sb;
}
-
+
public Result<Void> attribRemove(AuthzTrans trans, String ns, String key) {
try {
@@ -468,7 +468,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
return Result.err(Result.ERR_Backend, CassAccess.ERR_ACCESS_MSG);
}
}
-
+
private StringBuilder attribDeleteStmt(StringBuilder stmt, String ns, String key) {
stmt.append("DELETE FROM ");
stmt.append(TABLE_ATTRIB);
@@ -479,7 +479,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
stmt.append("';");
return stmt;
}
-
+
private void attribDeleteAllStmt(StringBuilder stmt, Data data) {
stmt.append(" DELETE FROM ");
stmt.append(TABLE_ATTRIB);
@@ -505,7 +505,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
*/
public Result<Void> addDescription(AuthzTrans trans, String ns, String description) {
try {
- getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ description.replace("'", "''") + "' WHERE name = '" + ns + "';");
} catch (DriverException | APIException | IOException e) {
reportPerhapsReset(trans,e);
@@ -521,11 +521,11 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public Result<List<Data>> getChildren(AuthzTrans trans, String parent) {
return psNS.read(trans, R_TEXT, new Object[]{parent});
}
-
+
/**
* Log Modification statements to History
- *
+ *
* @param modified which CRUD action was done
* @param data entity data that needs a log entry
* @param overrideMessage if this is specified, we use it rather than crafting a history message based on data
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java
index 2beeaf38..017c813a 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,7 +25,7 @@ public class NsSplit {
public final String ns;
public final String name;
public final NsDAO.Data nsd;
-
+
public NsSplit(NsDAO.Data nsd, String child) {
this.nsd = nsd;
if (child.startsWith(nsd.name)) {
@@ -41,7 +41,7 @@ public class NsSplit {
ns = null;
}
}
-
+
public NsSplit(String ns, String name) {
this.ns = ns;
this.name = name;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java
index e656a555..bc7aa227 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,19 +29,19 @@ package org.onap.aaf.auth.dao.cass;
public enum NsType {
UNKNOWN (-1),
DOT (0),
- ROOT (1),
- COMPANY (2),
- APP (3),
- STACKED_APP (10),
+ ROOT (1),
+ COMPANY (2),
+ APP (3),
+ STACKED_APP (10),
STACK (11);
-
+
public final int type;
private NsType(int t) {
type = t;
}
/**
* This is not the Ordinal, but the Type that is stored in NS Tables
- *
+ *
* @param t
* @return
*/
@@ -53,7 +53,7 @@ public enum NsType {
}
return UNKNOWN;
}
-
+
/**
* Use this one rather than "valueOf" to avoid Exception
* @param s
@@ -70,5 +70,5 @@ public enum NsType {
return UNKNOWN;
}
-
+
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java
index 5d0f084b..a84490d0 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,19 +44,19 @@ import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Row;
/**
- * CredDAO manages credentials.
+ * CredDAO manages credentials.
* @author Jonathan
* Date: 7/19/13
*/
public class OAuthTokenDAO extends CassDAOImpl<AuthzTrans,OAuthTokenDAO.Data> {
public static final String TABLE = "oauth_token";
private AbsCassDAO<AuthzTrans, Data>.PSInfo psByUser;
-
+
public OAuthTokenDAO(AuthzTrans trans, Cluster cluster, String keyspace) {
super(trans, OAuthTokenDAO.class.getSimpleName(),cluster, keyspace, Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
init(trans);
}
-
+
public OAuthTokenDAO(AuthzTrans trans, AbsCassDAO<AuthzTrans,?> aDao) {
super(trans, OAuthTokenDAO.class.getSimpleName(),aDao, Data.class, TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
init(trans);
@@ -73,7 +73,7 @@ public class OAuthTokenDAO extends CassDAOImpl<AuthzTrans,OAuthTokenDAO.Data> {
public String refresh;
public Date expires;
public long exp_sec;
- public String content;
+ public String content;
public Set<String> scopes;
public String state;
public String req_ip; // requesting
@@ -93,7 +93,7 @@ public class OAuthTokenDAO extends CassDAOImpl<AuthzTrans,OAuthTokenDAO.Data> {
OAuthLoader.deflt.marshal(this,new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
OAuthLoader.deflt.unmarshal(this, toDIS(bb));
@@ -107,13 +107,13 @@ public class OAuthTokenDAO extends CassDAOImpl<AuthzTrans,OAuthTokenDAO.Data> {
private static class OAuthLoader extends Loader<Data> implements Streamer<Data>{
public static final int MAGIC=235677843;
public static final int VERSION=1;
- public static final int BUFF_SIZE=96; // Note: only used when
-
+ public static final int BUFF_SIZE=96; // Note: only used when
+
public static final OAuthLoader deflt = new OAuthLoader(KEYLIMIT);
public OAuthLoader(int keylimit) {
super(keylimit);
}
-
+
@Override
public Data load(Data data, Row row) {
data.id = row.getString(0);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
index 699d6e28..a59682c4 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -53,10 +53,10 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
public static final int CACHE_SEG = 0x40; // yields segment 0x0-0x3F
private static final String STAR = "*";
-
+
private final HistoryDAO historyDAO;
private final CacheInfoDAO infoDAO;
-
+
private PSInfo psNS, psChildren, psByType;
public PermDAO(AuthzTrans trans, Cluster cluster, String keyspace) throws APIException, IOException {
@@ -80,11 +80,11 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
public String type;
public String instance;
public String action;
- public Set<String> roles;
+ public Set<String> roles;
public String description;
public Data() {}
-
+
public Data(NsSplit nss, String instance, String action) {
ns = nss.ns;
type = nss.name;
@@ -103,7 +103,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
sb.append(type);
return sb.toString();
}
-
+
public String fullPerm() {
StringBuilder sb = new StringBuilder();
if(ns==null) {
@@ -123,10 +123,10 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
public String encode() {
return ns + '|' + type + '|' + instance + '|' + action;
}
-
+
/**
* Decode Perm String, including breaking into appropriate Namespace
- *
+ *
* @param trans
* @param q
* @param p
@@ -158,7 +158,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
/**
* Decode Perm String, including breaking into appropriate Namespace
- *
+ *
* @param trans
* @param q
* @param p
@@ -169,7 +169,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
if (ss[2]==null) {
return Result.err(Status.ERR_BadData,"Perm Encodings must be separated by '|'");
}
-
+
if (ss[3]==null) { // older 3 part encoding must be evaluated for NS
ss[3] = ss[2];
ss[2] = ss[1];
@@ -206,7 +206,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
}
return rv;
}
-
+
public static Data create(AuthzTrans trans, Question q, String name) {
String[] s = name.split("\\|");
Result<NsSplit> rdns = q.deriveNsSplit(trans, s[0]);
@@ -240,7 +240,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
}
return rv;
}
-
+
////////////////////////////////////////
// Getters
public Set<String> roles(boolean mutable) {
@@ -268,7 +268,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
PermLoader.deflt.marshal(this, new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
PermLoader.deflt.unmarshal(this, toDIS(bb));
@@ -279,18 +279,18 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
return encode();
}
}
-
+
private static class PermLoader extends Loader<Data> implements Streamer<Data> {
public static final int MAGIC=283939453;
public static final int VERSION=1;
public static final int BUFF_SIZE=96;
public static final PermLoader deflt = new PermLoader(KEYLIMIT);
-
+
public PermLoader(int keylimit) {
super(keylimit);
}
-
+
@Override
public Data load(Data data, Row row) {
// Int more efficient Match "fields" string
@@ -343,25 +343,25 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
data.description = readString(is,buff);
}
}
-
+
private void init(AuthzTrans trans) {
// the 3 is the number of key fields
String[] helpers = setCRUD(trans, TABLE, Data.class, PermLoader.deflt);
-
+
// Other SELECT style statements... match with a local Method
- psByType = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
+ psByType = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE ns = ? AND type = ?", new PermLoader(2) {
@Override
protected void key(Data data, int idx, Object[] obj) {
obj[idx]=data.type;
}
},readConsistency);
-
+
psNS = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE ns = ?", new PermLoader(1),readConsistency);
-
- psChildren = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
- " WHERE ns=? AND type > ? AND type < ?",
+
+ psChildren = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
+ " WHERE ns=? AND type > ? AND type < ?",
new PermLoader(3) {
@Override
protected void key(Data data, int _idx, Object[] obj) {
@@ -377,7 +377,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
/**
* Add a single Permission to the Role's Permission Collection
- *
+ *
* @param trans
* @param roleFullName
* @param perm
@@ -438,11 +438,11 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
}
-
+
/**
- * Additional method:
+ * Additional method:
* Select all Permissions by Name
- *
+ *
* @param name
* @return
* @throws DAOException
@@ -450,7 +450,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
public Result<List<Data>> readByType(AuthzTrans trans, String ns, String type) {
return psByType.read(trans, R_TEXT, new Object[]{ns, type});
}
-
+
public Result<List<Data>> readChildren(AuthzTrans trans, String ns, String type) {
return psChildren.read(trans, R_TEXT, new Object[]{ns, type+DOT, type + DOT_PLUS_ONE});
}
@@ -461,7 +461,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
/**
* Add description to this permission
- *
+ *
* @param trans
* @param ns
* @param type
@@ -473,7 +473,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
public Result<Void> addDescription(AuthzTrans trans, String ns, String type,
String instance, String action, String description) {
try {
- getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ description + "' WHERE ns = '" + ns + "' AND type = '" + type + "'"
+ "AND instance = '" + instance + "' AND action = '" + action + "';");
} catch (DriverException | APIException | IOException e) {
@@ -486,11 +486,11 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
data.type=type;
data.instance=instance;
data.action=action;
- wasModified(trans, CRUD.update, data, "Added description " + description + " to permission "
+ wasModified(trans, CRUD.update, data, "Added description " + description + " to permission "
+ data.encode(), null );
return Result.ok();
}
-
+
/**
* Log Modification statements to History
*/
@@ -510,7 +510,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
} else {
hd.memo = String.format("%sd %s|%s|%s", modified.name(),data.fullType(),data.instance,data.action);
}
-
+
if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
@@ -518,7 +518,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
trans.error().log(e,"Could not serialize PermDAO.Data");
}
}
-
+
if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
index e5c97559..ae8d525d 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,7 +50,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
public static final String TABLE = "role";
public static final int CACHE_SEG = 0x40; // yields segment 0x0-0x3F
-
+
private final HistoryDAO historyDAO;
private final CacheInfoDAO infoDAO;
@@ -96,34 +96,34 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
}
return perms;
}
-
+
public static Data create(NsDAO.Data ns, String name) {
- NsSplit nss = new NsSplit(ns,name);
+ NsSplit nss = new NsSplit(ns,name);
RoleDAO.Data rv = new Data();
rv.ns = nss.ns;
rv.name=nss.name;
return rv;
}
-
+
public String fullName() {
StringBuilder sb = new StringBuilder();
if(ns==null) {
sb.append('.');
} else {
sb.append(ns);
- sb.append(ns.indexOf('@')<0?'.':':');
+ sb.append(ns.indexOf('@')<0?'.':':');
}
sb.append(name);
return sb.toString();
}
-
+
public String encode() {
return ns + '|' + name;
}
-
+
/**
* Decode Perm String, including breaking into appropriate Namespace
- *
+ *
* @param trans
* @param q
* @param r
@@ -171,7 +171,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
/**
* Decode Perm String, including breaking into appropriate Namespace
- *
+ *
* @param trans
* @param q
* @param p
@@ -189,7 +189,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
}
return Result.ok(ss);
}
-
+
@Override
public int[] invalidate(Cached<?,?> cache) {
return new int[] {
@@ -205,7 +205,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
RoleLoader.deflt.marshal(this,new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
RoleLoader.deflt.unmarshal(this, toDIS(bb));
@@ -223,11 +223,11 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
public static final int BUFF_SIZE=96;
public static final RoleLoader deflt = new RoleLoader(KEYLIMIT);
-
+
public RoleLoader(int keylimit) {
super(keylimit);
}
-
+
@Override
public Data load(Data data, Row row) {
// Int more efficient
@@ -275,15 +275,15 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
private void init(AuthzTrans trans) {
String[] helpers = setCRUD(trans, TABLE, Data.class, RoleLoader.deflt);
-
+
psNS = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE ns = ?", new RoleLoader(1),readConsistency);
psName = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
" WHERE name = ?", new RoleLoader(1),readConsistency);
- psChildren = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
- " WHERE ns=? AND name > ? AND name < ?",
+ psChildren = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM " + TABLE +
+ " WHERE ns=? AND name > ? AND name < ?",
new RoleLoader(3) {
@Override
protected void key(Data data, int _idx, Object[] obj) {
@@ -293,7 +293,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
obj[++idx]=data.name + DOT_PLUS_ONE;
}
},readConsistency);
-
+
}
public Result<List<Data>> readNS(AuthzTrans trans, String ns) {
@@ -306,7 +306,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
public Result<List<Data>> readChildren(AuthzTrans trans, String ns, String role) {
if (role.length()==0 || "*".equals(role)) {
- return psChildren.read(trans, R_TEXT, new Object[]{ns, FIRST_CHAR, LAST_CHAR});
+ return psChildren.read(trans, R_TEXT, new Object[]{ns, FIRST_CHAR, LAST_CHAR});
} else {
return psChildren.read(trans, R_TEXT, new Object[]{ns, role+DOT, role+DOT_PLUS_ONE});
}
@@ -314,7 +314,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
/**
* Add a single Permission to the Role's Permission Collection
- *
+ *
* @param trans
* @param role
* @param perm
@@ -326,7 +326,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
// Note: Prepared Statements for Collection updates aren't supported
String pencode = perm.encode();
try {
- getSession(trans).execute(UPDATE_SP + TABLE + " SET perms = perms + {'" +
+ getSession(trans).execute(UPDATE_SP + TABLE + " SET perms = perms + {'" +
pencode + "'} WHERE " +
"ns = '" + role.ns + "' AND name = '" + role.name + "';");
} catch (DriverException | APIException | IOException e) {
@@ -351,10 +351,10 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
// Note: Prepared Statements for Collection updates aren't supported
String pencode = perm.encode();
-
+
//ResultSet rv =
try {
- getSession(trans).execute(UPDATE_SP + TABLE + " SET perms = perms - {'" +
+ getSession(trans).execute(UPDATE_SP + TABLE + " SET perms = perms - {'" +
pencode + "'} WHERE " +
"ns = '" + role.ns + "' AND name = '" + role.name + "';");
} catch (DriverException | APIException | IOException e) {
@@ -366,10 +366,10 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
wasModified(trans, CRUD.update, role, "Removed permission " + pencode + " from role " + role.fullName() );
return Result.ok();
}
-
+
/**
* Add description to role
- *
+ *
* @param trans
* @param ns
* @param name
@@ -378,7 +378,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
*/
public Result<Void> addDescription(AuthzTrans trans, String ns, String name, String description) {
try {
- getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ getSession(trans).execute(UPDATE_SP + TABLE + " SET description = '"
+ description + "' WHERE ns = '" + ns + "' AND name = '" + name + "';");
} catch (DriverException | APIException | IOException e) {
reportPerhapsReset(trans,e);
@@ -391,8 +391,8 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
wasModified(trans, CRUD.update, data, "Added description " + description + " to role " + data.fullName(), null );
return Result.ok();
}
-
-
+
+
/**
* Log Modification statements to History
* @param modified which CRUD action was done
@@ -426,5 +426,5 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
}
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Status.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Status.java
index a4d0bf4d..3a05eb31 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Status.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Status.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,7 +28,7 @@ import org.onap.aaf.auth.layer.Result;
/**
* Add additional Behavior for Specific Applications for Results
- *
+ *
* In this case, we add additional BitField information accessible by
* method (
* @author Jonathan
@@ -36,11 +36,11 @@ import org.onap.aaf.auth.layer.Result;
* @param <RV>
*/
public class Status<RV> extends Result<RV> {
-
+
// Jonathan 10/1/2013: Initially, I used enum, but it's not extensible.
public final static int ERR_NsNotFound = Result.ERR_General+1,
ERR_RoleNotFound = Result.ERR_General+2,
- ERR_PermissionNotFound = Result.ERR_General+3,
+ ERR_PermissionNotFound = Result.ERR_General+3,
ERR_UserNotFound = Result.ERR_General+4,
ERR_UserRoleNotFound = Result.ERR_General+5,
ERR_DelegateNotFound = Result.ERR_General+6,
@@ -51,9 +51,9 @@ public class Status<RV> extends Result<RV> {
ACC_Future = Result.ERR_General+11,
ERR_ChoiceNeeded = Result.ERR_General+12,
ERR_FutureNotRequested = Result.ERR_General+13;
-
+
/**
- * Constructor for Result set.
+ * Constructor for Result set.
* @param data
* @param status
*/
@@ -66,7 +66,7 @@ public class Status<RV> extends Result<RV> {
case OK: return "OK";
case ERR_NsNotFound: return "ERR_NsNotFound";
case ERR_RoleNotFound: return "ERR_RoleNotFound";
- case ERR_PermissionNotFound: return "ERR_PermissionNotFound";
+ case ERR_PermissionNotFound: return "ERR_PermissionNotFound";
case ERR_UserNotFound: return "ERR_UserNotFound";
case ERR_UserRoleNotFound: return "ERR_UserRoleNotFound";
case ERR_DelegateNotFound: return "ERR_DelegateNotFound";
@@ -81,8 +81,8 @@ public class Status<RV> extends Result<RV> {
case ERR_NotFound: return "ERR_NotFound";
case ERR_ChoiceNeeded: return "ERR_ChoiceNeeded";
}
- //case ERR_General: or unknown...
+ //case ERR_General: or unknown...
return "ERR_General";
}
-
+
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java
index b6cbcf82..813f55ac 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,15 +47,15 @@ import com.datastax.driver.core.Row;
public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
public static final String TABLE = "user_role";
-
+
public static final int CACHE_SEG = 0x40; // yields segment 0x0-0x3F
private static final String TRANS_UR_SLOT = "_TRANS_UR_SLOT_";
public Slot transURSlot;
-
+
private final HistoryDAO historyDAO;
private final CacheInfoDAO infoDAO;
-
+
private PSInfo psByUser, psByRole, psUserInRole;
@@ -82,10 +82,10 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
public static class Data extends CacheableData implements Bytification {
public String user;
public String role;
- public String ns;
- public String rname;
+ public String ns;
+ public String rname;
public Date expires;
-
+
@Override
public int[] invalidate(Cached<?,?> cache) {
// Note: I'm not worried about Name collisions, because the formats are different:
@@ -105,7 +105,7 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
URLoader.deflt.marshal(this,new DataOutputStream(baos));
return ByteBuffer.wrap(baos.toByteArray());
}
-
+
@Override
public void reconstitute(ByteBuffer bb) throws IOException {
URLoader.deflt.unmarshal(this, toDIS(bb));
@@ -116,14 +116,14 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
this.rname = rname;
this.role = ns + '.' + rname;
}
-
+
public void role(RoleDAO.Data rdd) {
ns = rdd.ns;
rname = rdd.name;
role = rdd.fullName();
}
-
+
public boolean role(AuthzTrans trans, Question ques, String role) {
this.role = role;
Result<NsSplit> rnss = ques.deriveNsSplit(trans, role);
@@ -141,12 +141,12 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
return user + '|' + ns + '|' + rname + '|' + Chrono.dateStamp(expires);
}
}
-
+
private static class URLoader extends Loader<Data> implements Streamer<Data> {
public static final int MAGIC=738469903;
public static final int VERSION=1;
public static final int BUFF_SIZE=48;
-
+
public static final URLoader deflt = new URLoader(KEYLIMIT);
public URLoader(int keylimit) {
@@ -177,7 +177,7 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
obj[++idx]=data.rname;
obj[++idx]=data.expires;
}
-
+
@Override
public void marshal(Data data, DataOutputStream os) throws IOException {
writeHeader(os,MAGIC,VERSION);
@@ -193,7 +193,7 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
public void unmarshal(Data data, DataInputStream is) throws IOException {
/*int version = */readHeader(is,MAGIC,VERSION);
// If Version Changes between Production runs, you'll need to do a switch Statement, and adequately read in fields
-
+
byte[] buff = new byte[BUFF_SIZE];
data.user = readString(is,buff);
data.role = readString(is,buff);
@@ -204,27 +204,27 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
}
};
-
+
private void init(AuthzTrans trans) {
String[] helper = setCRUD(trans, TABLE, Data.class, URLoader.deflt);
-
- psByUser = new PSInfo(trans, SELECT_SP + helper[FIELD_COMMAS] + " FROM user_role WHERE user = ?",
+
+ psByUser = new PSInfo(trans, SELECT_SP + helper[FIELD_COMMAS] + " FROM user_role WHERE user = ?",
new URLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
obj[idx]=data.user;
}
},readConsistency);
-
+
// Note: We understand this call may have poor performance, so only should be used in Management (Delete) func
- psByRole = new PSInfo(trans, SELECT_SP + helper[FIELD_COMMAS] + " FROM user_role WHERE role = ? ALLOW FILTERING",
+ psByRole = new PSInfo(trans, SELECT_SP + helper[FIELD_COMMAS] + " FROM user_role WHERE role = ? ALLOW FILTERING",
new URLoader(1) {
@Override
protected void key(Data data, int idx, Object[] obj) {
obj[idx]=data.role;
}
},readConsistency);
-
+
psUserInRole = new PSInfo(trans,SELECT_SP + helper[FIELD_COMMAS] + " FROM user_role WHERE user = ? AND role = ?",
URLoader.deflt,readConsistency);
}
@@ -243,7 +243,7 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
public Result<List<Data>> readByRole(AuthzTrans trans, String role) {
return psByRole.read(trans, R_TEXT + " by Role " + role, new Object[]{role});
}
-
+
/**
* Direct Lookup of User Role
* Don't forget to check for Expiration
@@ -266,7 +266,7 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
HistoryDAO.Data hd = HistoryDAO.newInitedData();
HistoryDAO.Data hdRole = HistoryDAO.newInitedData();
-
+
hd.user = hdRole.user = trans.user();
hd.action = modified.name();
// Modifying User/Role is an Update to Role, not a Create. Jonathan, 07-14-2015
@@ -276,17 +276,17 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
hd.subject = subject?override[1] : (data.user + '|'+data.role);
hdRole.subject = data.role;
switch(modified) {
- case create:
+ case create:
hd.memo = hdRole.memo = memo
? String.format("%s by %s", override[0], hd.user)
- : String.format("%s added to %s",data.user,data.role);
+ : String.format("%s added to %s",data.user,data.role);
break;
- case update:
+ case update:
hd.memo = hdRole.memo = memo
? String.format("%s by %s", override[0], hd.user)
: String.format("%s - %s was updated",data.user,data.role);
break;
- case delete:
+ case delete:
hd.memo = hdRole.memo = memo
? String.format("%s by %s", override[0], hd.user)
: String.format("%s removed from %s",data.user,data.role);
@@ -305,7 +305,7 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
-
+
if (historyDAO.create(trans, hdRole).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java
index a92de21c..27a18821 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
index dd367c51..d8096188 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
@@ -7,9 +7,9 @@
* 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.
@@ -64,17 +64,17 @@ public class Function {
public enum FUTURE_OP {
C("Create"),U("Update"),D("Delete"),G("Grant"),UG("UnGrant"),A("Approval");
-
+
private String desc;
-
+
private FUTURE_OP(String desc) {
this.desc = desc;
}
-
+
public String desc() {
return desc;
}
-
+
/**
* Same as valueOf(), but passes back null instead of throwing Exception
* @param value
@@ -94,7 +94,7 @@ public class Function {
public enum OP_STATUS {
E("Executed"),D("Denied"),P("Pending"),L("Lapsed");
-
+
private String desc;
public final static Result<OP_STATUS> RE = Result.ok(OP_STATUS.E);
public final static Result<OP_STATUS> RD = Result.ok(OP_STATUS.D);
@@ -104,11 +104,11 @@ public class Function {
private OP_STATUS(String desc) {
this.desc = desc;
}
-
+
public String desc() {
return desc;
}
-
+
}
public static final String FOP_CRED = "cred";
@@ -159,16 +159,16 @@ public class Function {
/**
* createNS
- *
+ *
* Create Namespace
- *
+ *
* @param trans
* @param org
* @param ns
* @param user
* @return
* @throws DAOException
- *
+ *
* To create an NS, you need to: 1) validate permission to
* modify parent NS 2) Does NS exist already? 3) Create NS with
* a) "user" as owner. NOTE: Per 10-15 request for AAF 1.0 4)
@@ -185,7 +185,7 @@ public class Function {
Identity orgUser = org.getIdentity(trans, u);
String reason;
if (orgUser == null) {
- return Result.err(Status.ERR_Policy,"%s is not a valid user at %s",u,org.getName());
+ return Result.err(Status.ERR_Policy,"%s is not a valid user at %s",u,org.getName());
} else if ((reason=orgUser.mayOwn())!=null) {
if (org.isTestEnv()) {
String reason2;
@@ -242,7 +242,7 @@ public class Function {
return Result.err(Status.ERR_ConflictAlreadyExists,
"Target Namespace already exists");
}
-
+
// 2.1) Does role exist with that name
if(cname!=null && q.roleDAO().read(trans, parent, cname).isOKhasData()) {
return Result.err(Status.ERR_ConflictAlreadyExists,
@@ -347,7 +347,7 @@ public class Function {
trans.error().log(rpdd.errorString());
}
}
-
+
// Save off Old keys
String delP1 = rdd.ns;
String delP2 = rdd.name;
@@ -356,7 +356,7 @@ public class Function {
rdd.ns = namespace.name;
rdd.name = (delP2.length() > targetNameDot) ? delP2
.substring(targetNameDot) : "";
-
+
// Need to use non-cached, because switching namespaces, not
// "create" per se
if ((rq = q.roleDAO().create(trans, rdd)).isOK()) {
@@ -364,7 +364,7 @@ public class Function {
for (PermDAO.Data pdd : lpdd) {
q.permDAO().addRole(trans, pdd, rdd);
}
- // Change data for User Roles
+ // Change data for User Roles
Result<List<UserRoleDAO.Data>> rurd = q.userRoleDAO().readByRole(trans, rdd.fullName());
if (rurd.isOKhasData()) {
for (UserRoleDAO.Data urd : rurd.value) {
@@ -391,7 +391,7 @@ public class Function {
for (PermDAO.Data pdd : rpdc.value) {
// Remove old Perm from Roles, save them off
List<RoleDAO.Data> lrdd = new ArrayList<>();
-
+
for (String rl : pdd.roles(false)) {
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,q,rl);
if (rrdd.isOKhasData()) {
@@ -402,7 +402,7 @@ public class Function {
trans.error().log(rrdd.errorString());
}
}
-
+
// Save off Old keys
String delP1 = pdd.ns;
String delP2 = pdd.type;
@@ -481,9 +481,9 @@ public class Function {
/**
* deleteNS
- *
+ *
* Delete Namespace
- *
+ *
* @param trans
* @param org
* @param ns
@@ -491,8 +491,8 @@ public class Function {
* @param user
* @return
* @throws DAOException
- *
- *
+ *
+ *
* To delete an NS, you need to: 1) validate permission to
* modify this NS 2) Find all Roles with this NS, and 2a) if
* Force, delete them, else modify to Parent NS 3) Find all
@@ -723,7 +723,7 @@ public class Function {
if (rq.notOK()) {
return Result.err(rq);
}
-
+
rq = q.mayUser(trans, trans.user(), rq.value, Access.write);
if (rq.notOK()) {
Result<List<UserRoleDAO.Data>> ruinr = q.userRoleDAO().readUserInRole(trans, trans.user(),ns+".owner");
@@ -757,7 +757,7 @@ public class Function {
return Result.err(Status.ERR_Security,
"%s is not a valid AAF Credential", user);
}
-
+
for (CredDAO.Data cd : cdr.value) {
if (cd.expires.after(now)) {
return Result.ok();
@@ -792,7 +792,7 @@ public class Function {
}
rq = q.mayUser(trans, trans.user(), rq.value, Access.write);
- if (rq.notOK()) {
+ if (rq.notOK()) {
// Even though not a "writer", Owners still determine who gets to be an Admin
Result<List<UserRoleDAO.Data>> ruinr = q.userRoleDAO().readUserInRole(trans, trans.user(),ns+".owner");
if (!(ruinr.isOKhasData() && ruinr.value.get(0).expires.after(new Date()))) {
@@ -806,7 +806,7 @@ public class Function {
/**
* Helper function that moves permissions from a namespace being deleted to
* its parent namespace
- *
+ *
* @param trans
* @param parent
* @param sb
@@ -827,7 +827,7 @@ public class Function {
}
// Remove old Perm from Roles, save them off
List<RoleDAO.Data> lrdd = new ArrayList<>();
-
+
for (String rl : pdd.roles(false)) {
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,q,rl);
if (rrdd.isOKhasData()) {
@@ -838,7 +838,7 @@ public class Function {
trans.error().log(rrdd.errorString());
}
}
-
+
// Save off Old keys
String delP1 = pdd.ns;
NsSplit nss = new NsSplit(parent, pdd.fullType());
@@ -872,7 +872,7 @@ public class Function {
/**
* Helper function that moves roles from a namespace being deleted to its
* parent namespace
- *
+ *
* @param trans
* @param parent
* @param sb
@@ -903,7 +903,7 @@ public class Function {
trans.error().log(rpdd.errorString());
}
}
-
+
// Save off Old keys
String delP1 = rdd.ns;
@@ -938,9 +938,9 @@ public class Function {
/**
* Create Permission (and any missing Permission between this and Parent) if
* we have permission
- *
+ *
* Pass in the desired Management Permission for this Permission
- *
+ *
* If Force is set, then Roles listed will be created, if allowed,
* pre-granted.
*/
@@ -1008,7 +1008,7 @@ public class Function {
Result<PermDAO.Data> pdr = q.permDAO().create(trans, perm);
if (pdr.isOK()) {
return Result.ok();
- } else {
+ } else {
return Result.err(pdr);
}
}
@@ -1118,10 +1118,10 @@ public class Function {
/**
* Only owner of Permission may add to Role
- *
+ *
* If force set, however, Role will be created before Grant, if User is
* allowed to create.
- *
+ *
* @param trans
* @param role
* @param pd
@@ -1129,7 +1129,7 @@ public class Function {
*/
public Result<Void> addPermToRole(AuthzTrans trans, RoleDAO.Data role,PermDAO.Data pd, boolean fromApproval) {
String user = trans.user();
-
+
if (!fromApproval) {
Result<NsDAO.Data> rRoleCo = q.deriveFirstNsForType(trans, role.ns, NsType.COMPANY);
if (rRoleCo.notOK()) {
@@ -1148,14 +1148,14 @@ public class Function {
return Result.err(r);
}
}
-
+
// Must be Perm Admin, or Granted Special Permission
Result<NsDAO.Data> ucp = q.mayUser(trans, user, pd, Access.write);
if (ucp.notOK()) {
// Don't allow CLI potential Grantees to change their own AAF
// Perms,
- if ((ROOT_NS.equals(pd.ns) && Question.NS.equals(pd.type))
+ if ((ROOT_NS.equals(pd.ns) && Question.NS.equals(pd.type))
|| !q.isGranted(trans, trans.user(),ROOT_NS,Question.PERM, rPermCo.value.name, "grant")) {
// Not otherwise granted
// TODO Needed?
@@ -1233,7 +1233,7 @@ public class Function {
/**
* Either Owner of Role or Permission may delete from Role
- *
+ *
* @param trans
* @param role
* @param pd
@@ -1332,10 +1332,10 @@ public class Function {
/**
* Add a User to Role
- *
+ *
* 1) Role must exist 2) User must be a known Credential (i.e. mechID ok if
* Credential) or known Organizational User
- *
+ *
* @param trans
* @param org
* @param urData
@@ -1352,9 +1352,9 @@ public class Function {
rv = checkValidID(trans, new Date(), urData.user);
}
if (rv.notOK()) {
- return rv;
+ return rv;
}
-
+
// Check if record exists
if (q.userRoleDAO().read(trans, urData).isOKhasData()) {
return Result.err(Status.ERR_ConflictAlreadyExists,
@@ -1366,8 +1366,8 @@ public class Function {
}
urData.expires = trans.org().expiration(null, Expiration.UserInRole, urData.user).getTime();
-
-
+
+
Result<UserRoleDAO.Data> udr = q.userRoleDAO().create(trans, urData);
if (udr.status == OK) {
return Result.ok();
@@ -1392,9 +1392,9 @@ public class Function {
/**
* Extend User Role.
- *
+ *
* extend the Expiration data, according to Organization rules.
- *
+ *
* @param trans
* @param org
* @param urData
@@ -1406,7 +1406,7 @@ public class Function {
return Result.err(Status.ERR_UserRoleNotFound,
"User Role does not exist");
}
-
+
if (q.roleDAO().read(trans, urData.ns, urData.rname).notOKorIsEmpty()) {
return Result.err(Status.ERR_RoleNotFound,
"Role [%s.%s] does not exist", urData.ns,urData.rname);
@@ -1485,13 +1485,13 @@ public class Function {
}
}
}
-
+
if (owners.isEmpty()) {
return Result.err(Result.ERR_NotFound,"No Owners found for " + nsd.name);
}
-
+
// Create Future Object
-
+
Result<FutureDAO.Data> fr = q.futureDAO().create(trans, data, id);
if (fr.isOK()) {
sb.append("Created Future: ");
@@ -1518,7 +1518,7 @@ public class Function {
} catch (Exception e) {
return Result.err(e);
}
-
+
return Result.ok(sb.toString());
}
@@ -1528,7 +1528,7 @@ public class Function {
public interface Lookup<T> {
T get(AuthzTrans trans, Object ... keys);
}
-
+
public Lookup<UserRoleDAO.Data> urDBLookup = new Lookup<UserRoleDAO.Data>() {
@Override
public UserRoleDAO.Data get(AuthzTrans trans, Object ... keys) {
@@ -1542,11 +1542,11 @@ public class Function {
};
/**
- * Note: if "allApprovals for Ticket is null, it will be looked up.
+ * Note: if "allApprovals for Ticket is null, it will be looked up.
* if "fdd" is null, it will be looked up, but
- *
+ *
* They can be passed for performance reasons.
- *
+ *
* @param trans
* @param cd
* @param allApprovalsForTicket
@@ -1575,7 +1575,7 @@ public class Function {
return Result.err(Result.ERR_BadData,"Cannot reconstitute %1",curr.memo);
}
}
-
+
boolean aDenial = false;
int cntSuper=0, appSuper=0,cntOwner=0, appOwner=0;
for (ApprovalDAO.Data add : la.get(trans)) {
@@ -1603,7 +1603,7 @@ public class Function {
break;
}
}
-
+
Result<OP_STATUS> ros=null;
if (aDenial) {
ros = OP_STATUS.RD;
@@ -1624,7 +1624,7 @@ public class Function {
}
}
}
-
+
// Decision: If not Denied, and at least owner, if exists, and at least one Super, if exists
boolean goDecision = (cntOwner>0?appOwner>0:true) && (cntSuper>0?appSuper>0:true);
@@ -1720,7 +1720,7 @@ public class Function {
if (fop == FUTURE_OP.C) {
ros = set(OP_STATUS.RE, q.credDAO().dao().create(trans, data));
}
- }
+ }
} catch (Exception e) {
trans.error().log("Exception: ", e.getMessage(),
" \n occurred while performing", curr.memo,
@@ -1732,7 +1732,7 @@ public class Function {
//return Result.err(Status.ACC_Future, "Full Approvals not obtained: No action taken");
ros = OP_STATUS.RP;
}
-
+
return ros;
}
@@ -1745,7 +1745,7 @@ public class Function {
}
}
- private Result<ApprovalDAO.Data> addIdentity(AuthzTrans trans, StringBuilder sb,
+ private Result<ApprovalDAO.Data> addIdentity(AuthzTrans trans, StringBuilder sb,
Boolean[] first, String user, String memo, FUTURE_OP op, Identity u, UUID ticket, String type) throws OrganizationException {
ApprovalDAO.Data ad = new ApprovalDAO.Data();
// Note ad.id is set by ApprovalDAO Create
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
index 3f0e92e7..5a27e5ec 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,9 +38,9 @@ import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.layer.Result;
/**
- * PermLookup is a Storage class for the various pieces of looking up Permission
+ * PermLookup is a Storage class for the various pieces of looking up Permission
* during Transactions to avoid duplicate processing
- *
+ *
* @author Jonathan
*
*/
@@ -53,9 +53,9 @@ public class PermLookup {
private Result<List<RoleDAO.Data>> roles = null;
private Result<Set<String>> permNames = null;
private Result<List<PermDAO.Data>> perms = null;
-
+
private PermLookup() {}
-
+
public static PermLookup get(AuthzTrans trans, Question q, String user) {
PermLookup lp=null;
Map<String, PermLookup> permMap = trans.get(Question.PERMS, null);
@@ -74,7 +74,7 @@ public class PermLookup {
}
return lp;
}
-
+
public Result<List<UserRoleDAO.Data>> getUserRoles() {
if (userRoles==null) {
userRoles = q.userRoleDAO().readByUser(trans,user);
@@ -143,7 +143,7 @@ public class PermLookup {
return permNames;
}
}
-
+
public Result<List<PermDAO.Data>> getPerms(boolean lookup) {
if (perms==null) {
// Note: It should be ok for a Valid user to have no permissions -
@@ -156,7 +156,7 @@ public class PermLookup {
Map<String,PermDAO.Data> mspdd = new TreeMap<>();
Result<String[]> ap = PermDAO.Data.decodeToArray(trans, q, perm);
if (ap.isOK()) {
-
+
Result<List<PermDAO.Data>> rlpd = q.permDAO().read(perm,trans,ap.value);
if (rlpd.isOKhasData()) {
for (PermDAO.Data pData : rlpd.value) {
@@ -174,7 +174,7 @@ public class PermLookup {
pdd.description = pData.description;
lpdd.add(pdd);
}
- pdd.roles(true).add(pdr);
+ pdd.roles(true).add(pdr);
break;
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
index c7ee5938..1809686a 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
@@ -7,9 +7,9 @@
* 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.
@@ -81,9 +81,9 @@ import com.datastax.driver.core.Cluster;
/**
* Question HL DAO
- *
+ *
* A Data Access Combination Object which asks Security and other Questions
- *
+ *
* @author Jonathan
*
*/
@@ -135,57 +135,57 @@ public class Question {
public HistoryDAO historyDAO() {
return historyDAO;
}
-
+
private final CachedNSDAO nsDAO;
public CachedNSDAO nsDAO() {
return nsDAO;
}
-
+
private final CachedRoleDAO roleDAO;
public CachedRoleDAO roleDAO() {
return roleDAO;
}
-
+
private final CachedPermDAO permDAO;
public CachedPermDAO permDAO() {
return permDAO;
}
-
+
private final CachedUserRoleDAO userRoleDAO;
public CachedUserRoleDAO userRoleDAO() {
return userRoleDAO;
}
-
+
private final CachedCredDAO credDAO;
public CachedCredDAO credDAO() {
return credDAO;
}
-
+
private final CachedCertDAO certDAO;
public CachedCertDAO certDAO() {
return certDAO;
}
-
+
private final DelegateDAO delegateDAO;
public DelegateDAO delegateDAO() {
return delegateDAO;
}
-
+
private final FutureDAO futureDAO;
public FutureDAO futureDAO() {
return futureDAO;
}
-
+
private final ApprovalDAO approvalDAO;
public ApprovalDAO approvalDAO() {
return approvalDAO;
}
-
+
public final LocateDAO locateDAO;
public LocateDAO locateDAO() {
return locateDAO;
}
-
+
private final CacheInfoDAO cacheInfoDAO;
private final int cldays;
private final boolean alwaysSpecial;
@@ -216,18 +216,18 @@ public class Question {
if (specialLogSlot==null) {
specialLogSlot = trans.slot(AuthzTransFilter.SPECIAL_LOG_SLOT);
}
-
+
if (transIDSlot==null) {
transIDSlot = trans.slot(AuthzTransFilter.TRANS_ID_SLOT);
}
-
+
AbsCassDAO.primePSIs(trans);
-
+
cldays = Integer.parseInt(trans.getProperty(Config.AAF_CRED_WARN_DAYS, Config.AAF_CRED_WARN_DAYS_DFT));
-
+
alwaysSpecial = Boolean.parseBoolean(trans.getProperty("aaf_always_special", Boolean.FALSE.toString()));
}
-
+
/**
* Note: This Constructor created for JUNIT Purposes. Do not use otherwise.
*/
@@ -259,7 +259,7 @@ public class Question {
CachedDAO.startCleansing(env, credDAO, userRoleDAO);
CachedDAO.startRefresh(env, cacheInfoDAO);
}
-
+
public void close(AuthzTrans trans) {
historyDAO.close(trans);
cacheInfoDAO.close(trans);
@@ -283,7 +283,7 @@ public class Question {
pdd.type = type.substring(colon+1);
pdd.instance = instance;
pdd.action = action;
-
+
return Result.ok(pdd);
} else {
return Result.err(Result.ERR_BadData,"Could not extract ns and type from " + type);
@@ -301,10 +301,10 @@ public class Question {
/**
* getPermsByUser
- *
+ *
* Because this call is frequently called internally, AND because we already
* look for it in the initial Call, we cache within the Transaction
- *
+ *
* @param trans
* @param user
* @return
@@ -312,26 +312,26 @@ public class Question {
public Result<List<PermDAO.Data>> getPermsByUser(AuthzTrans trans, String user, boolean lookup) {
return PermLookup.get(trans, this, user).getPerms(lookup);
}
-
+
public Result<List<PermDAO.Data>> getPermsByUserFromRolesFilter(AuthzTrans trans, String user, String forUser) {
PermLookup plUser = PermLookup.get(trans, this, user);
Result<Set<String>> plPermNames = plUser.getPermNames();
if (plPermNames.notOK()) {
return Result.err(plPermNames);
}
-
+
Set<String> nss;
if (forUser.equals(user)) {
nss = null;
} else {
- // Setup a TreeSet to check on Namespaces to
+ // Setup a TreeSet to check on Namespaces to
nss = new TreeSet<>();
PermLookup fUser = PermLookup.get(trans, this, forUser);
Result<Set<String>> forUpn = fUser.getPermNames();
if (forUpn.notOK()) {
return Result.err(forUpn);
}
-
+
for (String pn : forUpn.value) {
Result<String[]> decoded = PermDAO.Data.decodeToArray(trans, this, pn);
if (decoded.isOKhasData()) {
@@ -356,7 +356,7 @@ public class Question {
trans.error().log(pn,", derived from a Role, is invalid. Run Data Cleanup:",rpdd.errorString());
}
}
- return Result.ok(rlpUser);
+ return Result.ok(rlpUser);
}
public Result<List<PermDAO.Data>> getPermsByType(AuthzTrans trans, String type) {
@@ -389,7 +389,7 @@ public class Question {
if (nss.notOK()) {
return Result.err(nss);
}
-
+
return permDAO.read(trans, nss.value.ns, nss.value.name, instance,action);
}
}
@@ -462,22 +462,22 @@ public class Question {
/**
* Derive NS
- *
+ *
* Given a Child Namespace, figure out what the best Namespace parent is.
- *
+ *
* For instance, if in the NS table, the parent "org.osaaf" exists, but not
* "org.osaaf.child" or "org.osaaf.a.b.c", then passing in either
* "org.osaaf.child" or "org.osaaf.a.b.c" will return "org.osaaf"
- *
+ *
* Uses recursive search on Cached DAO data
- *
+ *
* @param trans
* @param child
* @return
*/
public Result<NsDAO.Data> deriveNs(AuthzTrans trans, String child) {
Result<List<NsDAO.Data>> r = nsDAO.read(trans, child);
-
+
if (r.isOKhasData()) {
return Result.ok(r.value.get(0));
} else {
@@ -502,7 +502,7 @@ public class Question {
return Result.ok(nsd);
} else {
int dot = str.lastIndexOf('.');
-
+
if (dot < 0) {
return Result.err(Status.ERR_NsNotFound, "No Namespace for [%s]", str);
} else {
@@ -511,7 +511,7 @@ public class Question {
}
} else {
int dot = str.lastIndexOf('.');
-
+
if (dot < 0) {
return Result.err(Status.ERR_NsNotFound,"There is no valid Company Namespace for %s",str);
} else {
@@ -539,9 +539,9 @@ public class Question {
/**
* Translate an ID into it's domain
- *
+ *
* i.e. myid1234@aaf.att.com results in domain of com.att.aaf
- *
+ *
* @param id
* @return
*/
@@ -568,9 +568,9 @@ public class Question {
/**
* Validate Namespace of ID@Domain
- *
+ *
* Namespace is reverse order of Domain.
- *
+ *
* @param trans
* @param id
* @return
@@ -584,7 +584,7 @@ public class Question {
ns = domain2ns(id);
}
if (ns.length() > 0) {
- if (!trans.org().getDomain().equals(ns)) {
+ if (!trans.org().getDomain().equals(ns)) {
Result<List<NsDAO.Data>> rlnsd = nsDAO.read(trans, ns);
if (rlnsd.isOKhasData()) {
return Result.ok(rlnsd.value.get(0));
@@ -611,7 +611,7 @@ public class Question {
ns = ns.substring(0, last);
}
} while (last >= 0);
-
+
// SAFETY - Do not allow these when NS is Root
if(!isRoot) {
// com.att.aaf.ns|:<client ns>:ns|<access>
@@ -681,7 +681,7 @@ public class Question {
// Check if Access to Whole NS
// AAF-724 - Make consistent response for May User", and not take the
// last check... too confusing.
- Result<org.onap.aaf.auth.dao.cass.NsDAO.Data> rv = mayUserVirtueOfNS(trans, user, ndd,
+ Result<org.onap.aaf.auth.dao.cass.NsDAO.Data> rv = mayUserVirtueOfNS(trans, user, ndd,
":" + rdd.ns + ":ns", access.name());
if (rv.isOK()) {
return rv;
@@ -717,7 +717,7 @@ public class Question {
if (isGranted(trans, user, pdd.ns, pdd.type, pdd.instance, pdd.action)) {
return Result.ok(ndd);
}
-
+
String permInst = ":perm:" + pdd.type + ':' + pdd.instance + ':' + pdd.action;
// <ns>.access|:role:<role name>|<read|write>
String ns = ndd.name;
@@ -795,7 +795,7 @@ public class Question {
break;
case read:
case write:
- if (!isUser && !isDelegate &&
+ if (!isUser && !isDelegate &&
!isGranted(trans, trans.user(), ROOT_NS,DELG,org.getDomain(), access.name())) {
return Result.err(Status.ERR_Denied,
"[%s] may not %s delegates for [%s]", trans.user(),
@@ -818,14 +818,14 @@ public class Question {
String ns = nsd.name;
// If an ADMIN of the Namespace, then allow
-
+
Result<List<UserRoleDAO.Data>> rurd;
if ((rurd = userRoleDAO.readUserInRole(trans, user, ns+DOT_ADMIN)).isOKhasData()) {
return Result.ok(nsd);
} else if (rurd.status==Result.ERR_Backend) {
return Result.err(rurd);
}
-
+
// If Specially granted Global Permission
if (isGranted(trans, user, ROOT_NS,NS, ns_and_type, access)) {
return Result.ok(nsd);
@@ -851,13 +851,13 @@ public class Question {
ns_and_type);
}
-
+
/**
* isGranted
- *
+ *
* Important function - Check internal Permission Schemes for Permission to
* do things
- *
+ *
* @param trans
* @param type
* @param instance
@@ -871,7 +871,7 @@ public class Question {
if (ns.equals(pd.ns)) {
if (type.equals(pd.type)) {
if (PermEval.evalInstance(pd.instance, instance)) {
- if (PermEval.evalAction(pd.action, action)) { // don't return action here, might miss other action
+ if (PermEval.evalAction(pd.action, action)) { // don't return action here, might miss other action
return true;
}
}
@@ -900,32 +900,32 @@ public class Question {
}
} else {
Date now = new Date();
- // Bug noticed 6/22. Sorting on the result can cause Concurrency Issues.
+ // Bug noticed 6/22. Sorting on the result can cause Concurrency Issues.
// 9/14/2019. Use TreeSet for sorting, and using only the LAST of a Tagged entry
Collection<CredDAO.Data> cddl;
if (result.value.size() > 1) {
- Map<String,CredDAO.Data> mcdd = new TreeMap<>();
- CredDAO.Data cdd;
- String tag;
- int pseudoTag = 0;
+ Map<String,CredDAO.Data> mcdd = new TreeMap<>();
+ CredDAO.Data cdd;
+ String tag;
+ int pseudoTag = 0;
for (CredDAO.Data rcdd : result.value) {
if (rcdd.type==CredDAO.BASIC_AUTH || rcdd.type==CredDAO.BASIC_AUTH_SHA256) {
- if(rcdd.tag==null) {
- mcdd.put(Integer.toString(++pseudoTag),rcdd);
- } else {
- tag = rcdd.tag;
- cdd = mcdd.get(tag);
- if(cdd==null || cdd.expires.before(rcdd.expires)) {
- mcdd.put(tag,rcdd);
- }
- }
+ if(rcdd.tag==null) {
+ mcdd.put(Integer.toString(++pseudoTag),rcdd);
+ } else {
+ tag = rcdd.tag;
+ cdd = mcdd.get(tag);
+ if(cdd==null || cdd.expires.before(rcdd.expires)) {
+ mcdd.put(tag,rcdd);
+ }
+ }
}
}
cddl = mcdd.values();
} else {
cddl = result.value;
}
-
+
Date expired = null;
StringBuilder debug = willSpecialLog(trans,user)?new StringBuilder():null;
for (CredDAO.Data cdd : cddl) {
@@ -934,7 +934,7 @@ public class Question {
}
if (cdd.expires.after(now)) {
byte[] dbcred = cdd.cred.array();
-
+
try {
switch(cdd.type) {
case CredDAO.BASIC_AUTH:
@@ -952,7 +952,7 @@ public class Question {
bb.putInt(cdd.other);
bb.put(cred);
byte[] hash = Hash.hashSHA256(bb.array());
-
+
if (Hash.compareTo(hash,dbcred)==0) {
checkLessThanDays(trans,cldays,now,cdd);
trans.setTag(cdd.tag);
@@ -974,7 +974,7 @@ public class Question {
}
}
} // end for each
-
+
if (expired!=null) {
// Note: this is only returned if there are no good Credentials
rv = Result.err(Status.ERR_Security,
@@ -1015,7 +1015,7 @@ public class Question {
if (cexp<close) {
int daysLeft = days-(int)((close-cexp)/86400000);
trans.audit().printf("user=%s,ip=%s,expires=%s,days=%d,tag=%s,msg=\"Password expires in less than %d day%s\"",
- cdd.id,trans.ip(),Chrono.dateOnlyStamp(cdd.expires),daysLeft, cdd.tag,
+ cdd.id,trans.ip(),Chrono.dateOnlyStamp(cdd.expires),daysLeft, cdd.tag,
daysLeft,daysLeft==1?"":"s");
}
}
@@ -1038,14 +1038,14 @@ public class Question {
} finally {
tt.done();
}
-
+
} else if (cred.type==CredDAO.FQI) {
cred.cred = null;
return Result.ok(cred);
}
return Result.err(Status.ERR_Security,"invalid/unreadable credential");
}
-
+
public Result<Boolean> userCredCheck(AuthzTrans trans, CredDAO.Data orig, final byte[] raw) {
Result<Boolean> rv;
TimeTaken tt = trans.start("CheckCred Cred", Env.SUB);
@@ -1205,7 +1205,7 @@ public class Question {
}
return b;
}
-
+
public static void logEncryptTrace(AuthzTrans trans, String data) {
long ti;
trans.put(transIDSlot, ti=nextTraceID());
@@ -1222,7 +1222,7 @@ public class Question {
}
boolean rc = specialLog.add(id);
if (rc) {
- trans.trace().printf("Trace on for %s requested by %s",id,trans.user());
+ trans.trace().printf("Trace on for %s requested by %s",id,trans.user());
}
return rc;
}
@@ -1236,12 +1236,12 @@ public class Question {
specialLog = null;
}
if (rv) {
- trans.trace().printf("Trace off for %s requested by %s",id,trans.user());
+ trans.trace().printf("Trace off for %s requested by %s",id,trans.user());
}
return rv;
}
- /**
+ /**
* canMove
* Which Types can be moved
* @param nsType
@@ -1274,7 +1274,7 @@ public class Question {
};
return false;
}
-
+
public boolean isOwner(AuthzTrans trans, String user, String ns) {
Result<List<UserRoleDAO.Data>> rur = userRoleDAO().read(trans, user,ns+DOT_OWNER);
if (rur.isOKhasData()) {for (UserRoleDAO.Data urdd : rur.value){
@@ -1297,14 +1297,14 @@ public class Question {
}};
return count;
}
-
+
/**
* Return a Unique String, (same string, if it is already unique), with only
* lowercase letters, digits and the '.' character.
- *
+ *
* @param name
* @return
- * @throws IOException
+ * @throws IOException
*/
public static String toUnique(String name) throws IOException {
byte[] from = name.getBytes();
@@ -1317,7 +1317,7 @@ public class Question {
}
return sb.toString();
}
-
+
public static String fromUnique(String name) throws IOException {
byte[] from = name.getBytes();
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
index bd297e7d..f8362553 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,18 +50,18 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
private final URI uri;
/**
- *
+ *
* @param env
* @param ldao
* @param key must be one or more of service, version, other in that order
- * @throws LocatorException
+ * @throws LocatorException
*/
public DirectAAFLocator(AuthzEnv env, LocateDAO ldao, String name, String version) throws LocatorException {
- super(env.access(), name, 1000L /* Don't hit DB more than once a second */);
+ super(env.access(), name, 1000L /* Don't hit DB more than once a second */);
this.env = env;
this.ldao = ldao;
if (version!=null) {
- try {
+ try {
String[] v = Split.split('.',version);
if (v.length>0) {major = Integer.parseInt(v[0]);}
if (v.length>1) {minor = Integer.parseInt(v[1]);}
@@ -71,7 +71,7 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
throw new LocatorException("Invalid Version String: " + version);
}
}
-
+
try {
String aaf_url;
if(name.indexOf('.')>=0) {
@@ -87,10 +87,10 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
throw new LocatorException(e);
}
myhostname=null;
- myport = 0;
+ myport = 0;
}
-
-
+
+
@Override
public boolean refresh() {
AuthzTrans trans = env.newTransNoAvg();
@@ -119,7 +119,7 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
for (String s : d.subprotocol(false)) {
endpoint.getSubprotocol().add(s);
}
-
+
try {
epl.add(new EP(endpoint,latitude,longitude));
} catch (URISyntaxException e) {
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java
index 59613961..2ccbd236 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,7 +44,7 @@ import org.onap.aaf.misc.env.util.Split;
public class DirectAAFLur implements Lur {
private final AuthzEnv env;
private final Question question;
-
+
public DirectAAFLur(AuthzEnv env, Question question/*, TokenMgr tm*/) {
this.env = env;
this.question = question;
@@ -55,7 +55,7 @@ public class DirectAAFLur implements Lur {
public boolean fish(Principal bait, Permission ... pond) {
return fish(env.newTransNoAvg(),bait,pond);
}
-
+
public boolean fish(AuthzTrans trans, Principal bait, Permission ... pond) {
boolean rv = false;
Result<List<Data>> pdr = question.getPermsByUser(trans, bait.getName(),false);
@@ -94,7 +94,7 @@ public class DirectAAFLur implements Lur {
env.error().log("Can't access Cassandra to fulfill Permission Query: ",pdr.status,"-", pdr.details);
}
}
-
+
@Override
public void destroy() {
}
@@ -103,7 +103,7 @@ public class DirectAAFLur implements Lur {
public boolean handlesExclusively(Permission ... pond) {
return false;
}
-
+
/**
* Small Class implementing CADI's Permission with Cassandra Data
* @author Jonathan
@@ -111,15 +111,15 @@ public class DirectAAFLur implements Lur {
*/
public static class PermPermission implements Permission {
private PermDAO.Data data;
-
+
public PermPermission(PermDAO.Data d) {
data = d;
}
-
+
public PermPermission(AuthzTrans trans, Question q, String p) {
data = PermDAO.Data.create(trans, q, p);
}
-
+
public PermPermission(String ns, String type, String instance, String action) {
data = new PermDAO.Data();
data.ns = ns;
@@ -161,12 +161,12 @@ public class DirectAAFLur implements Lur {
public String permType() {
return "AAFLUR";
}
-
+
}
-
+
public String toString() {
return "DirectAAFLur is enabled";
-
+
}
/* (non-Javadoc)
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
index bdeb77f3..f5b7779b 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,14 +37,14 @@ import org.onap.aaf.cadi.CredVal;
/**
* DirectAAFUserPass is intended to provide password Validation directly from Cassandra Database, and is only
* intended for use in AAF itself. The normal "AAF Taf" objects are, of course, clients.
- *
+ *
* @author Jonathan
*
*/
public class DirectAAFUserPass implements CredVal {
private final AuthzEnv env;
private final Question question;
-
+
public DirectAAFUserPass(AuthzEnv env, Question question) {
this.env = env;
this.question = question;
@@ -55,7 +55,7 @@ public class DirectAAFUserPass implements CredVal {
if(user==null || type==null || pass==null) {
return false;
}
-
+
try {
AuthzTrans trans;
boolean transfer = false;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java
index f3351dae..d78ddcaa 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,10 +40,10 @@ import org.onap.aaf.cadi.taf.cert.X509Taf;
/**
* Direct view of CertIdentities
- *
- * Warning: this class is difficult to instantiate. The only service that can use it is AAF itself, and is thus
+ *
+ * Warning: this class is difficult to instantiate. The only service that can use it is AAF itself, and is thus
* entered in the "init" after the CachedCertDAO is created.
- *
+ *
* @author Jonathan
*
*/
@@ -62,7 +62,7 @@ public class DirectCertIdentity implements CertIdentity {
byte[] fingerprint = X509Taf.getFingerPrint(certBytes);
AuthzTrans trans = (AuthzTrans) req.getAttribute(TransFilter.TRANS_TAG);
-
+
Result<List<Data>> cresp = certDAO.read(trans, ByteBuffer.wrap(fingerprint));
if (cresp.isOKhasData()) {
Data cdata = cresp.value.get(0);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java
index aa6bf8c5..2ea6830c 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,12 +31,12 @@ public class DirectLocatorCreator implements AbsAAFLocator.LocatorCreator {
private final LocateDAO locateDAO;
private String myhostname;
private int myport;
-
+
public DirectLocatorCreator(AuthzEnv env, LocateDAO locateDAO) {
this.env = env;
this.locateDAO = locateDAO;
}
-
+
@Override
public AbsAAFLocator<?> create(String key, String version) throws LocatorException {
DirectAAFLocator dal = new DirectAAFLocator(env,locateDAO,key,version);
@@ -45,7 +45,7 @@ public class DirectLocatorCreator implements AbsAAFLocator.LocatorCreator {
}
return dal;
}
-
+
/**
* Make sure DirectAAFLocator created does not include self.
* @param hostname
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
index ce9d5930..75830863 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,7 +39,7 @@ import locate.v1_0.MgmtEndpoints;
public class DirectRegistrar implements Registrant<AuthzEnv> {
private LocateDAO ldao;
- private List<LocateDAO.Data> ldd;
+ private List<LocateDAO.Data> ldd;
public DirectRegistrar(Access access, LocateDAO ldao, int port) throws CadiException {
this.ldao = ldao;
ldd = new ArrayList<>();
@@ -70,7 +70,7 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
@Override
public Result<Void> update(AuthzEnv env) {
- AuthzTrans trans = env.newTransNoAvg();
+ AuthzTrans trans = env.newTransNoAvg();
StringBuilder sb = null;
for(LocateDAO.Data ld : ldd) {
org.onap.aaf.auth.layer.Result<Void> dr = ldao.update(trans, ld);
@@ -83,7 +83,7 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
}
}
}
-
+
if(sb==null) {
return Result.ok(200, null);
} else {
@@ -96,7 +96,7 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
*/
@Override
public Result<Void> cancel(AuthzEnv env) {
- AuthzTrans trans = env.newTransNoAvg();
+ AuthzTrans trans = env.newTransNoAvg();
StringBuilder sb = null;
for(LocateDAO.Data ld : ldd) {
org.onap.aaf.auth.layer.Result<Void> dr = ldao.delete(trans, ld, false);
@@ -109,7 +109,7 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
}
}
}
-
+
if(sb==null) {
return Result.ok(200, null);
} else {
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java
index 055e91ed..f6bdf20a 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_Cached.java
@@ -7,9 +7,9 @@
* * 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.
@@ -59,20 +59,20 @@ public class JU_Cached {
@Mock
CIDAO<AuthzTrans> cidaoATMock;
-
+
String name = "nameString";
@Before
public void setUp(){
MockitoAnnotations.initMocks(this);
}
-
+
@Test
public void testCachedIdx(){
Cached<Trans, DataStub> cached = new Cached<Trans, DataStub>(ciDaoMock, name, 1, 30000L);
assertThat(cached.cacheIdx("1234567890"), is(0));
}
-
+
@Test
public void testInvalidate(){
Cached<Trans, DataStub> cached = new Cached<Trans, DataStub>(ciDaoMock, name, 5, 30000L);
@@ -103,26 +103,26 @@ public class JU_Cached {
// Trans transMock;
// @Mock
// Getter<DAO> getterMock;
-//
+//
// @Test
// public void testGet(){
// cached.get(transMock, name, getterMock);
// fail("not implemented");
// }
-//
+//
// @SuppressWarnings("unchecked")
// public Result<List<DATA>> get(TRANS trans, String key, Getter<DATA> getter) {
// List<DATA> ld = null;
// Result<List<DATA>> rld = null;
-//
+//
// int cacheIdx = cacheIdx(key);
// Map<String, Dated> map = ((Map<String,Dated>)cache[cacheIdx]);
-//
+//
// // Check for saved element in cache
// Dated cached = map.get(key);
// // Note: These Segment Timestamps are kept up to date with DB
// Date dbStamp = info.get(trans, name,cacheIdx);
-//
+//
// // Check for cache Entry and whether it is still good (a good Cache Entry is same or after DBEntry, so we use "before" syntax)
// if (cached!=null && dbStamp.before(cached.timestamp)) {
// ld = (List<DATA>)cached.data;
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedDAO.java
index 242904ac..23deced0 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CachedDAO.java
@@ -7,9 +7,9 @@
* * 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.
@@ -44,22 +44,22 @@ public class JU_CachedDAO {
@Mock
DAO daoMock;
@Mock
- CIDAO<Trans> ciDAOMock;
+ CIDAO<Trans> ciDAOMock;
int segsize=1;
Object[ ] objs = new Object[2];
-
+
@Before
public void setUp(){
objs[0] = "helo";
objs[1] = "polo";
cachedDAO = new CachedDAO(daoMock, ciDAOMock, segsize, segsize);
}
-
+
@Test
public void testKeyFromObjs(){
String result = cachedDAO.keyFromObjs(objs);
System.out.println("value of resut " +result);
assertTrue(true);
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassAccess.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassAccess.java
index c06cd5c1..3f6b1500 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassAccess.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassAccess.java
@@ -7,9 +7,9 @@
* * 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.
@@ -43,7 +43,7 @@ import com.datastax.driver.core.Cluster.Builder;
@RunWith(PowerMockRunner.class)
public class JU_CassAccess {
CassAccess cassAccess;
-
+
public static final String KEYSPACE = "authz";
public static final String CASSANDRA_CLUSTERS = "cassandra.clusters";
public static final String CASSANDRA_CLUSTERS_PORT = "cassandra.clusters.port";
@@ -58,7 +58,7 @@ public class JU_CassAccess {
@Mock
Env envMock;
String prefix=null;
-
+
@Before
public void setUp(){
cassAccess = new CassAccess();
@@ -68,7 +68,7 @@ public class JU_CassAccess {
// @Test(expected=APIException.class)
// public void testCluster() throws APIException, IOException {
//// cassAccess.cluster(envMock, prefix);
-//
+//
// }
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassDAOImpl.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassDAOImpl.java
index 2e03c060..9eab56ff 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassDAOImpl.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_CassDAOImpl.java
@@ -7,9 +7,9 @@
* * 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.
@@ -76,7 +76,7 @@ AuthzTrans authzTransMock;
}
//TODO: Gabe [JUnit] Visibility issue
- @Test
+ @Test
public void testReadConsistency() {
String table = "users";
PowerMockito.when(authzTransMock.getProperty(CASS_READ_CONSISTENCY+'.'+table)).thenReturn("TWO");
@@ -84,8 +84,8 @@ AuthzTrans authzTransMock;
System.out.println("Consistency level" + consistencyLevel.name());
assertEquals("TWO", consistencyLevel.name());
}
-
- @Test
+
+ @Test
public void testWriteConsistency() {
String table = "users";
PowerMockito.when(authzTransMock.getProperty(CASS_WRITE_CONSISTENCY+'.'+table)).thenReturn(null);
@@ -93,5 +93,5 @@ AuthzTrans authzTransMock;
System.out.println("Consistency level" + consistencyLevel.name());
assertEquals("ONE", consistencyLevel.name());
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_DAOException.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_DAOException.java
index c1592bdb..f8a09c60 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_DAOException.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/JU_DAOException.java
@@ -7,9 +7,9 @@
* * 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.
@@ -35,32 +35,32 @@ public class JU_DAOException {
DAOException daoException;
String message = "message";
- Throwable cause;
+ Throwable cause;
@Before
public void setUp(){
- daoException = new DAOException();
+ daoException = new DAOException();
}
@Test
public void testNoArgConstructor(){
assertNull(daoException.getMessage());
}
-
+
@Test
public void testOneArgConstructorMsg(){
- daoException = new DAOException("test message");
+ daoException = new DAOException("test message");
assertTrue("test message".equalsIgnoreCase(daoException.getMessage()));
}
-
+
@Test
public void testOneArgConstructorThrowable(){
- daoException = new DAOException(new Throwable());
+ daoException = new DAOException(new Throwable());
assertTrue("java.lang.Throwable".equalsIgnoreCase(daoException.getMessage()));
}
-
+
@Test
public void testTwoArgConstructor(){
- daoException = new DAOException("test message", new Throwable());
+ daoException = new DAOException("test message", new Throwable());
assertTrue("test message".equalsIgnoreCase(daoException.getMessage()));
}
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java
index bb0fcd43..7780a165 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/AbsJUCass.java
@@ -7,9 +7,9 @@
* * 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.
@@ -50,7 +50,7 @@ import junit.framework.Assert;
/**
* Do Setup of Cassandra for Cassandra JUnit Testing
- *
+ *
*
*/
public class AbsJUCass {
@@ -63,8 +63,8 @@ public class AbsJUCass {
protected static float json = 0.0f;
protected static AuthzTrans trans;
protected static boolean details = true;
-
- @BeforeClass
+
+ @BeforeClass
public static void startup() throws APIException, IOException {
synchronized(AUTHZ) {
if (env==null) {
@@ -101,14 +101,14 @@ public class AbsJUCass {
Assert.fail("Not able to connect to DB: " + e.getLocalizedMessage());
}
env.info().log("Connected");
-
+
// Load special data here
-
-
+
+
iterations = 0;
-
+
}
-
+
@AfterClass
public static void shutdown() {
if (cluster!=null) {
@@ -120,10 +120,10 @@ public class AbsJUCass {
@Before
public void newTrans() {
trans = env.newTrans();
-
+
trans.setProperty(CassDAOImpl.USER_NAME, System.getProperty("user.name"));
}
-
+
@After
public void auditTrail() {
if (totals==0) { // "updateTotals()" was not called... just do one Trans
@@ -144,7 +144,7 @@ public class AbsJUCass {
}
}
}
-
+
protected void updateTotals() {
Metric metric = trans.auditTrail(0, null, Env.JSON, Env.REMOTE);
totals+=metric.total;
@@ -163,7 +163,7 @@ public class AbsJUCass {
}
env.info().log(
"Total time:",
- totals,
+ totals,
"JSON time:",
json,
"REMOTE time:",
@@ -174,10 +174,10 @@ public class AbsJUCass {
transTime
);
}
-
+
/**
* Take a User/Pass and turn into an MD5 Hashed BasicAuth
- *
+ *
* @param user
* @param pass
* @return
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java
index 7e460899..2ef15ff3 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_Bytification.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,25 +41,25 @@ public class JU_Bytification {
@Test
public void testNS() throws IOException {
-
+
// Normal
NsDAO.Data ns = new NsDAO.Data();
ns.name = "org.osaaf.<pass>";
ns.type = NsType.APP.type;
ByteBuffer bb = ns.bytify();
-
+
NsDAO.Data nsr = new NsDAO.Data();
nsr.reconstitute(bb);
check(ns,nsr);
-
+
// Empty admin
// ns.admin(true).clear();
bb = ns.bytify();
nsr = new NsDAO.Data();
nsr.reconstitute(bb);
check(ns,nsr);
-
+
// Empty responsible
// ns.responsible(true).clear();
bb = ns.bytify();
@@ -72,16 +72,16 @@ public class JU_Bytification {
nsr.reconstitute(bb);
check(ns,nsr);
}
-
+
private void check(NsDAO.Data a, NsDAO.Data b) {
assertEquals(a.name,b.name);
assertEquals(a.type,b.type);
// assertEquals(a.admin.size(),b.admin.size());
-
+
// for (String s: a.admin) {
// assertTrue(b.admin.contains(s));
// }
-//
+//
// assertEquals(a.responsible.size(),b.responsible.size());
// for (String s: a.responsible) {
// assertTrue(b.responsible.contains(s));
@@ -101,7 +101,7 @@ public class JU_Bytification {
RoleDAO.Data rd2 = new RoleDAO.Data();
rd2.reconstitute(bb);
check(rd1,rd2);
-
+
// Overshoot Buffer
StringBuilder sb = new StringBuilder(300);
sb.append("role|instance|veryLongAction...");
@@ -113,15 +113,15 @@ public class JU_Bytification {
rd2 = new RoleDAO.Data();
rd2.reconstitute(bb);
check(rd1,rd2);
-
+
// No Perms
rd1.perms.clear();
-
+
bb = rd1.bytify();
rd2 = new RoleDAO.Data();
rd2.reconstitute(bb);
check(rd1,rd2);
-
+
// 1000 Perms
for (int i=0;i<1000;++i) {
rd1.perms(true).add("com|inst|action"+ i);
@@ -133,11 +133,11 @@ public class JU_Bytification {
check(rd1,rd2);
}
-
+
private void check(RoleDAO.Data a, RoleDAO.Data b) {
assertEquals(a.ns,b.ns);
assertEquals(a.name,b.name);
-
+
assertEquals(a.perms.size(),b.perms.size());
for (String s: a.perms) {
assertTrue(b.perms.contains(s));
@@ -159,15 +159,15 @@ public class JU_Bytification {
PermDAO.Data rd2 = new PermDAO.Data();
rd2.reconstitute(bb);
check(pd1,rd2);
-
+
// No Perms
pd1.roles.clear();
-
+
bb = pd1.bytify();
rd2 = new PermDAO.Data();
rd2.reconstitute(bb);
check(pd1,rd2);
-
+
// 1000 Perms
for (int i=0;i<1000;++i) {
pd1.roles(true).add("org.osaaf.<pass>.my.Role"+ i);
@@ -179,13 +179,13 @@ public class JU_Bytification {
check(pd1,rd2);
}
-
+
private void check(PermDAO.Data a, PermDAO.Data b) {
assertEquals(a.ns,b.ns);
assertEquals(a.type,b.type);
assertEquals(a.instance,b.instance);
assertEquals(a.action,b.action);
-
+
assertEquals(a.roles.size(),b.roles.size());
for (String s: a.roles) {
assertTrue(b.roles.contains(s));
@@ -204,11 +204,11 @@ public class JU_Bytification {
UserRoleDAO.Data urd2 = new UserRoleDAO.Data();
urd2.reconstitute(bb);
check(urd1,urd2);
-
+
// A null
- urd1.expires = null;
+ urd1.expires = null;
urd1.role = null;
-
+
bb = urd1.bytify();
urd2 = new UserRoleDAO.Data();
urd2.reconstitute(bb);
@@ -221,7 +221,7 @@ public class JU_Bytification {
assertEquals(a.expires,b.expires);
}
-
+
@Test
public void testCred() throws IOException {
CredDAO.Data cd = new CredDAO.Data();
@@ -236,11 +236,11 @@ public class JU_Bytification {
CredDAO.Data cd2 = new CredDAO.Data();
cd2.reconstitute(bb);
check(cd,cd2);
-
+
// nulls
cd.expires = null;
cd.cred = null;
-
+
bb = cd.bytify();
cd2 = new CredDAO.Data();
cd2.reconstitute(bb);
@@ -253,7 +253,7 @@ public class JU_Bytification {
assertEquals(a.ns,b.ns);
assertEquals(a.type,b.type);
if (a.cred==null) {
- assertEquals(a.cred,b.cred);
+ assertEquals(a.cred,b.cred);
} else {
int l = a.cred.limit();
assertEquals(l,b.cred.limit());
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java
index 05195eeb..bd07e594 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsType.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,15 +41,15 @@ public class JU_NsType {
for (String s : tests) {
nt = NsType.valueOf(s);
assertEquals(s,nt.name());
-
+
nt2 = NsType.fromString(s);
assertEquals(nt,nt2);
-
+
int t = nt.type;
nt2 = NsType.fromType(t);
assertEquals(nt,nt2);
}
-
+
nt = NsType.fromType(Integer.MIN_VALUE);
assertEquals(nt,NsType.UNKNOWN);
nt = NsType.fromString("Garbage");
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCertDAOTest.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCertDAOTest.java
index de004fd5..54da1bf0 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCertDAOTest.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCertDAOTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCredDAOTest.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCredDAOTest.java
index 7f5ed85c..3d98dcda 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCredDAOTest.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedCredDAOTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedNSDAOTest.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedNSDAOTest.java
index 064b985c..9298b9fd 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedNSDAOTest.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedNSDAOTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedPermDAOTest.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedPermDAOTest.java
index 46bbc7e6..8a505479 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedPermDAOTest.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedPermDAOTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,13 +47,13 @@ public class JU_CachedPermDAOTest {
private CIDAO<AuthzTrans> info;
@Mock
private PermDAO dao;
-
+
@Mock
RoleDAO.Data role;
-
+
@Mock
private PermDAO.Data perm;
-
+
@Mock
private AuthzTrans trans;
@Mock
@@ -65,25 +65,25 @@ public class JU_CachedPermDAOTest {
when(dao.readNS(trans, "ns")).thenReturn(value);
when(trans.debug()).thenReturn(new LogTarget() {
-
+
@Override
public void printf(String fmt, Object... vars) {}
-
+
@Override
public void log(Throwable e, Object... msgs) {
e.getMessage();
e.printStackTrace();
msgs.toString();
-
+
}
-
+
@Override
public void log(Object... msgs) {
}
-
+
@Override
public boolean isLoggable() {
-
+
return true;
}
});
@@ -109,7 +109,7 @@ public class JU_CachedPermDAOTest {
verify(dao).readChildren(trans, "ns", "type");
}
-
+
@Test
public void testReadByTypeSuccess() {
CachedPermDAO roleDaoObj =new CachedPermDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
@@ -119,8 +119,8 @@ public class JU_CachedPermDAOTest {
// System.out.println(retVal.status);
//retVal.status = 0;
assertEquals("1", Integer.toString(retVal.status));
- }
-
+ }
+
@Test
public void testReadByTypeFailure() {
CachedPermDAO roleDaoObj =new CachedPermDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
@@ -130,7 +130,7 @@ public class JU_CachedPermDAOTest {
//System.out.println(retVal.status);
assertEquals("23", Integer.toString(retVal.status));
}
-
+
@Test
public void testAddRole() {
CachedPermDAO roleDaoObj =new CachedPermDAO(dao,info, 10);
@@ -141,7 +141,7 @@ public class JU_CachedPermDAOTest {
// System.out.println("ret value is::"+retVal);
assertEquals("testAddRole", retVal.toString());
}
-
+
@Test
public void testDelRole() {
CachedPermDAO roleDaoObj =new CachedPermDAO(dao,info, 10);
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedRoleDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedRoleDAO.java
index 4d9527c5..d4062b73 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedRoleDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedRoleDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,52 +42,52 @@ import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.LogTarget;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.class)
public class JU_CachedRoleDAO {
@Mock
RoleDAO dao;
-
+
@Mock
CIDAO<AuthzTrans> info;
-
+
@Mock
AuthzTransImpl trans;
-
+
@Mock
RoleDAO.Data data;
-
+
@Mock
PermDAO.Data permData;
-
+
@Before
public void setUp() throws Exception {
initMocks(this);
when(trans.debug()).thenReturn(new LogTarget() {
-
+
@Override
public void printf(String fmt, Object... vars) {}
-
+
@Override
public void log(Throwable e, Object... msgs) {
e.getMessage();
e.printStackTrace();
msgs.toString();
-
+
}
-
+
@Override
public void log(Object... msgs) {
}
-
+
@Override
public boolean isLoggable() {
-
+
return true;
}
});
}
-
+
@Test
public void testReadNameSuccess() {
CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
@@ -99,8 +99,8 @@ public class JU_CachedRoleDAO {
// System.out.println(retVal.status);
//retVal.status = 0;
assertEquals("1", Integer.toString(retVal.status));
- }
-
+ }
+
@Test
public void testReadNameFailure() {
CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
@@ -120,7 +120,7 @@ public class JU_CachedRoleDAO {
Result<List<Data>> retVal = roleDaoObj.readNS(trans, "");
// System.out.println(retVal.status);
assertEquals("1", Integer.toString(retVal.status));
- }
+ }
@Test
public void testReadNSFailure() {
CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
@@ -131,7 +131,7 @@ public class JU_CachedRoleDAO {
// System.out.println(retVal.status);
assertEquals("22", Integer.toString(retVal.status));
}
-
+
@Test
public void testReadChildren() {
CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
@@ -141,7 +141,7 @@ public class JU_CachedRoleDAO {
//System.out.println(retVal.status);
assertEquals("0", Integer.toString(retVal.status));
}
-
+
@Test
public void testAddPerm() {
CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);
@@ -151,7 +151,7 @@ public class JU_CachedRoleDAO {
Result<Void> retVal = roleDaoObj.addPerm(trans, data, permData);
assertEquals("testAddPerm", retVal.toString());
}
-
+
@Test
public void testDelPerm() {
CachedRoleDAO roleDaoObj =new CachedRoleDAO(dao,info, 10);
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedUserRoleDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedUserRoleDAO.java
index 053fc889..814a03fe 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedUserRoleDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cached/JU_CachedUserRoleDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,47 +50,47 @@ public class JU_CachedUserRoleDAO {
@Mock
UserRoleDAO dao;
-
+
@Mock
CIDAO<AuthzTrans> info;
-
+
@Mock
AuthzTransImpl trans;
-
+
@Mock
RoleDAO.Data data;
-
+
@Mock
PermDAO.Data permData;
-
+
@Before
public void setUp() throws Exception {
initMocks(this);
when(trans.debug()).thenReturn(new LogTarget() {
-
+
@Override
public void printf(String fmt, Object... vars) {}
-
+
@Override
public void log(Throwable e, Object... msgs) {
e.getMessage();
e.printStackTrace();
msgs.toString();
-
+
}
-
+
@Override
public void log(Object... msgs) {
}
-
+
@Override
public boolean isLoggable() {
-
+
return true;
}
});
}
-
+
private class TaggedPrincipalStub extends TaggedPrincipal {
String name="TaggedPrincipalStub";
public TaggedPrincipalStub() { super(); }
@@ -98,7 +98,7 @@ public class JU_CachedUserRoleDAO {
@Override public String getName() { return name; }
@Override public String tag() { return null; }
}
-
+
@Test
public void testReadName() {
CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 10L);
@@ -109,8 +109,8 @@ public class JU_CachedUserRoleDAO {
//System.out.println(retVal.status);
//retVal.status = 0;
assertEquals("25", Integer.toString(retVal.status));
- }
-
+ }
+
@Test
public void testReadNameUser() {
CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 10L);
@@ -122,7 +122,7 @@ public class JU_CachedUserRoleDAO {
Object o=null;
return (T)o;
}
-
+
};
transTemp.setUser(new TaggedPrincipalStub());
Mockito.doReturn(retVal1).when(info).touch(trans, null,null);
@@ -132,7 +132,7 @@ public class JU_CachedUserRoleDAO {
// System.out.println(retVal.status);
assertEquals("1", Integer.toString(retVal.status));
}
-
+
@Test
public void testReadByRoleSuccess() {
CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 0);//Mockito.mock(CachedRoleDAO.class);//
@@ -142,7 +142,7 @@ public class JU_CachedUserRoleDAO {
Result<List<Data>> retVal = roleDaoObj.readByRole(trans, "");
//System.out.println(retVal.status);
assertEquals("1", Integer.toString(retVal.status));
- }
+ }
@Test
public void testReadByRoleFailure() {
CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 0);//Mockito.mock(CachedRoleDAO.class);//
@@ -153,7 +153,7 @@ public class JU_CachedUserRoleDAO {
//System.out.println(retVal.status);
assertEquals("25", Integer.toString(retVal.status));
}
-
+
@Test
public void testReadUserInRole() {
CachedUserRoleDAO roleDaoObj =new CachedUserRoleDAO(dao,info, 10);//Mockito.mock(CachedRoleDAO.class);//
@@ -165,7 +165,7 @@ public class JU_CachedUserRoleDAO {
Object o=null;
return (T)o;
}
-
+
};
transTemp.setUser(new TaggedPrincipalStub());
Mockito.doReturn(retVal1).when(info).touch(trans, null,null);
@@ -175,6 +175,6 @@ public class JU_CachedUserRoleDAO {
//System.out.println(retVal.status);
assertEquals("25", Integer.toString(retVal.status));
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ApprovalDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ApprovalDAO.java
index 2b303673..c990c2fe 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ApprovalDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ApprovalDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -60,7 +60,7 @@ public class JU_ApprovalDAO {
AuthzTrans trans;
@Mock
Cluster cluster;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -69,7 +69,7 @@ public class JU_ApprovalDAO {
Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).debug();
Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).info();
}
-
+
@Test
public void testInit() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -82,35 +82,35 @@ public class JU_ApprovalDAO {
PSInfo createPS = Mockito.mock(PSInfo.class);
Result<ResultSet> rs = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "ApprovalDAOImpl CREATE", data);
-
+
ApprovalDAOImpl daoObj = new ApprovalDAOImpl(trans, cluster, "test",data, createPS);
// data.id
Result<Data> retVal = daoObj.create(trans, data);
assertTrue(retVal.status == 0);
-
+
rs = new Result<ResultSet>(null,1,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "ApprovalDAOImpl CREATE", data);
retVal = daoObj.create(trans, data);
assertTrue(retVal.status == 1);
-
+
Result<List<ApprovalDAO.Data>> rs1 = new Result<List<ApprovalDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(createPS).read(trans, "ApprovalDAOImpl CREATE", new Object[]{"testUser"});
Result<List<ApprovalDAO.Data>> retVal1 = daoObj.readByUser(trans, "testUser");
assertNull(retVal1);
-
+
Mockito.doReturn(rs1).when(createPS).read(trans, "ApprovalDAOImpl CREATE", new Object[]{"testApprover"});
retVal1 = daoObj.readByApprover(trans, "testApprover");
assertNull(retVal1);
-
+
Mockito.doReturn(rs1).when(createPS).read(trans, "ApprovalDAOImpl CREATE", new Object[]{new UUID(0, 0)});
retVal1 = daoObj.readByTicket(trans, new UUID(0, 0));
assertNull(retVal1);
-
+
Mockito.doReturn(rs1).when(createPS).read(trans, "ApprovalDAOImpl CREATE", new Object[]{"testStatus"});
retVal1 = daoObj.readByStatus(trans, "testStatus");
assertNull(retVal1);
}
-
+
@Test
public void testDelete() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -125,28 +125,28 @@ public class JU_ApprovalDAO {
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
PSInfo createPS = Mockito.mock(PSInfo.class);
ResultSet rsObj = new ResultSetImpl();
Result<ResultSet> rs = new Result<ResultSet>(rsObj,0,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "ApprovalDAOImpl READ", data);
Mockito.doReturn(rs).when(createPS).exec(trans, "ApprovalDAOImpl DELETE", data);
-
+
ApprovalDAOImpl daoObj = new ApprovalDAOImpl(trans, cluster, "test", createPS, historyDAO);
// data.id
Result<Void> retVal = daoObj.delete(trans, data, true);
assertTrue(retVal.status == 0);
-
+
rs = new Result<ResultSet>(rsObj,1,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "ApprovalDAOImpl READ", data);
retVal = daoObj.delete(trans, data, true);
assertTrue(retVal.status == 1);
-
+
data.status="approved";
data.memo="test";
retVal = daoObj.delete(trans, data, false);
assertTrue(retVal.status == 0);
-
+
daoObj.async(true);
data.status="denied";
retVal = daoObj.delete(trans, data, false);
@@ -155,7 +155,7 @@ public class JU_ApprovalDAO {
data.status=null;
retVal = daoObj.delete(trans, data, false);
}
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -167,24 +167,24 @@ public class JU_ApprovalDAO {
Mockito.doNothing().when(tt).done();
ApprovalDAO.Data data = new ApprovalDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
ApprovalDAOImpl daoObj = new ApprovalDAOImpl(trans, cluster, "test", createPS, historyDAO);
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
+
daoObj.wasModified(trans, CRUD.create, data, new String[] {});
daoObj.wasModified(trans, CRUD.create, data, new String[] {null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test",null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
-
+
rs1 = new Result<ResultSet>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
}
-
+
@Test
public void testSecondConstructor() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -196,7 +196,7 @@ public class JU_ApprovalDAO {
Mockito.doNothing().when(tt).done();
ApprovalDAO.Data data = new ApprovalDAO.Data();
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
-
+
ApprovalDAO daoObj = new ApprovalDAO(trans, historyDAO);
}
}
@@ -270,7 +270,7 @@ class ResultSetImpl implements ResultSet{
// TODO Auto-generated method stub
return false;
}
-
+
}
class ApprovalDAOImpl extends ApprovalDAO{
@@ -283,12 +283,12 @@ class ApprovalDAOImpl extends ApprovalDAO{
setPs(this, createPS, "psByTicket");
setPs(this, createPS, "psByStatus");
}
-
+
public ApprovalDAOImpl(AuthzTrans trans, Cluster cluster, String keyspace,PSInfo readPS ) {
super(trans, cluster, keyspace);
this.readPS = readPS;
}
-
+
public ApprovalDAOImpl(AuthzTrans trans, Cluster cluster, String keyspace,PSInfo readPS, HistoryDAO historyDAO ) {
super(trans, cluster, keyspace);
this.deletePS = readPS;
@@ -296,18 +296,18 @@ class ApprovalDAOImpl extends ApprovalDAO{
setHistoryDao(this, historyDAO);
setSession(this, Mockito.mock(Session.class));
}
-
+
public void setPs(ApprovalDAOImpl approvalDaoObj, PSInfo psInfoObj, String methodName) {
Field nsDaoField;
try {
nsDaoField = ApprovalDAO.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(approvalDaoObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -325,13 +325,13 @@ class ApprovalDAOImpl extends ApprovalDAO{
Field nsDaoField;
try {
nsDaoField = ApprovalDAO.class.getDeclaredField("historyDAO");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(approvalDaoObj, historyDAO);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -348,13 +348,13 @@ class ApprovalDAOImpl extends ApprovalDAO{
Field nsDaoField;
try {
nsDaoField = AbsCassDAO.class.getDeclaredField("session");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(approvalDaoObj, session);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ArtiDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ArtiDAO.java
index d6e1fb55..c71da3bc 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ArtiDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ArtiDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -59,7 +59,7 @@ public class JU_ArtiDAO {
AuthzTrans trans;
@Mock
Cluster cluster;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -68,7 +68,7 @@ public class JU_ArtiDAO {
Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).debug();
Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).info();
}
-
+
@Test
public void testReadByMechID() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -77,17 +77,17 @@ public class JU_ArtiDAO {
Mockito.doReturn(tt).when(trans).start("New Cassandra Session", Env.SUB);
Mockito.doReturn(tt).when(trans).start("Preparing PSInfo CREATE on ArtiDAO", Env.SUB);
Mockito.doNothing().when(tt).done();
-
+
PSInfo psByMechIdObj = Mockito.mock(PSInfo.class);
Result<ResultSet> rs = new Result<ResultSet>(null,0,"test",new String[0]);
// Mockito.doReturn(rs).when(createPS).exec(trans, "ArtiDAOImpl CREATE", data);
-
+
ArtiDAOImpl daoObj = new ArtiDAOImpl(trans, cluster, "test", psByMechIdObj);
-
+
Result<List<ArtiDAO.Data>> rs1 = new Result<List<ArtiDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psByMechIdObj).read(trans, "ArtiDAOImpl READ", new Object[]{"testMechId"});
daoObj.readByMechID(trans, "testMechId");
-
+
rs1 = new Result<List<ArtiDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psByMechIdObj).read(trans, "ArtiDAOImpl READ", new Object[]{"testMachine"});
daoObj.readByMachine(trans, "testMachine");
@@ -96,7 +96,7 @@ public class JU_ArtiDAO {
Mockito.doReturn(rs1).when(psByMechIdObj).read(trans, "ArtiDAOImpl READ", new Object[]{"testNs"});
daoObj.readByNs(trans, "testNs");
}
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -108,43 +108,43 @@ public class JU_ArtiDAO {
Mockito.doNothing().when(tt).done();
ArtiDAO.Data data = new ArtiDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
ArtiDAOImpl daoObj = new ArtiDAOImpl(trans, cluster, "test", createPS, historyDAO);
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
+
daoObj.wasModified(trans, CRUD.create, data, new String[] {});
daoObj.wasModified(trans, CRUD.create, data, new String[] {null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test",null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
-
+
rs1 = new Result<ResultSet>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
-
+
data.type(true);
daoObj.wasModified(trans, CRUD.delete, data, new String[] {"test","test"});
-
+
}
@Test
public void testData(){
ArtiDAO.Data data = new ArtiDAO.Data();
data.type(true);
data.type(false);
-
+
data.sans(true);
data.sans(false);
data.sans = new TreeSet();
data.sans(false);
data.sans(true);
-
+
data.expires = new Date();
data.toString();
}
-
+
@Test
public void testArtifactLoader(){
ArtiDAO daoObj = new ArtiDAO(trans, cluster, "test");
@@ -154,18 +154,18 @@ public class JU_ArtiDAO {
try {
Object obj = constructor.newInstance(10);
Method innnerClassMtd;
-
+
ArtiDAO.Data data = new ArtiDAO.Data();
Row row = Mockito.mock(Row.class);
innnerClassMtd = innerClass.getMethod("load", new Class[] {ArtiDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {ArtiDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test"} });
-
+
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {ArtiDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
// DataInputStream in = Mockito.mock(DataInputStream.class);
//// Mockito.doReturn(100).when(in).read();
//// Mockito.doReturn(100).when(in).readInt();
@@ -189,9 +189,9 @@ public class JU_ArtiDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testSecondConstructor() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -203,10 +203,10 @@ public class JU_ArtiDAO {
Mockito.doNothing().when(tt).done();
ArtiDAO.Data data = new ArtiDAO.Data();
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
-
+
ArtiDAO daoObj = new ArtiDAO(trans, historyDAO, Mockito.mock(CacheInfoDAO.class));
}
-
+
}
@@ -219,7 +219,7 @@ class ArtiDAOImpl extends ArtiDAO{
setPs(this, createPS, "psByMachine");
setPs(this, createPS, "psByNs");
}
-
+
public ArtiDAOImpl(AuthzTrans trans, Cluster cluster, String keyspace,PSInfo readPS, HistoryDAO historyDAO ) {
super(trans, cluster, keyspace);
this.deletePS = readPS;
@@ -227,18 +227,18 @@ class ArtiDAOImpl extends ArtiDAO{
setHistoryDao(this, historyDAO);
setSession(this, Mockito.mock(Session.class));
}
-
+
public void setPs(ArtiDAOImpl ArtiDAOObj, PSInfo psInfoObj, String methodName) {
Field nsDaoField;
try {
nsDaoField = ArtiDAO.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(ArtiDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -256,13 +256,13 @@ class ArtiDAOImpl extends ArtiDAO{
Field nsDaoField;
try {
nsDaoField = ArtiDAO.class.getDeclaredField("historyDAO");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(ArtiDAOObj, historyDAO);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -279,13 +279,13 @@ class ArtiDAOImpl extends ArtiDAO{
Field nsDaoField;
try {
nsDaoField = AbsCassDAO.class.getDeclaredField("session");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(ArtiDAOObj, session);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CacheInfoDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CacheInfoDAO.java
index c23a3729..695de1f0 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CacheInfoDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CacheInfoDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -77,7 +77,7 @@ public class JU_CacheInfoDAO {
AuthzEnv env;
@Mock
LogTarget logTarget;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -90,7 +90,7 @@ public class JU_CacheInfoDAO {
Mockito.doReturn("100").when(trans).getProperty(Config.CADI_LONGITUDE);
Mockito.doReturn(session).when(cluster).connect("test");
}
-
+
@Test
public void testInit() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -103,7 +103,7 @@ public class JU_CacheInfoDAO {
PSInfo createPS = Mockito.mock(PSInfo.class);
Result<ResultSet> rs = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "CacheInfoDAOImpl CREATE", data);
-
+
CacheInfoDAOImpl daoObj=null;
try {
daoObj = new CacheInfoDAOImpl(trans, cluster, "test",data, createPS);
@@ -115,7 +115,7 @@ public class JU_CacheInfoDAO {
Result<Data> retVal = daoObj.create(trans, data);
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testTouch() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -128,12 +128,12 @@ public class JU_CacheInfoDAO {
Mockito.doNothing().when(tt).done();
Mockito.doReturn(logTarget).when(env).debug();
-
+
CacheInfoDAO.Data data = new CacheInfoDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
Result<ResultSet> rs = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "CacheInfoDAOImpl CREATE", data);
-
+
CacheInfoDAOImpl daoObj=null;
try {
daoObj = new CacheInfoDAOImpl(trans, cluster, "test",data, createPS);
@@ -147,8 +147,8 @@ public class JU_CacheInfoDAO {
Mockito.doThrow(DriverException.class).when(session).executeAsync(Mockito.anyString());
daoObj.startUpdate(env, Mockito.mock(HMangr.class), Mockito.mock(SecuritySetter.class), "12.0.0.1", 8080);
retVal = daoObj.touch(trans, "test", 1, 2);
-
-
+
+
try {
daoObj = new CacheInfoDAOImpl(trans, cluster, "test",data, createPS);
} catch (APIException | IOException e) {
@@ -175,7 +175,7 @@ public class JU_CacheInfoDAO {
retVal = daoObj.touch(trans, "test", 1, 2);
assertTrue(retVal.status == Result.ERR_Backend);
}
-
+
@Test
public void testCheck() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -189,7 +189,7 @@ public class JU_CacheInfoDAO {
PSInfo createPS = Mockito.mock(PSInfo.class);
Result<ResultSet> rs = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "CacheInfoDAOImpl CREATE", data);
-
+
CacheInfoDAOImpl daoObj=null;
PreparedStatement ps = Mockito.mock(PreparedStatement.class);
Mockito.doReturn(ps).when(session).prepare(Mockito.anyString());
@@ -208,7 +208,7 @@ public class JU_CacheInfoDAO {
Mockito.doReturn(resultSet).when(session).execute(Mockito.any(Statement.class));
Result<Void> retVal = daoObj.check(trans);
assertTrue(retVal.status == 0);
-
+
Row row = Mockito.mock(Row.class);
Mockito.doReturn("test").when(row).getString(Mockito.anyInt());
rowList.add(row);
@@ -243,9 +243,9 @@ public class JU_CacheInfoDAO {
}
@Test
public void testStopUpdate() {
-
+
CacheInfoDAO.stopUpdate();
-
+
}
@@ -264,7 +264,7 @@ public class JU_CacheInfoDAO {
PSInfo createPS = Mockito.mock(PSInfo.class);
Result<ResultSet> rs = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "CacheInfoDAOImpl CREATE", data);
-
+
CacheInfoDAOImpl daoObj=null;
try {
daoObj = new CacheInfoDAOImpl(trans, cluster, "test",data, createPS);
@@ -276,7 +276,7 @@ public class JU_CacheInfoDAO {
}
}
*/
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -288,11 +288,11 @@ public class JU_CacheInfoDAO {
Mockito.doNothing().when(tt).done();
CacheInfoDAO.Data data = new CacheInfoDAO.Data("test",1);
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
CacheInfoDAOImpl daoObj=null;
try {
daoObj = new CacheInfoDAOImpl(trans, cluster, "test", createPS);
@@ -301,10 +301,10 @@ public class JU_CacheInfoDAO {
e.printStackTrace();
}
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
-
+
+
}
-
+
@Test
public void testInfoLoader(){
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -338,12 +338,12 @@ public class JU_CacheInfoDAO {
try {
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
CacheInfoDAO.Data data = new CacheInfoDAO.Data();
Row row = Mockito.mock(Row.class);
innnerClassMtd = innerClass.getMethod("load", new Class[] {CacheInfoDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {CacheInfoDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test"}});
@@ -367,9 +367,9 @@ public class JU_CacheInfoDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testCacheUpdate(){
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -407,24 +407,24 @@ public class JU_CacheInfoDAO {
Constructor<?> innerConstructor = innerInnerClass.getDeclaredConstructors()[0];
innerConstructor.setAccessible(true);
Object innerClassObj = innerConstructor.newInstance(obj, trans);
-
+
Method innnerClassMtd;
-
+
CacheInfoDAO.Data data = new CacheInfoDAO.Data();
Row row = Mockito.mock(Row.class);
Rcli rcli = Mockito.mock(Rcli.class);
URI uri = new URI("ftp","admin:admin@geeksforgeeks.org:1234","/path/data","tt","ttd");
Mockito.doReturn(uri).when(rcli).getURI();
Mockito.doReturn(Mockito.mock(org.onap.aaf.cadi.client.Future.class)).when(rcli).delete("/mgmt/cache/null/null", "application/Void+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*/*;q=1.0");
-
+
innnerClassMtd = innerInnerClass.getMethod("code", new Class[] {Rcli.class});
innnerClassMtd.invoke(innerClassObj, new Object[] {rcli});
-
+
org.onap.aaf.cadi.client.Future futureObj = Mockito.mock(org.onap.aaf.cadi.client.Future.class);
Mockito.doReturn(futureObj).when(rcli).delete("/mgmt/cache/null/null", "application/Void+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*/*;q=1.0");
Mockito.doReturn(true).when(futureObj).get(0);
innnerClassMtd.invoke(innerClassObj, new Object[] {rcli});
-
+
uri = new URI("ftp","12.0.0.1:8080","/path/data","tt","ttd");
Mockito.doReturn(uri).when(rcli).getURI();
innnerClassMtd.invoke(innerClassObj, new Object[] {rcli});
@@ -458,9 +458,9 @@ public class JU_CacheInfoDAO {
} catch (CadiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testIntHolder(){
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -499,16 +499,16 @@ public class JU_CacheInfoDAO {
innerConstructor.setAccessible(true);
int[] a = new int[10];
Object innerClassObj = innerConstructor.newInstance(obj, a);
-
+
Method innnerClassMtd=null;
-
+
CacheInfoDAO.Data data = new CacheInfoDAO.Data();
Row row = Mockito.mock(Row.class);
Rcli rcli = Mockito.mock(Rcli.class);
URI uri = new URI("ftp","admin:admin@geeksforgeeks.org:1234","/path/data","tt","ttd");
Mockito.doReturn(uri).when(rcli).getURI();
Mockito.doReturn(Mockito.mock(org.onap.aaf.cadi.client.Future.class)).when(rcli).delete("/mgmt/cache/null/null", "application/Void+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*/*;q=1.0");
-
+
Method[] allMtds = innerInnerClass.getDeclaredMethods();
for(Method indMtd:allMtds) {
if(indMtd.getName().contains("add")) {
@@ -516,8 +516,8 @@ public class JU_CacheInfoDAO {
}
}
innnerClassMtd.invoke(innerClassObj, new Object[] {a});
-
-
+
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -545,9 +545,9 @@ public class JU_CacheInfoDAO {
} catch (CadiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
//@Test
public void testSecondConstructor() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -580,24 +580,24 @@ class CacheInfoDAOImpl extends CacheInfoDAO{
// setPs(this, createPS, "psByStatus");
// setSession(this, Mockito.mock(Session.class));
}
-
+
public CacheInfoDAOImpl(AuthzTrans trans, Cluster cluster, String keyspace,PSInfo readPS ) throws APIException, IOException {
super(trans, cluster, keyspace);
this.readPS = readPS;
}
-
+
public void setPs(CacheInfoDAOImpl CacheInfoDAOObj, PSInfo psInfoObj, String methodName) {
Field nsDaoField;
try {
nsDaoField = CacheInfoDAO.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(CacheInfoDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -611,12 +611,12 @@ class CacheInfoDAOImpl extends CacheInfoDAO{
}
}
-
+
public void setSession(CacheInfoDAOImpl CacheInfoDAOObj, Session session) {
Field nsDaoField;
try {
nsDaoField = AbsCassDAO.class.getDeclaredField("session");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
@@ -634,5 +634,5 @@ class CacheInfoDAOImpl extends CacheInfoDAO{
e.printStackTrace();
}
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CertDAOTest.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CertDAOTest.java
index 782bd985..718d9dec 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CertDAOTest.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_CertDAOTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -66,7 +66,7 @@ public class JU_CertDAOTest {
AuthzEnv env;
@Mock
LogTarget logTarget;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -79,7 +79,7 @@ public class JU_CertDAOTest {
Mockito.doReturn("100").when(trans).getProperty(Config.CADI_LONGITUDE);
Mockito.doReturn(session).when(cluster).connect("test");
}
-
+
@Test
public void testInit() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -92,7 +92,7 @@ public class JU_CertDAOTest {
PSInfo createPS = Mockito.mock(PSInfo.class);
Result<ResultSet> rs = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "CertDAOImpl CREATE", data);
-
+
CertDAOImpl daoObj=null;
try {
daoObj = new CertDAOImpl(trans, cluster, "test",data, createPS);
@@ -102,17 +102,17 @@ public class JU_CertDAOTest {
}
}
-
+
@Test
public void testCertLoader(){
-
+
Class<?> innerClass = CertDAO.class.getDeclaredClasses()[0];
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
try {
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
CertDAO.Data data = new CertDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -121,16 +121,16 @@ public class JU_CertDAOTest {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {CertDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {CertDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {CertDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
// DataInputStream in = Mockito.mock(DataInputStream.class);
//// Mockito.doReturn(100).when(in).read();
//// Mockito.doReturn(100).when(in).readInt();
@@ -154,9 +154,9 @@ public class JU_CertDAOTest {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -168,14 +168,14 @@ public class JU_CertDAOTest {
Mockito.doNothing().when(tt).done();
CertDAO.Data data = new CertDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
CacheInfoDAO cacheInfoDAO = Mockito.mock(CacheInfoDAO.class);
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(trans, CertDAO.TABLE, new int[1]);
-
+
CertDAO daoObj = null;
try {
daoObj = new CertDAO(trans, historyDAO, cacheInfoDAO);
@@ -183,21 +183,21 @@ public class JU_CertDAOTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
+
rs1 = new Result<ResultSet>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(trans, CertDAO.TABLE, new int[1]);
-
+
try {
daoObj = new CertDAO(trans, historyDAO, cacheInfoDAO);
} catch (APIException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
daoObj.wasModified(trans, CRUD.delete, data, new String[] {"test"});
@@ -205,7 +205,7 @@ public class JU_CertDAOTest {
daoObj.wasModified(trans, CRUD.delete, data, new String[] {"test", "test"});
daoObj.wasModified(trans, CRUD.delete, data, new String[] {null});
daoObj.wasModified(trans, CRUD.delete, data, new String[] {});
-
+
try {
CertDAO.Data data1 = Mockito.mock(CertDAO.Data.class);
Mockito.doThrow(new IOException()).when(data1).bytify();
@@ -216,7 +216,7 @@ public class JU_CertDAOTest {
e.printStackTrace();
}
}
-
+
@Test
public void testRead() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -235,14 +235,14 @@ public class JU_CertDAOTest {
Mockito.doNothing().when(tt).done();
CertDAO.Data data = new CertDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
CacheInfoDAO cacheInfoDAO = Mockito.mock(CacheInfoDAO.class);
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(trans, CertDAO.TABLE, new int[1]);
-
+
CertDAOImpl daoObj = null;
try {
daoObj = new CertDAOImpl(trans, historyDAO, cacheInfoDAO, createPS);
@@ -250,15 +250,15 @@ public class JU_CertDAOTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
daoObj.read(trans, new Object[] {"test", BigInteger.ONE});
Field cbField;
try {
cbField = CassAccess.class.getDeclaredField("cb");
-
+
cbField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
cbField.set(null, null);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -270,15 +270,15 @@ public class JU_CertDAOTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
daoObj.readX500(trans, "test");
-
+
try {
cbField = CassAccess.class.getDeclaredField("cb");
-
+
cbField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
cbField.set(null, null);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -290,11 +290,11 @@ public class JU_CertDAOTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
- daoObj.readID(trans, "test");
+
+ daoObj.readID(trans, "test");
}
-
+
@Test
public void testSecondConstructor() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -328,24 +328,24 @@ class CertDAOImpl extends CertDAO{
// setPs(this, createPS, "psByStatus");
// setSession(this, Mockito.mock(Session.class));
}
-
+
public CertDAOImpl(AuthzTrans trans, HistoryDAO historyDAO, CacheInfoDAO cacheInfoDAO,PSInfo readPS ) throws APIException, IOException {
super(trans, historyDAO, cacheInfoDAO);
this.readPS = readPS;
}
-
+
public void setPs(CertDAOImpl CertDAOObj, PSInfo psInfoObj, String methodName) {
Field nsDaoField;
try {
nsDaoField = CertDAO.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(CertDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -359,12 +359,12 @@ class CertDAOImpl extends CertDAO{
}
}
-
+
public void setSession(CertDAOImpl CertDAOObj, Session session) {
Field nsDaoField;
try {
nsDaoField = AbsCassDAO.class.getDeclaredField("session");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
@@ -382,5 +382,5 @@ class CertDAOImpl extends CertDAO{
e.printStackTrace();
}
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ConfigDAOTest.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ConfigDAOTest.java
index 91d16970..30004e91 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ConfigDAOTest.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_ConfigDAOTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -73,7 +73,7 @@ public class JU_ConfigDAOTest {
AuthzEnv env;
@Mock
LogTarget logTarget;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -86,7 +86,7 @@ public class JU_ConfigDAOTest {
Mockito.doReturn("100").when(trans).getProperty(Config.CADI_LONGITUDE);
Mockito.doReturn(session).when(cluster).connect("test");
}
-
+
@Test
public void testInit() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -99,7 +99,7 @@ public class JU_ConfigDAOTest {
PSInfo createPS = Mockito.mock(PSInfo.class);
Result<ResultSet> rs = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs).when(createPS).exec(trans, "ConfigDAOImpl CREATE", data);
-
+
ConfigDAO daoObj=null;
try {
daoObj = new ConfigDAO(trans, cluster, "test");
@@ -109,17 +109,17 @@ public class JU_ConfigDAOTest {
}
}
-
+
@Test
public void testConfigLoader(){
-
+
Class<?> innerClass = ConfigDAO.class.getDeclaredClasses()[0];
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
try {
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
ConfigDAO.Data data = new ConfigDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -128,16 +128,16 @@ public class JU_ConfigDAOTest {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {ConfigDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {ConfigDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {ConfigDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
innnerClassMtd = innerClass.getDeclaredMethod("marshal", new Class[] {ConfigDAO.Data.class, DataOutputStream.class });
@@ -147,7 +147,7 @@ public class JU_ConfigDAOTest {
DataInputStream dis = new DataInputStream(bais);
innnerClassMtd = innerClass.getDeclaredMethod("unmarshal", new Class[] {ConfigDAO.Data.class, DataInputStream.class });
innnerClassMtd.invoke(obj, new Object[] {data, dis });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -166,9 +166,9 @@ public class JU_ConfigDAOTest {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -180,7 +180,7 @@ public class JU_ConfigDAOTest {
Mockito.doNothing().when(tt).done();
ConfigDAO.Data data = new ConfigDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
ConfigDAO daoObj = null;
try {
daoObj = new ConfigDAO(trans, cluster, "test");
@@ -188,13 +188,13 @@ public class JU_ConfigDAOTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
-
-
+
+
+
}
-
+
@Test
public void testRead() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -210,9 +210,9 @@ public class JU_ConfigDAOTest {
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,null);
Mockito.doReturn(Mockito.mock(Decryptor.class)).when(trans).decryptor();
Mockito.doNothing().when(tt).done();
-
+
Result<List<Data>> rs1 = new Result<List<Data>>(null,0,"test",new String[0]);
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
ConfigDAOImpl daoObj = null;
@@ -224,12 +224,12 @@ public class JU_ConfigDAOTest {
}
Mockito.doReturn(rs1).when(psObj).read(trans, "ConfigDAO READ", new Object[]{"test"});
daoObj.readName(trans, "test");
-
-
+
+
}
-
-
+
+
@Test
public void testSecondConstructor() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -252,24 +252,24 @@ public class JU_ConfigDAOTest {
class ConfigDAOImpl extends ConfigDAO{
-
+
public ConfigDAOImpl(AuthzTrans trans, Cluster cluster, String keyspace,PSInfo readPS ) throws APIException, IOException {
super(trans, cluster, keyspace);
setPs(this, readPS, "psName");
}
-
+
public void setPs(ConfigDAOImpl ConfigDAOObj, PSInfo psInfoObj, String methodName) {
Field nsDaoField;
try {
nsDaoField = ConfigDAO.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(ConfigDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -283,12 +283,12 @@ class ConfigDAOImpl extends ConfigDAO{
}
}
-
+
public void setSession(ConfigDAOImpl ConfigDAOObj, Session session) {
Field nsDaoField;
try {
nsDaoField = AbsCassDAO.class.getDeclaredField("session");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
@@ -306,5 +306,5 @@ class ConfigDAOImpl extends ConfigDAO{
e.printStackTrace();
}
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_DelegateDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_DelegateDAO.java
index 39d7492a..3826fcbe 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_DelegateDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_DelegateDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -51,7 +51,7 @@ public class JU_DelegateDAO {
AuthzTrans trans;
@Mock
Cluster cluster;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -65,27 +65,27 @@ public class JU_DelegateDAO {
@Test
public void testReadByDelegate() {
DelegateDAO daoObj = new DelegateDAO(trans, cluster, "test");
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsDelegate(daoObj, psObj, "psByDelegate");
-
+
Result<List<DelegateDAO.Data>> rs1 = new Result<List<DelegateDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "DelegateDAO READ", new Object[]{"test"});
-
+
daoObj.readByDelegate(trans, "test");
}
-
+
public void setPsDelegate(DelegateDAO delegateDAOObj, PSInfo psInfoObj, String fieldName) {
Field nsDaoField;
try {
nsDaoField = DelegateDAO.class.getDeclaredField(fieldName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(delegateDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -98,13 +98,13 @@ public class JU_DelegateDAO {
e.printStackTrace();
}
}
-
+
@Test
public void testSecondConstructor() {
AbsCassDAO absDAO = Mockito.mock(AbsCassDAO.class);
DelegateDAO daoObj = new DelegateDAO(trans, absDAO);
-
+
}
@Test
@@ -117,13 +117,13 @@ public class JU_DelegateDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
try {
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
DelegateDAO.Data data = new DelegateDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -132,16 +132,16 @@ public class JU_DelegateDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {DelegateDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {DelegateDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {DelegateDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
// DataOutputStream dos = new DataOutputStream(new FileOutputStream("JU_DelegateDAOTest.java"));
// innnerClassMtd = innerClass.getDeclaredMethod("marshal", new Class[] {DelegateDAO.Data.class, DataOutputStream.class });
// innnerClassMtd.invoke(obj, new Object[] {data, dos });
@@ -149,7 +149,7 @@ public class JU_DelegateDAO {
// DataInputStream dis = new DataInputStream(new FileInputStream("JU_DelegateDAOTest.java"));
// innnerClassMtd = innerClass.getDeclaredMethod("unmarshal", new Class[] {DelegateDAO.Data.class, DataInputStream.class });
// innnerClassMtd.invoke(obj, new Object[] {data, dis });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -168,9 +168,9 @@ public class JU_DelegateDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testData(){
DelegateDAO.Data data = new DelegateDAO.Data();
@@ -184,5 +184,5 @@ public class JU_DelegateDAO {
e.printStackTrace();
}
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_FutureDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_FutureDAO.java
index 07946156..f05738ea 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_FutureDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_FutureDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -58,7 +58,7 @@ public class JU_FutureDAO {
AuthzTrans trans;
@Mock
Cluster cluster;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -72,13 +72,13 @@ public class JU_FutureDAO {
@Test
public void testReadByStartAndTarget() {
FutureDAO daoObj = new FutureDAO(trans, cluster, "test");
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psByStartAndTarget");
-
+
Result<List<FutureDAO.Data>> rs1 = new Result<List<FutureDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "FutureDAO READ", new Object[]{"test"});
-
+
daoObj.readByStartAndTarget(trans,new Date(), "test");
}
@Test
@@ -91,7 +91,7 @@ public class JU_FutureDAO {
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psObj).exec(trans, "FutureDAOImpl CREATE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
FutureDAOImpl daoObj=null;
try {
daoObj = new FutureDAOImpl(trans, historyDAO, psObj);
@@ -100,35 +100,35 @@ public class JU_FutureDAO {
e.printStackTrace();
}
Mockito.doReturn("test user").when(trans).user();
-
+
Result<FutureDAO.Data> retVal = daoObj.create(trans,data, "test");
assertTrue(retVal.status == 0);
-
+
StringBuilder sb = new StringBuilder(trans.user());
sb.append(data.target);
sb.append(System.currentTimeMillis());
data.id = UUID.nameUUIDFromBytes(sb.toString().getBytes());
-
+
rs1 = new Result<ResultSet>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(psObj).exec(trans, "FutureDAOImpl CREATE", data);
-
+
retVal = daoObj.create(trans,data, "test");
assertTrue(retVal.status != 0);
-
-
+
+
}
-
+
public void setPsByStartAndTarget(FutureDAO FutureDAOObj, PSInfo psInfoObj, String fieldName) {
Field nsDaoField;
try {
nsDaoField = FutureDAO.class.getDeclaredField(fieldName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(FutureDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -141,7 +141,7 @@ public class JU_FutureDAO {
e.printStackTrace();
}
}
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -154,11 +154,11 @@ public class JU_FutureDAO {
Mockito.doNothing().when(tt).done();
FutureDAO.Data data = new FutureDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
FutureDAOImpl daoObj = null;
try {
daoObj = new FutureDAOImpl(trans, historyDAO, createPS );
@@ -167,23 +167,23 @@ public class JU_FutureDAO {
e.printStackTrace();
}
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
+
daoObj.wasModified(trans, CRUD.create, data, new String[] {});
daoObj.wasModified(trans, CRUD.create, data, new String[] {null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test",null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
-
+
rs1 = new Result<ResultSet>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
}
-
+
@Test
public void testSecondConstructor() {
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
FutureDAO daoObj = new FutureDAO(trans, historyDAO);
-
+
}
@Test
@@ -196,18 +196,18 @@ public class JU_FutureDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[1];
constructor.setAccessible(true);
-
+
Constructor<?> constructor1 = innerClass.getDeclaredConstructors()[0];
constructor1.setAccessible(true);
try {
-
+
Object obj = constructor.newInstance(1);
obj = constructor1.newInstance();
Method innnerClassMtd;
-
+
FutureDAO.Data data = new FutureDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -216,16 +216,16 @@ public class JU_FutureDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {FutureDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {FutureDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {FutureDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
// DataOutputStream dos = new DataOutputStream(new FileOutputStream("JU_FutureDAOTest.java"));
// innnerClassMtd = innerClass.getDeclaredMethod("marshal", new Class[] {FutureDAO.Data.class, DataOutputStream.class });
// innnerClassMtd.invoke(obj, new Object[] {data, dos });
@@ -233,7 +233,7 @@ public class JU_FutureDAO {
// DataInputStream dis = new DataInputStream(new FileInputStream("JU_FutureDAOTest.java"));
// innnerClassMtd = innerClass.getDeclaredMethod("unmarshal", new Class[] {FutureDAO.Data.class, DataInputStream.class });
// innnerClassMtd.invoke(obj, new Object[] {data, dis });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -252,31 +252,31 @@ public class JU_FutureDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
}
class FutureDAOImpl extends FutureDAO{
-
+
public FutureDAOImpl(AuthzTrans trans, HistoryDAO historyDAO,PSInfo readPS ) throws APIException, IOException {
super(trans, historyDAO);
setPs(this, readPS, "createPS");
}
-
+
public void setPs(FutureDAOImpl FutureDAOObj, PSInfo psInfoObj, String methodName) {
Field nsDaoField;
try {
nsDaoField = CassDAOImpl.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(FutureDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -289,5 +289,5 @@ class FutureDAOImpl extends FutureDAO{
e.printStackTrace();
}
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_HistoryDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_HistoryDAO.java
index f6d0a65b..3503adff 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_HistoryDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_HistoryDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -61,7 +61,7 @@ public class JU_HistoryDAO {
AuthzTrans trans;
@Mock
Cluster cluster;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -77,7 +77,7 @@ public class JU_HistoryDAO {
HistoryDAO.Data data = daoObj.newInitedData();
assertTrue( Integer.toString(((new Date()).getYear())+1900).equalsIgnoreCase(Integer.toString(data.yr_mon).substring(0,4)) );
}
-
+
@Test
public void testCreateBatch() {
HistoryDAO daoObj = new HistoryDAO(trans, cluster, "test");
@@ -86,81 +86,81 @@ public class JU_HistoryDAO {
daoObj.createBatch(sb, data);
assertTrue(sb.toString().contains("INSERT INTO history"));
}
-
+
@Test
public void testReadByYYYYMM() {
HistoryDAO daoObj = new HistoryDAO(trans, cluster, "test");
AbsCassDAO<AuthzTrans, Data>.PSInfo psInfoObj = Mockito.mock(PSInfo.class);
setAbsCassDAO(daoObj, psInfoObj, "readByYRMN");
-
+
ResultSet rs = Mockito.mock(ResultSet.class);
Result<ResultSet> rs1 = new Result<ResultSet>(rs,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psInfoObj).exec(trans, "yr_mon", 201905);
-
+
Result<List<Data>> retVal = daoObj.readByYYYYMM(trans, 201905);
assertTrue(retVal.status !=1);
-
+
rs1 = new Result<ResultSet>(rs,1,"test",new String[0]);
Mockito.doReturn(rs1).when(psInfoObj).exec(trans, "yr_mon", 201905);
retVal = daoObj.readByYYYYMM(trans, 201905);
assertTrue(retVal.status !=0);
}
-
+
@Test
public void testReadByUser() {
HistoryDAO daoObj = new HistoryDAO(trans, cluster, "test");
AbsCassDAO<AuthzTrans, Data>.PSInfo psInfoObj = Mockito.mock(PSInfo.class);
setAbsCassDAO(daoObj, psInfoObj, "readByUser");
-
+
ResultSet rs = Mockito.mock(ResultSet.class);
Result<ResultSet> rs1 = new Result<ResultSet>(rs,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psInfoObj).exec(trans, "user", "test");
-
+
Result<List<Data>> retVal = daoObj.readByUser(trans, "test", 201905);
assertTrue(retVal.status !=1);
-
+
rs1 = new Result<ResultSet>(rs,1,"test",new String[0]);
Mockito.doReturn(rs1).when(psInfoObj).exec(trans, "user", "test");
retVal = daoObj.readByUser(trans,"test", 201905);
assertTrue(retVal.status !=0);
-
+
retVal = daoObj.readByUser(trans,"test");
assertTrue(retVal.status !=0);
}
-
+
@Test
public void testReadBySubject() {
HistoryDAO daoObj = new HistoryDAO(trans, cluster, "test");
AbsCassDAO<AuthzTrans, Data>.PSInfo psInfoObj = Mockito.mock(PSInfo.class);
setAbsCassDAO(daoObj, psInfoObj, "readBySubject");
-
+
ResultSet rs = Mockito.mock(ResultSet.class);
Result<ResultSet> rs1 = new Result<ResultSet>(rs,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psInfoObj).exec(trans, "subject", "test", "test");
-
+
Result<List<Data>> retVal = daoObj.readBySubject(trans, "test", "test", 201905);
assertTrue(retVal.status !=1);
-
+
rs1 = new Result<ResultSet>(rs,1,"test",new String[0]);
Mockito.doReturn(rs1).when(psInfoObj).exec(trans, "subject", "test", "test");
retVal = daoObj.readBySubject(trans,"test", "test", 201905);
assertTrue(retVal.status !=0);
-
+
retVal = daoObj.readBySubject(trans,"test", "test");
assertTrue(retVal.status !=0);
}
-
+
public void setAbsCassDAO(HistoryDAO HistoryDAOObj, PSInfo psInfoObj, String fieldName) {
Field nsDaoField;
try {
nsDaoField = HistoryDAO.class.getDeclaredField(fieldName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(HistoryDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -173,14 +173,14 @@ public class JU_HistoryDAO {
e.printStackTrace();
}
}
-
-
+
+
@Test
public void testSecondConstructor() {
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
HistoryDAO daoObj = new HistoryDAO(trans, historyDAO);
-
+
}
@Test
@@ -193,14 +193,14 @@ public class JU_HistoryDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
-
+
try {
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
HistoryDAO.Data data = new HistoryDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -209,16 +209,16 @@ public class JU_HistoryDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {HistoryDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {HistoryDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {HistoryDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -237,9 +237,9 @@ public class JU_HistoryDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testYYYYMM(){
Class<?> innerClass = null;
@@ -250,14 +250,14 @@ public class JU_HistoryDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
int yyyymm[] = new int[2];
try {
Object obj = constructor.newInstance(new HistoryDAO(trans, cluster, "test"), yyyymm);
Method innnerClassMtd;
-
+
HistoryDAO.Data data = new HistoryDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -266,13 +266,13 @@ public class JU_HistoryDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("ok", new Class[] {HistoryDAO.Data.class});
innnerClassMtd.invoke(obj, new Object[] {data});
-
+
data.yr_mon=201904;
innnerClassMtd.invoke(obj, new Object[] {data});
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -291,30 +291,30 @@ public class JU_HistoryDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
}
class HistoryDAOImpl extends HistoryDAO{
-
+
public HistoryDAOImpl(AuthzTrans trans, HistoryDAO historyDAO,PSInfo readPS ) throws APIException, IOException {
super(trans, historyDAO);
setPs(this, readPS, "createPS");
}
-
+
public void setPs(HistoryDAOImpl HistoryDAOObj, PSInfo psInfoObj, String methodName) {
Field nsDaoField;
try {
nsDaoField = CassDAOImpl.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(HistoryDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -327,5 +327,5 @@ class HistoryDAOImpl extends HistoryDAO{
e.printStackTrace();
}
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_LocateDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_LocateDAO.java
index 53bad44e..d4f2c981 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_LocateDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_LocateDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -60,7 +60,7 @@ public class JU_LocateDAO {
AuthzTrans trans;
@Mock
Cluster cluster;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -84,28 +84,28 @@ public class JU_LocateDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psName");
-
+
Result<List<LocateDAO.Data>> rs1 = new Result<List<LocateDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "LocateDAO READ", new Object[]{"test"});
-
+
daoObj.readByName(trans, "test");
}
-
-
+
+
public void setPsByStartAndTarget(LocateDAO LocateDAOObj, PSInfo psInfoObj, String fieldName) {
Field nsDaoField;
try {
nsDaoField = LocateDAO.class.getDeclaredField(fieldName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(LocateDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -118,14 +118,14 @@ public class JU_LocateDAO {
e.printStackTrace();
}
}
-
+
@Test
public void testWasMOdified() {
-
+
LocateDAO.Data data = new LocateDAO.Data();
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
-
+
LocateDAO daoObj = null;
try {
daoObj = new LocateDAO(trans, historyDAO );
@@ -134,10 +134,10 @@ public class JU_LocateDAO {
e.printStackTrace();
}
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
-
+
+
}
-
+
@Test
public void testSecondConstructor() {
AbsCassDAO historyDAO = Mockito.mock(AbsCassDAO.class);
@@ -148,7 +148,7 @@ public class JU_LocateDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
}
@Test
@@ -161,15 +161,15 @@ public class JU_LocateDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
-
+
try {
-
+
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
LocateDAO.Data data = new LocateDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -178,16 +178,16 @@ public class JU_LocateDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {LocateDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {LocateDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 0, new Object[] {"test","test","test"} });
-
+
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {LocateDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
innnerClassMtd = innerClass.getDeclaredMethod("marshal", new Class[] {LocateDAO.Data.class, DataOutputStream.class });
@@ -197,7 +197,7 @@ public class JU_LocateDAO {
DataInputStream dis = new DataInputStream(bais);
innnerClassMtd = innerClass.getDeclaredMethod("unmarshal", new Class[] {LocateDAO.Data.class, DataInputStream.class });
innnerClassMtd.invoke(obj, new Object[] {data, dis });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -216,9 +216,9 @@ public class JU_LocateDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testData(){
LocateDAO.Data data = new LocateDAO.Data();
@@ -230,16 +230,16 @@ public class JU_LocateDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
data.subprotocol(true);
-
+
Set<String> subProt = new HashSet<String>();
Field protField;
try {
protField = LocateDAO.Data.class.getDeclaredField("subprotocol");
-
+
protField.setAccessible(true);
-
+
protField.set(data, subProt);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -251,15 +251,15 @@ public class JU_LocateDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
data.subprotocol(true);
subProt = new TreeSet<String>();
subProt.add("test");
try {
protField = LocateDAO.Data.class.getDeclaredField("subprotocol");
-
+
protField.setAccessible(true);
-
+
protField.set(data, subProt);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -271,36 +271,36 @@ public class JU_LocateDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
data.subprotocol(true);
data.subprotocol(false);
-
+
LocateDAO.Data newDate = data.copy();
assertTrue(data.name.equals(newDate.name));
}
-
+
}
class LocateDAOImpl extends LocateDAO{
-
+
public LocateDAOImpl(AuthzTrans trans, HistoryDAO historyDAO,PSInfo readPS ) throws APIException, IOException {
super(trans, historyDAO);
setPs(this, readPS, "createPS");
}
-
+
public void setPs(LocateDAOImpl LocateDAOObj, PSInfo psInfoObj, String methodName) {
Field nsDaoField;
try {
nsDaoField = CassDAOImpl.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(LocateDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -313,5 +313,5 @@ class LocateDAOImpl extends LocateDAO{
e.printStackTrace();
}
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_Namespace.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_Namespace.java
index 6bdb3d76..e1c13999 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_Namespace.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_Namespace.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,7 +38,7 @@ import org.onap.aaf.misc.env.APIException;
public class JU_Namespace {
Namespace namespace;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -56,9 +56,9 @@ public class JU_Namespace {
data.attrib.put("test", "test");
namespace = new Namespace(data);
}
-
-
-
+
+
+
@Test
public void testSecondConstructor() {
@@ -72,10 +72,10 @@ public class JU_Namespace {
namespace = new Namespace(data,owner, admin);
data.attrib.put("test", "test");
namespace = new Namespace(data ,owner, admin);
-
+
NsDAO.Data retData = namespace.data();
assertTrue(retData.name.equals("name"));
-
+
}
@Test
public void testBytify() {
@@ -101,5 +101,5 @@ public class JU_Namespace {
nameObj = new Namespace(data);
assertTrue(namespace.equals(nameObj));
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_NsDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_NsDAO.java
index 9be4f5a2..3923d7e4 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_NsDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_NsDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -76,7 +76,7 @@ public class JU_NsDAO {
Session session;
@Mock
ResultSet rs;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -105,18 +105,18 @@ public class JU_NsDAO {
e.printStackTrace();
}
}
-
+
public void setPsByStartAndTarget(NsDAO NsDAOObj, PSInfo psInfoObj, String fieldName) {
Field nsDaoField;
try {
nsDaoField = NsDAO.class.getDeclaredField(fieldName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(NsDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -129,7 +129,7 @@ public class JU_NsDAO {
e.printStackTrace();
}
}
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -141,13 +141,13 @@ public class JU_NsDAO {
Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).error();
Mockito.doNothing().when(tt).done();
NsDAO.Data data = new NsDAO.Data();
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
CacheInfoDAO cacheInfoDAO = Mockito.mock(CacheInfoDAO.class);
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(Mockito.any(), Mockito.anyString(), Mockito.anyInt());
-
+
NsDAO daoObj = null;
try {
daoObj = new NsDAO(trans, historyDAO, cacheInfoDAO);
@@ -156,17 +156,17 @@ public class JU_NsDAO {
e.printStackTrace();
}
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
+
daoObj.wasModified(trans, CRUD.create, data, new String[] {});
daoObj.wasModified(trans, CRUD.create, data, new String[] {null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test",null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
-
+
rs1 = new Result<ResultSet>(null,1,"test",new Object[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
}
-
+
@Test
public void testSecondConstructor() {
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
@@ -178,7 +178,7 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
}
@Test
@@ -191,15 +191,15 @@ public class JU_NsDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
-
+
try {
-
+
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
NsDAO.Data data = new NsDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -208,16 +208,16 @@ public class JU_NsDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {NsDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {NsDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {NsDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
innnerClassMtd = innerClass.getDeclaredMethod("marshal", new Class[] {NsDAO.Data.class, DataOutputStream.class });
@@ -227,7 +227,7 @@ public class JU_NsDAO {
DataInputStream dis = new DataInputStream(bais);
innnerClassMtd = innerClass.getDeclaredMethod("unmarshal", new Class[] {NsDAO.Data.class, DataInputStream.class });
innnerClassMtd.invoke(obj, new Object[] {data, dis });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -246,7 +246,7 @@ public class JU_NsDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
@Test
public void testCreate() {
@@ -267,7 +267,7 @@ public class JU_NsDAO {
e.printStackTrace();
}
Mockito.doReturn("test user").when(trans).user();
-
+
Result<NsDAO.Data> retVal = daoObj.create(trans,data);
assertTrue(retVal.status == 4);
@@ -278,7 +278,7 @@ public class JU_NsDAO {
data.parent = "parent";
data.attrib = new HashMap<>();
data.attrib.put("test", "test");
-
+
Field cbField;
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(Mockito.any(), Mockito.anyString(), Mockito.anyInt());
try {
@@ -295,10 +295,10 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
retVal = daoObj.create(trans,data);
assertTrue(retVal.status == 9);
-
+
Field owningField;
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(Mockito.any(), Mockito.anyString(), Mockito.anyInt());
try {
@@ -317,9 +317,9 @@ public class JU_NsDAO {
}
retVal = daoObj.create(trans,data);
assertTrue(retVal.status == 0);
-
+
}
-
+
@Test
public void testUpdate() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -340,7 +340,7 @@ public class JU_NsDAO {
e.printStackTrace();
}
Mockito.doReturn("test user").when(trans).user();
-
+
Result<Void> retVal = daoObj.update(trans,data);
assertTrue(retVal.status == 4);
@@ -367,10 +367,10 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
retVal = daoObj.update(trans,data);
assertTrue(retVal.status == 0);
-
+
ResultSet rsMock = Mockito.mock(ResultSet.class);
Iterator<Row> iteMock = Mockito.mock(Iterator.class);
Mockito.doReturn(iteMock).when(rsMock).iterator();
@@ -382,7 +382,7 @@ public class JU_NsDAO {
retVal = daoObj.update(trans,data);
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testRead() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -408,7 +408,7 @@ public class JU_NsDAO {
e.printStackTrace();
}
Mockito.doReturn("test user").when(trans).user();
-
+
Result<List<Data>> retVal = daoObj.read(trans,data);
assertTrue(retVal.status == 0);
@@ -436,7 +436,7 @@ public class JU_NsDAO {
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testReadByObject() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -462,7 +462,7 @@ public class JU_NsDAO {
e.printStackTrace();
}
Mockito.doReturn("test user").when(trans).user();
-
+
Result<List<Data>> retVal = daoObj.read(trans,new Object[] {});
assertTrue(retVal.status == 0);
@@ -490,7 +490,7 @@ public class JU_NsDAO {
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testDelete() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -533,7 +533,7 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Result<Void> retVal = daoObj.delete(trans,data, false);
assertTrue(retVal.status == 0);
@@ -541,12 +541,12 @@ public class JU_NsDAO {
dataAL.add(data);
rs1 = new Result<List<Data>>(dataAL,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "NsDAOImpl READ", data);
-
+
retVal = daoObj.delete(trans,data, false);
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testReadNsByAttrib() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -560,7 +560,7 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -572,7 +572,7 @@ public class JU_NsDAO {
Mockito.doReturn(rs1).when(psObj).read(trans, "NsDAOImpl READ", data);
Mockito.doReturn(rs1).when(psObj).exec(trans, "NsDAOImpl DELETE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Mockito.doReturn("test user").when(trans).user();
Field cbField;
try {
@@ -589,10 +589,10 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Result<Set<String>> retVal = daoObj.readNsByAttrib(trans,"test");
assertTrue(retVal.status == 0);
-
+
ResultSet rsMock = Mockito.mock(ResultSet.class);
Iterator<Row> iteMock = Mockito.mock(Iterator.class);
Mockito.doReturn(iteMock).when(rsMock).iterator();
@@ -619,7 +619,7 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -631,7 +631,7 @@ public class JU_NsDAO {
Mockito.doReturn(rs1).when(psObj).read(trans, "NsDAOImpl READ", data);
Mockito.doReturn(rs1).when(psObj).exec(trans, "NsDAOImpl DELETE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Mockito.doReturn("test user").when(trans).user();
Field cbField;
try {
@@ -648,11 +648,11 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Result<Void> retVal = daoObj.attribAdd(trans, "test", "test", "test");
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testAttribRemove() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -666,7 +666,7 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -678,7 +678,7 @@ public class JU_NsDAO {
Mockito.doReturn(rs1).when(psObj).read(trans, "NsDAOImpl READ", data);
Mockito.doReturn(rs1).when(psObj).exec(trans, "NsDAOImpl DELETE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Mockito.doReturn("test user").when(trans).user();
Field cbField;
try {
@@ -695,11 +695,11 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Result<Void> retVal = daoObj.attribRemove(trans, "test", "test");
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testAddDescription() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -713,7 +713,7 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -744,11 +744,11 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Result<Void> retVal = daoObj.addDescription(trans, "test", "test");
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testGetChildren() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -761,11 +761,11 @@ public class JU_NsDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Result<List<Data>> retVal = daoObj.getChildren(trans, "test");
assertNull(retVal);
}
-
+
@Test
public void testData() {
NsDAO.Data data = new NsDAO.Data();
@@ -778,10 +778,10 @@ public class JU_NsDAO {
data.attrib(false);
data.attrib = new ConcurrentHashMap<>();
data.attrib(true);
-
+
data.name="123";
data.split("test");
-
+
data.toString();
}
@@ -789,12 +789,12 @@ public class JU_NsDAO {
class NsDAOImpl extends NsDAO{
-
+
// public NsDAOImpl(AuthzTrans trans, HistoryDAO historyDAO,PSInfo readPS ) throws APIException, IOException {
// super(trans, historyDAO);
// setSession(this, Mockito.mock(Session.class));
// }
-
+
public NsDAOImpl(AuthzTrans trans, Cluster cluster, String keySpace, Session session)throws APIException, IOException {
super(trans, cluster, keySpace);
@@ -816,13 +816,13 @@ class NsDAOImpl extends NsDAO{
Field nsDaoField;
try {
nsDaoField = NsDAO.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(NsDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -840,13 +840,13 @@ class NsDAOImpl extends NsDAO{
Field nsDaoField;
try {
nsDaoField = CassDAOImpl.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(NsDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -863,13 +863,13 @@ class NsDAOImpl extends NsDAO{
Field nsDaoField;
try {
nsDaoField = AbsCassDAO.class.getDeclaredField("session");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(approvalDaoObj, session);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_OAuthTokenDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_OAuthTokenDAO.java
index 5c158b6a..93c595d4 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_OAuthTokenDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_OAuthTokenDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -63,7 +63,7 @@ public class JU_OAuthTokenDAO {
AuthzTrans trans;
@Mock
Cluster cluster;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -77,27 +77,27 @@ public class JU_OAuthTokenDAO {
@Test
public void testReadByUser() {
OAuthTokenDAO daoObj = new OAuthTokenDAO(trans, cluster, "test");
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psByUser");
-
+
Result<List<OAuthTokenDAO.Data>> rs1 = new Result<List<OAuthTokenDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "OAuthTokenDAO READ", new Object[]{"test"});
-
+
daoObj.readByUser(trans, "test");
}
-
+
public void setPsByStartAndTarget(OAuthTokenDAO OAuthTokenDAOObj, PSInfo psInfoObj, String fieldName) {
Field nsDaoField;
try {
nsDaoField = OAuthTokenDAO.class.getDeclaredField(fieldName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(OAuthTokenDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -110,7 +110,7 @@ public class JU_OAuthTokenDAO {
e.printStackTrace();
}
}
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -126,15 +126,15 @@ public class JU_OAuthTokenDAO {
OAuthTokenDAO daoObj = null;
daoObj = new OAuthTokenDAO(trans, cluster, "test" );
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
+
}
-
+
@Test
public void testSecondConstructor() {
AbsCassDAO absCassDAO = Mockito.mock(AbsCassDAO.class);
OAuthTokenDAO daoObj = new OAuthTokenDAO(trans, absCassDAO);
-
+
}
@Test
@@ -149,15 +149,15 @@ public class JU_OAuthTokenDAO {
data.scopes(false);
data.scopes = new ConcurrentHashSet<>();
data.scopes(true);
-
+
data.expires = new Date();
data.user="test";
data.id="id";
data.toString();
-
+
data.active=true;
data.toString();
-
+
try {
ByteBuffer bb = data.bytify();
data.reconstitute(bb);
@@ -176,15 +176,15 @@ public class JU_OAuthTokenDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
-
+
try {
-
+
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
OAuthTokenDAO.Data data = new OAuthTokenDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -193,16 +193,16 @@ public class JU_OAuthTokenDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {OAuthTokenDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {OAuthTokenDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {OAuthTokenDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test","test"} });
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
innnerClassMtd = innerClass.getDeclaredMethod("marshal", new Class[] {OAuthTokenDAO.Data.class, DataOutputStream.class });
@@ -212,7 +212,7 @@ public class JU_OAuthTokenDAO {
DataInputStream dis = new DataInputStream(bais);
innnerClassMtd = innerClass.getDeclaredMethod("unmarshal", new Class[] {OAuthTokenDAO.Data.class, DataInputStream.class });
innnerClassMtd.invoke(obj, new Object[] {data, dis });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -231,31 +231,31 @@ public class JU_OAuthTokenDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
}
class OAuthTokenDAOImpl extends OAuthTokenDAO{
-
+
public OAuthTokenDAOImpl(AuthzTrans trans, HistoryDAO historyDAO,PSInfo readPS ) throws APIException, IOException {
super(trans, historyDAO);
setPs(this, readPS, "createPS");
}
-
+
public void setPs(OAuthTokenDAOImpl OAuthTokenDAOObj, PSInfo psInfoObj, String methodName) {
Field nsDaoField;
try {
nsDaoField = CassDAOImpl.class.getDeclaredField(methodName);
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(OAuthTokenDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -268,5 +268,5 @@ class OAuthTokenDAOImpl extends OAuthTokenDAO{
e.printStackTrace();
}
}
-
+
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_PermDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_PermDAO.java
index 57f39922..28f92890 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_PermDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_PermDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -69,7 +69,7 @@ public class JU_PermDAO {
Cluster cluster;
@Mock
Session session;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -114,13 +114,13 @@ public class JU_PermDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psByType");
-
+
Result<List<PermDAO.Data>> rs1 = new Result<List<PermDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "PermDAO READ", new Object[]{"test"});
-
+
daoObj.readByType(trans, "test", "test");
}
@Test
@@ -138,13 +138,13 @@ public class JU_PermDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psChildren");
-
+
Result<List<PermDAO.Data>> rs1 = new Result<List<PermDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "PermDAO READ", new Object[]{"test"});
-
+
daoObj.readChildren(trans, "test", "test");
}
@Test
@@ -162,13 +162,13 @@ public class JU_PermDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psNS");
-
+
Result<List<PermDAO.Data>> rs1 = new Result<List<PermDAO.Data>>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "PermDAO READ", new Object[]{"test"});
-
+
daoObj.readNS(trans, "test");
}
@Test
@@ -190,7 +190,7 @@ public class JU_PermDAO {
Mockito.doReturn(tt).when(trans).start("Clear Reset Deque", Env.SUB);
Mockito.doReturn(tt).when(trans).start("New Cassandra Session", Env.SUB);
Mockito.doReturn(tt).when(trans).start("Preparing PSInfo CREATE on PermDAO", Env.SUB);
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -202,10 +202,10 @@ public class JU_PermDAO {
Mockito.doReturn(rs1).when(psObj).read(trans, "PermDAOImpl READ", data);
Mockito.doReturn(rs1).when(psObj).exec(trans, "PermDAOImpl DELETE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Result<Void> rs2 = new Result<Void>(null,0,"test",new String[0]);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
-
+
rs1 = new Result<List<Data>>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(Mockito.any(), Mockito.anyString(), Mockito.anyInt());
Mockito.doReturn("test user").when(trans).user();
@@ -224,11 +224,11 @@ public class JU_PermDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PermDAO.Data perm = new PermDAO.Data();
Result<Void> retVal = daoObj.addRole(trans, perm, "test");
assertTrue(retVal.status == 9);
-
+
Field owningField;
try {
owningField = AbsCassDAO.class.getDeclaredField("owningDAO");
@@ -247,7 +247,7 @@ public class JU_PermDAO {
retVal = daoObj.addRole(trans, perm, "test");
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testDelRole() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -267,7 +267,7 @@ public class JU_PermDAO {
Mockito.doReturn(tt).when(trans).start("Clear Reset Deque", Env.SUB);
Mockito.doReturn(tt).when(trans).start("New Cassandra Session", Env.SUB);
Mockito.doReturn(tt).when(trans).start("Preparing PSInfo CREATE on PermDAO", Env.SUB);
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -279,14 +279,14 @@ public class JU_PermDAO {
Mockito.doReturn(rs1).when(psObj).read(trans, "PermDAOImpl READ", data);
Mockito.doReturn(rs1).when(psObj).exec(trans, "PermDAOImpl DELETE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Result<Void> rs2 = new Result<Void>(null,0,"test",new String[0]);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
-
+
rs1 = new Result<List<Data>>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(Mockito.any(), Mockito.anyString(), Mockito.anyInt());
Mockito.doReturn("test user").when(trans).user();
-
+
PermDAO.Data perm = new PermDAO.Data();
Field cbField;
try {
@@ -303,10 +303,10 @@ public class JU_PermDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Result<Void> retVal = daoObj.delRole(trans, perm, "test");
assertTrue(retVal.status == 9);
-
+
Field owningDaoField;
try {
owningDaoField = AbsCassDAO.class.getDeclaredField("owningDAO");
@@ -325,7 +325,7 @@ public class JU_PermDAO {
retVal = daoObj.delRole(trans, perm, "test");
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testAddDescription() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -345,7 +345,7 @@ public class JU_PermDAO {
Mockito.doReturn(tt).when(trans).start("Clear Reset Deque", Env.SUB);
Mockito.doReturn(tt).when(trans).start("New Cassandra Session", Env.SUB);
Mockito.doReturn(tt).when(trans).start("Preparing PSInfo CREATE on PermDAO", Env.SUB);
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -357,14 +357,14 @@ public class JU_PermDAO {
Mockito.doReturn(rs1).when(psObj).read(trans, "PermDAOImpl READ", data);
Mockito.doReturn(rs1).when(psObj).exec(trans, "PermDAOImpl DELETE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Result<Void> rs2 = new Result<Void>(null,1,"test",new String[0]);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
-
+
rs1 = new Result<List<Data>>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(Mockito.any(), Mockito.anyString(), Mockito.anyInt());
Mockito.doReturn("test user").when(trans).user();
-
+
PermDAO.Data perm = new PermDAO.Data();
Field cbField;
try {
@@ -381,10 +381,10 @@ public class JU_PermDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Result<Void> retVal = daoObj.addDescription(trans, "test", "test", "test", "test", "test");
assertTrue(retVal.status == 9);
-
+
Field owningDaoField;
try {
owningDaoField = AbsCassDAO.class.getDeclaredField("owningDAO");
@@ -403,18 +403,18 @@ public class JU_PermDAO {
retVal = daoObj.addDescription(trans, "test", "test", "test", "test", "test");
assertTrue(retVal.status == 0);
}
-
+
public void setPsByStartAndTarget(PermDAO PermDAOObj, PSInfo psInfoObj, String fieldName) {
Field PermDAOField;
try {
PermDAOField = PermDAO.class.getDeclaredField(fieldName);
-
+
PermDAOField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(PermDAOField, PermDAOField.getModifiers() & ~Modifier.FINAL);
-
+
PermDAOField.set(PermDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -427,7 +427,7 @@ public class JU_PermDAO {
e.printStackTrace();
}
}
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -440,15 +440,15 @@ public class JU_PermDAO {
Mockito.doNothing().when(tt).done();
PermDAO.Data data = new PermDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Result<Void> rs2 = new Result<Void>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
CacheInfoDAO cacheInfoDAO = Mockito.mock(CacheInfoDAO.class);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
-
+
PermDAOImpl daoObj = null;
try {
daoObj = new PermDAOImpl(trans, historyDAO, cacheInfoDAO, createPS );
@@ -457,24 +457,24 @@ public class JU_PermDAO {
e.printStackTrace();
}
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
+
daoObj.wasModified(trans, CRUD.create, data, new String[] {});
daoObj.wasModified(trans, CRUD.create, data, new String[] {null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test",null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
-
+
rs1 = new Result<ResultSet>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
daoObj.wasModified(trans, CRUD.delete, data, new String[] {"test","test"});
}
-
+
@Test
public void testSecondConstructor() {
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
CacheInfoDAO cacheInfoDAO = Mockito.mock(CacheInfoDAO.class);
PermDAO daoObj = new PermDAO(trans, historyDAO, cacheInfoDAO);
-
+
}
@Test
@@ -487,15 +487,15 @@ public class JU_PermDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
-
+
try {
-
+
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
PermDAO.Data data = new PermDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -504,16 +504,16 @@ public class JU_PermDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {PermDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {PermDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {PermDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
innnerClassMtd = innerClass.getDeclaredMethod("marshal", new Class[] {PermDAO.Data.class, DataOutputStream.class });
@@ -523,7 +523,7 @@ public class JU_PermDAO {
DataInputStream dis = new DataInputStream(bais);
innnerClassMtd = innerClass.getDeclaredMethod("unmarshal", new Class[] {PermDAO.Data.class, DataInputStream.class });
innnerClassMtd.invoke(obj, new Object[] {data, dis });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -542,21 +542,21 @@ public class JU_PermDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testData() {
PermDAO.Data data = new PermDAO.Data();
NsSplit nss = new NsSplit("test", "test");
data = new PermDAO.Data(nss, "test", "test");
-
+
data.toString();
-
+
assertTrue("test.test|test|test".equalsIgnoreCase(data.fullPerm()));
-
+
Question q = Mockito.mock( Question.class);
-
+
Result<NsSplit> rs = new Result<NsSplit>(nss,0,"test",new Object[0]);
Mockito.doReturn(rs).when(q).deriveNsSplit(trans, "test");
Result<Data> retVal= PermDAO.Data.decode(trans, q, "test|||");
@@ -566,7 +566,7 @@ public class JU_PermDAO {
retVal= PermDAO.Data.decode(trans, q, "test||");
retVal1= PermDAO.Data.decodeToArray(trans, q, "test||");
assertTrue(retVal.status==0);
-
+
rs = new Result<NsSplit>(nss,1,"test",new Object[0]);
Mockito.doReturn(rs).when(q).deriveNsSplit(trans, "test");
retVal= PermDAO.Data.decode(trans, q, "test||");
@@ -576,7 +576,7 @@ public class JU_PermDAO {
retVal= PermDAO.Data.decode(trans, q, "test|");
retVal1= PermDAO.Data.decodeToArray(trans, q, "test|");
assertTrue(retVal.status==4);
-
+
NsDAO.Data ns = new NsDAO.Data();
ns.name="test";
PermDAO.Data.create(ns, "test");
@@ -586,7 +586,7 @@ public class JU_PermDAO {
Mockito.doReturn(rs).when(q).deriveNsSplit(trans, "test");
PermDAO.Data.create(trans,q, "test|test|test|test");
}
-
+
}
class PermDAOImpl extends PermDAO{
@@ -594,25 +594,25 @@ class PermDAOImpl extends PermDAO{
super(trans, historyDAO, cacheDao);
setPs(this, readPS, "createPS");
}
-
+
public PermDAOImpl(AuthzTrans trans, HistoryDAO historyDAO,CacheInfoDAO cacheDao, PSInfo readPS, Session session ) throws APIException, IOException {
super(trans, historyDAO, cacheDao);
setPs(this, readPS, "createPS");
setSession(this, session);
}
-
+
public void setPs(PermDAOImpl PermDAOObj, PSInfo psInfoObj, String methodName) {
Field PermDAOField;
try {
PermDAOField = CassDAOImpl.class.getDeclaredField(methodName);
-
+
PermDAOField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(PermDAOField, PermDAOField.getModifiers() & ~Modifier.FINAL);
-
+
PermDAOField.set(PermDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -625,18 +625,18 @@ class PermDAOImpl extends PermDAO{
e.printStackTrace();
}
}
-
+
public void setSession(PermDAOImpl approvalDaoObj, Session session) {
Field nsDaoField;
try {
nsDaoField = AbsCassDAO.class.getDeclaredField("session");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(approvalDaoObj, session);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_RoleDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_RoleDAO.java
index 4057a6ed..f91fac44 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_RoleDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_RoleDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -70,7 +70,7 @@ public class JU_RoleDAO {
Cluster cluster;
@Mock
Session session;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -113,13 +113,13 @@ public class JU_RoleDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psName");
-
+
Result<List<RoleDAO.Data>> rs1 = new Result<List<RoleDAO.Data>>(null,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "RoleDAO READ", new Object[]{"test"});
-
+
daoObj.readName(trans, "test");
}
@Test
@@ -136,15 +136,15 @@ public class JU_RoleDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psChildren");
-
+
Result<List<RoleDAO.Data>> rs1 = new Result<List<RoleDAO.Data>>(null,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "RoleDAO READ", new Object[]{"test"});
-
+
daoObj.readChildren(trans, "test", "test");
-
+
daoObj.readChildren(trans, "test", "*");
daoObj.readChildren(trans, "test", "");
}
@@ -162,13 +162,13 @@ public class JU_RoleDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psNS");
-
+
Result<List<RoleDAO.Data>> rs1 = new Result<List<RoleDAO.Data>>(null,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "RoleDAO READ", new Object[]{"test"});
-
+
daoObj.readNS(trans, "test");
}
@Test
@@ -190,7 +190,7 @@ public class JU_RoleDAO {
Mockito.doReturn(tt).when(trans).start("Clear Reset Deque", Env.SUB);
Mockito.doReturn(tt).when(trans).start("New Cassandra Session", Env.SUB);
Mockito.doReturn(tt).when(trans).start("Preparing PSInfo CREATE on RoleDAO", Env.SUB);
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -202,10 +202,10 @@ public class JU_RoleDAO {
Mockito.doReturn(rs1).when(psObj).read(trans, "RoleDAOImpl READ", data);
Mockito.doReturn(rs1).when(psObj).exec(trans, "RoleDAOImpl DELETE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Result<Void> rs2 = new Result<Void>(null,0,"test",new Object[0]);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
-
+
rs1 = new Result<List<Data>>(null,1,"test",new Object[0]);
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(Mockito.any(), Mockito.anyString(), Mockito.anyInt());
Mockito.doReturn("test user").when(trans).user();
@@ -224,12 +224,12 @@ public class JU_RoleDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PermDAO.Data perm = new PermDAO.Data();
RoleDAO.Data role = new RoleDAO.Data();
Result<Void> retVal = daoObj.addPerm(trans, role, perm);
assertTrue(retVal.status == 9);
-
+
Field owningField;
try {
owningField = AbsCassDAO.class.getDeclaredField("owningDAO");
@@ -248,7 +248,7 @@ public class JU_RoleDAO {
retVal = daoObj.addPerm(trans, role, perm);
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testDelRole() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -268,7 +268,7 @@ public class JU_RoleDAO {
Mockito.doReturn(tt).when(trans).start("Clear Reset Deque", Env.SUB);
Mockito.doReturn(tt).when(trans).start("New Cassandra Session", Env.SUB);
Mockito.doReturn(tt).when(trans).start("Preparing PSInfo CREATE on RoleDAO", Env.SUB);
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -280,14 +280,14 @@ public class JU_RoleDAO {
Mockito.doReturn(rs1).when(psObj).read(trans, "RoleDAOImpl READ", data);
Mockito.doReturn(rs1).when(psObj).exec(trans, "RoleDAOImpl DELETE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Result<Void> rs2 = new Result<Void>(null,0,"test",new String[0]);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
-
+
rs1 = new Result<List<Data>>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(Mockito.any(), Mockito.anyString(), Mockito.anyInt());
Mockito.doReturn("test user").when(trans).user();
-
+
PermDAO.Data perm = new PermDAO.Data();
Field cbField;
try {
@@ -307,7 +307,7 @@ public class JU_RoleDAO {
RoleDAO.Data role = new RoleDAO.Data();
Result<Void> retVal = daoObj.delPerm(trans, role, perm);
assertTrue(retVal.status == 9);
-
+
Field owningDaoField;
try {
owningDaoField = AbsCassDAO.class.getDeclaredField("owningDAO");
@@ -326,7 +326,7 @@ public class JU_RoleDAO {
retVal = daoObj.delPerm(trans,role, perm);
assertTrue(retVal.status == 0);
}
-
+
@Test
public void testAddDescription() {
PSInfo psObj = Mockito.mock(PSInfo.class);
@@ -346,7 +346,7 @@ public class JU_RoleDAO {
Mockito.doReturn(tt).when(trans).start("Clear Reset Deque", Env.SUB);
Mockito.doReturn(tt).when(trans).start("New Cassandra Session", Env.SUB);
Mockito.doReturn(tt).when(trans).start("Preparing PSInfo CREATE on RoleDAO", Env.SUB);
-
+
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"100");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_PORT,"9042");
Mockito.doReturn("100").when(trans).getProperty(CassAccess.CASSANDRA_CLUSTERS_USER_NAME,"100");
@@ -358,14 +358,14 @@ public class JU_RoleDAO {
Mockito.doReturn(rs1).when(psObj).read(trans, "RoleDAOImpl READ", data);
Mockito.doReturn(rs1).when(psObj).exec(trans, "RoleDAOImpl DELETE", data);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
Result<Void> rs2 = new Result<Void>(null,1,"test",new String[0]);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
-
+
rs1 = new Result<List<Data>>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(cacheInfoDAO).touch(Mockito.any(), Mockito.anyString(), Mockito.anyInt());
Mockito.doReturn("test user").when(trans).user();
-
+
RoleDAO.Data perm = new RoleDAO.Data();
Field cbField;
try {
@@ -382,10 +382,10 @@ public class JU_RoleDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Result<Void> retVal = daoObj.addDescription(trans, "test", "test", "test");
assertTrue(retVal.status == 9);
-
+
Field owningDaoField;
try {
owningDaoField = AbsCassDAO.class.getDeclaredField("owningDAO");
@@ -404,18 +404,18 @@ public class JU_RoleDAO {
retVal = daoObj.addDescription(trans, "test", "test", "test");
assertTrue(retVal.status == 0);
}
-
+
public void setPsByStartAndTarget(RoleDAO RoleDAOObj, PSInfo psInfoObj, String fieldName) {
Field RoleDAOField;
try {
RoleDAOField = RoleDAO.class.getDeclaredField(fieldName);
-
+
RoleDAOField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(RoleDAOField, RoleDAOField.getModifiers() & ~Modifier.FINAL);
-
+
RoleDAOField.set(RoleDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -428,7 +428,7 @@ public class JU_RoleDAO {
e.printStackTrace();
}
}
-
+
@Test
public void testWasModified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -441,15 +441,15 @@ public class JU_RoleDAO {
Mockito.doNothing().when(tt).done();
RoleDAO.Data data = new RoleDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new String[0]);
Result<Void> rs2 = new Result<Void>(null,0,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
CacheInfoDAO cacheInfoDAO = Mockito.mock(CacheInfoDAO.class);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
-
+
RoleDAOImpl daoObj = null;
try {
daoObj = new RoleDAOImpl(trans, historyDAO, cacheInfoDAO, createPS );
@@ -458,24 +458,24 @@ public class JU_RoleDAO {
e.printStackTrace();
}
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
+
daoObj.wasModified(trans, CRUD.create, data, new String[] {});
daoObj.wasModified(trans, CRUD.create, data, new String[] {null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test",null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test","test"});
-
+
rs1 = new Result<ResultSet>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
daoObj.wasModified(trans, CRUD.delete, data, new String[] {"test","test"});
}
-
+
@Test
public void testSecondConstructor() {
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
CacheInfoDAO cacheInfoDAO = Mockito.mock(CacheInfoDAO.class);
RoleDAO daoObj = new RoleDAO(trans, historyDAO, cacheInfoDAO);
-
+
}
@Test
@@ -488,15 +488,15 @@ public class JU_RoleDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
-
+
try {
-
+
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
RoleDAO.Data data = new RoleDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -505,16 +505,16 @@ public class JU_RoleDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {RoleDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {RoleDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {RoleDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
innnerClassMtd = innerClass.getDeclaredMethod("marshal", new Class[] {RoleDAO.Data.class, DataOutputStream.class });
@@ -524,7 +524,7 @@ public class JU_RoleDAO {
DataInputStream dis = new DataInputStream(bais);
innnerClassMtd = innerClass.getDeclaredMethod("unmarshal", new Class[] {RoleDAO.Data.class, DataInputStream.class });
innnerClassMtd.invoke(obj, new Object[] {data, dis });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -543,20 +543,20 @@ public class JU_RoleDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testData() {
RoleDAO.Data data = new RoleDAO.Data();
NsSplit nss = new NsSplit("test", "test");
data = new RoleDAO.Data();
-
+
data.toString();
-
-
+
+
Question q = Mockito.mock( Question.class);
-
+
Result<NsSplit> rs = new Result<NsSplit>(nss,0,"test",new Object[0]);
Mockito.doReturn(rs).when(q).deriveNsSplit(trans, "test");
Result<Data> retVal= RoleDAO.Data.decode(trans, q, "test|||");
@@ -566,7 +566,7 @@ public class JU_RoleDAO {
retVal= RoleDAO.Data.decode(trans, q, "test");
retVal1= RoleDAO.Data.decodeToArray(trans, q, "test");
assertTrue(retVal.status==0);
-
+
rs = new Result<NsSplit>(nss,1,"test",new Object[0]);
Mockito.doReturn(rs).when(q).deriveNsSplit(trans, "test");
retVal= RoleDAO.Data.decode(trans, q, "test");
@@ -576,7 +576,7 @@ public class JU_RoleDAO {
retVal= RoleDAO.Data.decode(trans, q, "test");
retVal1= RoleDAO.Data.decodeToArray(trans, q, "test");
assertTrue(retVal.status==1);
-
+
NsDAO.Data ns = new NsDAO.Data();
ns.name="test";
RoleDAO.Data.create(ns, "test");
@@ -585,9 +585,9 @@ public class JU_RoleDAO {
urdd.ns="test";
RoleDAO.Data dd=RoleDAO.Data.decode(urdd);
assertTrue("test".equals(dd.ns));
-
+
assertTrue(data.encode().contains("null"));
-
+
data.perms = null;
data.perms(true);
@@ -598,7 +598,7 @@ public class JU_RoleDAO {
data.perms = new TreeSet<>();
data.perms(true);
}
-
+
}
class RoleDAOImpl extends RoleDAO{
@@ -606,25 +606,25 @@ class RoleDAOImpl extends RoleDAO{
super(trans, historyDAO, cacheDao);
setPs(this, readPS, "createPS");
}
-
+
public RoleDAOImpl(AuthzTrans trans, HistoryDAO historyDAO,CacheInfoDAO cacheDao, PSInfo readPS, Session session ) throws APIException, IOException {
super(trans, historyDAO, cacheDao);
setPs(this, readPS, "createPS");
setSession(this, session);
}
-
+
public void setPs(RoleDAOImpl RoleDAOObj, PSInfo psInfoObj, String methodName) {
Field RoleDAOField;
try {
RoleDAOField = CassDAOImpl.class.getDeclaredField(methodName);
-
+
RoleDAOField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(RoleDAOField, RoleDAOField.getModifiers() & ~Modifier.FINAL);
-
+
RoleDAOField.set(RoleDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -637,18 +637,18 @@ class RoleDAOImpl extends RoleDAO{
e.printStackTrace();
}
}
-
+
public void setSession(RoleDAOImpl approvalDaoObj, Session session) {
Field nsDaoField;
try {
nsDaoField = AbsCassDAO.class.getDeclaredField("session");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(approvalDaoObj, session);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_UserRoleDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_UserRoleDAO.java
index 43496fd5..22824fd5 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_UserRoleDAO.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/cass/JU_UserRoleDAO.java
@@ -7,9 +7,9 @@
* 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.
@@ -66,7 +66,7 @@ public class JU_UserRoleDAO {
Cluster cluster;
@Mock
Session session;
-
+
@Before
public void setUp() throws APIException, IOException {
initMocks(this);
@@ -109,13 +109,13 @@ public class JU_UserRoleDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psByUser");
-
+
Result<List<UserRoleDAO.Data>> rs1 = new Result<List<UserRoleDAO.Data>>(null,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "UserRoleDAO READ", new Object[]{"test"});
-
+
daoObj.readByUser(trans, "test");
}
@Test
@@ -132,13 +132,13 @@ public class JU_UserRoleDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psByRole");
-
+
Result<List<UserRoleDAO.Data>> rs1 = new Result<List<UserRoleDAO.Data>>(null,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "UserRoleDAO READ", new Object[]{"test"});
-
+
daoObj.readByRole(trans, "test");
}
@Test
@@ -155,28 +155,28 @@ public class JU_UserRoleDAO {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
PSInfo psObj = Mockito.mock(PSInfo.class);
setPsByStartAndTarget(daoObj, psObj, "psUserInRole");
-
+
Result<List<UserRoleDAO.Data>> rs1 = new Result<List<UserRoleDAO.Data>>(null,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(psObj).read(trans, "UserRoleDAO READ", new Object[]{"test"});
-
+
daoObj.readByUserRole(trans, "test","test");
}
-
-
+
+
public void setPsByStartAndTarget(UserRoleDAO UserRoleDAOObj, PSInfo psInfoObj, String fieldName) {
Field UserRoleDAOField;
try {
UserRoleDAOField = UserRoleDAO.class.getDeclaredField(fieldName);
-
+
UserRoleDAOField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(UserRoleDAOField, UserRoleDAOField.getModifiers() & ~Modifier.FINAL);
-
+
UserRoleDAOField.set(UserRoleDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -189,7 +189,7 @@ public class JU_UserRoleDAO {
e.printStackTrace();
}
}
-
+
@Test
public void testWasMOdified() {
TimeTaken tt = Mockito.mock(TimeTaken.class);
@@ -202,15 +202,15 @@ public class JU_UserRoleDAO {
Mockito.doNothing().when(tt).done();
UserRoleDAO.Data data = new UserRoleDAO.Data();
PSInfo createPS = Mockito.mock(PSInfo.class);
-
+
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
Result<ResultSet> rs1 = new Result<ResultSet>(null,0,"test",new Object[0]);
Result<Void> rs2 = new Result<Void>(null,0,"test",new Object[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
-
+
CacheInfoDAO cacheInfoDAO = Mockito.mock(CacheInfoDAO.class);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
-
+
UserRoleDAOImpl daoObj = null;
try {
daoObj = new UserRoleDAOImpl(trans, historyDAO, cacheInfoDAO, createPS );
@@ -219,7 +219,7 @@ public class JU_UserRoleDAO {
e.printStackTrace();
}
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test"});
-
+
daoObj.wasModified(trans, CRUD.update, data, new String[] {});
daoObj.wasModified(trans, CRUD.create, data, new String[] {null});
daoObj.wasModified(trans, CRUD.create, data, new String[] {"test",null});
@@ -227,24 +227,24 @@ public class JU_UserRoleDAO {
daoObj.wasModified(trans, CRUD.delete, data, new String[] {"test","test"});
daoObj.wasModified(trans, CRUD.delete, data, new String[] {});
-
+
rs2 = new Result<Void>(null,1,"test",new Object[0]);
Mockito.doReturn(rs2).when(cacheInfoDAO).touch(Mockito.any(AuthzTrans.class),Mockito.anyString(), Mockito.anyVararg());
daoObj.wasModified(trans, CRUD.read, data, new String[] {"test","test"});
daoObj.wasModified(trans, CRUD.read, data, new String[] {});
-
+
rs1 = new Result<ResultSet>(null,1,"test",new String[0]);
Mockito.doReturn(rs1).when(historyDAO).create(Mockito.any(), Mockito.any());
daoObj.wasModified(trans, CRUD.delete, data, new String[] {"test","test"});
}
-
+
@Test
public void testSecondConstructor() {
HistoryDAO historyDAO = Mockito.mock(HistoryDAO.class);
CacheInfoDAO cacheInfoDAO = Mockito.mock(CacheInfoDAO.class);
UserRoleDAO daoObj = new UserRoleDAO(trans, historyDAO, cacheInfoDAO);
-
+
}
@Test
@@ -257,15 +257,15 @@ public class JU_UserRoleDAO {
break;
}
}
-
+
Constructor<?> constructor = innerClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
-
+
try {
-
+
Object obj = constructor.newInstance(1);
Method innnerClassMtd;
-
+
UserRoleDAO.Data data = new UserRoleDAO.Data();
Row row = Mockito.mock(Row.class);
ByteBuffer bbObj = ByteBuffer.allocateDirect(10);
@@ -274,16 +274,16 @@ public class JU_UserRoleDAO {
bbObj.put(1, new Byte("1"));
bbObj.put(2, new Byte("2"));
Mockito.doReturn(bbObj).when(row).getBytesUnsafe(1);
-
+
innnerClassMtd = innerClass.getMethod("load", new Class[] {UserRoleDAO.Data.class, Row.class});
innnerClassMtd.invoke(obj, new Object[] {data, row});
-
+
innnerClassMtd = innerClass.getDeclaredMethod("key", new Class[] {UserRoleDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test"} });
-//
+//
innnerClassMtd = innerClass.getDeclaredMethod("body", new Class[] {UserRoleDAO.Data.class, Integer.TYPE, Object[].class });
innnerClassMtd.invoke(obj, new Object[] {data, 1, new Object[] {"test","test","test","test","test","test","test","test","test","test","test"} });
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
innnerClassMtd = innerClass.getDeclaredMethod("marshal", new Class[] {UserRoleDAO.Data.class, DataOutputStream.class });
@@ -293,7 +293,7 @@ public class JU_UserRoleDAO {
DataInputStream dis = new DataInputStream(bais);
innnerClassMtd = innerClass.getDeclaredMethod("unmarshal", new Class[] {UserRoleDAO.Data.class, DataInputStream.class });
innnerClassMtd.invoke(obj, new Object[] {data, dis });
-
+
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -312,36 +312,36 @@ public class JU_UserRoleDAO {
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testData() {
UserRoleDAO.Data data = new UserRoleDAO.Data();
NsSplit nss = new NsSplit("test", "test");
data = new UserRoleDAO.Data();
-
+
data.toString();
data.role("test", "test");
assertTrue("test".equals(data.ns));
-
+
RoleDAO.Data rdd = new RoleDAO.Data();
rdd.ns="test";
data.role(rdd);
assertTrue("test".equals(data.ns));
-
+
Question q = Mockito.mock( Question.class);
Result<NsSplit> rs = new Result<NsSplit>(nss,0,"test",new Object[0]);
Mockito.doReturn(rs).when(q).deriveNsSplit(trans, "test");
-
+
data.role(trans, q, "test");
-
+
rs = new Result<NsSplit>(nss,1,"test",new Object[0]);
Mockito.doReturn(rs).when(q).deriveNsSplit(trans, "test");
-
+
data.role(trans, q, "test");
}
-
+
}
class UserRoleDAOImpl extends UserRoleDAO{
@@ -349,25 +349,25 @@ class UserRoleDAOImpl extends UserRoleDAO{
super(trans, historyDAO, cacheDao);
setPs(this, readPS, "createPS");
}
-
+
public UserRoleDAOImpl(AuthzTrans trans, HistoryDAO historyDAO,CacheInfoDAO cacheDao, PSInfo readPS, Session session ) throws APIException, IOException {
super(trans, historyDAO, cacheDao);
setPs(this, readPS, "createPS");
setSession(this, session);
}
-
+
public void setPs(UserRoleDAOImpl UserRoleDAOObj, PSInfo psInfoObj, String methodName) {
Field UserRoleDAOField;
try {
UserRoleDAOField = CassDAOImpl.class.getDeclaredField(methodName);
-
+
UserRoleDAOField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(UserRoleDAOField, UserRoleDAOField.getModifiers() & ~Modifier.FINAL);
-
+
UserRoleDAOField.set(UserRoleDAOObj, psInfoObj);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
@@ -380,18 +380,18 @@ class UserRoleDAOImpl extends UserRoleDAO{
e.printStackTrace();
}
}
-
+
public void setSession(UserRoleDAOImpl approvalDaoObj, Session session) {
Field nsDaoField;
try {
nsDaoField = AbsCassDAO.class.getDeclaredField("session");
-
+
nsDaoField.setAccessible(true);
// remove final modifier from field
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
// modifiersField.setInt(nsDaoField, nsDaoField.getModifiers() & ~Modifier.FINAL);
-
+
nsDaoField.set(approvalDaoObj, session);
} catch (NoSuchFieldException | SecurityException e) {
// TODO Auto-generated catch block
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_CassExecutor.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_CassExecutor.java
index 6d029933..8305944f 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_CassExecutor.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_CassExecutor.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,24 +43,24 @@ import org.onap.aaf.cadi.Access;
import org.onap.aaf.cadi.CadiException;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.class)
public class JU_CassExecutor {
-
-
+
+
private static final Object NO_PARAM = new Object[0];
@Mock
AuthzTransImpl trans;
-
+
@Mock
Question q;
-
+
@Mock
Access access;
-
+
Function f;
-
+
@Before
public void setUp() throws Exception {
initMocks(this);
@@ -74,36 +74,36 @@ public class JU_CassExecutor {
}
f =new Function(trans, q);
}
-
+
@Test
public void testHasPermission() {
-
+
CassExecutor cassExecutorObj =new CassExecutor(trans, f);
Mockito.doReturn(false).when(q).isGranted(trans, "","","","","");
boolean retVal = cassExecutorObj.hasPermission("", "", "", "", "");
// System.out.println(retVal);
assertFalse(retVal);
- }
-
+ }
+
@Test
public void testInRole() {
-
+
CassExecutor cassExecutorObj =new CassExecutor(trans, f);
Result<NsSplit> retVal1 = new Result<NsSplit>(null,1,"",NO_PARAM);
Mockito.doReturn(retVal1).when(q).deriveNsSplit(trans, "test");
-
+
boolean retVal = cassExecutorObj.inRole("test");
// System.out.println(retVal);
assertFalse(retVal);
}
-
+
@Test
public void testNamespace() {
f =new Function(trans, q);
CassExecutor cassExecutorObj =new CassExecutor(trans, f);
Result<Data> retVal1 = new Result<Data>(null,1,"",NO_PARAM);
Mockito.doReturn(retVal1).when(q).validNSOfDomain(trans, null);
-
+
String retVal="";
try {
retVal = cassExecutorObj.namespace();
@@ -114,7 +114,7 @@ public class JU_CassExecutor {
System.out.println(retVal);
// assertFalse(retVal);
}
-
+
@Test
public void testId() {
Mockito.doReturn("").when(trans).user();
@@ -122,7 +122,7 @@ public class JU_CassExecutor {
String retVal = cassExecutorObj.id();
assertEquals("", retVal);
}
-
+
@Test
public void testNamespaceSuccess() {
Mockito.doAnswer(new Answer<Object>() {
@@ -139,8 +139,8 @@ public class JU_CassExecutor {
CassExecutor cassExecutorObj =new CassExecutor(trans, f);
Result<Data> retVal1 = new Result<Data>(null,0,"",NO_PARAM);
Mockito.doReturn(retVal1).when(q).validNSOfDomain(trans, null);
-
-
+
+
// String retVal="";
try {
/*retVal =*/ cassExecutorObj.namespace();
@@ -152,5 +152,5 @@ public class JU_CassExecutor {
// System.out.println(retVal);
// assertFalse(retVal);
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_Function.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_Function.java
index bfa5838c..cb52cf44 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_Function.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_Function.java
@@ -7,9 +7,9 @@
* * 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.
@@ -81,21 +81,21 @@ import org.onap.aaf.misc.env.LogTarget;
public class JU_Function {
private static final Object NO_PARAM = new Object[0];
-
+
@Mock
AuthzTrans trans;
@Mock
PropAccess access;
-
+
@Mock
Question ques;
-
- @Mock
+
+ @Mock
Organization org;
-
+
@Mock
CachedNSDAO nsDAO;
-
+
@Mock
CachedRoleDAO roleDAO;
@@ -131,7 +131,7 @@ public class JU_Function {
Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).debug();
Mockito.doReturn(Mockito.mock(Properties.class)).when(access).getProperties();
Mockito.doReturn("test.test").when(access).getProperty(Config.AAF_ROOT_NS,"org.osaaf.aaf");
-
+
try {
Define.set(access);
} catch (CadiException e) {
@@ -154,14 +154,14 @@ public class JU_Function {
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
Result<Void> retVal = new Result<Void>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
//setQuestion(ques, cachedNS);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.createNS(trans, namespace, true);
assertTrue(3 == result.status);
}
-
+
@Test
public void testCreateNsReadSuccess() {
Namespace namespace = Mockito.mock(Namespace.class);
@@ -172,50 +172,50 @@ public class JU_Function {
List<String> admin = new ArrayList<String>();
admin.add("test");
namespace.admin= admin;
-
+
Organization org = Mockito.mock(Organization.class);
Mockito.doReturn(org).when(trans).org();
-
+
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
Result<Void> retVal = new Result<Void>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.createNS(trans, namespace, true);
assertTrue(3 == result.status);
}
-
+
@Test
public void testCreateNsFromApprovaFalse() {
Namespace namespace = Mockito.mock(Namespace.class);
namespace.name = "test.test";
List<String> owner = new ArrayList<String>();
namespace.owner = owner;
-
+
Organization org = Mockito.mock(Organization.class);
Mockito.doReturn(org).when(trans).org();
-
+
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(data,1,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal1.value, Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.createNS(trans, namespace, false);
assertTrue(1 == result.status);
-
+
Mockito.doReturn(retVal2).when(ques).deriveNs(trans, "test");
funcObj = new Function(trans, ques);
result = funcObj.createNS(trans, namespace, false);
assertTrue(1 == result.status);
}
-
+
@Test
public void testCreateNsownerLoop() {
Namespace namespace = Mockito.mock(Namespace.class);
@@ -223,16 +223,16 @@ public class JU_Function {
List<String> owner = new ArrayList<String>();
owner.add("test");
namespace.owner = owner;
-
+
Organization org = Mockito.mock(Organization.class);
Mockito.doReturn(org).when(trans).org();
Mockito.doReturn(org).when(trans).org();
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.createNS(trans, namespace, true);
assertTrue(result.status == Status.ERR_Policy);
assertTrue(result.details.contains("is not a valid user at"));
-
+
Identity iden=Mockito.mock(Identity.class);
try {
Mockito.doReturn(iden).when(org).getIdentity(trans, "test");
@@ -249,7 +249,7 @@ public class JU_Function {
result = funcObj.createNS(trans, namespace, true);
assertTrue(result.status == Status.ERR_Policy);
assertTrue(result.details.contains("cannot be the owner of the namespace "));
-
+
Mockito.doReturn(true).when(org).isTestEnv();
try {
Mockito.doReturn("test").when(org).validate(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
@@ -261,7 +261,7 @@ public class JU_Function {
e.printStackTrace();
}
}
-
+
@Test
public void testCreateNsownerLoopException() {
Namespace namespace = Mockito.mock(Namespace.class);
@@ -269,12 +269,12 @@ public class JU_Function {
List<String> owner = new ArrayList<String>();
owner.add("test");
namespace.owner = owner;
-
+
Organization org = Mockito.mock(Organization.class);
Mockito.doReturn(org).when(trans).org();
-
+
Function funcObj = new Function(trans, ques);
-
+
Identity iden=Mockito.mock(Identity.class);
try {
Mockito.doThrow(new OrganizationException()).when(org).getIdentity(trans, "test");
@@ -283,26 +283,26 @@ public class JU_Function {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,1,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
-
+
Result<Void> result = funcObj.createNS(trans, namespace, true);
assertTrue(result.status == Status.ERR_Security);
assertTrue(result.details.contains("may not create Root Namespaces"));
-
+
Mockito.doReturn(true).when(ques).isGranted(Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, null);
-
+
Result<Void> retVal = new Result<Void>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
+
result = funcObj.createNS(trans, namespace, true);
assertTrue(24 == result.status);
-
+
}
@Test
@@ -313,15 +313,15 @@ public class JU_Function {
owner.add("test");
namespace.owner = owner;
namespace.admin = owner;
-
+
Organization org = Mockito.mock(Organization.class);
Mockito.doReturn(org).when(trans).org();
-
+
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
-
+
Result<Void> retVal = new Result<Void>(null,1,"test",NO_PARAM);
Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
Mockito.doReturn(retVal).when(nsDAO).create(Mockito.any(), Mockito.any());
@@ -338,8 +338,8 @@ public class JU_Function {
}
dataObj.add(indData);
Result<List<CredDAO.Data>> retVal2 = new Result<List<CredDAO.Data>>(dataObj,0,"test",NO_PARAM);
- Mockito.doReturn(retVal2).when(credDAO).readID(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal2).when(credDAO).readID(Mockito.any(), Mockito.anyString());
+
Identity iden=Mockito.mock(Identity.class);
try {
Mockito.doReturn(iden).when(org).getIdentity(trans, "test");
@@ -349,16 +349,16 @@ public class JU_Function {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Mockito.doReturn(Result.err(Result.ERR_NotFound, "Not Found")).when(roleDAO).read(trans, "test","test");
Mockito.doReturn(Result.err(Result.ERR_NotFound, "Not Found")).when(permDAO).readByType(trans, "test","test");
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.createNS(trans, namespace, true);
assertTrue(result.status == 1);
-
+
}
-
+
@Test
public void testCreateNsAdminLoopCreateSucReadChildrenFailure() {
Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).error();
@@ -377,15 +377,15 @@ public class JU_Function {
owner.add("test");
namespace.owner = owner;
namespace.admin = owner;
-
+
Organization org = Mockito.mock(Organization.class);
Mockito.doReturn(org).when(trans).org();
-
+
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
-
+
Result<Void> retVal = new Result<Void>(null,0,"test",NO_PARAM);
Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
Mockito.doReturn(retVal).when(nsDAO).create(Mockito.any(), Mockito.any());
@@ -409,34 +409,34 @@ public class JU_Function {
permsSet.add("test|test");
indData1.perms = permsSet;
dataObj1.add(indData1);
-
+
List<UserRoleDAO.Data> dataObj4 = new ArrayList<>();
UserRoleDAO.Data indData4 = new UserRoleDAO.Data();
indData4.ns = "test";
indData4.rname = "test";
dataObj4.add(indData4);
-
+
List<PermDAO.Data> dataObj5 = new ArrayList<>();
PermDAO.Data indData5 = new PermDAO.Data();
indData5.ns = "test";
indData5.type = "test";
dataObj5.add(indData5);
-
+
Result<List<CredDAO.Data>> retVal2 = new Result<List<CredDAO.Data>>(dataObj,0,"test",NO_PARAM);
Result<List<CredDAO.Data>> retVal6 = new Result<List<CredDAO.Data>>(dataObj,1,"test",NO_PARAM);
Result<List<RoleDAO.Data>> retVal3 = new Result<List<RoleDAO.Data>>(dataObj1,0,"test",NO_PARAM);
Result<List<UserRoleDAO.Data>> retVal4 = new Result<List<UserRoleDAO.Data>>(dataObj4,0,"test",NO_PARAM);
Result<List<PermDAO.Data>> retVal5 = new Result<List<PermDAO.Data>>(dataObj5,0,"test",NO_PARAM);
- Mockito.doReturn(retVal2).when(credDAO).readID(Mockito.any(), Mockito.anyString());
- Mockito.doReturn(retVal4).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
- Mockito.doReturn(retVal2).when(userRoleDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal6).when(roleDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal6).when(roleDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
- Mockito.doReturn(retVal2).when(permDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal5).when(permDAO).readChildren(trans, "test", "test");
- Mockito.doReturn(retVal5).when(permDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
- Mockito.doReturn(retVal3).when(roleDAO).readChildren(trans, "test", "test");
-
+ Mockito.doReturn(retVal2).when(credDAO).readID(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal4).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal2).when(userRoleDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal6).when(roleDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal6).when(roleDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+ Mockito.doReturn(retVal2).when(permDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal5).when(permDAO).readChildren(trans, "test", "test");
+ Mockito.doReturn(retVal5).when(permDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+ Mockito.doReturn(retVal3).when(roleDAO).readChildren(trans, "test", "test");
+
Identity iden=Mockito.mock(Identity.class);
try {
Mockito.doReturn(iden).when(org).getIdentity(trans, "test");
@@ -447,16 +447,16 @@ public class JU_Function {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Function funcObj = new Function(trans, ques);
Mockito.doReturn(Result.err(Result.ERR_NotFound, "Not Found")).when(roleDAO).read(trans, "test","test");
Mockito.doReturn(Result.err(Result.ERR_NotFound, "Not Found")).when(permDAO).readByType(trans, "test","test");
Result<Void> result = funcObj.createNS(trans, namespace, true);
assertTrue(result.status == Status.ERR_ActionNotCompleted);
-
+
}
-
+
@Test
public void testCreateNsAdminLoopCreateSuc() {
Namespace namespace = Mockito.mock(Namespace.class);
@@ -465,15 +465,15 @@ public class JU_Function {
owner.add("test");
namespace.owner = owner;
namespace.admin = owner;
-
+
Organization org = Mockito.mock(Organization.class);
Mockito.doReturn(org).when(trans).org();
-
+
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
-
+
Result<Void> retVal = new Result<Void>(null,0,"test",NO_PARAM);
Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
Mockito.doReturn(retVal).when(nsDAO).create(Mockito.any(), Mockito.any());
@@ -497,13 +497,13 @@ public class JU_Function {
permsSet.add("test|test|test|test");
indData1.perms = permsSet;
dataObj1.add(indData1);
-
+
List<UserRoleDAO.Data> dataObj4 = new ArrayList<>();
UserRoleDAO.Data indData4 = new UserRoleDAO.Data();
indData4.ns = "test";
indData4.rname = "test";
dataObj4.add(indData4);
-
+
List<PermDAO.Data> dataObj5 = new ArrayList<>();
PermDAO.Data indData5 = new PermDAO.Data();
indData5.ns = "test";
@@ -512,21 +512,21 @@ public class JU_Function {
rolesSet.add("test|test|test|test");
indData5.roles = rolesSet;
dataObj5.add(indData5);
-
+
Result<List<CredDAO.Data>> retVal2 = new Result<List<CredDAO.Data>>(dataObj,0,"test",NO_PARAM);
Result<List<RoleDAO.Data>> retVal3 = new Result<List<RoleDAO.Data>>(dataObj1,0,"test",NO_PARAM);
Result<List<UserRoleDAO.Data>> retVal4 = new Result<List<UserRoleDAO.Data>>(dataObj4,0,"test",NO_PARAM);
Result<List<PermDAO.Data>> retVal5 = new Result<List<PermDAO.Data>>(dataObj5,0,"test",NO_PARAM);
- Mockito.doReturn(retVal2).when(credDAO).readID(Mockito.any(), Mockito.anyString());
- Mockito.doReturn(retVal4).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
- Mockito.doReturn(retVal2).when(userRoleDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal2).when(roleDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal2).when(roleDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
- Mockito.doReturn(retVal2).when(permDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal5).when(permDAO).readChildren(trans, "test", "test");
- Mockito.doReturn(retVal5).when(permDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
- Mockito.doReturn(retVal3).when(roleDAO).readChildren(trans, "test", "test");
-
+ Mockito.doReturn(retVal2).when(credDAO).readID(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal4).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal2).when(userRoleDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal2).when(roleDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal2).when(roleDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+ Mockito.doReturn(retVal2).when(permDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal5).when(permDAO).readChildren(trans, "test", "test");
+ Mockito.doReturn(retVal5).when(permDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+ Mockito.doReturn(retVal3).when(roleDAO).readChildren(trans, "test", "test");
+
Identity iden=Mockito.mock(Identity.class);
try {
Mockito.doReturn(iden).when(org).getIdentity(trans, "test");
@@ -537,27 +537,27 @@ public class JU_Function {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
Mockito.doReturn(Result.err(Result.ERR_NotFound, "Not Found")).when(roleDAO).read(trans, "test","test");
Mockito.doReturn(Result.err(Result.ERR_NotFound, "Not Found")).when(permDAO).readByType(trans, "test","test");
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.createNS(trans, namespace, true);
assertTrue(result.status == 0);
-
+
}
-
+
@Test
public void test4DeleteNs() {
Result<Void> retVal = new Result<Void>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.deleteNS(trans, "test");
-
+
assertTrue(result.status == Status.ERR_NsNotFound);
}
-
+
@Test
public void test4DeleteCanMoveFail() {
List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
@@ -565,17 +565,17 @@ public class JU_Function {
dataObj.type=1;
dataAl.add(dataObj);
Result<List<NsDAO.Data>> retVal = new Result<List<NsDAO.Data>>(dataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
+
Mockito.doReturn(false).when(ques).canMove(Mockito.any());
Mockito.doReturn(retVal).when(ques).mayUser(trans, null,retVal.value.get(0), Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.deleteNS(trans, "test");
assertTrue(result.status == Status.ERR_Security);
-
+
}
-
+
@Test
public void test4DeleteNsReadSuc() {
List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
@@ -583,17 +583,17 @@ public class JU_Function {
dataObj.type=1;
dataAl.add(dataObj);
Result<List<NsDAO.Data>> retVal = new Result<List<NsDAO.Data>>(dataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
+
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,1,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal.value.get(0), Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.deleteNS(trans, "test");
assertTrue(result.status == 1);
-
+
}
-
+
@Test
public void test4DeleteNsMayUserSuc() {
List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
@@ -601,22 +601,22 @@ public class JU_Function {
dataObj.type=1;
dataAl.add(dataObj);
Result<List<NsDAO.Data>> retVal = new Result<List<NsDAO.Data>>(dataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
+
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal.value.get(0), Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.deleteNS(trans, "test");
assertTrue(result.status == 1);
Mockito.doReturn(true).when(ques).isGranted(Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
- Mockito.doReturn(retVal2).when(credDAO).readNS(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal2).when(credDAO).readNS(Mockito.any(), Mockito.anyString());
Result<List<PermDAO.Data>> retVal5 = new Result<List<PermDAO.Data>>(null,0,"test",NO_PARAM);
Mockito.doReturn(retVal5).when(permDAO).readNS(trans, "test");
-
+
List<UserRoleDAO.Data> dataObj4 = new ArrayList<>();
UserRoleDAO.Data indData4 = new UserRoleDAO.Data();
indData4.ns = "test";
@@ -624,7 +624,7 @@ public class JU_Function {
dataObj4.add(indData4);
Result<List<UserRoleDAO.Data>> retVal4 = new Result<List<UserRoleDAO.Data>>(dataObj4,0,"test",NO_PARAM);
Mockito.doReturn(retVal4).when(userRoleDAO).readByRole(trans, "test");
-
+
List<RoleDAO.Data> dataObj1 = new ArrayList<>();
RoleDAO.Data indData1 = new RoleDAO.Data();
indData1.ns = "test";
@@ -634,15 +634,15 @@ public class JU_Function {
indData1.perms = permsSet;
dataObj1.add(indData1);
Result<List<RoleDAO.Data>> retVal3 = new Result<List<RoleDAO.Data>>(dataObj1,0,"test",NO_PARAM);
- Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test");
+ Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test");
Mockito.doReturn(retVal3).when(roleDAO).read(trans, indData1);
-
+
funcObj = new Function(trans, ques);
result = funcObj.deleteNS(trans, "test");
assertTrue(result.status == Status.ERR_DependencyExists);
-
- Mockito.doReturn(retVal4).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
-
+
+ Mockito.doReturn(retVal4).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+
Mockito.doReturn(true).when(trans).requested(REQD_TYPE.force);
funcObj = new Function(trans, ques);
result = funcObj.deleteNS(trans, "test");
@@ -655,18 +655,18 @@ public class JU_Function {
dataObj.type=1;
dataAl.add(dataObj);
Result<List<NsDAO.Data>> retVal = new Result<List<NsDAO.Data>>(dataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
+
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal.value.get(0), Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.deleteNS(trans, "test");
assertTrue(result.status == 1);
Mockito.doReturn(true).when(ques).isGranted(Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
- Mockito.doReturn(retVal2).when(credDAO).readNS(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal2).when(credDAO).readNS(Mockito.any(), Mockito.anyString());
List<PermDAO.Data> dataObj5 = new ArrayList<>();
PermDAO.Data indData5 = new PermDAO.Data();
@@ -677,8 +677,8 @@ public class JU_Function {
Mockito.doReturn(retVal5).when(permDAO).readNS(trans, "test");
Mockito.doReturn(retVal5).when(permDAO).readNS(trans, "test.test");
Mockito.doReturn(retVal5).when(permDAO).read(trans, indData5);
-
-
+
+
List<RoleDAO.Data> dataObj1 = new ArrayList<>();
RoleDAO.Data indData1 = new RoleDAO.Data();
indData1.ns = "test";
@@ -688,19 +688,19 @@ public class JU_Function {
indData1.perms = permsSet;
dataObj1.add(indData1);
Result<List<RoleDAO.Data>> retVal3 = new Result<List<RoleDAO.Data>>(dataObj1,0,"test",NO_PARAM);
- Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test");
- Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test.test");
+ Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test");
+ Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test.test");
Mockito.doReturn(retVal3).when(roleDAO).read(trans, indData1);
-
+
funcObj = new Function(trans, ques);
result = funcObj.deleteNS(trans, "test");
assertTrue(result.status == Status.ERR_DependencyExists);
-
+
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,1,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
-
+
Mockito.doReturn(true).when(trans).requested(REQD_TYPE.force);
funcObj = new Function(trans, ques);
result = funcObj.deleteNS(trans, "test.test");
@@ -714,8 +714,8 @@ public class JU_Function {
dataObj.type=1;
dataAl.add(dataObj);
Result<List<NsDAO.Data>> retVal = new Result<List<NsDAO.Data>>(dataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal).when(nsDAO).read(Mockito.any(), Mockito.anyString());
+
List<CredDAO.Data> nsDataList = new ArrayList<CredDAO.Data>();
CredDAO.Data nsData = new CredDAO.Data();
nsData.id="test";
@@ -723,15 +723,15 @@ public class JU_Function {
Result<List<CredDAO.Data>> retVal21 = new Result<List<CredDAO.Data>>(nsDataList,0,"test",NO_PARAM);
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal.value.get(0), Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.deleteNS(trans, "test");
assertTrue(result.status == 1);
Mockito.doReturn(true).when(ques).isGranted(Mockito.any(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
- Mockito.doReturn(retVal21).when(credDAO).readNS(Mockito.any(), Mockito.anyString());
- Mockito.doReturn(retVal21).when(credDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+ Mockito.doReturn(retVal21).when(credDAO).readNS(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal21).when(credDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
List<PermDAO.Data> dataObj5 = new ArrayList<>();
PermDAO.Data indData5 = new PermDAO.Data();
@@ -742,7 +742,7 @@ public class JU_Function {
Mockito.doReturn(retVal5).when(permDAO).readNS(trans, "test");
Mockito.doReturn(retVal5).when(permDAO).readNS(trans, "test.test");
Mockito.doReturn(retVal5).when(permDAO).read(trans, indData5);
-
+
List<UserRoleDAO.Data> dataObj4 = new ArrayList<>();
UserRoleDAO.Data indData4 = new UserRoleDAO.Data();
indData4.ns = "test";
@@ -751,7 +751,7 @@ public class JU_Function {
Result<List<UserRoleDAO.Data>> retVal4 = new Result<List<UserRoleDAO.Data>>(dataObj4,0,"test",NO_PARAM);
Mockito.doReturn(retVal4).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
Mockito.doReturn(retVal4).when(userRoleDAO).readByUser(Mockito.any(), Mockito.anyString());
-
+
List<RoleDAO.Data> dataObj1 = new ArrayList<>();
RoleDAO.Data indData1 = new RoleDAO.Data();
indData1.ns = "test";
@@ -761,25 +761,25 @@ public class JU_Function {
indData1.perms = permsSet;
dataObj1.add(indData1);
Result<List<RoleDAO.Data>> retVal3 = new Result<List<RoleDAO.Data>>(dataObj1,0,"test",NO_PARAM);
- Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test");
- Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test.test");
+ Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test");
+ Mockito.doReturn(retVal3).when(roleDAO).readNS(trans, "test.test");
Mockito.doReturn(retVal3).when(roleDAO).read(trans, indData1);
-
+
funcObj = new Function(trans, ques);
result = funcObj.deleteNS(trans, "test");
assertTrue(result.status == Status.ERR_DependencyExists);
-
+
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
-
+
Mockito.doReturn(true).when(trans).requested(REQD_TYPE.force);
funcObj = new Function(trans, ques);
result = funcObj.deleteNS(trans, "test.test");
assertNull(result);
}
-
+
@Test
public void testGetOwners() {
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
@@ -787,49 +787,49 @@ public class JU_Function {
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
-//
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+//
// Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
// Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal.value.get(0), Access.write);
-//
+//
Function funcObj = new Function(trans, ques);
Result<List<String>> result = funcObj.getOwners(trans, "test", false);
assertTrue(result.status == 1);
-//
+//
}
-
+
@Test
public void testDelOwner() {
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
- Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any( UserRoleDAO.Data.class));
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any( UserRoleDAO.Data.class));
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
-
+
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(data,1,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal1.value, Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.delOwner(trans, "test", "test");
assertTrue(result.status == 1);
-
+
retVal1 = new Result<NsDAO.Data>(data,1,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
result = funcObj.delOwner(trans, "test", "test");
assertTrue(result.status == 1);
-
+
retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
result = funcObj.delOwner(trans, "test", "test");
retVal2 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal1.value, Access.write);
result = funcObj.delOwner(trans, "test", "test");
-//
+//
}
-
+
@Test
public void testGetAdmins() {
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
@@ -837,49 +837,49 @@ public class JU_Function {
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
-//
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+//
// Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
// Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal.value.get(0), Access.write);
-//
+//
Function funcObj = new Function(trans, ques);
Result<List<String>> result = funcObj.getAdmins(trans, "test", false);
assertTrue(result.status == 1);
-//
+//
}
-
+
@Test
public void testDelAdmin() {
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readUserInRole(Mockito.any(), Mockito.anyString(), Mockito.anyString());
- Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any( UserRoleDAO.Data.class));
+ Mockito.doReturn(retVal).when(userRoleDAO).readUserInRole(Mockito.any(), Mockito.anyString(), Mockito.anyString());
+ Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any( UserRoleDAO.Data.class));
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
-
+
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(data,1,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal1.value, Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.delAdmin(trans, "test", "test");
assertTrue(result.status == 1);
-
+
retVal1 = new Result<NsDAO.Data>(data,1,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
result = funcObj.delAdmin(trans, "test", "test");
assertTrue(result.status == 1);
-
+
retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal1).when(ques).deriveNs(trans, "test");
result = funcObj.delOwner(trans, "test", "test");
retVal2 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal1.value, Access.write);
result = funcObj.delAdmin(trans, "test", "test");
-//
+//
}
-
+
@Test
public void testMovePerms() {
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
@@ -887,19 +887,19 @@ public class JU_Function {
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
-
- Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(), Mockito.any());
-
- Mockito.doReturn(retVal).when(permDAO).create(Mockito.any(), Mockito.any());
-
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+
+ Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(), Mockito.any());
+
+ Mockito.doReturn(retVal).when(permDAO).create(Mockito.any(), Mockito.any());
+
NsDAO.Data nsDataObj = new NsDAO.Data();
nsDataObj.name="test";
StringBuilder sb = new StringBuilder();
Result<List<PermDAO.Data>> retVal1 = new Result<List<PermDAO.Data>>(null,1,"test",NO_PARAM);
-
+
invokeMovePerms(nsDataObj, sb, retVal1);
-
+
List<PermDAO.Data> dataObj5 = new ArrayList<>();
PermDAO.Data indData5 = new PermDAO.Data();
indData5.ns = "test";
@@ -915,25 +915,25 @@ public class JU_Function {
retVal1 = new Result<List<PermDAO.Data>>(dataObj5,0,"test",NO_PARAM);
Result<List<UserRoleDAO.Data>> retVal3 = new Result<List<UserRoleDAO.Data>>(null,0,"test",NO_PARAM);
- Mockito.doReturn(retVal3).when(permDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal3).when(permDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+ Mockito.doReturn(retVal3).when(permDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal3).when(permDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
NsSplit splitObj = new NsSplit("test", "test");
Result<NsSplit> retVal2 = new Result<NsSplit>(splitObj,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).deriveNsSplit(Mockito.any(), Mockito.anyString());
-
+
invokeMovePerms(nsDataObj, sb, retVal1);
-
+
Result<List<UserRoleDAO.Data>> retVal4 = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal4).when(permDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal4).when(permDAO).create(Mockito.any(), Mockito.any());
invokeMovePerms(nsDataObj, sb, retVal1);
-
- Mockito.doReturn(retVal3).when(permDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal4).when(permDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+
+ Mockito.doReturn(retVal3).when(permDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal4).when(permDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
invokeMovePerms(nsDataObj, sb, retVal1);
-
+
}
-
+
private void invokeMovePerms(NsDAO.Data nsDataObj, StringBuilder sb,Result<List<PermDAO.Data>> retVal1) {
Function funcObj = new Function(trans, ques);
Method met;
@@ -955,7 +955,7 @@ public class JU_Function {
e.printStackTrace();
}
}
-
+
@Test
public void testMoveRoles() {
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
@@ -963,19 +963,19 @@ public class JU_Function {
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
-
- Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(), Mockito.any());
-
- Mockito.doReturn(retVal).when(roleDAO).create(Mockito.any(), Mockito.any());
-
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+
+ Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(), Mockito.any());
+
+ Mockito.doReturn(retVal).when(roleDAO).create(Mockito.any(), Mockito.any());
+
NsDAO.Data nsDataObj = new NsDAO.Data();
nsDataObj.name="test";
StringBuilder sb = new StringBuilder();
Result<List<RoleDAO.Data>> retVal1 = new Result<List<RoleDAO.Data>>(null,1,"test",NO_PARAM);
-
+
invokeMoveRoles(nsDataObj, sb, retVal1);
-
+
List<RoleDAO.Data> dataObj5 = new ArrayList<>();
RoleDAO.Data indData5 = new RoleDAO.Data();
indData5.ns = "test";
@@ -989,27 +989,27 @@ public class JU_Function {
indData5.name = "admin";
dataObj5.add(indData5);
retVal1 = new Result<List<RoleDAO.Data>>(dataObj5,0,"test",NO_PARAM);
-
+
Result<List<UserRoleDAO.Data>> retVal3 = new Result<List<UserRoleDAO.Data>>(null,0,"test",NO_PARAM);
- Mockito.doReturn(retVal3).when(roleDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal3).when(roleDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+ Mockito.doReturn(retVal3).when(roleDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal3).when(roleDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
NsSplit splitObj = new NsSplit("test", "test");
Result<NsSplit> retVal2 = new Result<NsSplit>(splitObj,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).deriveNsSplit(Mockito.any(), Mockito.anyString());
-
+
invokeMoveRoles(nsDataObj, sb, retVal1);
-
+
Result<List<UserRoleDAO.Data>> retVal4 = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal4).when(roleDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal4).when(roleDAO).create(Mockito.any(), Mockito.any());
invokeMoveRoles(nsDataObj, sb, retVal1);
-
- Mockito.doReturn(retVal3).when(roleDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal4).when(roleDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
+
+ Mockito.doReturn(retVal3).when(roleDAO).create(Mockito.any(), Mockito.any());
+ Mockito.doReturn(retVal4).when(roleDAO).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
invokeMoveRoles(nsDataObj, sb, retVal1);
-
+
}
-
+
private void invokeMoveRoles(NsDAO.Data nsDataObj, StringBuilder sb,Result<List<RoleDAO.Data>> retVal1) {
Function funcObj = new Function(trans, ques);
Method met;
@@ -1031,7 +1031,7 @@ public class JU_Function {
e.printStackTrace();
}
}
-
+
@Test
public void testCreatePerm() {
try {
@@ -1049,20 +1049,20 @@ public class JU_Function {
dataAl.add(perm);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
Mockito.doReturn(retVal).when(ques).deriveNsSplit(Mockito.any(), Mockito.anyString());
-
- Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
- Mockito.doReturn(retVal).when(userRoleDAO).create(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
-
+
+ Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
+ Mockito.doReturn(retVal).when(userRoleDAO).create(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
+
Mockito.doReturn(retVal).when(permDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal).when(permDAO).read(trans, perm);
-
+ Mockito.doReturn(retVal).when(permDAO).read(trans, perm);
+
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,1,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,perm, Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.createPerm(trans, perm, false);
assertTrue(result.status == 1);
-
+
retVal2 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,perm, Access.write);
result = funcObj.createPerm(trans, perm, false);
@@ -1077,21 +1077,21 @@ public class JU_Function {
Result<List<RoleDAO.Data>> retVal4 = Result.err(Result.ERR_NotFound,"");
Mockito.doReturn(retVal4).when(roleDAO).create(Mockito.any(),Mockito.any(RoleDAO.Data.class));
result = funcObj.createPerm(trans, perm, false);
-
- Mockito.doReturn(retVal).when(permDAO).read(trans, perm);
+
+ Mockito.doReturn(retVal).when(permDAO).read(trans, perm);
result = funcObj.createPerm(trans, perm, true);
assertTrue(result.status == 1);
Mockito.doReturn(retVal2).when(permDAO).create(Mockito.any(), Mockito.any());
result = funcObj.createPerm(trans, perm, true);
assertTrue(result.status == 0);
-
+
Mockito.doReturn(false).when(trans).requested(REQD_TYPE.force);
Result<List<PermDAO.Data>> retVal1 = new Result<List<PermDAO.Data>>(dataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal1).when(permDAO).read(trans, perm);
+ Mockito.doReturn(retVal1).when(permDAO).read(trans, perm);
result = funcObj.createPerm(trans, perm, true);
assertTrue(result.status == Status.ERR_ConflictAlreadyExists);
-
+
}
@Test
public void testDeletePerm() {
@@ -1108,24 +1108,24 @@ public class JU_Function {
perm.roles = rolesSet;
// perm.type=1
dataAl.add(perm);
-
+
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,1,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,perm, Access.write);
-
+
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
// NsDAO.Data dataObj = new NsDAO.Data();
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<PermDAO.Data>> retVal = new Result<List<PermDAO.Data>>(dataAl,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.deletePerm(trans, perm, true,false);
assertTrue(result.status == 1);
// Mockito.doReturn(retVal).when(cachedPermDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal).when(permDAO).read(trans, perm);
-
+ Mockito.doReturn(retVal).when(permDAO).read(trans, perm);
+
result = funcObj.deletePerm(trans, perm, true,true);
assertTrue(result.status == Status.ERR_PermissionNotFound);
@@ -1133,24 +1133,24 @@ public class JU_Function {
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,perm, Access.write);
Result<List<PermDAO.Data>> retVal3 = new Result<List<PermDAO.Data>>(dataAl,0,"test",NO_PARAM);
Mockito.doReturn(retVal3).when(permDAO).read(trans, perm);
-
+
NsSplit nsObj = new NsSplit("test","test");
Result<NsSplit> retValNs = new Result<NsSplit>(nsObj,0,"test",NO_PARAM);
Mockito.doReturn(retValNs).when(ques).deriveNsSplit(Mockito.any(), Mockito.anyString());
-
- Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(), Mockito.any());
-
+
+ Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(), Mockito.any());
+
result = funcObj.deletePerm(trans, perm, true,false);
- assertNull(result);
-
- Mockito.doReturn(retVal2).when(roleDAO).delPerm(Mockito.any(), Mockito.any(), Mockito.any());
+ assertNull(result);
+
+ Mockito.doReturn(retVal2).when(roleDAO).delPerm(Mockito.any(), Mockito.any(), Mockito.any());
result = funcObj.deletePerm(trans, perm, true,false);
- assertNull(result);
-
+ assertNull(result);
+
result = funcObj.deletePerm(trans, perm, false,false);
// assertTrue(result.status == 1);
}
-
+
@Test
public void testDeleteRole() {
try {
@@ -1167,7 +1167,7 @@ public class JU_Function {
// perm.roles = rolesSet;
// perm.type=1
dataAlUser.add(roleUser);
-
+
List<RoleDAO.Data> dataAl = new ArrayList<RoleDAO.Data>();
RoleDAO.Data role = new RoleDAO.Data();
Set<String> rolesSet = new HashSet<>();
@@ -1176,48 +1176,48 @@ public class JU_Function {
// perm.roles = rolesSet;
// perm.type=1
dataAl.add(role);
-
+
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,1,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,role, Access.write);
-
+
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
// NsDAO.Data dataObj = new NsDAO.Data();
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
-//
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+//
// Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
// Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal.value.get(0), Access.write);
-//
+//
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.deleteRole(trans, role, true, false);
assertTrue(result.status == 1);
Result<List<RoleDAO.Data>> retVal1 = new Result<List<RoleDAO.Data>>(dataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal1).when(roleDAO).read(Mockito.any(), Mockito.any(RoleDAO.Data.class));
+ Mockito.doReturn(retVal1).when(roleDAO).read(Mockito.any(), Mockito.any(RoleDAO.Data.class));
NsSplit splitObj = new NsSplit("test", "test");
Result<NsSplit> retVal3 = new Result<NsSplit>(splitObj,0,"test",NO_PARAM);
Mockito.doReturn(retVal3).when(ques).deriveNsSplit(Mockito.any(), Mockito.anyString());
// Mockito.doReturn(retVal).when(cachedPermDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal).when(permDAO).delRole(Mockito.any(), Mockito.any(),Mockito.any());
+ Mockito.doReturn(retVal).when(permDAO).delRole(Mockito.any(), Mockito.any(),Mockito.any());
result = funcObj.deleteRole(trans, role, true, true);
assertNull(result);
-
+
Mockito.doReturn(retVal1).when(permDAO).delRole(Mockito.any(), Mockito.any(),Mockito.any());
result = funcObj.deleteRole(trans, role, true, true);
assertNull(result);
- Mockito.doReturn(retVal).when(roleDAO).read(Mockito.any(), Mockito.any(RoleDAO.Data.class));
+ Mockito.doReturn(retVal).when(roleDAO).read(Mockito.any(), Mockito.any(RoleDAO.Data.class));
result = funcObj.deleteRole(trans, role, true, true);
assertTrue(result.status == Status.ERR_RoleNotFound);
-
+
retVal = new Result<List<UserRoleDAO.Data>>(dataAlUser,0,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
result = funcObj.deleteRole(trans, role, false, true);
assertTrue(result.status == Status.ERR_DependencyExists);
}
-
+
@Test
public void testAddPermToRole() {
List<PermDAO.Data> dataAlPerm = new ArrayList<PermDAO.Data>();
@@ -1227,7 +1227,7 @@ public class JU_Function {
// perm.roles = rolesSet;
// perm.type=1
dataAlPerm.add(rolePerm);
-
+
List<RoleDAO.Data> dataAl = new ArrayList<RoleDAO.Data>();
RoleDAO.Data role = new RoleDAO.Data();
Set<String> rolesSet = new HashSet<>();
@@ -1236,27 +1236,27 @@ public class JU_Function {
// perm.roles = rolesSet;
// perm.type=1
dataAl.add(role);
-
+
NsDAO.Data nsObj = new NsDAO.Data();
nsObj.name="test";
NsDAO.Data nsObj1 = new NsDAO.Data();
nsObj1.name="test12";
-
+
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
// NsDAO.Data dataObj = new NsDAO.Data();
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(nsObj,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).deriveFirstNsForType(trans, role.ns, NsType.COMPANY);
Mockito.doReturn(retVal2).when(ques).deriveFirstNsForType(trans, rolePerm.ns, NsType.COMPANY);
-
+
Result<NsDAO.Data> retVal3 = new Result<NsDAO.Data>(null,1,"test",NO_PARAM);
Mockito.doReturn(retVal3).when(ques).mayUser(trans, null,rolePerm, Access.write);
Mockito.doReturn(retVal3).when(ques).mayUser(trans, null,role, Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.addPermToRole(trans, role, rolePerm, false);
assertTrue(result.status == 1);
@@ -1266,62 +1266,62 @@ public class JU_Function {
Mockito.doReturn(retVal2).when(ques).deriveFirstNsForType(trans, rolePerm.ns, NsType.COMPANY);
result = funcObj.addPermToRole(trans, role, rolePerm, false);
assertTrue(result.status == 1);
-
+
role.ns="test2";
retVal2 = new Result<NsDAO.Data>(nsObj,0,"test",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).deriveFirstNsForType(trans, role.ns, NsType.COMPANY);
result = funcObj.addPermToRole(trans, role, rolePerm, false);
assertTrue(result.status == 1);
-
+
retVal2 = new Result<NsDAO.Data>(nsObj,0,"test1",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).deriveFirstNsForType(trans, role.ns, NsType.COMPANY);
Result<NsDAO.Data> retVal21 = new Result<NsDAO.Data>(nsObj1,0,"test1",NO_PARAM);
Mockito.doReturn(retVal21).when(ques).deriveFirstNsForType(trans, rolePerm.ns, NsType.COMPANY);
result = funcObj.addPermToRole(trans, role, rolePerm, false);
assertTrue(result.status == 1);
-
+
retVal3 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
Mockito.doReturn(retVal3).when(ques).mayUser(trans, null,rolePerm, Access.write);
retVal2 = new Result<NsDAO.Data>(nsObj,0,"test1",NO_PARAM);
Mockito.doReturn(retVal2).when(ques).deriveFirstNsForType(trans, role.ns, NsType.COMPANY);
Mockito.doReturn(retVal2).when(ques).deriveFirstNsForType(trans, rolePerm.ns, NsType.COMPANY);
-
+
// Mockito.doReturn(retVal).when(cachedPermDAO).create(Mockito.any(), Mockito.any());
- Mockito.doReturn(retVal).when(permDAO).read(Mockito.any(), Mockito.any(PermDAO.Data.class));
-
+ Mockito.doReturn(retVal).when(permDAO).read(Mockito.any(), Mockito.any(PermDAO.Data.class));
+
result = funcObj.addPermToRole(trans, role, rolePerm, false);
assertTrue(result.status == Status.ERR_PermissionNotFound);
-
+
Result<List<PermDAO.Data>> retValPerm= new Result<List<PermDAO.Data>>(dataAlPerm,0,"test1",NO_PARAM);
- Mockito.doReturn(retValPerm).when(permDAO).read(Mockito.any(), Mockito.any(PermDAO.Data.class));
-
+ Mockito.doReturn(retValPerm).when(permDAO).read(Mockito.any(), Mockito.any(PermDAO.Data.class));
+
Mockito.doReturn(retVal3).when(roleDAO).read(trans, role);
-
+
result = funcObj.addPermToRole(trans, role, rolePerm, true);
assertTrue(result.status == 22);
Mockito.doReturn(true).when(trans).requested(REQD_TYPE.force);
result = funcObj.addPermToRole(trans, role, rolePerm, true);
assertTrue(result.status == 2);
-
+
retVal3 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
Mockito.doReturn(retVal3).when(ques).mayUser(trans, null,role, Access.write);
Mockito.doReturn(retVal3).when(roleDAO).create(trans, role);
result = funcObj.addPermToRole(trans, role, rolePerm, true);
// System.out.println(result.status);
assertNull(result);
-
+
retVal3 = new Result<NsDAO.Data>(null,1,"test",NO_PARAM);
Mockito.doReturn(retVal3).when(roleDAO).create(trans, role);
result = funcObj.addPermToRole(trans, role, rolePerm, true);
assertTrue(result.status == 1);
-
+
Result<List<RoleDAO.Data>> retVal31 = new Result<List<RoleDAO.Data>>(dataAl,0,"test",NO_PARAM);
Mockito.doReturn(retVal31).when(roleDAO).read(trans, role);
result = funcObj.addPermToRole(trans, role, rolePerm, true);
assertTrue(result.status == 7);
}
-
+
@Test
public void testDelPermFromRole() {
List<PermDAO.Data> dataAlPerm = new ArrayList<PermDAO.Data>();
@@ -1331,78 +1331,78 @@ public class JU_Function {
// perm.roles = rolesSet;
// perm.type=1
dataAlPerm.add(rolePerm);
-
+
List<RoleDAO.Data> dataAl = new ArrayList<RoleDAO.Data>();
RoleDAO.Data role = new RoleDAO.Data();
Set<String> rolesSet = new HashSet<>();
rolesSet.add("17623");
role.perms = rolesSet;
dataAl.add(role);
-
+
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
// NsDAO.Data dataObj = new NsDAO.Data();
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
Result<NsDAO.Data> retValFail = new Result<NsDAO.Data>(null,1,"test",NO_PARAM);
Result<NsDAO.Data> retValSuc = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
Mockito.doReturn(retValFail).when(ques).mayUser(trans, null,rolePerm, Access.write);
Mockito.doReturn(retValFail).when(ques).mayUser(trans, null,role, Access.write);
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.delPermFromRole(trans, role, rolePerm, false);
assertTrue(result.status == Status.ERR_Denied);
-
+
Mockito.doReturn(retValFail).when(ques).mayUser(trans, null,rolePerm, Access.write);
- Mockito.doReturn(retValSuc).when(ques).mayUser(trans, null,role, Access.write);
-
+ Mockito.doReturn(retValSuc).when(ques).mayUser(trans, null,role, Access.write);
+
Mockito.doReturn(retValFail).when(roleDAO).read(trans, role);
-
- Mockito.doReturn(retVal).when(permDAO).read(Mockito.any(), Mockito.any(PermDAO.Data.class));
-
+
+ Mockito.doReturn(retVal).when(permDAO).read(Mockito.any(), Mockito.any(PermDAO.Data.class));
+
result = funcObj.delPermFromRole(trans, role, rolePerm, false);
assertTrue(result.status == 1);
-
+
Result<List<PermDAO.Data>> retValPermSuc = new Result<List<PermDAO.Data>>(dataAlPerm,0,"test",NO_PARAM);
- Mockito.doReturn(retValPermSuc).when(permDAO).read(Mockito.any(), Mockito.any(PermDAO.Data.class));
+ Mockito.doReturn(retValPermSuc).when(permDAO).read(Mockito.any(), Mockito.any(PermDAO.Data.class));
result = funcObj.delPermFromRole(trans, role, rolePerm, false);
assertTrue(result.status == 1);
-
+
Result<List<RoleDAO.Data>> retValRoleSuc = new Result<List<RoleDAO.Data>>(dataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retValRoleSuc).when(roleDAO).read(Mockito.any(), Mockito.any(RoleDAO.Data.class));
+ Mockito.doReturn(retValRoleSuc).when(roleDAO).read(Mockito.any(), Mockito.any(RoleDAO.Data.class));
result = funcObj.delPermFromRole(trans, role, rolePerm, true);
assertTrue(result.status == Status.ERR_PermissionNotFound);
-
+
role.perms = null;
dataAl.add(role);
rolesSet.add("null|null|null|null");
role.perms = rolesSet;
dataAl.add(role);
- Mockito.doReturn(retValRoleSuc).when(roleDAO).read(Mockito.any(), Mockito.any(RoleDAO.Data.class));
- Mockito.doReturn(retVal).when(permDAO).delRole(Mockito.any(), Mockito.any(),Mockito.any(RoleDAO.Data.class));
+ Mockito.doReturn(retValRoleSuc).when(roleDAO).read(Mockito.any(), Mockito.any(RoleDAO.Data.class));
+ Mockito.doReturn(retVal).when(permDAO).delRole(Mockito.any(), Mockito.any(),Mockito.any(RoleDAO.Data.class));
result = funcObj.delPermFromRole(trans, role, rolePerm, true);
assertTrue(result.status == 1);
-
- Mockito.doReturn(true).when(trans).requested(REQD_TYPE.force);
+
+ Mockito.doReturn(true).when(trans).requested(REQD_TYPE.force);
result = funcObj.delPermFromRole(trans, role, rolePerm, true);
assertTrue(result.status == 1);
-
+
Mockito.doReturn(retValRoleSuc).when(permDAO).delRole(Mockito.any(), Mockito.any(),Mockito.any(RoleDAO.Data.class));
- Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(),Mockito.any(PermDAO.Data.class));
+ Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(),Mockito.any(PermDAO.Data.class));
result = funcObj.delPermFromRole(trans, role, rolePerm, true);
assertTrue(result.status == 1);
-
- Mockito.doReturn(retValPermSuc).when(roleDAO).delPerm(Mockito.any(), Mockito.any(),Mockito.any(PermDAO.Data.class));
+
+ Mockito.doReturn(retValPermSuc).when(roleDAO).delPerm(Mockito.any(), Mockito.any(),Mockito.any(PermDAO.Data.class));
result = funcObj.delPermFromRole(trans, role, rolePerm, true);
assertTrue(result.status == 0);
-
+
Mockito.doReturn(retVal).when(permDAO).read(Mockito.any(), Mockito.any(PermDAO.Data.class));
result = funcObj.delPermFromRole(trans, role, rolePerm, true);
assertTrue(result.status == 0);
-
- Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(),Mockito.any(PermDAO.Data.class));
+
+ Mockito.doReturn(retVal).when(roleDAO).delPerm(Mockito.any(), Mockito.any(),Mockito.any(PermDAO.Data.class));
result = funcObj.delPermFromRole(trans, role, rolePerm, true);
assertTrue(result.status == 1);
@@ -1413,7 +1413,7 @@ public class JU_Function {
Mockito.doReturn(retValFail).when(ques).mayUser(Mockito.any(), Mockito.anyString(),Mockito.any(PermDAO.Data.class), Mockito.any());
result = funcObj.delPermFromRole(trans, "test", rolePerm);
assertTrue(result.status == 2);
-
+
retVal3 = new Result<NsSplit>(null,1,"test",NO_PARAM);
Mockito.doReturn(retVal3).when(ques).deriveNsSplit(Mockito.any(), Mockito.anyString());
result = funcObj.delPermFromRole(trans, "test", rolePerm);
@@ -1427,29 +1427,29 @@ public class JU_Function {
urData.rname="test";
urData.user="test";
urDataAl.add(urData);
-
+
Organization org = Mockito.mock(Organization.class);
Mockito.doReturn(org).when(trans).org();
Mockito.doReturn(Mockito.mock(GregorianCalendar.class)).when(org).expiration(Mockito.any(), Mockito.any(), Mockito.anyString());
-
+
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
Result<List<UserRoleDAO.Data>> retValSuc = new Result<List<UserRoleDAO.Data>>(urDataAl,0,"test",NO_PARAM);
Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
- Mockito.doReturn(retVal).when(userRoleDAO).create(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
- Mockito.doReturn(retValSuc).when(roleDAO).read(Mockito.any(), Mockito.anyString(), Mockito.anyString());
+ Mockito.doReturn(retVal).when(userRoleDAO).create(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
+ Mockito.doReturn(retValSuc).when(roleDAO).read(Mockito.any(), Mockito.anyString(), Mockito.anyString());
Result<List<CredDAO.Data>> retVal2 = new Result<List<CredDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal2).when(credDAO).readID(Mockito.any(), Mockito.anyString());
-
+ Mockito.doReturn(retVal2).when(credDAO).readID(Mockito.any(), Mockito.anyString());
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.addUserRole(trans, urData);
assertTrue(result.status == 1);
-
+
urData.rname=Question.ADMIN;
result = funcObj.addUserRole(trans, urData);
assertTrue(result.status == 1);
-
+
NsDAO.Data data = new NsDAO.Data();
data.name="test";
Result<NsDAO.Data> retVal1 = new Result<NsDAO.Data>(data,0,"test",NO_PARAM);
@@ -1465,21 +1465,21 @@ public class JU_Function {
result = funcObj.addUserRole(trans, urData);
assertTrue(result.status == 1);
- Mockito.doReturn(retValSuc).when(userRoleDAO).create(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
+ Mockito.doReturn(retValSuc).when(userRoleDAO).create(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
result = funcObj.addUserRole(trans, urData);
assertTrue(result.status == 0);
Mockito.doReturn(retVal).when(roleDAO).read(Mockito.any(), Mockito.anyString(), Mockito.anyString());
result = funcObj.addUserRole(trans, urData);
assertTrue(result.status == Status.ERR_RoleNotFound);
-
+
Mockito.doReturn(retValSuc).when(userRoleDAO).read(Mockito.any(), Mockito.any(UserRoleDAO.Data.class));
result = funcObj.addUserRole(trans, urData);
assertTrue(result.status == Status.ERR_ConflictAlreadyExists);
-
+
result = funcObj.addUserRole(trans, "test", "test", "test");
assertTrue(result.status == 1);
-
+
try {
Mockito.doReturn(null).when(org).getIdentity(trans, "test");
} catch (OrganizationException e) {
@@ -1488,7 +1488,7 @@ public class JU_Function {
}
result = funcObj.addUserRole(trans, "test", "test", "test");
assertTrue(result.status == Result.ERR_BadData);
-
+
try {
Mockito.doThrow(OrganizationException.class).when(org).getIdentity(trans, "test");
} catch (OrganizationException e) {
@@ -1498,7 +1498,7 @@ public class JU_Function {
result = funcObj.addUserRole(trans, "test", "test", "test");
assertTrue(result.status == 20);
}
-
+
@Test
public void testExtendUserRole() {
List<UserRoleDAO.Data> urDataAl = new ArrayList<>();
@@ -1508,34 +1508,34 @@ public class JU_Function {
urData.user="test";
urData.expires=new Date();
urDataAl.add(urData);
-
+
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
// NsDAO.Data dataObj = new NsDAO.Data();
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
Result<List<UserRoleDAO.Data>> retValSuc = new Result<List<UserRoleDAO.Data>>(urDataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
Mockito.doReturn(retValSuc).when(roleDAO).read(Mockito.any(), Mockito.anyString(), Mockito.anyString());
Organization org = Mockito.mock(Organization.class);
Mockito.doReturn(org).when(trans).org();
Mockito.doReturn(Mockito.mock(GregorianCalendar.class)).when(org).expiration(Mockito.any(), Mockito.any());
-
+
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.extendUserRole(trans, urData, false);
assertNull(result);
-
+
Mockito.doReturn(retVal).when(roleDAO).read(Mockito.any(), Mockito.anyString(), Mockito.anyString());
Mockito.doReturn(retValSuc).when(userRoleDAO).read(trans, urData);
result = funcObj.extendUserRole(trans, urData, true);
assertTrue(result.status == Status.ERR_RoleNotFound);
-
+
Mockito.doReturn(retVal).when(userRoleDAO).read(trans, urData);
result = funcObj.extendUserRole(trans, urData, true);
assertTrue(result.status == Status.ERR_UserRoleNotFound);
}
-
+
@SuppressWarnings("deprecation")
@Test
public void testGetUsersByRole() {
@@ -1547,7 +1547,7 @@ public class JU_Function {
urData.expires=new Date();
urDataAl.add(urData);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(urDataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
Function funcObj = new Function(trans, ques);
Result<List<String>> result = funcObj.getUsersByRole(trans, "test", false);
@@ -1555,11 +1555,11 @@ public class JU_Function {
result = funcObj.getUsersByRole(trans, "test", true);
assertTrue(result.status == 0);
-
+
urData.expires=new Date(130,1,1);
result = funcObj.getUsersByRole(trans, "test", true);
assertTrue(result.status == 0);
-//
+//
}
@Test
public void testDelUserRole() {
@@ -1571,26 +1571,26 @@ public class JU_Function {
urData.expires=new Date();
urDataAl.add(urData);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(urDataAl,0,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any( UserRoleDAO.Data.class));
+ Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any( UserRoleDAO.Data.class));
Function funcObj = new Function(trans, ques);
Result<Void> result = funcObj.delUserRole(trans, "test", "test", "test");
assertNull(result);
-
+
retVal = new Result<List<UserRoleDAO.Data>>(urDataAl,1,"test",NO_PARAM);
Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any( UserRoleDAO.Data.class));
result = funcObj.delUserRole(trans, "test", "test", "test");
-// assertTrue(result.status ==1);
-//
+// assertTrue(result.status ==1);
+//
}
-
+
@Test
public void testCreateFuture() {
FutureDAO.Data data = new FutureDAO.Data();
data.memo = "test";
NsDAO.Data nsd = new NsDAO.Data();
nsd.name = "test";
-
+
List<UserRoleDAO.Data> urDataAl = new ArrayList<>();
UserRoleDAO.Data urData = new UserRoleDAO.Data();
urData.ns="test";
@@ -1600,7 +1600,7 @@ public class JU_Function {
urDataAl.add(urData);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(urDataAl,0,"test",NO_PARAM);
Result<List<UserRoleDAO.Data>> retValFail = new Result<List<UserRoleDAO.Data>>(urDataAl,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any( UserRoleDAO.Data.class));
+ Mockito.doReturn(retVal).when(userRoleDAO).read(Mockito.any(), Mockito.any( UserRoleDAO.Data.class));
Function funcObj = new Function(trans, ques);
Result<String> result = funcObj.createFuture(trans, data, "test", "test", nsd, FUTURE_OP.A);
@@ -1618,23 +1618,23 @@ public class JU_Function {
data.memo = "test";
Result<FutureDAO.Data> retValFuture = new Result<FutureDAO.Data>(futureData,0,"test",NO_PARAM);
Mockito.doReturn(retValFuture).when(futureDAO).create(Mockito.any(), Mockito.any( FutureDAO.Data.class), Mockito.anyString());
-
+
ApprovalDAO.Data approvalData = new ApprovalDAO.Data();
data.memo = "test";
Result<ApprovalDAO.Data> retValApproval = new Result<ApprovalDAO.Data>(approvalData,0,"test",NO_PARAM);
Mockito.doReturn(retValApproval).when(approvalDAO).create(Mockito.any(), Mockito.any( ApprovalDAO.Data.class));
-
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
result = funcObj.createFuture(trans, data, "test", "test", nsd, FUTURE_OP.A);
assertTrue(result.status == 0);
-
+
result = funcObj.createFuture(trans, data, "test", "test", null, FUTURE_OP.A);
assertTrue(result.status == 20);
Mockito.doReturn(retValFail).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
result = funcObj.createFuture(trans, data, "test", "test", nsd, FUTURE_OP.A);
assertTrue(result.status == Result.ERR_NotFound);
-
+
Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
try {
Mockito.doReturn(null).when(org).getIdentity(trans, "test");
@@ -1644,7 +1644,7 @@ public class JU_Function {
}
result = funcObj.createFuture(trans, data, "test", "test", nsd, FUTURE_OP.A);
assertTrue(result.status == Result.ERR_NotFound);
-
+
try {
Mockito.doReturn(iden).when(org).getIdentity(trans, "test");
} catch (OrganizationException e) {
@@ -1653,7 +1653,7 @@ public class JU_Function {
}
result = funcObj.createFuture(trans, data, "test", "test", nsd, FUTURE_OP.C);
assertTrue(result.status == 0);
-
+
retValApproval = new Result<ApprovalDAO.Data>(null,1,"test",NO_PARAM);
Mockito.doReturn(retValApproval).when(approvalDAO).create(Mockito.any(), Mockito.any( ApprovalDAO.Data.class));
result = funcObj.createFuture(trans, data, "test", "test", nsd, FUTURE_OP.A);
@@ -1671,22 +1671,22 @@ public class JU_Function {
urDataAl.add(urData);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(urDataAl,0,"test",NO_PARAM);
Result<List<UserRoleDAO.Data>> retValFail = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).read(trans, objArr);
-
+ Mockito.doReturn(retVal).when(userRoleDAO).read(trans, objArr);
+
Function funcObj = new Function(trans, ques);
funcObj.urDBLookup.get(trans, objArr);
-
- Mockito.doReturn(retValFail).when(userRoleDAO).read(trans, objArr);
+
+ Mockito.doReturn(retValFail).when(userRoleDAO).read(trans, objArr);
funcObj.urDBLookup.get(trans, objArr);
}
-
+
@Test
public void testPerformFutureOp() {
FutureDAO.Data futureDataDaoObj = new FutureDAO.Data();
futureDataDaoObj.memo="test";
futureDataDaoObj.target = "test";
futureDataDaoObj.id = new UUID(10L,10L);
-
+
final List<ApprovalDAO.Data> apprs = new ArrayList<>();
ApprovalDAO.Data approvalObj = new ApprovalDAO.Data();
approvalObj.status = "approved";
@@ -1698,7 +1698,7 @@ public class JU_Function {
return apprs;
}
};
-
+
final UserRoleDAO.Data userObj = new UserRoleDAO.Data();
Lookup<UserRoleDAO.Data> lookupUserObj = new Lookup<UserRoleDAO.Data>() {
@Override
@@ -1706,61 +1706,61 @@ public class JU_Function {
return userObj;
}
};
-
+
FutureDAO.Data futureData = new FutureDAO.Data();
// data.memo = "test";
Result<FutureDAO.Data> retValFuture = new Result<FutureDAO.Data>(futureData,0,"test",NO_PARAM);
Mockito.doReturn(retValFuture).when(futureDAO).delete(Mockito.any(), Mockito.any( FutureDAO.Data.class), Mockito.anyBoolean());
-
+
// List<NsDAO.Data> dataAl = new ArrayList<NsDAO.Data>();
// NsDAO.Data dataObj = new NsDAO.Data();
// dataObj.type=1;
// dataAl.add(dataObj);
Result<List<UserRoleDAO.Data>> retVal = new Result<List<UserRoleDAO.Data>>(null,1,"test",NO_PARAM);
- Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
-//
+ Mockito.doReturn(retVal).when(userRoleDAO).readByRole(Mockito.any(), Mockito.anyString());
+//
// Result<NsDAO.Data> retVal2 = new Result<NsDAO.Data>(null,0,"test",NO_PARAM);
// Mockito.doReturn(retVal2).when(ques).mayUser(trans, null,retVal.value.get(0), Access.write);
-//
+//
Function funcObj = new Function(trans, ques);
Result<Function.OP_STATUS> result = funcObj.performFutureOp(trans, FUTURE_OP.A, futureDataDaoObj, lookupApprovalObj, lookupUserObj);
assertTrue(result.status == 0);
-
+
approvalObj.status = "approved";
approvalObj.type = "supervisor";
result = funcObj.performFutureOp(trans, FUTURE_OP.A, futureDataDaoObj, lookupApprovalObj, lookupUserObj);
assertTrue(result.status == 0);
-
+
approvalObj.status = "approved";
approvalObj.type = "";
result = funcObj.performFutureOp(trans, FUTURE_OP.A, futureDataDaoObj, lookupApprovalObj, lookupUserObj);
assertTrue(result.status == 0);
-
+
approvalObj.status = "pending";
approvalObj.type = "supervisor";
result = funcObj.performFutureOp(trans, FUTURE_OP.A, futureDataDaoObj, lookupApprovalObj, lookupUserObj);
assertTrue(result.status == 0);
-
+
approvalObj.status = "pending";
approvalObj.type = "owner";
result = funcObj.performFutureOp(trans, FUTURE_OP.A, futureDataDaoObj, lookupApprovalObj, lookupUserObj);
assertTrue(result.status == 0);
-
+
approvalObj.status = "pending";
approvalObj.type = "";
result = funcObj.performFutureOp(trans, FUTURE_OP.A, futureDataDaoObj, lookupApprovalObj, lookupUserObj);
assertTrue(result.status == 0);
-
+
approvalObj.status = "denied";
approvalObj.type = "";
result = funcObj.performFutureOp(trans, FUTURE_OP.A, futureDataDaoObj, lookupApprovalObj, lookupUserObj);
assertTrue(result.status == 0);
-
+
retValFuture = new Result<FutureDAO.Data>(futureData,1,"test",NO_PARAM);
Mockito.doReturn(retValFuture).when(futureDAO).delete(Mockito.any(), Mockito.any( FutureDAO.Data.class), Mockito.anyBoolean());
result = funcObj.performFutureOp(trans, FUTURE_OP.A, futureDataDaoObj, lookupApprovalObj, lookupUserObj);
System.out.println(result);
assertTrue(result.status == 0);
-//
+//
}
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_PermLookup.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_PermLookup.java
index 7e1abeba..f5d22ba2 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_PermLookup.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/hl/JU_PermLookup.java
@@ -7,9 +7,9 @@
* 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.
@@ -51,17 +51,17 @@ import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.misc.env.LogTarget;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.class)
public class JU_PermLookup {
-
-
+
+
@Mock
AuthzTrans trans;
-
+
@Mock
Question q;
-
+
@Mock
Access access;
@@ -70,40 +70,40 @@ public class JU_PermLookup {
@Mock
CachedUserRoleDAO userRoleDAO;
-
+
Function f;
-
+
@Before
public void setUp() throws Exception {
initMocks(this);
Mockito.doReturn(userRoleDAO).when(q).userRoleDAO();
Mockito.doReturn(roleDAO).when(q).roleDAO();
-
+
try {
Mockito.doReturn("0.0").when(access).getProperty("aaf_root_ns","org.osaaf.aaf");
Mockito.doReturn(new Properties()).when(access).getProperties();
Define.set(access);
-
+
when(trans.error()).thenReturn(new LogTarget() {
-
+
@Override
public void printf(String fmt, Object... vars) {}
-
+
@Override
public void log(Throwable e, Object... msgs) {
e.getMessage();
e.printStackTrace();
msgs.toString();
-
+
}
-
+
@Override
public void log(Object... msgs) {
}
-
+
@Override
public boolean isLoggable() {
-
+
return true;
}
});
@@ -113,70 +113,70 @@ public class JU_PermLookup {
}
f =new Function(trans, q);
}
-
-
+
+
// @Test
// public void testPerm() {
-//
+//
// PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
-//
+//
//// System.out.println(cassExecutorObj);
//// assertFalse(retVal);
// }
-
+
@Test
public void testGetUserRole() {
@SuppressWarnings("unchecked")
Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
retVal1.value = new ArrayList<UserRoleDAO.Data>();
UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
-
+
dataObj.expires = new Date();
-
+
retVal1.value.add(dataObj);
Mockito.doReturn(true).when(retVal1).isOKhasData();
Mockito.doReturn(retVal1).when(userRoleDAO).readByUser(trans,"");
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
Result<List<UserRoleDAO.Data>> userRoles = cassExecutorObj.getUserRoles();
-
+
//System.out.println(""+userRoles.status);
assertEquals(24,userRoles.status);
}
-
+
@Test
public void testGetUserRolesFirstIf() {
@SuppressWarnings("unchecked")
Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
retVal1.value = new ArrayList<UserRoleDAO.Data>();
-
+
Mockito.doReturn(false).when(retVal1).isOKhasData();
Mockito.doReturn(retVal1).when(userRoleDAO).readByUser(trans,"");
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
Result<List<UserRoleDAO.Data>> userRoles = cassExecutorObj.getUserRoles();
-
+
// System.out.println("output is"+userRoles.status);
assertEquals(0,userRoles.status);
}
-
+
@Test
public void testGetUserRolesSecondIf() {
@SuppressWarnings("unchecked")
Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
retVal1.value = new ArrayList<UserRoleDAO.Data>();
UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
-
+
Date dt = new Date();
- Calendar c = Calendar.getInstance();
- c.setTime(dt);
+ Calendar c = Calendar.getInstance();
+ c.setTime(dt);
c.add(Calendar.DATE, 1);
dataObj.expires = c.getTime();
-
+
retVal1.value.add(dataObj);
Mockito.doReturn(true).when(retVal1).isOKhasData();
Mockito.doReturn(retVal1).when(userRoleDAO).readByUser(trans,"");
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
Result<List<UserRoleDAO.Data>> userRoles = cassExecutorObj.getUserRoles();
-
+
//System.out.println(userRoles.status);
assertEquals("Success",userRoles.details);
Result<List<UserRoleDAO.Data>> userRoles1 = cassExecutorObj.getUserRoles();
@@ -184,38 +184,38 @@ public class JU_PermLookup {
//System.out.println(userRoles1.status);
assertEquals(0, userRoles1.status);
}
-
+
@Test
public void testGetRole() {
@SuppressWarnings("unchecked")
Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
retVal1.value = new ArrayList<UserRoleDAO.Data>();
UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
-
+
dataObj.expires = new Date();
-
+
retVal1.value.add(dataObj);
Mockito.doReturn(false).when(retVal1).isOKhasData();
Mockito.doReturn(true).when(retVal1).isOK();
Mockito.doReturn(retVal1).when(userRoleDAO).readByUser(trans,"");
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
Result<List<RoleDAO.Data>> userRoles = cassExecutorObj.getRoles();
-
+
//System.out.println(""+userRoles.status);
assertEquals(4,userRoles.status);
}
-
+
@Test
public void testGetRoleFirstIf() {
@SuppressWarnings("unchecked")
Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
retVal1.value = new ArrayList<UserRoleDAO.Data>();
UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
-
+
dataObj.expires = new Date();
dataObj.ns="";
dataObj.rname="";
-
+
retVal1.value.add(dataObj);
Mockito.doReturn(false).when(retVal1).isOKhasData();
Mockito.doReturn(false).when(retVal1).isOK();
@@ -223,22 +223,22 @@ public class JU_PermLookup {
Mockito.doReturn(retVal1).when(roleDAO).read(trans,"","");
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
Result<List<RoleDAO.Data>> userRoles = cassExecutorObj.getRoles();
-
+
// System.out.println(""+userRoles.status);
assertEquals(0,userRoles.status);
}
-
+
@Test
public void testGetRoleSecondIf() {
@SuppressWarnings("unchecked")
Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
retVal1.value = new ArrayList<UserRoleDAO.Data>();
UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
-
+
dataObj.expires = new Date();
dataObj.ns="";
dataObj.rname="";
-
+
retVal1.value.add(dataObj);
Mockito.doReturn(false).when(retVal1).isOKhasData();
Mockito.doReturn(true).when(retVal1).isOK();
@@ -247,7 +247,7 @@ public class JU_PermLookup {
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
Result<List<RoleDAO.Data>> userRoles = cassExecutorObj.getRoles();
userRoles = cassExecutorObj.getRoles();
-
+
// System.out.println(""+userRoles.status);
assertEquals(0,userRoles.status);
}
@@ -262,7 +262,7 @@ public class JU_PermLookup {
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
Result<Set<String>> userRoles = cassExecutorObj.getPermNames();
userRoles = cassExecutorObj.getPermNames();
-
+
//System.out.println(""+userRoles.status);
assertEquals(0,userRoles.status);
}
@@ -272,19 +272,19 @@ public class JU_PermLookup {
Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
retVal1.value = new ArrayList<UserRoleDAO.Data>();
UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
-
+
dataObj.expires = new Date();
-
+
retVal1.value.add(dataObj);
Mockito.doReturn(false).when(retVal1).isOKhasData();
Mockito.doReturn(true).when(retVal1).isOK();
Mockito.doReturn(retVal1).when(userRoleDAO).readByUser(trans,"");
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
Result<Set<String>> userRoles = cassExecutorObj.getPermNames();
-
+
//System.out.println(""+userRoles.status);
assertEquals(4,userRoles.status);
- }
+ }
@SuppressWarnings("unchecked")
@@ -292,31 +292,31 @@ public class JU_PermLookup {
public void testGetPerm() {
Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
Result<List<RoleDAO.Data>> retVal2 = Mockito.mock(Result.class);
-
+
retVal1.value = new ArrayList<UserRoleDAO.Data>();
retVal2.value = new ArrayList<RoleDAO.Data>();
UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
-
+
Date dt = new Date();
- Calendar c = Calendar.getInstance();
- c.setTime(dt);
+ Calendar c = Calendar.getInstance();
+ c.setTime(dt);
c.add(Calendar.DATE, 1);
dataObj.expires = c.getTime();
dataObj.ns = "";
dataObj.rname="";
-
+
RoleDAO.Data dataObj1 = Mockito.mock( RoleDAO.Data.class);
Set<String> permSet = new HashSet<String>();
permSet.add("test");
Mockito.doReturn(permSet).when(dataObj1).perms(false);
-
+
dt = new Date();
- c = Calendar.getInstance();
- c.setTime(dt);
+ c = Calendar.getInstance();
+ c.setTime(dt);
c.add(Calendar.DATE, 1);
dataObj1.ns = "test";
dataObj1.perms = permSet;
-
+
retVal1.value.add(dataObj);
retVal2.value.add(dataObj1);
Mockito.doReturn(true).when(retVal1).isOKhasData();
@@ -325,47 +325,47 @@ public class JU_PermLookup {
Mockito.doReturn(retVal1).when(userRoleDAO).readByUser(trans,"");
Mockito.doReturn(retVal2).when(roleDAO).read(trans,"","");
-
+
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
-//
+//
// Mockito.doReturn(retVal2).when(cassExecutorObj).getPermNames();
Result<List<Data>> userRoles = cassExecutorObj.getPerms(true);
// userRoles = cassExecutorObj.getPerms(false);
-
+
// System.out.println(""+userRoles.status);
assertEquals(0,userRoles.status);
}
-
+
@SuppressWarnings("unchecked")
@Test
public void testGetPermFalse() {
Result<List<UserRoleDAO.Data>> retVal1 = Mockito.mock(Result.class);
Result<List<RoleDAO.Data>> retVal2 = Mockito.mock(Result.class);
-
+
retVal1.value = new ArrayList<UserRoleDAO.Data>();
retVal2.value = new ArrayList<RoleDAO.Data>();
UserRoleDAO.Data dataObj = Mockito.mock( UserRoleDAO.Data.class);
-
+
Date dt = new Date();
- Calendar c = Calendar.getInstance();
- c.setTime(dt);
+ Calendar c = Calendar.getInstance();
+ c.setTime(dt);
c.add(Calendar.DATE, 1);
dataObj.expires = c.getTime();
dataObj.ns = "";
dataObj.rname="";
-
+
RoleDAO.Data dataObj1 = Mockito.mock( RoleDAO.Data.class);
Set<String> permSet = new HashSet<String>();
permSet.add("test");
Mockito.doReturn(permSet).when(dataObj1).perms(false);
-
+
dt = new Date();
- c = Calendar.getInstance();
- c.setTime(dt);
+ c = Calendar.getInstance();
+ c.setTime(dt);
c.add(Calendar.DATE, 1);
dataObj1.ns = "test";
dataObj1.perms = permSet;
-
+
retVal1.value.add(dataObj);
retVal2.value.add(dataObj1);
Mockito.doReturn(true).when(retVal1).isOKhasData();
@@ -374,15 +374,15 @@ public class JU_PermLookup {
Mockito.doReturn(retVal1).when(userRoleDAO).readByUser(trans,"");
Mockito.doReturn(retVal2).when(roleDAO).read(trans,"","");
-
+
PermLookup cassExecutorObj =PermLookup.get(trans, q,"");
-//
+//
// Mockito.doReturn(retVal2).when(cassExecutorObj).getPermNames();
Result<List<Data>> userRoles = cassExecutorObj.getPerms(false);
userRoles = cassExecutorObj.getPerms(false);
-
+
// System.out.println(""+userRoles.status);
assertEquals(0,userRoles.status);
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLocator.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLocator.java
index 5a7d4959..05623127 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLocator.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,26 +48,26 @@ import org.onap.aaf.cadi.config.Config;
import junit.framework.Assert;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.class)
public class JU_DirectAAFLocator {
@Mock
LocateDAO ldao;
-
+
@Mock
AuthzEnv env;
-
+
@Mock
AuthzTrans trans;
-
+
@Mock
PropAccess access;
-
+
@Before
public void setUp() throws Exception {
initMocks(this);
}
-
+
@Test
public void testConstructorVersionExcpetion() {
Mockito.doReturn(access).when(env).access();
@@ -97,7 +97,7 @@ public class JU_DirectAAFLocator {
assertEquals("Invalid Version String: 20.20.20.test", e.getMessage());
}
}
-
+
@Test
public void testConstructorExcpetion() {
Mockito.doReturn(access).when(env).access();
@@ -112,7 +112,7 @@ public class JU_DirectAAFLocator {
// System.out.println(e.getMessage());
}
}
-
+
// NOTE: These mocks to not well represent the DirectAAFLocator Class.
@Test
public void testConstructorUriExcpetion() {
@@ -133,7 +133,7 @@ public class JU_DirectAAFLocator {
@Test
public void testRefresh() {
-
+
DirectAAFLocator aafLocatorObj=null;
PropAccess access = Mockito.mock(PropAccess.class);
Mockito.doReturn(access).when(env).access();
@@ -150,7 +150,7 @@ public class JU_DirectAAFLocator {
e.printStackTrace();
}
Result<List<Data>> retVal1 = new Result<List<Data>>(null,0,"",new Object[0]);
-
+
Data data= new Data();
data.major=30;
data.minor=30;
@@ -158,16 +158,16 @@ public class JU_DirectAAFLocator {
data.pkg=30;
retVal1.value = new ArrayList<Data>();
retVal1.value.add(data);
-
+
Mockito.doReturn(retVal1).when(ldao).readByName(trans,"test");
boolean retVal = aafLocatorObj.refresh();
// System.out.println(retVal);
assertTrue(retVal);
- }
-
+ }
+
@Test
public void testRefreshNOK() {
-
+
DirectAAFLocator aafLocatorObj=null;
PropAccess access = Mockito.mock(PropAccess.class);
Mockito.doReturn(access).when(env).access();
@@ -184,11 +184,11 @@ public class JU_DirectAAFLocator {
e.printStackTrace();
}
Result<List<Data>> retVal1 = new Result<List<Data>>(null,1,"",new String[0]);
-
+
Mockito.doReturn(retVal1).when(ldao).readByName(trans,"test");
boolean retVal = aafLocatorObj.refresh();
// System.out.println(retVal);
assertFalse(retVal);
- }
-
+ }
+
} \ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLur.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLur.java
index 0ed6e60c..dbd517a0 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLur.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLur.java
@@ -7,9 +7,9 @@
* 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.
@@ -51,34 +51,34 @@ import org.onap.aaf.cadi.lur.LocalPermission;
import org.onap.aaf.misc.env.LogTarget;
import org.onap.aaf.misc.env.Trans;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.class)
public class JU_DirectAAFLur {
@Mock
AuthzEnv env;
-
+
@Mock
Question question;
-
+
@Mock
Principal bait;
-
+
@Mock
Permission pond;
-
+
@Mock
AuthzTrans trans;
-
+
@Before
public void setUp() throws Exception {
initMocks(this);
Mockito.when(env.newTransNoAvg()).thenReturn(trans);
Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).error();
}
-
+
public void testFish() {
DirectAAFLur aafLurObj = new DirectAAFLur(env, question);
-
+
List<PermDAO.Data> rsVal = new ArrayList<PermDAO.Data>();
Result<List<Data>> rs = new Result<List<Data>>(rsVal,0,"test",new Object[0]);
Mockito.when(question.getPermsByUser(env.newTransNoAvg(), bait.getName(), false)).thenReturn(rs);
@@ -88,7 +88,7 @@ public class JU_DirectAAFLur {
@Test
public void testFishSecondMtd() {
DirectAAFLur aafLurObj = new DirectAAFLur(env, question);
-
+
List<PermDAO.Data> rsVal = new ArrayList<PermDAO.Data>();
PermDAO.Data pd = new PermDAO.Data();
pd.ns = "ns";
@@ -101,7 +101,7 @@ public class JU_DirectAAFLur {
pd.instance = "instance";
pd.action = null;
rsVal.add(pd);
-
+
pd = new PermDAO.Data();
pd.ns = "ns";
pd.type = "name";
@@ -115,25 +115,25 @@ public class JU_DirectAAFLur {
pd.ns = "ns";
pd.type = "name1";
rsVal.add(pd);
-
+
pd = new PermDAO.Data();
pd.ns = "ns";
pd.type = "name";
pd.instance = "instance";
pd.action = "action";
rsVal.add(pd);
-
+
pond = new DirectAAFLur.PermPermission("ns", "name", "instance", "action");
-
+
Result<List<Data>> rs = new Result<List<Data>>(rsVal,0,"test",new Object[0]);
Mockito.when(question.getPermsByUser(env.newTransNoAvg(), bait.getName(), false)).thenReturn(rs);
aafLurObj.fish(bait, pond);
-
+
pond = new AAFPermission("ns", "name", "instance", "action");
-
+
Mockito.when(question.getPermsByUser(env.newTransNoAvg(), bait.getName(), false)).thenReturn(rs);
aafLurObj.fish(bait, pond);
-
+
rs = new Result<List<Data>>(rsVal,1,"test",new Object[0]);
Mockito.when(question.getPermsByUser(env.newTransNoAvg(), bait.getName(), false)).thenReturn(rs);
aafLurObj.fish(bait, pond);
@@ -144,76 +144,76 @@ public class JU_DirectAAFLur {
Mockito.when(question.getPermsByUser(env.newTransNoAvg(), bait.getName(), false)).thenReturn(rs);
aafLurObj.fish(bait, pond);
}
-
+
@Test
public void testFishAll() {
Mockito.doReturn(Mockito.mock(LogTarget.class)).when(env).error();
DirectAAFLur aafLurObj = new DirectAAFLur(env, question);
-
+
List<PermDAO.Data> rsVal = new ArrayList<PermDAO.Data>();
PermDAO.Data pd = new PermDAO.Data();
pd.ns = "ns";
pd.type = "name";
pd.instance = null;
rsVal.add(pd);
-
+
pond = new DirectAAFLur.PermPermission("ns", "name", "instance", "action");
List<Permission> permissions = new ArrayList<>();
permissions.add(pond);
-
+
Result<List<Data>> rs = new Result<List<Data>>(rsVal,0,"test",new Object[0]);
Mockito.when(question.getPermsByUser(env.newTrans(), bait.getName(), false)).thenReturn(rs);
aafLurObj.fishAll(bait, permissions);
assertTrue(permissions.size() == 2);
-
+
rs = new Result<List<Data>>(rsVal,1,"test",new Object[0]);
Mockito.when(question.getPermsByUser(env.newTrans(), bait.getName(), false)).thenReturn(rs);
aafLurObj.fishAll(bait, permissions);
}
-
+
@Test
public void testDestroy() {
DirectAAFLur aafLurObj = new DirectAAFLur(env, question);
aafLurObj.destroy();
}
-
+
@Test
public void testHandlesExclusively() {
DirectAAFLur aafLurObj = new DirectAAFLur(env, question);
pond = new DirectAAFLur.PermPermission("ns", "name", "instance", "action");
assertFalse(aafLurObj.handlesExclusively(pond));
}
-
+
@Test
public void testToString() {
DirectAAFLur aafLurObj = new DirectAAFLur(env, question);
assertTrue(aafLurObj.toString().contains("DirectAAFLur is enabled"));
}
-
+
@Test
public void testHandles() {
DirectAAFLur aafLurObj = new DirectAAFLur(env, question);
assertTrue(aafLurObj.handles(null));
}
-
+
@Test
public void testCreatePerm() {
DirectAAFLur aafLurObj = new DirectAAFLur(env, question);
Permission retVal = aafLurObj.createPerm("test");
assertTrue(retVal instanceof LocalPermission);
-
+
NsSplit nss = new NsSplit("test", "test");
Result<NsSplit> rs = new Result<NsSplit>(nss,0,"test",new Object[0]);
Mockito.when(question.deriveNsSplit(NullTrans.singleton() , "test")).thenReturn(rs);
retVal = aafLurObj.createPerm("test|1|2");
assertTrue(retVal instanceof PermPermission);
-
+
rs = new Result<NsSplit>(null,1,"test",new Object[0]);
Mockito.when(question.deriveNsSplit(NullTrans.singleton() , "test")).thenReturn(rs);
retVal = aafLurObj.createPerm("test|1|2");
assertTrue(retVal instanceof LocalPermission);
}
-
+
@Test
public void testClear() {
AuthzTransImpl trans = Mockito.mock(AuthzTransImpl.class);
@@ -223,7 +223,7 @@ public class JU_DirectAAFLur {
Mockito.when(trans.auditTrail(0, sb)).thenReturn(Mockito.mock(Trans.Metric.class));
aafLurObj.clear(bait, sb);
}
-
+
@Test
public void testPermPermission() {
AuthzTransImpl trans = Mockito.mock(AuthzTransImpl.class);
@@ -231,12 +231,12 @@ public class JU_DirectAAFLur {
Result<NsSplit> rs = new Result<NsSplit>(nss,0,"test",new Object[0]);
Mockito.when(question.deriveNsSplit(trans , "test")).thenReturn(rs);
PermPermission pp = new PermPermission(trans, question, "test|test|test|test");
-
+
assertTrue("test".equalsIgnoreCase(pp.getKey()));
assertTrue("AAFLUR".equalsIgnoreCase(pp.permType()));
-
+
assertFalse(pp.match(null));
-
+
pond = new AAFPermission("test.test", "test", "test", "test");
assertTrue(pp.match(pond));
}
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java
index 241d407b..03e3e932 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,76 +44,76 @@ import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.LogTarget;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.class)
public class JU_DirectAAFUserPass {
@Mock
Question question;
-
+
@Mock
AuthzEnv env;
-
+
@Mock
AuthzTrans trans;
-
+
@Mock
HttpServletRequest request;
-
-
+
+
@Before
public void setUp() throws Exception {
initMocks(this);
when(env.warn()).thenReturn(new LogTarget() {
-
+
@Override
public void printf(String fmt, Object... vars) {}
-
+
@Override
public void log(Throwable e, Object... msgs) {
e.getMessage();
e.printStackTrace();
msgs.toString();
-
+
}
-
+
@Override
public void log(Object... msgs) {
}
-
+
@Override
public boolean isLoggable() {
-
+
return true;
}
});
when(env.error()).thenReturn(new LogTarget() {
-
+
@Override
public void printf(String fmt, Object... vars) {}
-
+
@Override
public void log(Throwable e, Object... msgs) {
e.getMessage();
e.printStackTrace();
msgs.toString();
-
+
}
-
+
@Override
public void log(Object... msgs) {
}
-
+
@Override
public boolean isLoggable() {
-
+
return true;
}
});
}
-
+
@Test
public void testUserPass() {
-
+
DirectAAFUserPass aafLocatorObj=null;
aafLocatorObj = new DirectAAFUserPass(env, question);
Result<Date> retVal1 = new Result<Date>(null,0,"",new String[0]);
@@ -124,13 +124,13 @@ public class JU_DirectAAFUserPass {
e.printStackTrace();
}
boolean retVal = aafLocatorObj.validate(null, null, null, null);
-
+
assertFalse(retVal);
- }
-
+ }
+
@Test
public void testUserPassStateisRequest() {
-
+
DirectAAFUserPass aafLocatorObj=null;
aafLocatorObj = new DirectAAFUserPass(env, question);
Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
@@ -141,14 +141,14 @@ public class JU_DirectAAFUserPass {
e.printStackTrace();
}
boolean retVal = aafLocatorObj.validate(null, null, null, request);
-
+
// System.out.println(retVal);
assertFalse(retVal);
}
-
+
@Test
public void testUserPassStateNotNull() {
-
+
DirectAAFUserPass aafLocatorObj=null;
aafLocatorObj = new DirectAAFUserPass(env, question);
Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
@@ -159,14 +159,14 @@ public class JU_DirectAAFUserPass {
e.printStackTrace();
}
boolean retVal = aafLocatorObj.validate(null, null, null, "test");
-
+
// System.out.println(retVal);
assertFalse(retVal);
}
-
+
@Test
public void testUserPassTransChk() {
-
+
DirectAAFUserPass aafLocatorObj=null;
aafLocatorObj = new DirectAAFUserPass(env, question);
Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
@@ -177,14 +177,14 @@ public class JU_DirectAAFUserPass {
e.printStackTrace();
}
boolean retVal = aafLocatorObj.validate(null, null, null, trans);
-
+
// System.out.println(retVal);
assertFalse(retVal);
}
-
+
@Test
public void testUserPassTransIpNotNull() {
-
+
DirectAAFUserPass aafLocatorObj=null;
aafLocatorObj = new DirectAAFUserPass(env, question);
Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
@@ -196,14 +196,14 @@ public class JU_DirectAAFUserPass {
e.printStackTrace();
}
boolean retVal = aafLocatorObj.validate(null, null, null, trans);
-
+
// System.out.println(retVal);
assertFalse(retVal);
}
-
+
@Test
public void testUserExceptionChk() {
-
+
DirectAAFUserPass aafLocatorObj=null;
aafLocatorObj = new DirectAAFUserPass(env, question);
Result<Date> retVal1 = new Result<Date>(null,1,"",new String[0]);
@@ -215,9 +215,9 @@ public class JU_DirectAAFUserPass {
// e.printStackTrace();
}
boolean retVal = aafLocatorObj.validate(null, null, null, trans);
-
+
// System.out.println(retVal);
assertFalse(retVal);
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectCertIdentity.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectCertIdentity.java
index 81195e5d..d59e615c 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectCertIdentity.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectCertIdentity.java
@@ -7,9 +7,9 @@
* * 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.
@@ -66,17 +66,17 @@ public class JU_DirectCertIdentity {
try {
Principal p = directCertIdentity.identity(req, cert, _certBytes);
assertEquals(((p) == null), true);
-
+
cert = Mockito.mock(X509Certificate.class);
Mockito.when(cert.getEncoded()).thenReturn(new byte[128]);
-
+
Result<List<CertDAO.Data>> rs = new Result<List<CertDAO.Data>>(null, 1, "test", new Object[0]);
-
+
CachedCertDAO cacheDao = Mockito.mock(CachedCertDAO.class);
Mockito.when(cacheDao.read(Mockito.any(AuthzTrans.class),Mockito.any(Object[].class))).thenReturn(rs);
DirectCertIdentity.set(cacheDao);
p = directCertIdentity.identity(req, cert, _certBytes);
-
+
_certBytes = new byte[128];
List<CertDAO.Data> dataAL = new ArrayList<>();
CertDAO.Data data = new CertDAO.Data();
@@ -86,7 +86,7 @@ public class JU_DirectCertIdentity {
DirectCertIdentity.set(cacheDao);
p = directCertIdentity.identity(req, cert, _certBytes);
assertTrue(p.toString().contains("X509 Authentication for null"));
-
+
cert = null;
directCertIdentity.identity(req, cert, _certBytes);
} catch (CertificateException e) {
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectLocatorCreator.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectLocatorCreator.java
index 7ac4ed1b..d745b145 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectLocatorCreator.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectLocatorCreator.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,23 +35,23 @@ import org.onap.aaf.cadi.LocatorException;
import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.config.Config;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.class)
public class JU_DirectLocatorCreator {
@Mock
AuthzEnv env;
-
+
@Mock
LocateDAO locateDAO;
-
+
@Mock
PropAccess access;
-
+
@Before
public void setUp() throws Exception {
initMocks(this);
}
-
+
@Test
public void testCreate() {
Mockito.doReturn(access).when(env).access();
diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectRegistrar.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectRegistrar.java
index cf1bd9d4..833b8970 100644
--- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectRegistrar.java
+++ b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectRegistrar.java
@@ -7,9 +7,9 @@
* 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.
@@ -74,12 +74,12 @@ public class JU_DirectRegistrar {
Mockito.doReturn(rs).when(ldao).update(Mockito.any(), Mockito.any());
registrarObj = new DirectRegistrar(access, ldao, 9080);
-
+
org.onap.aaf.auth.layer.Result<Void> retVal1 = new Result<Void>(null, 0, "test", new Object[0]);
Mockito.doReturn(trans).when(env).newTransNoAvg();
// Mockito.doReturn(retVal1).when(ldao).update(trans,locate);
registrarObj.update(env);
-
+
rs = new org.onap.aaf.auth.layer.Result<Void>(null, 1, "test", new Object[0]);
Mockito.doReturn(rs).when(ldao).update(Mockito.any(), Mockito.any());
registrarObj = new DirectRegistrar(access, ldao, 9080);
@@ -100,7 +100,7 @@ public class JU_DirectRegistrar {
Mockito.doReturn("20").when(access).getProperty(Config.AAF_LOCATOR_CONTAINER, "");
Mockito.doReturn("20,test,test").when(access).getProperty(Config.AAF_LOCATOR_ENTRIES, "");
registrarObj = new DirectRegistrar(access, ldao, 9080);
-
+
org.onap.aaf.auth.layer.Result<Void> rs = new org.onap.aaf.auth.layer.Result<Void>(null, 1, "test", new Object[0]);
Mockito.doReturn(rs).when(ldao).delete(Mockito.any(), Mockito.any(), Mockito.anyBoolean());
} catch (CadiException e) {
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
index aadb165e..d7571ab5 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/AAF_CM.java
@@ -8,9 +8,9 @@
* 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.
@@ -92,12 +92,12 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
}
/**
* Construct AuthzAPI with all the Context Supporting Routes that Authz needs
- *
+ *
* @param env
- * @param si
- * @param dm
- * @param decryptor
- * @throws APIException
+ * @param si
+ * @param dm
+ * @param decryptor
+ * @throws APIException
*/
public AAF_CM(AuthzEnv env) throws Exception {
super(env.access(),env);
@@ -109,7 +109,7 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
if (aafEnv==null) {
throw new APIException("aaf_env needs to be set");
}
-
+
// Check for allowing /tmp in Properties
String allowTmp = env.getProperty(CM_ALLOW_TMP);
if("true".equalsIgnoreCase(allowTmp)) {
@@ -132,7 +132,7 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
String key = es.getKey().toString();
if (key.startsWith(CA.CM_CA_PREFIX)) {
int idx = key.indexOf('.');
- if (idx==key.lastIndexOf('.')) { // else it's a regular property
+ if (idx==key.lastIndexOf('.')) { // else it's a regular property
env.log(Level.INIT, "Loading Certificate Authority Module: " + key.substring(idx+1));
String[] segs = Split.split(',', env.getProperty(key));
if (segs.length>0) {
@@ -149,7 +149,7 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
pinst[0]=env;
pinst[1]= key.substring(idx+1);
pinst[2]= aafEnv;
- pinst[3] = multiParams;
+ pinst[3] = multiParams;
try {
CA ca = cons.newInstance(pinst);
certAuths.put(ca.getName(),ca);
@@ -170,7 +170,7 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
}
// note: Service knows how to shutdown Cluster on Shutdown, etc. See Constructor
facade1_0 = FacadeFactory.v1_0(this,trans, service,Data.TYPE.JSON); // Default Facade
- facade1_0_XML = FacadeFactory.v1_0(this,trans,service,Data.TYPE.XML);
+ facade1_0_XML = FacadeFactory.v1_0(this,trans,service,Data.TYPE.XML);
synchronized(env) {
@@ -194,19 +194,19 @@ public class AAF_CM extends AbsService<AuthzEnv, AuthzTrans> {
public CA getCA(String key) {
return certAuths.get(key);
}
-
+
/**
* Setup XML and JSON implementations for each supported Version type
- *
+ *
* We do this by taking the Code passed in and creating clones of these with the appropriate Facades and properties
* to do Versions and Content switches
- *
+ *
*/
public void route(HttpMethods meth, String path, API api, Code code) throws Exception {
String version = "1.0";
// Get Correct API Class from Mapper
- Class<?> respCls = facade1_0.mapper().getClass(api);
+ Class<?> respCls = facade1_0.mapper().getClass(api);
if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
// setup Application API HTML ContentTypes for JSON and Route
String application = applicationJSON(respCls, version);
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/LocalCAImpl.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/LocalCAImpl.java
index d32b67a3..dbc63ad1 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/LocalCAImpl.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/LocalCAImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,7 +35,7 @@ public class LocalCAImpl extends CA {
super(access, caName, env);
// TODO Auto-generated constructor stub
}
-
+
public LocalCAImpl(Access access, final String name, final String env, final String[][] params) throws IOException, CertException {
super(access, name, env);
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java
index a3a30607..8ba4b127 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,7 +34,7 @@ import org.onap.aaf.auth.rserv.HttpMethods;
/**
* API Deployment Artifact Apis.. using Redirect for mechanism
- *
+ *
* @author Jonathan
*
*/
@@ -43,7 +43,7 @@ public class API_Artifact {
private static final String CERT_ARTIFACTS = "/cert/artifacts";
/**
* Normal Init level APIs
- *
+ *
* @param cmAPI
* @throws Exception
*/
@@ -79,7 +79,7 @@ public class API_Artifact {
cmAPI.route(HttpMethods.GET, "/cert/artifacts/:mechid/:machine", API.ARTIFACTS, new Code(cmAPI,GET_ARTIFACTS) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.readArtifacts(trans, resp, pathParam(req,":mechid"), pathParam(req,":machine"));
if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
@@ -88,8 +88,8 @@ public class API_Artifact {
}
}
});
-
-
+
+
cmAPI.route(HttpMethods.PUT, CERT_ARTIFACTS, API.ARTIFACTS, new Code(cmAPI,"Update Artifacts") {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
@@ -105,7 +105,7 @@ public class API_Artifact {
cmAPI.route(HttpMethods.DELETE, "/cert/artifacts/:mechid/:machine", API.VOID, new Code(cmAPI,"Delete Artifacts") {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
- Result<Void> r = context.deleteArtifacts(trans, resp,
+ Result<Void> r = context.deleteArtifacts(trans, resp,
pathParam(req, ":mechid"), pathParam(req,":machine"));
if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
@@ -114,7 +114,7 @@ public class API_Artifact {
}
}
});
-
+
cmAPI.route(HttpMethods.DELETE, CERT_ARTIFACTS, API.VOID, new Code(cmAPI,"Delete Artifacts") {
@Override
@@ -127,7 +127,7 @@ public class API_Artifact {
}
}
});
-
+
}
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java
index 68354413..0f239ada 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Cert.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,7 +36,7 @@ import org.onap.aaf.misc.env.Slot;
/**
* API Apis.. using Redirect for mechanism
- *
+ *
* @author Jonathan
*
*/
@@ -46,7 +46,7 @@ public class API_Cert {
/**
* Normal Init level APIs
- *
+ *
* @param aafCM
* @param facade
* @throws Exception
@@ -54,7 +54,7 @@ public class API_Cert {
public static void init(final AAF_CM aafCM) throws Exception {
// Check for Created Certificate Authorities in TRANS
sCertAuth = aafCM.env.slot(CERT_AUTH);
-
+
////////
// Overall APIs
///////
@@ -76,7 +76,7 @@ public class API_Cert {
}
}
});
-
+
aafCM.route(HttpMethods.GET,"/cert/:ca/personal",API.CERT,new Code(aafCM,"Request Personal Certificate") {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
@@ -96,9 +96,9 @@ public class API_Cert {
}
});
-
+
/**
- *
+ *
*/
aafCM.route(HttpMethods.GET, "/cert/may/:perm", API.VOID, new Code(aafCM,"Check Permission") {
@Override
@@ -114,10 +114,10 @@ public class API_Cert {
});
/**
- * Get Cert by ID and Machine
+ * Get Cert by ID and Machine
*/
-
+
/**
* Get Certs by ID
*/
@@ -133,10 +133,10 @@ public class API_Cert {
}
});
-
+
/**
* Get Certs by Machine
*/
-
+
}
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java
index ab304629..13876b14 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/CA.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,11 +54,11 @@ public abstract class CA {
public static final Set<String> EMPTY = Collections.unmodifiableSet(new HashSet<>());
-
+
private final String name;
private final String env;
private MessageDigest messageDigest;
- private final String permNS;
+ private final String permNS;
private final String permType;
private final ArrayList<String> idDomains;
private String[] trustedCAs;
@@ -71,7 +71,7 @@ public abstract class CA {
trustedCAs = new String[4]; // starting array
this.name = caName;
this.env = env;
- this.env_tag = env==null || env.isEmpty()?false:
+ this.env_tag = env==null || env.isEmpty()?false:
Boolean.parseBoolean(access.getProperty(CM_CA_ENV_TAG, Boolean.FALSE.toString()));
permNS=null;
String prefix = CM_CA_PREFIX + name;
@@ -80,9 +80,9 @@ public abstract class CA {
throw new CertException(prefix + ".perm_type" + MUST_EXIST_TO_CREATE_CSRS_FOR + caName);
}
caIssuerDNs = Split.splitTrim(':', access.getProperty(Config.CADI_X509_ISSUERS, null));
-
+
String tag = CA.CM_CA_PREFIX+caName+CA.CM_CA_BASE_SUBJECT;
-
+
String fields = access.getProperty(tag, null);
if (fields==null) {
throw new CertException(tag + MUST_EXIST_TO_CREATE_CSRS_FOR + caName);
@@ -94,7 +94,7 @@ public abstract class CA {
throw new CertException("email address is not allowed in " + CM_CA_BASE_SUBJECT);
}
}
-
+
idDomains = new ArrayList<>();
StringBuilder sb = null;
for (String s : Split.splitTrim(',', access.getProperty(CA.CM_CA_PREFIX+caName+".idDomains", ""))) {
@@ -111,7 +111,7 @@ public abstract class CA {
if (sb!=null) {
access.printf(Level.INIT, "CA '%s' supports Personal Certificates for %s", caName, sb);
}
-
+
String dataDir = access.getProperty(CM_PUBLIC_DIR,null);
if (dataDir!=null) {
File data = new File(dataDir);
@@ -132,7 +132,7 @@ public abstract class CA {
FileInputStream fis = new FileInputStream(crt);
try {
int read = fis.read(bytes);
- if (read>0) {
+ if (read>0) {
addTrustedCA(new String(bytes));
}
} finally {
@@ -166,7 +166,7 @@ public abstract class CA {
caIssuerDNs = newsa;
}
}
-
+
protected synchronized void addTrustedCA(final String crtString) {
String crt;
if (crtString.endsWith("\n")) {
@@ -185,19 +185,19 @@ public abstract class CA {
temp[trustedCAs.length]=crt;
trustedCAs = temp;
}
-
+
public String[] getCaIssuerDNs() {
return caIssuerDNs;
}
-
+
public String[] getTrustedCAs() {
return trustedCAs;
}
-
+
public boolean shouldAddEnvTag() {
- return env_tag;
+ return env_tag;
}
-
+
public String getEnv() {
return env;
}
@@ -213,16 +213,16 @@ public abstract class CA {
public String getName() {
return name;
}
-
-
+
+
public String getPermNS() {
return permNS;
}
-
+
public String getPermType() {
return permType;
}
-
+
public abstract X509andChain sign(Trans trans, CSRMeta csrmeta) throws IOException, CertException;
/* (non-Javadoc)
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java
index 4dd49199..51b962c8 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java
@@ -9,9 +9,9 @@
* 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.
@@ -71,20 +71,20 @@ public class JscepCA extends CA {
super(access, name, env);
mxcwiS = new ConcurrentHashMap<>();
mxcwiC = new ConcurrentHashMap<>();
-
+
if (params.length<2) {
throw new CertException("No Trust Chain parameters are included");
- }
+ }
if (params[0].length<2) {
throw new CertException("User/Password required for JSCEP");
}
final String id = params[0][0];
- final String pw = params[0][1];
-
+ final String pw = params[0][1];
+
// Set this for NTLM password Microsoft
Authenticator.setDefault(new Authenticator() {
- @Override
- public PasswordAuthentication getPasswordAuthentication () {
+ @Override
+ public PasswordAuthentication getPasswordAuthentication () {
try {
return new PasswordAuthentication (id,access.decrypt(pw,true).toCharArray());
} catch (IOException e) {
@@ -93,16 +93,16 @@ public class JscepCA extends CA {
return null;
}
});
-
+
StringBuilder urlstr = new StringBuilder();
for (int i=1;i<params.length;++i) { // skip first section, which is user/pass
- // Work
+ // Work
if (i>1) {
urlstr.append(','); // delimiter
}
urlstr.append(params[i][0]);
-
+
String dir = access.getProperty(CM_PUBLIC_DIR, "");
if (!"".equals(dir) && !dir.endsWith("/")) {
dir = dir + '/';
@@ -125,12 +125,12 @@ public class JscepCA extends CA {
}
}
}
- }
+ }
clients = new JscepClientLocator(access,urlstr.toString());
}
// package on purpose
-
+
@Override
public X509ChainWithIssuer sign(Trans trans, CSRMeta csrmeta) throws IOException, CertException {
TimeTaken tt = trans.start("Generating CSR and Keys for New Certificate", Env.SUB);
@@ -139,14 +139,14 @@ public class JscepCA extends CA {
csr = csrmeta.generateCSR(trans);
if (trans.info().isLoggable()) {
trans.info().log(BCFactory.toString(csr));
- }
+ }
if (trans.info().isLoggable()) {
trans.info().log(csr);
}
} finally {
tt.done();
}
-
+
tt = trans.start("Enroll CSR", Env.SUB);
Client client = null;
Item item = null;
@@ -154,13 +154,13 @@ public class JscepCA extends CA {
try {
item = clients.best();
client = clients.get(item);
-
+
EnrollmentResponse er = client.enrol(
csrmeta.initialConversationCert(trans),
csrmeta.keypair(trans).getPrivate(),
csr,
MS_PROFILE /* profile... MS can't deal with blanks*/);
-
+
while (true) {
if (er.isSuccess()) {
trans.checkpoint("Cert from " + clients.info(item));
@@ -186,7 +186,7 @@ public class JscepCA extends CA {
i=MAX_RETRY;
} catch (ClientException e) {
trans.error().log(e,"SCEP Client Error, Temporarily Invalidating Client: " + clients.info(item));
- try {
+ try {
clients.invalidate(client);
if (!clients.hasItems()) {
clients.refresh();
@@ -202,13 +202,13 @@ public class JscepCA extends CA {
tt.done();
}
}
-
+
return null;
}
-
+
/**
* Locator specifically for Jscep Clients.
- *
+ *
* Class based client for access to common Map
*/
private class JscepClientLocator extends HotPeerLocator<Client> {
@@ -247,7 +247,7 @@ public class JscepCA extends CA {
protected void _destroy(Client client) {
mxcwiC.remove(client);
}
-
-
+
+
}
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java
index c51ddbde..c2d6701a 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/LocalCA.java
@@ -7,9 +7,9 @@
* 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.
@@ -79,22 +79,22 @@ public class LocalCA extends CA {
KeyPurposeId.id_kp_serverAuth, // WebServer
KeyPurposeId.id_kp_clientAuth // WebClient
};
-
+
private final PrivateKey caKey;
private final X500Name issuer;
private BigInteger serial;
private final X509ChainWithIssuer x509cwi; // "Cert" is CACert
-
-
+
+
public LocalCA(Access access, final String name, final String env, final String[][] params) throws IOException, CertException {
super(access, name, env);
-
+
serial = new BigInteger(64,new SecureRandom());
if (params.length<1 || params[0].length<2) {
throw new IOException("LocalCA expects cm_ca.<ca name>=org.onap.aaf.auth.cm.ca.LocalCA,<full path to key file>[;<Full Path to Trust Chain, ending with actual CA>]+");
}
-
+
// Read in the Private Key
String configured;
File f = new File(params[0][0]);
@@ -145,7 +145,7 @@ public class LocalCA extends CA {
} else {
throw new CertException("Unknown Keystore type from filename " + fileName);
}
-
+
KeyStore.ProtectionParameter keyPass;
try {
@@ -174,7 +174,7 @@ public class LocalCA extends CA {
}
PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry)entry;
caKey = privateKeyEntry.getPrivateKey();
-
+
x509cwi = new X509ChainWithIssuer(privateKeyEntry.getCertificateChain());
configured = "keystore \"" + fileName + "\", alias " + params[0][1];
} catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | UnrecoverableEntryException e) {
@@ -184,7 +184,7 @@ public class LocalCA extends CA {
} else {
throw new CertException("Private Key, " + f.getPath() + ", does not exist");
}
-
+
X500NameBuilder xnb = new X500NameBuilder();
List<RDN> rp = RDN.parse(',', x509cwi.getIssuerDN());
Collections.reverse(rp);
@@ -209,12 +209,12 @@ public class LocalCA extends CA {
TimeTaken tt = trans.start("Create/Sign Cert",Env.SUB);
try {
BigInteger bi;
-
+
synchronized(ONE) {
bi = serial;
serial = serial.add(ONE);
}
-
+
RSAPublicKey rpk = (RSAPublicKey)csrmeta.keypair(trans).getPublic();
X509v3CertificateBuilder xcb = new X509v3CertificateBuilder(
issuer,
@@ -238,7 +238,7 @@ public class LocalCA extends CA {
))
.addExtension(Extension.keyUsage,
true, new KeyUsage(KeyUsage.digitalSignature
- | KeyUsage.keyEncipherment
+ | KeyUsage.keyEncipherment
| KeyUsage.nonRepudiation))
.addExtension(Extension.extendedKeyUsage,
true, new ExtendedKeyUsage(ASN_WebUsage))
@@ -250,8 +250,8 @@ public class LocalCA extends CA {
false, new GeneralNames(sans))
// .addExtension(MiscObjectIdentifiers.netscape, true, new NetscapeCertType(
// NetscapeCertType.sslClient|NetscapeCertType.sslClient))
- ;
-
+ ;
+
x509 = new JcaX509CertificateConverter().getCertificate(
xcb.build(BCFactory.contentSigner(caKey)));
} catch (GeneralSecurityException|OperatorCreationException e) {
@@ -259,7 +259,7 @@ public class LocalCA extends CA {
} finally {
tt.done();
}
-
+
return new X509andChain(x509,x509cwi.trustChain);
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java
index 30495d08..fde94b42 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,9 +38,9 @@ public class X509ChainWithIssuer extends X509andChain {
public X509ChainWithIssuer(X509ChainWithIssuer orig, X509Certificate x509) {
super(x509,orig.trustChain);
- issuerDN=orig.issuerDN;
+ issuerDN=orig.issuerDN;
}
-
+
public X509ChainWithIssuer(final List<? extends Reader> rdrs) throws IOException, CertException {
// Trust Chain. Last one should be the CA
Collection<? extends Certificate> certs;
@@ -49,7 +49,7 @@ public class X509ChainWithIssuer extends X509andChain {
if (rdr==null) { // cover for badly formed array
continue;
}
-
+
byte[] bytes = Factory.decode(rdr,null);
try {
certs = Factory.toX509Certificate(bytes);
@@ -70,7 +70,7 @@ public class X509ChainWithIssuer extends X509andChain {
}
}
}
-
+
public X509ChainWithIssuer(Certificate[] certs) throws IOException, CertException {
X509Certificate x509;
for (int i=certs.length-1; i>=0; --i) {
@@ -79,8 +79,8 @@ public class X509ChainWithIssuer extends X509andChain {
if (subject!=null) {
addTrustChainEntry(x509);
if (i==0) { // last one is signer
- cert=x509;
- issuerDN= subject.toString();
+ cert=x509;
+ issuerDN= subject.toString();
}
}
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java
index 9a0e1c0d..b05747b6 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509andChain.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,21 +30,21 @@ import org.onap.aaf.cadi.configure.Factory;
/**
- * Have to put the Cert and resulting Trust Chain together.
+ * Have to put the Cert and resulting Trust Chain together.
* Treating them separately has caused issues
- *
+ *
* @author JonathanGathman
*
*/
public class X509andChain {
protected X509Certificate cert;
protected String[] trustChain;
-
+
public X509andChain() {
cert = null;
trustChain = null;
}
-
+
public X509andChain(X509Certificate cert, String[] tc) {
this.cert = cert;
trustChain=tc;
@@ -55,8 +55,8 @@ public class X509andChain {
trustChain = new String[chain.size()+1];
chain.toArray(trustChain);
}
-
-
+
+
public void addTrustChainEntry(X509Certificate x509) throws IOException, CertException {
if (trustChain==null) {
trustChain = new String[] {Factory.toString(NullTrans.singleton(),x509)};
@@ -67,14 +67,14 @@ public class X509andChain {
trustChain=temp;
}
}
-
+
public X509Certificate getX509() {
return cert;
}
-
+
public String[] getTrustChain() {
return trustChain;
}
-
+
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java
index b84816ab..9715422d 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/BCFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,7 +47,7 @@ import org.onap.aaf.misc.env.Trans;
/**
* Additional Factory mechanisms for CSRs, and BouncyCastle. The main Factory
* utilizes only Java abstractions, and is useful in Client code.
- *
+ *
* @author JonathanGathman
*
*/
@@ -59,11 +59,11 @@ public class BCFactory extends Factory {
// Bouncy
jcsb = new JcaContentSignerBuilder(Factory.SIG_ALGO);
}
-
+
public static ContentSigner contentSigner(PrivateKey pk) throws OperatorCreationException {
return jcsb.build(pk);
}
-
+
public static String toString(PKCS10CertificationRequest csr) throws IOException, CertException {
if (csr==null) {
throw new CertException("x509 Certificate Request not built");
@@ -89,7 +89,7 @@ public class BCFactory extends Factory {
tt.done();
}
}
-
+
public static CSRMeta createCSRMeta(CA ca, String mechid, String sponsorEmail, List<String> fqdns) throws CertException {
CSRMeta csr = ca.newCSRMeta();
boolean first = true;
@@ -99,9 +99,9 @@ public class BCFactory extends Factory {
first = false;
csr.cn(fqdn);
}
- csr.san(fqdn); // duplicate CN in SAN, per RFC 5280 section 4.2.1.6
+ csr.san(fqdn); // duplicate CN in SAN, per RFC 5280 section 4.2.1.6
}
-
+
csr.challenge(new String(Symm.randomGen(24)));
csr.mechID(mechid);
csr.email(sponsorEmail);
@@ -111,7 +111,7 @@ public class BCFactory extends Factory {
}
return csr;
}
-
+
private static String validateApp(CSRMeta csr) {
CertmanValidator v = new CertmanValidator();
if (v.nullOrBlank("cn", csr.cn())
@@ -146,6 +146,6 @@ public class BCFactory extends Factory {
return null;
}
}
-
+
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java
index f67f445f..04ba0b89 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/CSRMeta.java
@@ -9,9 +9,9 @@
* 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.
@@ -90,15 +90,15 @@ public class CSRMeta {
}
return name;
}
-
-
+
+
public PKCS10CertificationRequest generateCSR(Trans trans) throws IOException, CertException {
PKCS10CertificationRequestBuilder builder = new JcaPKCS10CertificationRequestBuilder(x500Name(),keypair(trans).getPublic());
if (challenge!=null) {
DERPrintableString password = new DERPrintableString(challenge);
builder.addAttribute(PKCSObjectIdentifiers.pkcs_9_at_challengePassword, password);
}
-
+
int plus = email==null?0:1;
if (!sanList.isEmpty()) {
GeneralName[] gna = new GeneralName[sanList.size()+plus];
@@ -107,7 +107,7 @@ public class CSRMeta {
gna[++i]=new GeneralName(GeneralName.dNSName,s);
}
gna[++i]=new GeneralName(GeneralName.rfc822Name,email);
-
+
builder.addAttribute(
PKCSObjectIdentifiers.pkcs_9_at_extensionRequest,
new Extensions(new Extension[] {
@@ -122,7 +122,7 @@ public class CSRMeta {
throw new CertException(e);
}
}
-
+
@SuppressWarnings("deprecation")
public static void dump(PKCS10CertificationRequest csr) {
Attribute[] certAttributes = csr.getAttributes();
@@ -152,7 +152,7 @@ public class CSRMeta {
}
}
}
-
+
public X509Certificate initialConversationCert(Trans trans) throws CertificateException, OperatorCreationException {
GregorianCalendar gc = new GregorianCalendar();
Date start = gc.getTime();
@@ -209,15 +209,15 @@ public class CSRMeta {
public void environment(String env) {
environment = env;
}
-
+
/**
- *
+ *
* @return
*/
public String environment() {
return environment;
}
-
+
/**
* @return the mechID
*/
@@ -263,5 +263,5 @@ public class CSRMeta {
public void challenge(String challenge) {
this.challenge = challenge;
}
-
+
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java
index fe4e20ff..c43e614c 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/cert/RDN.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,7 +35,7 @@ public class RDN {
public RDN(final String tagValue) throws CertException {
String[] tv = Split.splitTrim('=',tagValue);
switch(tv[0]) {
- case "cn":case "CN": aoi = BCStyle.CN;
+ case "cn":case "CN": aoi = BCStyle.CN;
break;
case "c":case "C": aoi = BCStyle.C;
break;
@@ -49,21 +49,21 @@ public class RDN {
break;
case "dc":case "DC": aoi = BCStyle.DC;
break;
- case "gn":case "GN": aoi = BCStyle.GIVENNAME;
+ case "gn":case "GN": aoi = BCStyle.GIVENNAME;
break;
- case "sn":case "SN": aoi = BCStyle.SN;
+ case "sn":case "SN": aoi = BCStyle.SN;
break; // surname
case "email":case "EMAIL":
case "emailaddress":
case "EMAILADDRESS": aoi = BCStyle.EmailAddress;
break; // should be SAN extension
- case "initials": aoi = BCStyle.INITIALS;
- break;
- case "pseudonym": aoi = BCStyle.PSEUDONYM;
+ case "initials": aoi = BCStyle.INITIALS;
+ break;
+ case "pseudonym": aoi = BCStyle.PSEUDONYM;
break;
- case "generationQualifier": aoi = BCStyle.GENERATION;
+ case "generationQualifier": aoi = BCStyle.GENERATION;
break;
- case "serialNumber": aoi = BCStyle.SERIALNUMBER;
+ case "serialNumber": aoi = BCStyle.SERIALNUMBER;
break;
default:
throw new CertException("Unknown ASN1ObjectIdentifier for " + tv[0] + " in " + tagValue);
@@ -71,7 +71,7 @@ public class RDN {
tag = tv[0];
value = tv[1];
}
-
+
/**
* Parse various forms of DNs into appropriate RDNs, which have the ASN1ObjectIdentifier
* @param delim
@@ -109,7 +109,7 @@ public class RDN {
}
return lrnd;
}
-
+
@Override
public String toString() {
return tag + '=' + value;
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertDrop.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertDrop.java
index 0a9d7661..e9e5d446 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertDrop.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertDrop.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertRenew.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertRenew.java
index 242a18ac..55e5a573 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertRenew.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertRenew.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertReq.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertReq.java
index 3e2fb816..7de19944 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertReq.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertReq.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,13 +37,13 @@ public class CertReq {
public List<String> fqdns;
// Notify
public List<String> emails;
-
-
+
+
// These may be null
public String sponsor;
public XMLGregorianCalendar start;
public XMLGregorianCalendar end;
-
+
public CSRMeta getCSRMeta() throws CertException {
return BCFactory.createCSRMeta(certAuthority, mechid, sponsor,fqdns);
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java
index 9017763a..be0c251c 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java
@@ -9,9 +9,9 @@
* 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.
@@ -37,12 +37,12 @@ public class CertResp {
private CA ca;
private KeyPair keyPair;
private String challenge;
-
+
private String privateKey;
private String certString;
private String[] trustChain;
private String[] notes;
-
+
public CertResp(Trans trans, CA ca, X509Certificate x509, CSRMeta csrMeta, String[] trustChain, String[] notes) throws IOException, CertException {
keyPair = csrMeta.keypair(trans);
privateKey = Factory.toString(trans, keyPair.getPrivate());
@@ -58,35 +58,35 @@ public class CertResp {
certString = cert;
}
-
+
public String asCertString() {
return certString;
}
-
+
public String privateString() {
return privateKey;
}
-
+
public String challenge() {
return challenge==null?"":challenge;
}
-
+
public String[] notes() {
return notes;
}
-
+
public String[] caIssuerDNs() {
return ca.getCaIssuerDNs();
}
-
+
public String env() {
return ca.getEnv();
}
-
+
public String[] trustChain() {
return trustChain;
}
-
+
public String[] trustCAs() {
return ca.getTrustedCAs();
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade.java
index 2a49d3cd..3926422a 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,14 +33,14 @@ import org.onap.aaf.auth.layer.Result;
/**
- *
+ *
* @author Jonathan
*
*/
public interface Facade<REQ,CERT,ARTIFACTS,ERROR> {
///////////////////// STANDARD ELEMENTS //////////////////
- /**
+ /**
* @param trans
* @param response
* @param result
@@ -48,7 +48,7 @@ public interface Facade<REQ,CERT,ARTIFACTS,ERROR> {
void error(AuthzTrans trans, HttpServletResponse response, Result<?> result);
/**
- *
+ *
* @param trans
* @param response
* @param status
@@ -62,20 +62,20 @@ public interface Facade<REQ,CERT,ARTIFACTS,ERROR> {
* @param resp
* @param perm
* @return
- * @throws IOException
+ * @throws IOException
*/
Result<Void> check(AuthzTrans trans, HttpServletResponse resp, String perm) throws IOException;
/**
- *
+ *
* @return
*/
public Mapper<REQ,CERT,ARTIFACTS,ERROR> mapper();
///////////////////// STANDARD ELEMENTS //////////////////
-
+
/**
- *
+ *
* @param trans
* @param resp
* @param rservlet
@@ -84,7 +84,7 @@ public interface Facade<REQ,CERT,ARTIFACTS,ERROR> {
public abstract Result<Void> requestCert(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, CA ca);
/**
- *
+ *
* @param trans
* @param resp
* @param rservlet
@@ -94,7 +94,7 @@ public interface Facade<REQ,CERT,ARTIFACTS,ERROR> {
/**
- *
+ *
* @param trans
* @param req
* @param resp
@@ -103,36 +103,36 @@ public interface Facade<REQ,CERT,ARTIFACTS,ERROR> {
public abstract Result<Void> renewCert(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, boolean withTrust);
/**
- *
+ *
* @param trans
* @param req
* @param resp
* @return
*/
public abstract Result<Void> dropCert(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
+
/**
- *
+ *
* @param trans
* @param resp
* @param pathParam
* @return
*/
public Result<Void> readCertsByMechID(AuthzTrans trans, HttpServletResponse resp, String mechID);
-
+
/**
- *
+ *
* @param trans
* @param req
* @param resp
* @return
*/
Result<Void> createArtifacts(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
+
/**
- *
+ *
* @param trans
* @param req
* @param resp
@@ -141,7 +141,7 @@ public interface Facade<REQ,CERT,ARTIFACTS,ERROR> {
Result<Void> readArtifacts(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
/**
- *
+ *
* @param trans
* @param resp
* @param mechid
@@ -151,16 +151,16 @@ public interface Facade<REQ,CERT,ARTIFACTS,ERROR> {
Result<Void> readArtifacts(AuthzTrans trans, HttpServletResponse resp, String mechid, String machine);
/**
- *
+ *
* @param trans
* @param req
* @param resp
* @return
*/
Result<Void> updateArtifacts(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
+
/**
- *
+ *
* @param trans
* @param req
* @param resp
@@ -169,7 +169,7 @@ public interface Facade<REQ,CERT,ARTIFACTS,ERROR> {
Result<Void> deleteArtifacts(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
/**
- *
+ *
* @param trans
* @param resp
* @param mechid
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade1_0.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade1_0.java
index 4a3b5cbe..63859656 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade1_0.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/Facade1_0.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,9 +37,9 @@ import certman.v1_0.CertInfo;
*
*/
public class Facade1_0 extends FacadeImpl<BaseRequest,CertInfo, Artifacts, Error> {
- public Facade1_0(AAF_CM certman,
- CMService service,
- Mapper<BaseRequest,CertInfo,Artifacts,Error> mapper,
+ public Facade1_0(AAF_CM certman,
+ CMService service,
+ Mapper<BaseRequest,CertInfo,Artifacts,Error> mapper,
Data.TYPE type) throws APIException {
super(certman, service, mapper, type);
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeFactory.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeFactory.java
index e9ffb908..1519de14 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeFactory.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,7 +35,7 @@ public class FacadeFactory {
certman,
service,
new Mapper1_0(),
- type);
+ type);
}
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java
index f381a9e8..513b8ea5 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/facade/FacadeImpl.java
@@ -8,9 +8,9 @@
* 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.
@@ -59,7 +59,7 @@ import org.onap.aaf.misc.rosetta.env.RosettaData;
/**
* AuthzFacade
- *
+ *
* This Service Facade encapsulates the essence of the API Service can do, and provides
* a single created object for elements such as RosettaDF.
*
@@ -70,14 +70,14 @@ import org.onap.aaf.misc.rosetta.env.RosettaData;
* a) In the future, we may support multiple Response Formats, aka JSON or XML, based on User Request.
* 4) Log Service info, warnings and exceptions as necessary
* 5) When asked by the API layer, this will create and write Error content to the OutputStream
- *
- * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
+ *
+ * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
* clearly coordinated with the API Documentation
- *
+ *
* @author Jonathan
*
*/
-public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.auth.layer.FacadeImpl implements Facade<REQ,CERT,ARTIFACTS,ERROR>
+public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.auth.layer.FacadeImpl implements Facade<REQ,CERT,ARTIFACTS,ERROR>
{
private static final String TRUE = "TRUE";
private static final String REQUEST_CERT = "Request New Certificate";
@@ -100,8 +100,8 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
private final String voidResp;
public FacadeImpl(AAF_CM certman,
- CMService service,
- Mapper<REQ,CERT,ARTIFACTS,ERROR> mapper,
+ CMService service,
+ Mapper<REQ,CERT,ARTIFACTS,ERROR> mapper,
Data.TYPE dataType) throws APIException {
this.service = service;
this.mapper = mapper;
@@ -120,14 +120,14 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
voidResp = "application/Void+json;charset=utf-8;version=1.0,application/json;version=1.0,*/*";
}
}
-
+
public Mapper<REQ,CERT,ARTIFACTS,ERROR> mapper() {
return mapper;
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#error(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, int)
- *
+ *
* Note: Conforms to AT&T TSS RESTful Error Structure
*/
@Override
@@ -136,7 +136,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
result.details==null?"":result.details.trim(),
result.variables==null?Result.EMPTY_VARS:result.variables);
}
-
+
@Override
public void error(AuthzTrans trans, HttpServletResponse response, int status, final String _msg, final Object ... _detail) {
String msgId;
@@ -158,7 +158,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
prefix = "Forbidden";
response.setStatus(/*httpstatus=*/403);
break;
-
+
case 404:
case ERR_NotFound:
msgId = "SVC1404";
@@ -172,21 +172,21 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
prefix = "Not Acceptable";
response.setStatus(/*httpstatus=*/406);
break;
-
+
case 409:
case ERR_ConflictAlreadyExists:
msgId = "SVC1409";
prefix = "Conflict Already Exists";
response.setStatus(/*httpstatus=*/409);
break;
-
+
case 501:
case ERR_NotImplemented:
msgId = "SVC1501";
- prefix = "Not Implemented";
+ prefix = "Not Implemented";
response.setStatus(/*httpstatus=*/501);
break;
-
+
default:
msgId = "SVC1500";
@@ -200,7 +200,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
StringBuilder holder = new StringBuilder();
ERROR em = mapper().errorFromMessage(holder, msgId,prefix + ": " + _msg,_detail);
trans.checkpoint(
- "ErrResp [" +
+ "ErrResp [" +
msgId +
"] " +
holder.toString(),
@@ -210,7 +210,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
em = mapper().errorFromMessage(holder, msgId, "Server had an issue processing this request");
}
errDF.newData(trans).load(em).to(response.getOutputStream());
-
+
} catch (Exception e) {
trans.error().log(e,"unable to send response for",_msg);
}
@@ -256,12 +256,12 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
trans.error().log("Invalid Input",IN,REQUEST_CERT);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
-
+
Result<CertResp> rcr = service.requestCert(trans,mapper.toReq(trans,request), ca);
if (rcr.notOK()) {
return Result.err(rcr);
}
-
+
Result<CERT> rc = mapper.toCert(trans, rcr, withTrust);
if (rc.status == OK) {
RosettaData<CERT> data = certDF.newData(trans).load(rc.value);
@@ -279,7 +279,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
tt.done();
}
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.cm.facade.Facade#requestPersonalCert(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean)
*/
@@ -300,7 +300,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
trans.error().log("Invalid Input",IN,RENEW_CERT);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
-
+
Result<CertResp> rcr = service.renewCert(trans,mapper.toRenew(trans,request));
Result<CERT> rc = mapper.toCert(trans, rcr, withTrust);
@@ -333,7 +333,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
trans.error().log("Invalid Input",IN,DROP_CERT);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
-
+
Result<Void> rv = service.dropCert(trans,mapper.toDrop(trans, request));
if (rv.status == OK) {
setContentType(resp, certRequestDF.getOutType());
@@ -387,7 +387,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
trans.error().log("Invalid Input",IN,CREATE_ARTIFACTS);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
-
+
return service.createArtifact(trans,mapper.toArtifact(trans,arti));
} catch (Exception e) {
@@ -405,7 +405,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
String mechid = req.getParameter("mechid");
String machine = req.getParameter("machine");
String ns = req.getParameter("ns");
-
+
Result<ARTIFACTS> ra;
if ( machine !=null && mechid == null) {
ra = mapper.fromArtifacts(service.readArtifactsByMachine(trans, machine));
@@ -422,7 +422,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
} else {
ra = Result.err(Status.ERR_BadData,"Invalid request inputs");
}
-
+
if (ra.isOK()) {
RosettaData<ARTIFACTS> data = artiDF.newData(trans).load(ra.value);
data.to(resp.getOutputStream());
@@ -477,7 +477,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
trans.error().log("Invalid Input",IN,UPDATE_ARTIFACTS);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
-
+
return service.updateArtifact(trans,mapper.toArtifact(trans,arti));
} catch (Exception e) {
trans.error().log(e,IN,UPDATE_ARTIFACTS);
@@ -499,7 +499,7 @@ public abstract class FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> extends org.onap.aaf.
trans.error().log("Invalid Input",IN,DELETE_ARTIFACTS);
return Result.err(Result.ERR_BadData,"Invalid Input");
}
-
+
Result<Void> rv = service.deleteArtifact(trans,mapper.toArtifact(trans,arti));
if (rv.status == OK) {
setContentType(resp, artiDF.getOutType());
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper.java
index 4a7019dd..90d1cf32 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,19 +36,19 @@ import org.onap.aaf.auth.layer.Result;
public interface Mapper<REQ,CERT,ARTIFACTS,ERROR>
{
public enum API{ERROR,VOID,CERT,CERT_REQ,CERT_RENEW,CERT_DROP,ARTIFACTS};
-
+
public Class<?> getClass(API api);
public<A> A newInstance(API api);
public ERROR errorFromMessage(StringBuilder holder, String msgID, String text, Object ... detail);
-
+
public Result<CERT> toCert(AuthzTrans trans, Result<CertResp> in, boolean withTrustChain) throws IOException;
public Result<CERT> toCert(AuthzTrans trans, Result<List<CertDAO.Data>> in);
public Result<CertReq> toReq(AuthzTrans trans, REQ req);
public Result<CertRenew> toRenew(AuthzTrans trans, REQ req);
public Result<CertDrop> toDrop(AuthzTrans trans, REQ req);
-
+
public List<ArtiDAO.Data> toArtifact(AuthzTrans trans, ARTIFACTS arti);
public Result<ARTIFACTS> fromArtifacts(Result<List<ArtiDAO.Data>> readArtifactsByMachine);
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java
index bce7eccd..bf5665af 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper1_0.java
@@ -8,9 +8,9 @@
* 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.
@@ -50,7 +50,7 @@ import certman.v1_0.CertificateRequest;
public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
-
+
@Override
public Class<?> getClass(API api) {
switch(api) {
@@ -233,7 +233,7 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
data.ns = trim(arti.getNs());
data.renewDays = arti.getRenewDays();
data.notify = trim(arti.getNotification());
-
+
// Ignored on way in for create/update
data.sponsor = (arti.getSponsor());
if(arti.getSans()!=null) {
@@ -279,8 +279,8 @@ public class Mapper1_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
return Result.err(lArtiDAO);
}
}
-
-
+
+
private String trim(String s) {
if(s==null) {
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java
index 283c828a..501fbcfe 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java
@@ -7,9 +7,9 @@
* 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.
@@ -49,7 +49,7 @@ import certman.v1_0.CertificateRequest;
public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
-
+
@Override
public Class<?> getClass(API api) {
switch(api) {
@@ -127,7 +127,7 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
}
cout.setNotes(sb.toString());
}
-
+
List<String> caIssuerDNs = cout.getCaIssuerDNs();
for (String s : cin.caIssuerDNs()) {
caIssuerDNs.add(s);
@@ -224,7 +224,7 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
data.ns = trim(arti.getNs());
data.renewDays = arti.getRenewDays();
data.notify = trim(arti.getNotification());
-
+
// Ignored on way in for create/update
data.sponsor = trim(arti.getSponsor());
data.expires = null;
@@ -274,7 +274,7 @@ public class Mapper2_0 implements Mapper<BaseRequest,CertInfo,Artifacts,Error> {
return Result.err(lArtiDAO);
}
}
-
-
+
+
} \ No newline at end of file
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java
index aa145f1c..88109437 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java
@@ -80,7 +80,7 @@ public class CMService {
// Limit total requests
private static final int MAX_X509s = 200; // Need a "LIMIT Exception" DB.
private static final String MAX_X509S_TAG = "cm_max_x509s"; // be able to adjust limit in future
-
+
public static final String REQUEST = "request";
public static final String IGNORE_IPS = "ignoreIPs";
public static final String RENEW = "renew";
@@ -153,25 +153,25 @@ public class CMService {
boolean dynamic_sans = false;
if(req.value.fqdns.isEmpty()) {
- fqdns = new ArrayList<>();
+ fqdns = new ArrayList<>();
} else {
- // Only Template or Dynamic permitted to pass in FQDNs
- if (req.value.fqdns.get(0).startsWith("*")) { // Domain set
+ // Only Template or Dynamic permitted to pass in FQDNs
+ if (req.value.fqdns.get(0).startsWith("*")) { // Domain set
if (trans.fish(new AAFPermission(null,ca.getPermType(), ca.getName(), DOMAIN))) {
- domain_based = true;
+ domain_based = true;
} else {
return Result.err(Result.ERR_Denied,
"Domain based Authorizations (" + req.value.fqdns.get(0) + ") requires Exception");
}
- } else {
- if(trans.fish(new AAFPermission(null, ca.getPermType(), ca.getName(),DYNAMIC_SANS))) {
- dynamic_sans = true;
- } else {
+ } else {
+ if(trans.fish(new AAFPermission(null, ca.getPermType(), ca.getName(),DYNAMIC_SANS))) {
+ dynamic_sans = true;
+ } else {
return Result.err(Result.ERR_Denied,
- "Dynamic SANs for (" + req.value.mechid + ") requires Permission");
- }
- }
- fqdns = new ArrayList<>(req.value.fqdns);
+ "Dynamic SANs for (" + req.value.mechid + ") requires Permission");
+ }
+ }
+ fqdns = new ArrayList<>(req.value.fqdns);
}
String email = null;
@@ -185,7 +185,7 @@ public class CMService {
} else {
ignoreIPs = false;
}
-
+
InetAddress primary = null;
// Organize incoming information to get to appropriate Artifact
@@ -197,8 +197,8 @@ public class CMService {
String domain = fqdns.get(0).substring(1); // starts with *, see above
fqdns.remove(0);
if (fqdns.isEmpty()) {
- return Result.err(Result.ERR_Denied,
- "Requests using domain require machine declaration");
+ return Result.err(Result.ERR_Denied,
+ "Requests using domain require machine declaration");
}
if (!ignoreIPs) {
@@ -212,7 +212,7 @@ public class CMService {
}
} else {
- // Passed in FQDNs, but not starting with *
+ // Passed in FQDNs, but not starting with *
if (!ignoreIPs) {
for (String cn : req.value.fqdns) {
try {
@@ -254,37 +254,37 @@ public class CMService {
return Result.err(Result.ERR_Denied,"Authorization must not include SANS when doing Dynamic SANS (%s, %s)", req.value.mechid, key);
}
} else {
- if(domain_based) {
- ra = artiDAO.read(trans, req.value.mechid, key);
- if (ra.isOKhasData()) { // is the Template available?
- add = ra.value.get(0);
- add.machine = host;
- for (String s : fqdns) {
- if (!s.equals(add.machine)) {
- add.sans(true).add(s);
- }
- }
- Result<ArtiDAO.Data> rc = artiDAO.create(trans, add); // Create new Artifact from Template
- if (rc.notOK()) {
- return Result.err(rc);
- }
- } else {
- return Result.err(Result.ERR_Denied,"No Authorization Template for %s, %s", req.value.mechid, key);
- }
- } else {
+ if(domain_based) {
+ ra = artiDAO.read(trans, req.value.mechid, key);
+ if (ra.isOKhasData()) { // is the Template available?
+ add = ra.value.get(0);
+ add.machine = host;
+ for (String s : fqdns) {
+ if (!s.equals(add.machine)) {
+ add.sans(true).add(s);
+ }
+ }
+ Result<ArtiDAO.Data> rc = artiDAO.create(trans, add); // Create new Artifact from Template
+ if (rc.notOK()) {
+ return Result.err(rc);
+ }
+ } else {
+ return Result.err(Result.ERR_Denied,"No Authorization Template for %s, %s", req.value.mechid, key);
+ }
+ } else {
return Result.err(Result.ERR_Denied,"No Authorization found for %s, %s", req.value.mechid, key);
- }
+ }
}
// Add Artifact listed FQDNs
if(!dynamic_sans) {
- if (add.sans != null) {
- for (String s : add.sans) {
- if (!fqdns.contains(s)) {
- fqdns.add(s);
- }
- }
- }
+ if (add.sans != null) {
+ for (String s : add.sans) {
+ if (!fqdns.contains(s)) {
+ fqdns.add(s);
+ }
+ }
+ }
}
// Policy 2: If Config marked as Expired, do not create or renew
@@ -354,7 +354,7 @@ public class CMService {
try {
csrMeta = BCFactory.createCSRMeta(ca, req.value.mechid, email, fqdns);
csrMeta.environment(ca.getEnv());
-
+
// Before creating, make sure they don't have too many
if(!trans.fish(limitOverridePerm)) {
Result<List<CertDAO.Data>> existing = certDAO.readID(trans, req.value.mechid);
@@ -392,7 +392,7 @@ public class CMService {
cdd.id = req.value.mechid;
cdd.x500 = x509.getSubjectDN().getName();
cdd.x509 = Factory.toString(trans, x509);
-
+
certDAO.create(trans, cdd);
CredDAO.Data crdd = new CredDAO.Data();
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/Code.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/Code.java
index fdf2447d..0a4a4abb 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/Code.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/Code.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ public abstract class Code extends HttpCode<AuthzTrans,Facade1_0> implements Clo
// Note, the first "Code" will be created with default Facade, "JSON".
// use clone for another Code with XML
}
-
+
public <D extends Code> D clone(Facade1_0 facade) throws Exception {
@SuppressWarnings("unchecked")
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java
index cdd501ce..eaee6dc5 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/validation/CertmanValidator.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,9 +31,9 @@ import org.onap.aaf.auth.validation.Validator;
/**
* Validator
* Consistently apply content rules for content (incoming)
- *
- * Note: We restrict content for usability in URLs (because RESTful service), and avoid
- * issues with Regular Expressions, and other enabling technologies.
+ *
+ * Note: We restrict content for usability in URLs (because RESTful service), and avoid
+ * issues with Regular Expressions, and other enabling technologies.
* @author Jonathan
*
*/
@@ -49,12 +49,12 @@ public class CertmanValidator extends Validator{
private static final String IS_NULL = " is null.";
private static final String ARTIFACTS_MUST_HAVE_AT_LEAST = "Artifacts must have at least ";
private static final Pattern ALPHA_NUM = Pattern.compile("[a-zA-Z0-9]*");
-
+
private static boolean disallowTmp = true;
public static void allowTmp() {
disallowTmp=false;
}
-
+
public CertmanValidator nullBlankMin(String name, List<String> list, int min) {
if (list==null) {
msg(name + IS_NULL);
@@ -97,7 +97,7 @@ public class CertmanValidator extends Validator{
}
return this;
}
-
+
private CertmanValidator allRequired(Data a) {
if (a==null) {
msg("Artifact is null.");
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java
index 9f7497e0..39681cfa 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/JU_AAF_CM.java
@@ -7,9 +7,9 @@
* 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.
@@ -65,20 +65,20 @@ public class JU_AAF_CM {
@Mock
AuthzEnv env;
-
+
BasicEnv baseEnv;
-
+
@Mock
PropAccess access;
-
+
AuthzTransImpl1 trans;
-
+
AAF_CMImpl rosettaObj = null;
-
+
@Before
public void setUp() {
initMocks(this);
-
+
try {
Mockito.doReturn(access).when(env).access();
Mockito.doReturn("test.test").when(access).getProperty(Config.AAF_ROOT_NS,"org.osaaf.aaf");
@@ -95,7 +95,7 @@ public class JU_AAF_CM {
Mockito.doReturn(trans).when(env).newTrans();
// Mockito.doReturn("test").when(trans).getProperty("cm_ca.props.baseSubject",null);
// Mockito.doReturn(Mockito.mock(TimeTaken.class)).when(trans).start("Clear Reset Deque",8);
-
+
Mockito.doReturn("TLSv1.1").when(access).getProperty("cadi_protocols","test");
Mockito.doReturn("https://www.google.com").when(access).getProperty(Config.AAF_URL,null);
Mockito.doReturn("test").when(env).getProperty(Config.AAF_ENV);
@@ -126,10 +126,10 @@ public class JU_AAF_CM {
PowerMockito.mockStatic(FacadeFactory.class);
FacadeFactory factObj = PowerMockito.mock(FacadeFactory.class);
PowerMockito.when(factObj.v1_0(tempObj,trans, null,Data.TYPE.JSON)).thenReturn(facadeObj);
-
+
// Mockito.doReturn(Mockito.mock(Mapper.class)).when(facadeObj).mapper();
-
+
rosettaObj = new AAF_CMImpl(env);
} catch (Exception e) {
// TODO Auto-generated catch block
@@ -137,13 +137,13 @@ public class JU_AAF_CM {
assertTrue(e instanceof NullPointerException);
}
}
-
+
@Test
public void testTestCA() {
CA obj = rosettaObj.getCA("props");
assertTrue(obj instanceof CA);
}
-
+
// @Test
// public void testRoute() {
// try {
@@ -155,7 +155,7 @@ public class JU_AAF_CM {
//// System.out.println(obj);
//// assertTrue(obj instanceof CA);
// }
-
+
@Test
public void testFilters() {
try {
@@ -168,31 +168,31 @@ public class JU_AAF_CM {
}
// assertTrue(obj instanceof CA);
}
-
+
class AAF_CMImpl extends AAF_CM{
public AAF_CMImpl(AuthzEnv env) throws Exception {
super(env);
// TODO Auto-generated constructor stub
}
-
+
@Override
public synchronized AAFConHttp aafCon() throws CadiException, LocatorException {
return Mockito.mock(AAFConHttp.class);
}
-
+
public CMService getService() {
return Mockito.mock(CMService.class);
}
-
+
@Override
public void route(HttpMethods meth, String path, API api, Code code) throws Exception {
-
+
}
}
-
-
-
+
+
+
class AuthzTransImpl1 extends AuthzTransImpl{
public AuthzTransImpl1(AuthzEnv env) {
@@ -204,22 +204,22 @@ public class JU_AAF_CM {
protected TimeTaken newTimeTaken(String name, int flag, Object ... values) {
// TODO Auto-generated method stub
TimeTaken tt= new TimeTaken("nameTest", Env.XML) {
-
+
@Override
public void output(StringBuilder sb) {
// TODO Auto-generated method stub
-
+
}
};
return tt;
}
-
+
@Override
public Metric auditTrail(int indent, StringBuilder sb, int ... flag) {
return null;
}
-
+
}
-
+
}
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java
index 31ee0727..c6a78b38 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java
@@ -7,9 +7,9 @@
* * 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.
@@ -42,19 +42,19 @@ import junit.framework.Assert;
@RunWith(MockitoJUnitRunner.class)
public class JU_API_Artifact {
-
+
@Mock
private static API_Artifact api;
-
+
@Mock
private static AAF_CM certManApi;
-
+
private static AAF_CM noMockAPI;
private static API_Artifact api_1;
-
+
private static HttpServletRequest req;
private static HttpServletResponse res;
-
+
@BeforeClass
public static void setUp() {
AuthzTrans trans = mock(AuthzTrans.class);
@@ -63,18 +63,18 @@ public class JU_API_Artifact {
trans.setProperty("testTag", "UserValue");
trans.set(req,res);
}
-
+
@Rule
public ExpectedException thrown= ExpectedException.none();
-
+
@Test
public void placeholder() {
Assert.assertTrue(true);
}
-
+
/*
* These fail in builds. Need something better.
- *
+ *
* Also, they don't do much. Just catch some null pointers.
@Test
public void init_bothValued() {
@@ -85,7 +85,7 @@ public class JU_API_Artifact {
e.printStackTrace();
}
}
-
+
@Test
public void init_Null_() {
try {
@@ -95,7 +95,7 @@ public class JU_API_Artifact {
e.printStackTrace();
}
}
-
+
@Test
public void init_NMC_Null() {
try {
@@ -105,7 +105,7 @@ public class JU_API_Artifact {
e.printStackTrace();
}
}
-
+
@Test
public void init_NMC() {
try {
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java
index 674e4edf..4c7888dc 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java
@@ -7,9 +7,9 @@
* * 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.
@@ -42,19 +42,19 @@ import org.onap.aaf.auth.env.AuthzTrans;
@RunWith(MockitoJUnitRunner.class)
public class JU_API_Cert {
-
+
@Mock
private static API_Cert api;
-
+
@Mock
private static AAF_CM certManApi;
-
+
private static AAF_CM noMockAPI;
private static API_Cert api_1;
-
+
private static HttpServletRequest req;
private static HttpServletResponse res;
-
+
@BeforeClass
public static void setUp() {
AuthzTrans trans = mock(AuthzTrans.class);
@@ -63,10 +63,10 @@ public class JU_API_Cert {
trans.setProperty("testTag", "UserValue");
trans.set(req,res);
}
-
+
@Rule
public ExpectedException thrown= ExpectedException.none();
-
+
@Test
public void init_bothValued() {
try {
@@ -76,7 +76,7 @@ public class JU_API_Cert {
e.printStackTrace();
}
}
-
+
@Test
public void init_Null_() {
try {
@@ -86,7 +86,7 @@ public class JU_API_Cert {
e.printStackTrace();
}
}
-
+
@Test
public void init_NMC_Null() {
try {
@@ -96,7 +96,7 @@ public class JU_API_Cert {
e.printStackTrace();
}
}
-
+
@Test
public void init_NMC() {
try {
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java
index 48c81c50..5d91d704 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java
@@ -7,9 +7,9 @@
* * 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.
@@ -61,23 +61,23 @@ import org.onap.aaf.misc.env.Trans;
//TODO: Gabe [JUnit] Import does not exist
@RunWith(MockitoJUnitRunner.class)
public class JU_AppCA {
-
+
@Mock
private static CachedCertDAO certDAO;
-
+
@Mock
private static HttpServletRequest req;
-
+
@Mock
private static CSRMeta csrMeta;
-
+
static Trans trans;
-
+
static X509andChain cert1;
static byte [] name = {1,23,4,54,6,56};
-
+
private static LocalCA localCA;
-
+
@BeforeClass
public static void setUp() throws CertificateException, CertException, IOException {
String str = "core java api";
@@ -86,196 +86,196 @@ public class JU_AppCA {
req = mock(HttpServletRequest.class);
localCA = mock(LocalCA.class);
X509Certificate cert = new X509Certificate() {
-
+
@Override
public boolean hasUnsupportedCriticalExtension() {
return false;
}
-
+
@Override
public Set<String> getNonCriticalExtensionOIDs() {
-
+
return null;
}
-
+
@Override
public byte[] getExtensionValue(String oid) {
-
+
return null;
}
-
+
@Override
public Set<String> getCriticalExtensionOIDs() {
-
+
return null;
}
-
+
@Override
public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException,
InvalidKeyException, NoSuchProviderException, SignatureException {
-
-
+
+
}
-
+
@Override
public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
NoSuchProviderException, SignatureException {
-
-
+
+
}
-
+
@Override
public String toString() {
-
+
return null;
}
-
+
@Override
public PublicKey getPublicKey() {
-
+
return null;
}
-
+
@Override
public byte[] getEncoded() throws CertificateEncodingException {
-
+
return null;
}
-
+
@Override
public int getVersion() {
-
+
return 0;
}
-
+
@Override
public byte[] getTBSCertificate() throws CertificateEncodingException {
-
+
return null;
}
-
+
@Override
public boolean[] getSubjectUniqueID() {
-
+
return null;
}
-
+
@Override
public Principal getSubjectDN() {
-
+
return null;
}
-
+
@Override
public byte[] getSignature() {
-
+
return null;
}
-
+
@Override
public byte[] getSigAlgParams() {
-
+
return null;
}
-
+
@Override
public String getSigAlgOID() {
-
+
return null;
}
-
+
@Override
public String getSigAlgName() {
-
+
return null;
}
-
+
@Override
public BigInteger getSerialNumber() {
-
+
return null;
}
-
+
@Override
public Date getNotBefore() {
-
+
return null;
}
-
+
@Override
public Date getNotAfter() {
-
+
return null;
}
-
+
@Override
public boolean[] getKeyUsage() {
-
+
return null;
}
-
+
@Override
public boolean[] getIssuerUniqueID() {
-
+
return null;
}
-
+
@Override
public Principal getIssuerDN() {
-
+
return null;
}
-
+
@Override
public int getBasicConstraints() {
-
+
return 0;
}
-
+
@Override
public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException {
-
-
+
+
}
-
+
@Override
public void checkValidity() throws CertificateExpiredException, CertificateNotYetValidException {
-
+
}
};
X509andChain xac = new X509andChain(cert, new ArrayList<>());
when(localCA.sign(Mockito.any(Trans.class), Mockito.any(CSRMeta.class))).thenReturn(xac);
certDAO = mock(CachedCertDAO.class, CALLS_REAL_METHODS);
}
-
+
@Test
public void identity_True() throws CertificateException, IOException, CertException {
assertNotNull(localCA.sign(trans, csrMeta));
}
-
-
+
+
@Test
public void identityNull() throws CertificateException {
try {
assertNotNull(localCA.sign(null, csrMeta));
} catch (IOException e) {
-
+
e.printStackTrace();
} catch (CertException e) {
-
+
e.printStackTrace();
}
}
-
+
@Test
public void identityBothNull() throws CertificateException {
try {
assertNotNull(localCA.sign(null, null));
} catch (IOException e) {
-
+
e.printStackTrace();
} catch (CertException e) {
-
+
e.printStackTrace();
}
}
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainTest.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainTest.java
index 4c6f7585..2560b4bf 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainTest.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainWithIssuerTest.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainWithIssuerTest.java
index dbae3fcd..c1b0f94f 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainWithIssuerTest.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_X509ChainWithIssuerTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java
index b5f35c3a..7e0a0845 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java
@@ -7,9 +7,9 @@
* * 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.
@@ -48,19 +48,19 @@ import org.onap.aaf.misc.env.Trans;
@RunWith(MockitoJUnitRunner.class)
public class JU_BCFactory {
-
+
private static BCFactory bcFactory = new BCFactory();
-
+
private static BCFactory bcFact;
-
+
private static PrivateKey pk;
-
-
+
+
private static Trans trans;
-
-
+
+
private static PKCS10CertificationRequest req;
-
+
@BeforeClass
public static void setUp() throws IOException {
pk = new XYZKey();
@@ -68,29 +68,29 @@ public class JU_BCFactory {
req = mock(PKCS10CertificationRequest.class);
when(req.getEncoded()).thenReturn(new byte[1]);
when(trans.start(Mockito.anyString(), Mockito.anyInt())).thenReturn(new TimeTaken(null, 0) {
-
+
@Override
public void output(StringBuilder sb) {
// TODO Auto-generated method stub
-
+
}
});
bcFact = mock(BCFactory.class);
}
-
+
@Test
public void toStrin() throws OperatorCreationException, IOException, CertException {
assertNotNull(bcFactory.toString(req));
}
-
+
@Test
public void toStrinMoc() throws OperatorCreationException, IOException, CertException {
assertNotNull(bcFact.toString(req));
}
-
+
@Rule
public ExpectedException thrown= ExpectedException.none();
-
+
@Test
public void toCSR() {
try {
@@ -100,11 +100,11 @@ public class JU_BCFactory {
e.printStackTrace();
}
}
-
+
}
class XYZKey implements Key, PublicKey, PrivateKey {
-
+
int rotValue;
public XYZKey() {
rotValue = 1200213;
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertReqTest.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertReqTest.java
index 8b33036f..ea7f5a86 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertReqTest.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertReqTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertRespTest.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertRespTest.java
index 37519a30..3424de06 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertRespTest.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/data/JU_CertRespTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java
index a9806439..7db1778d 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java
@@ -7,9 +7,9 @@
* * 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.
@@ -53,7 +53,7 @@ import org.onap.aaf.misc.env.TimeTaken;
@RunWith(MockitoJUnitRunner.class)
public class JU_FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> {
-
+
private static AuthzTrans trans;
private static HttpServletResponse resp;
private static AAF_CM certman;
@@ -62,10 +62,10 @@ public class JU_FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> {
private Mapper<REQ,CERT,ARTIFACTS,ERROR> mapper;
private Data.TYPE dataType;
private static AuthzEnv env;
-
+
private static FacadeImpl fImpl;
private static HttpServletRequest req;
-
+
@Before
public void setUp() throws APIException, IOException {
fImpl = mock(FacadeImpl.class);
@@ -76,111 +76,111 @@ public class JU_FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> {
Result<Void> rvd = (Result) mock(Result.class);
trans = mock(AuthzTrans.class);
when(trans.error()).thenReturn(new LogTarget() {
-
+
@Override
public void printf(String fmt, Object... vars) {}
-
+
@Override
public void log(Throwable e, Object... msgs) {
e.getMessage();
//e.printStackTrace();
msgs.toString();
-
+
}
-
+
@Override
public void log(Object... msgs) {
}
-
+
@Override
public boolean isLoggable() {
-
+
return false;
}
});
when(trans.start(Mockito.anyString(), Mockito.anyInt())).thenReturn(new TimeTaken("Now", 1) {
-
+
@Override
public void output(StringBuilder sb) {
-
+
}
});
when(fImpl.check(Mockito.any(AuthzTrans.class), Mockito.any(HttpServletResponse.class), Mockito.anyString())).thenReturn(rvd);
when(resp.getOutputStream()).thenReturn(new ServletOutputStream() {
-
+
@Override
public void write(int b) throws IOException {
-
-
+
+
}
});
-
+
}
-
+
@Test
public void check() throws IOException {
AAFPermission ap = new AAFPermission("str0","str1","str3","str2");
String perms = ap.getInstance();
assertNotNull(hImpl.check(trans, resp, perms));
}
-
+
@Test
public void checkNull() throws IOException {
AAFPermission ap = new AAFPermission(null,null,"Str3","str2");
String perms = ap.getInstance();
assertNotNull(hImpl.check(trans, resp, perms));
}
-
+
@Test
public void checkTwoNull() throws IOException {
AAFPermission ap = new AAFPermission(null,null,null,"str2");
String perms = ap.getInstance();
assertNotNull(fImpl.check(trans, resp, perms));
}
-
+
@Test
public void checkAllNull() throws IOException {
AAFPermission ap = new AAFPermission(null,null,null,null);
String perms = ap.getInstance();
assertNotNull(fImpl.check(trans, resp, perms));
}
-
+
@Test
public void checkTrans_null() throws IOException {
AAFPermission ap = new AAFPermission("str0","str1","str3","str2");
String perms = ap.getInstance();
assertNotNull(hImpl.check(null, resp, perms));
}
-
+
@Test
public void checkRespNull() throws IOException {
AAFPermission ap = new AAFPermission("str0","str1","str3","str2");
String perms = ap.getInstance();
assertNotNull(hImpl.check(trans, null, perms));
}
-
+
@Test
- public void requestCert() {
+ public void requestCert() {
assertNotNull(hImpl.requestCert(trans, req, resp, null));
}
-
+
@Test
- public void renewCert() {
+ public void renewCert() {
assertNotNull(hImpl.renewCert(trans, req, resp, true));
}
-
+
@Test
- public void dropCert() {
+ public void dropCert() {
assertNotNull(hImpl.renewCert(trans, req, resp, true));
}
-
+
@Test
- public void createArtifacts() {
+ public void createArtifacts() {
assertNotNull(hImpl.createArtifacts(trans, req, resp));
}
-
+
@Test
- public void readArtifacts() {
+ public void readArtifacts() {
assertNotNull(hImpl.readArtifacts(trans, req, resp));
}
}
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java
index 80c9dbcc..f23acd83 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,14 +54,14 @@ public class CertmanTest {
// for (Item item = loc.first(); item!=null; item=loc.next(item)) {
// System.out.println(loc.get(item));
// }
-//
-//
+//
+//
// SecurityInfoC<HttpURLConnection> si = SecurityInfoC.instance(env, HttpURLConnection.class);
-// ss = new HBasicAuthSS(si,"m12345@aaf.att.com",
+// ss = new HBasicAuthSS(si,"m12345@aaf.att.com",
// env.decrypt("enc:gvptdJyo0iKdVZw2rzMb0woxa7YKMdqLuhfQ4OQfZ8k",false));
// env.decrypt("enc:jFfAnO3mOKb9Gzm2OFysslmXpbnyuAxuoNJK",false), si);
// SecuritySetter<HttpURLConnection> ss = new X509SS(si, "aaf");
-
+
// hman = new HMangr(env,loc);
//
// reqDF = env.newDataFactory(CertificateRequest.class);
@@ -85,13 +85,13 @@ public class CertmanTest {
// @Test
// public void testX500Name() throws Exception {
-//
+//
// for ( InetAddress ia : InetAddress.getAllByName("aaf.dev.att.com")) {
// System.out.printf("%s - %s\n", ia.getHostName(), ia.getHostAddress());
// InetAddress ia1 = InetAddress.getByName(ia.getHostAddress());
// System.out.printf("%s - %s\n", ia1.getHostName(), ia1.getHostAddress());
// }
-//
+//
// hman.best(ss, new Retryable<Void>() {
// @Override
// public Void code(Rcli<?> client) throws APIException, CadiException {
@@ -101,7 +101,7 @@ public class CertmanTest {
// cr.getFqdns().add("mithrilcsp.sbc.com");
// cr.getFqdns().add("zld01907.vci.att.com");
// cr.getFqdns().add("aaftest.test.att.com");
-//
+//
// String path = "/cert/local"; // Local Test
//// String path = "/cert/aaf"; // Official CA
// long end=0,start = System.nanoTime();
@@ -131,12 +131,12 @@ public class CertmanTest {
// return null;
// }
// });
-//
-//
+//
+//
// }
//
// public X500Principal ephemeral() {
// return null;
// }
-
+
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
index 51986b92..2c084428 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
@@ -9,9 +9,9 @@
* 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.
@@ -232,7 +232,7 @@ public class AAFcli {
continue;
// Sleep, typically for reports, to allow DB to update
// Milliseconds
-
+
} else if ("sleep".equalsIgnoreCase(largs[idx])) {
Integer t = Integer.parseInt(largs[++idx]);
pw.println("sleep " + t);
@@ -298,8 +298,8 @@ public class AAFcli {
// Allow Script to indicate if Failure is what is expected
}
- }
-
+ }
+
if ("REQUEST".equalsIgnoreCase(largs[idx])) {
request=true;
++idx;
@@ -416,7 +416,7 @@ public class AAFcli {
System.out.println("For instance, C-b means hold ctrl key and press b, M-b means hold alt and press b\n");
System.out.println("Basic Keybindings:");
- System.out.println("\tC-l - clear screen");
+ System.out.println("\tC-l - clear screen");
System.out.println("\tC-a - beginning of line");
System.out.println("\tC-e - end of line");
System.out.println("\tC-b - backward character (left arrow also works)");
@@ -441,7 +441,7 @@ public class AAFcli {
*/
public static void main(String[] args) {
int rv = 0;
-
+
try {
AAFSSO aafsso = new AAFSSO(args);
String noexit = aafsso.access().getProperty("no_exit");
@@ -451,7 +451,7 @@ public class AAFcli {
if (aafsso.ok()) {
Define.set(access);
AuthzEnv env = new AuthzEnv(access);
-
+
Reader rdr = null;
boolean exitOnFailure = true;
/*
@@ -489,15 +489,15 @@ public class AAFcli {
sb.append(args[i]);
}
}
-
+
AAFConHttp aafcon = new AAFConHttp(access);
-//
+//
// SecurityInfoC<?> si = aafcon.securityInfo();
// Locator<URI> loc;
-
+
aafsso.setLogDefault();
aafsso.setStdErrDefault();
-
+
// Note, with AAF Locator, this may not longer be necessary 3/2018 Jonathan
if (!aafsso.loginOnly()) {
// try {
@@ -509,16 +509,16 @@ public class AAFcli {
// // Other Access is done writing to StdOut and StdErr, reset Std out
// aafsso.setLogDefault();
// }
-
+
TIMEOUT = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
// HMangr hman = new HMangr(access, loc).readTimeout(TIMEOUT).apiVersion(Config.AAF_DEFAULT_API_VERSION);
-
+
if (access.getProperty(Config.AAF_DEFAULT_REALM)==null) {
access.setProperty(Config.AAF_DEFAULT_REALM, "people.osaaf.org");
aafsso.addProp(Config.AAF_DEFAULT_REALM, "people.osaaf.org");
}
-
- AAFcli aafcli = new AAFcli(access,env, new OutputStreamWriter(System.out),
+
+ AAFcli aafcli = new AAFcli(access,env, new OutputStreamWriter(System.out),
aafcon.hman(), aafcon.securityInfo(), aafcon.securityInfo().defSS);
// new HBasicAuthSS(si,aafsso.user(), access.decrypt(aafsso.enc_pass(),false)));
// }
@@ -540,18 +540,18 @@ public class AAFcli {
System.out.println("Type 'help' for short help or 'help -d' for detailed help with aafcli commands");
System.out.println("Type '?' for help with command line editing");
System.out.println("Type 'q', 'quit', or 'exit' to quit aafcli\n");
-
+
ConsoleReader reader = new ConsoleReader();
try {
reader.setPrompt("aafcli > ");
-
+
String line;
while ((line = reader.readLine()) != null) {
showDetails = (line.contains("-d"));
-
+
if (line.equalsIgnoreCase("quit") || line.equalsIgnoreCase("q") || line.equalsIgnoreCase("exit")) {
break;
- } else if (line.equalsIgnoreCase("--help -d") || line.equalsIgnoreCase("help -d")
+ } else if (line.equalsIgnoreCase("--help -d") || line.equalsIgnoreCase("help -d")
|| line.equalsIgnoreCase("help")) {
line = "--help";
} else if (line.equalsIgnoreCase("cls")) {
@@ -592,10 +592,10 @@ public class AAFcli {
}
rv = aafcli.eval(sb.toString()) ? 0 : 1;
}
-
+
} finally {
aafcli.close();
-
+
// Don't close if No Reader, or it's a Reader of Standard In
if (rdr != null && !(rdr instanceof InputStreamReader)) {
rdr.close();
@@ -629,7 +629,7 @@ public class AAFcli {
public boolean isTest() {
return AAFcli.isTest;
}
-
+
public boolean isDetailed() {
return AAFcli.showDetails;
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java
index 77d1894f..6978e9e2 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,13 +36,13 @@ public class BaseCmd<CMD extends Cmd> extends Cmd {
super(aafcli, null, name, params);
cmds = new ArrayList<>();
}
-
+
public BaseCmd(CMD parent, String name, Param ... params) {
super(parent.aafcli, parent, name, params);
cmds = new ArrayList<>();
}
-
+
@Override
public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException {
if (args.length-idx<1) {
@@ -53,7 +53,7 @@ public class BaseCmd<CMD extends Cmd> extends Cmd {
Cmd empty = null;
for (Cmd c: cmds) {
name = c.getName();
- if (name==null && empty==null) { // Mark with Command is null, and take the first one.
+ if (name==null && empty==null) { // Mark with Command is null, and take the first one.
empty = c;
} else if (s.equalsIgnoreCase(c.getName()))
return c.exec(idx+1, args);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java
index 6ca09213..0ae4ce99 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java
@@ -7,9 +7,9 @@
* 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.
@@ -67,7 +67,7 @@ public abstract class Cmd {
public static final String STARTDATE = "startdate";
public static final String ENDDATE = "enddate";
-
+
private String name;
private final Param[] params;
private int required;
@@ -104,7 +104,7 @@ public abstract class Cmd {
++required;
}
}
-
+
String temp = access.getProperty(Config.AAF_DEFAULT_REALM,null);
if (temp!=null && !temp.startsWith("@")) {
defaultRealm = '@' + temp;
@@ -112,16 +112,16 @@ public abstract class Cmd {
defaultRealm="<Set Default Realm>";
}
}
-
+
public final int exec(int idx, String ... args) throws CadiException, APIException, LocatorException {
if (args.length-idx<required) {
throw new CadiException(build(new StringBuilder("Too few args: "),null).toString());
}
return _exec(idx,args);
}
-
+
protected abstract int _exec(int idx, final String ... args) throws CadiException, APIException, LocatorException;
-
+
public void detailedHelp(int indent,StringBuilder sb) {
}
@@ -179,7 +179,7 @@ public abstract class Cmd {
sb.append(p.tag);
sb.append(p.required?"> ": "] ");
}
-
+
boolean first = true;
for (Cmd child : children) {
if (!(child instanceof DeprecatedCMD)) {
@@ -222,7 +222,7 @@ public abstract class Cmd {
}
return sb;
}
-
+
protected void error(Future<?> future) {
StringBuilder sb = new StringBuilder("Failed");
String desc = future.body();
@@ -275,7 +275,7 @@ public abstract class Cmd {
pw().println(sb);
}
-
+
private void withCode(StringBuilder sb, Integer code) {
sb.append(" with code ");
sb.append(code);
@@ -303,7 +303,7 @@ public abstract class Cmd {
if ((str = access.getProperty(Cmd.STARTDATE,null))!=null) {
req.setStart(Chrono.timeStamp(Date.valueOf(str)));
}
-
+
if ((str = access.getProperty(Cmd.ENDDATE,null))!=null) {
req.setEnd(Chrono.timeStamp(Date.valueOf(str)));
}
@@ -311,7 +311,7 @@ public abstract class Cmd {
/**
* For Derived classes, who have ENV in this parent
- *
+ *
* @param cls
* @return
* @throws APIException
@@ -349,17 +349,17 @@ public abstract class Cmd {
pw().print('-');
}
pw().println();
-
+
pw().format(hformat,"Date","Table","User","Memo");
for (int i=0;i<lineLength;++i) {
pw().print('-');
}
pw().println();
-
+
// Save Server time by Sorting locally
List<Item> items = history.getItem();
java.util.Collections.sort(items, (Comparator<Item>) (o1, o2) -> o2.getTimestamp().compare(o1.getTimestamp()));
-
+
for (History.Item item : items) {
GregorianCalendar gc = item.getTimestamp().toGregorianCalendar();
pw().format(hformat,
@@ -370,7 +370,7 @@ public abstract class Cmd {
}
}
}
-
+
/**
* Turn String Array into a | delimited String
* @param options
@@ -389,12 +389,12 @@ public abstract class Cmd {
}
return sb.toString();
}
-
+
/**
* return which index number the Option matches.
- *
+ *
* throws an Exception if not part of this Option Set
- *
+ *
* @param options
* @param test
* @return
@@ -420,9 +420,9 @@ public abstract class Cmd {
retryable.item(aafcli.prevCall.item());
retryable.lastClient=aafcli.prevCall.lastClient;
}
-
+
RET ret = aafcli.hman.same(aafcli.ss,retryable);
-
+
// Store last call in AAFcli, because Cmds are all different instances.
aafcli.prevCall = retryable;
return ret;
@@ -445,7 +445,7 @@ public abstract class Cmd {
public String getName() {
return name;
}
-
+
public void reportHead(String ... str) {
pw().println();
boolean first = true;
@@ -467,7 +467,7 @@ public abstract class Cmd {
pw().println();
reportLine();
}
-
+
public String reportColHead(String format, String ... args) {
pw().format(format,(Object[])args);
reportLine();
@@ -480,7 +480,7 @@ public abstract class Cmd {
}
pw().println();
}
-
+
protected void setQueryParamsOn(Rcli<?> rcli) {
StringBuilder sb=null;
String force;
@@ -502,7 +502,7 @@ public abstract class Cmd {
//
// /**
// * If Force is set, will return True once only, then revert to "FALSE".
-// *
+// *
// * @return
// */
// protected String checkForce() {
@@ -525,7 +525,7 @@ public abstract class Cmd {
/**
* Appends shortID with Realm, but only when allowed by Organization
- * @throws OrganizationException
+ * @throws OrganizationException
*/
public String fullID(String id) {
if (id != null) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/DeprecatedCMD.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/DeprecatedCMD.java
index 6082fac8..cb9eb7ce 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/DeprecatedCMD.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/DeprecatedCMD.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,7 +29,7 @@ import org.onap.aaf.misc.env.APIException;
/**
* Use this class to deprecate methods and features, by pointing to the new
* usages.
- *
+ *
* These commands will not show up in Help
* @author Jonathan
*
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java
index 49ffb51b..52439046 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,7 +31,7 @@ public class Help extends Cmd {
private List<Cmd> cmds;
public Help(AAFcli aafcli, List<Cmd> cmds) {
- super(aafcli, "help",
+ super(aafcli, "help",
new Param("-d (more details)", false),
new Param("command",false));
this.cmds = cmds;
@@ -83,7 +83,7 @@ public class Help extends Cmd {
pw().println(sb.toString());
return 200 /*HttpStatus.OK_200*/;
}
-
+
@Override
public void detailedHelp(int indentValue, StringBuilder sb) {
int indent = indentValue;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/MessageException.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/MessageException.java
index 934212ca..bca337e3 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/MessageException.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/MessageException.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,19 +20,19 @@
*/
/**
- *
+ *
*/
package org.onap.aaf.auth.cmd;
/**
* An Exception designed simply to give End User message, no stack trace
- *
+ *
* @author Jonathan
*
*/
public class MessageException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = 8143933588878259048L;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Param.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Param.java
index 8e485528..dfcf4ed5 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Param.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Param.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,9 +24,9 @@ package org.onap.aaf.auth.cmd;
public class Param {
public final String tag;
public final boolean required;
-
+
/**
- *
+ *
* @param t
* @param b
*/
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java
index 9bfb77f9..c6ff3bd9 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Cache.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Cache.java
index ab9758ae..29b74a8d 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Cache.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Cache.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java
index 83bf57c0..6b958108 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,7 +54,7 @@ public class Clear extends Cmd {
public Integer code(Rcli<?> client) throws APIException, CadiException {
int rv = 409;
Future<Void> fp = client.delete(
- "/mgmt/cache/"+name,
+ "/mgmt/cache/"+name,
Void.class
);
if (fp.get(AAFcli.timeout())) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java
index bc7f91f8..3ab26cbd 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,7 +41,7 @@ public class Deny extends BaseCmd<Mgmt> {
cmds.add(new DenySomething(this,"ip","ipv4or6[,ipv4or6]*"));
cmds.add(new DenySomething(this,"id","identity[,identity]*"));
}
-
+
public class DenySomething extends Cmd {
private boolean isID;
@@ -84,7 +84,7 @@ public class Deny extends BaseCmd<Mgmt> {
pw().println(name + append + resp + " on " + client);
rv=fp.code();
} else {
- if (rv==409) {
+ if (rv==409) {
rv = fp.code();
};
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java
index 6289032d..df9f520c 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,7 +42,7 @@ public class Log extends BaseCmd<Mgmt> {
new Param(optionsToString(options),true),
new Param("id[,id]*",true));
}
-
+
@Override
public int _exec(int idxValue, String ... args) throws CadiException, APIException, LocatorException {
int rv=409;
@@ -56,7 +56,7 @@ public class Log extends BaseCmd<Mgmt> {
} else {
fname = name;
}
-
+
rv = all(new Retryable<Integer>() {
@Override
public Integer code(Rcli<?> client) throws APIException, CadiException {
@@ -65,7 +65,7 @@ public class Log extends BaseCmd<Mgmt> {
String str = "/mgmt/log/id/"+fname;
String msg;
switch(option) {
- case 0:
+ case 0:
fp = client.create(str,Void.class);
msg = "Added";
break;
@@ -77,7 +77,7 @@ public class Log extends BaseCmd<Mgmt> {
fp = null;
msg = "Ignored";
}
-
+
if (fp!=null) {
if (fp.get(AAFcli.timeout())) {
pw().println(msg + " Special Log for " + fname + " on " + client);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Mgmt.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Mgmt.java
index a1c83ee0..43dfc85a 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Mgmt.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Mgmt.java
@@ -9,9 +9,9 @@
* 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.
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java
index 9ca01a39..ef139aef 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java
@@ -7,9 +7,9 @@
* 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.
@@ -53,14 +53,14 @@ public class SessClear extends Cmd {
public Integer code(Rcli<?> client) throws APIException, CadiException {
int rv = 409;
Future<Void> fp = client.delete(
- "/mgmt/dbsession",
+ "/mgmt/dbsession",
Void.class
);
if (fp.get(AAFcli.timeout())) {
pw().println("Cleared DBSession on " + client);
rv=200;
} else {
- if (rv==409) {
+ if (rv==409) {
rv = fp.code();
};
error(fp);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Session.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Session.java
index c70234ed..e543e238 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Session.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Session.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java
index 9d2843bc..0afa73b8 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,24 +52,24 @@ public class Admin extends BaseCmd<NS> {
return same(new Retryable<Integer>() {
@Override
- public Integer code(Rcli<?> client) throws CadiException, APIException {
+ public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Void> fp = null;
for (String id : ids) {
id = fullID(id);
String verb;
switch(option) {
- case 0:
+ case 0:
fp = client.create("/authz/ns/"+ns+"/admin/"+id,Void.class);
verb = " added to ";
break;
- case 1:
+ case 1:
fp = client.delete("/authz/ns/"+ns+"/admin/"+id,Void.class);
verb = " deleted from ";
break;
default:
throw new CadiException("Bad Argument");
};
-
+
if (fp.get(AAFcli.timeout())) {
pw().append("Admin ");
pw().append(id);
@@ -79,7 +79,7 @@ public class Admin extends BaseCmd<NS> {
error(fp);
return fp.code();
}
-
+
}
return fp==null?500:fp.code();
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java
index feade450..63089e45 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java
@@ -9,9 +9,9 @@
* 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.
@@ -62,24 +62,24 @@ public class Attrib extends BaseCmd<NS> {
} else {
value = "";
}
-
+
return same(new Retryable<Integer>() {
@Override
- public Integer code(Rcli<?> client) throws CadiException, APIException {
+ public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Void> fp = null;
String message;
switch(option) {
- case 0:
+ case 0:
fp = client.create(authzString+ns+atrributeString+key+'/'+value,Void.class);
message = String.format("Add Attrib %s=%s to %s",
key,value,ns);
break;
- case 1:
+ case 1:
fp = client.update(authzString+ns+atrributeString+key+'/'+value);
message = String.format("Update Attrib %s=%s for %s",
key,value,ns);
break;
- case 2:
+ case 2:
fp = client.delete(authzString+ns+atrributeString+key,Void.class);
message = String.format("Attrib %s deleted from %s",
key,ns);
@@ -95,8 +95,8 @@ public class Attrib extends BaseCmd<NS> {
} else {
error(fp);
}
-
- return fp.code();
+
+ return fp.code();
}
}
});
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java
index 05d66881..6e6b40b4 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,9 +42,9 @@ public class Create extends Cmd {
private static final String COMMA = ",";
public Create(NS parent) {
- super(parent,"create",
+ super(parent,"create",
new Param("ns-name",true),
- new Param("owner (id[,id]*)",true),
+ new Param("owner (id[,id]*)",true),
new Param("admin (id[,id]*)",false));
}
@@ -53,7 +53,7 @@ public class Create extends Cmd {
int idx = _idx;
final NsRequest nr = new NsRequest();
-
+
nr.setName(args[idx++]);
String[] responsible = args[idx++].split(COMMA);
for (String s : responsible) {
@@ -68,17 +68,17 @@ public class Create extends Cmd {
for (String s : admin) {
nr.getAdmin().add(fullID(s));
}
-
+
// Set Start/End commands
setStartEnd(nr);
-
+
return same(new Retryable<Integer>() {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
// Requestable
setQueryParamsOn(client);
Future<NsRequest> fp = client.create(
- "/authz/ns",
+ "/authz/ns",
getDF(NsRequest.class),
nr
);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java
index 7da6c26b..7e6b1422 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,8 +39,8 @@ import org.onap.aaf.misc.env.APIException;
*/
public class Delete extends Cmd {
public Delete(NS parent) {
- super(parent,"delete",
- new Param("ns-name",true));
+ super(parent,"delete",
+ new Param("ns-name",true));
}
@Override
@@ -51,11 +51,11 @@ public class Delete extends Cmd {
int index = idx;
StringBuilder path = new StringBuilder("/authz/ns/");
path.append(args[index++]);
-
+
// Send "Force" if set
setQueryParamsOn(client);
Future<Void> fp = client.delete(path.toString(),Void.class);
-
+
if (fp.get(AAFcli.timeout())) {
pw().println("Deleted Namespace");
} else {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java
index e521d616..68532c9b 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,9 +37,9 @@ import aaf.v2_0.NsRequest;
public class Describe extends Cmd {
private static final String NS_PATH = "/authz/ns";
public Describe(NS parent) {
- super(parent,"describe",
+ super(parent,"describe",
new Param("ns-name",true),
- new Param("description",true));
+ new Param("description",true));
}
@Override
@@ -53,14 +53,14 @@ public class Describe extends Cmd {
while (idx < args.length) {
desc.append(args[idx++] + ' ');
}
-
+
NsRequest nsr = new NsRequest();
nsr.setName(name);
nsr.setDescription(desc.toString());
-
+
// Set Start/End commands
setStartEnd(nsr);
-
+
Future<NsRequest> fn = null;
int rv;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
index e1252d87..ef25f75a 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,9 +47,9 @@ public class List extends BaseCmd<NS> {
public List(NS parent) {
super(parent,"list");
cmds.add(new ListByName(this));
-
-// TODO: uncomment when on cassandra 2.1.2 if we like cli command to get all ns's
-// a user is admin or responsible for
+
+// TODO: uncomment when on cassandra 2.1.2 if we like cli command to get all ns's
+// a user is admin or responsible for
cmds.add(new ListAdminResponsible(this));
cmds.add(new DeprecatedCMD<List>(this,"responsible","'responsible' is deprecated. use 'owner'")); // deprecated
cmds.add(new ListActivity(this));
@@ -57,13 +57,13 @@ public class List extends BaseCmd<NS> {
cmds.add(new ListChildren(this));
cmds.add(new ListNsKeysByAttrib(this));
}
-
+
public void report(Future<Nss> fp, String ... str) {
reportHead(str);
if (fp==null) {
pw().println(" *** Namespace Not Found ***");
}
-
+
if (fp!=null && fp.value!=null) {
for (Ns ns : fp.value.getNs()) {
pw().println(ns.getName());
@@ -93,12 +93,12 @@ public class List extends BaseCmd<NS> {
}
pw().format(sformat,sb.toString());
}
-
+
}
}
}
}
-
+
public void reportName(Future<Nss> fp, String ... str) {
reportHead(str);
if (fp!=null && fp.value!=null) {
@@ -109,7 +109,7 @@ public class List extends BaseCmd<NS> {
return ns1.getName().compareTo(ns2.getName());
}
});
-
+
for (Ns ns : nss) {
pw().println(ns.getName());
if (this.aafcli.isDetailed() && ns.getDescription() != null) {
@@ -136,9 +136,9 @@ public class List extends BaseCmd<NS> {
}
}
}
-
- public void reportCred(Future<Users> fc) {
+
+ public void reportCred(Future<Users> fc) {
if (fc!=null && fc.value!=null && !(fc.value.getUser().isEmpty())) {
pw().println(" Credentials");
java.util.List<User> users = fc.value.getUser();
@@ -162,9 +162,9 @@ public class List extends BaseCmd<NS> {
Integer type;
if ((type=u.getType())==null) {
type = 9999;
- }
+ }
return Define.getCredType(type);
}
-
+
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java
index f8f82466..ae80fd8d 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,9 +40,9 @@ import aaf.v2_0.History;
*/
public class ListActivity extends Cmd {
private static final String HEADER = "List Activity of Namespace";
-
+
public ListActivity(List parent) {
- super(parent,"activity",
+ super(parent,"activity",
new Param("ns-name",true));
}
@@ -50,15 +50,15 @@ public class ListActivity extends Cmd {
public int _exec(int _idx, final String ... args) throws CadiException, APIException, LocatorException {
int idx = _idx;
final String ns = args[idx++];
-
+
return same(new Retryable<Integer>() {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<History> fp = client.read(
- "/authz/hist/ns/"+ns,
+ "/authz/hist/ns/"+ns,
getDF(History.class)
);
-
+
if (fp.get(AAFcli.timeout())) {
activity(fp.value, HEADER + " [ " + ns + " ]");
} else {
@@ -68,7 +68,7 @@ public class ListActivity extends Cmd {
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java
index 3e3a0ea6..1f833d9c 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,11 +37,11 @@ import aaf.v2_0.Nss;
public class ListAdminResponsible extends Cmd {
private static final String HEADER="List Namespaces with ";
private static final String[] options = {"admin","owner"};
-
+
public ListAdminResponsible(List parent) {
- super(parent,null,
+ super(parent,null,
new Param(optionsToString(options),true),
- new Param("user",true));
+ new Param("user",true));
}
@Override
@@ -54,21 +54,21 @@ public class ListAdminResponsible extends Cmd {
String title = args[idx++];
String user = fullID(args[idx++]);
String apipart = "owner".equals(title)?"responsible":title;
-
+
Future<Nss> fn = client.read("/authz/nss/"+apipart+"/"+user,getDF(Nss.class));
if (fn.get(AAFcli.timeout())) {
((List)parent).reportName(fn,HEADER + title + " privileges for ",user);
} else if (fn.code()==404) {
((List)parent).report(null,HEADER + title + " privileges for ",user);
return 200;
- } else {
+ } else {
error(fn);
}
return fn.code();
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER + "admin or owner privileges for user");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java
index b4cca87e..8151b19b 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,9 +45,9 @@ import aaf.v2_0.Users;
*/
public class ListByName extends Cmd {
private static final String HEADER="List Namespaces by Name";
-
+
public ListByName(List parent) {
- super(parent,"name",
+ super(parent,"name",
new Param("ns-name",true));
}
@@ -84,7 +84,7 @@ public class ListByName extends Cmd {
} else if (fn.code()==404) {
((List)parent).report(null,HEADER,ns);
return 200;
- } else {
+ } else {
error(fn);
}
return fn.code();
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java
index 96baa324..9a9f47ff 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,9 +42,9 @@ import aaf.v2_0.Nss.Ns;
*/
public class ListChildren extends Cmd {
private static final String HEADER="List Child Namespaces";
-
+
public ListChildren(List parent) {
- super(parent,"children",
+ super(parent,"children",
new Param("ns-name",true));
}
@@ -64,7 +64,7 @@ public class ListChildren extends Cmd {
} else if (fn.code()==404) {
((List)parent).report(null,HEADER,ns);
return 200;
- } else {
+ } else {
error(fn);
}
return fn.code();
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java
index 01b0f21c..14bc3313 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,10 +45,10 @@ import aaf.v2_0.Users;
*/
public class ListNsKeysByAttrib extends Cmd {
private static final String HEADER="List Namespace Names by Attribute";
-
+
public ListNsKeysByAttrib(List parent) {
- super(parent,"keys",
- new Param("attrib",true));
+ super(parent,"keys",
+ new Param("attrib",true));
}
@Override
@@ -67,7 +67,7 @@ public class ListNsKeysByAttrib extends Cmd {
parent.reportHead(HEADER);
pw().println(" *** No Namespaces Found ***");
return 200;
- } else {
+ } else {
error(fn);
}
return fn.code();
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsers.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsers.java
index ba2f88dc..a89c8497 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsers.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsers.java
@@ -9,9 +9,9 @@
* 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.
@@ -58,7 +58,7 @@ public class ListUsers extends BaseCmd<List> {
};
private static final String uformat = "%s%-50s expires:%02d/%02d/%04d\n";
-
+
public ListUsers(List parent) {
super(parent,"user");
cmds.add(new ListUsersWithPerm(this));
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java
index d6eb9b30..3ebafc23 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java
@@ -7,9 +7,9 @@
* 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.
@@ -49,10 +49,10 @@ import aaf.v2_0.Users.User;
*/
public class ListUsersContact extends Cmd {
private static final String HEADER="List Contacts of Namespace ";
-
+
public ListUsersContact(ListUsers parent) {
- super(parent,"contact",
- new Param("ns-name",true));
+ super(parent,"contact",
+ new Param("ns-name",true));
}
@Override
@@ -76,7 +76,7 @@ public class ListUsersContact extends Cmd {
((ListUsers)parent).report(r.getName());
}
Future<Users> fus = client.read(
- "/authz/users/role/"+r.getName(),
+ "/authz/users/role/"+r.getName(),
getDF(Users.class)
);
if (fus.get(AAFcli.timeout())) {
@@ -102,7 +102,7 @@ public class ListUsersContact extends Cmd {
}
} else if (fn.code()==404) {
return 200;
- } else {
+ } else {
error(fn);
}
return fn.code();
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java
index b33f506d..5cda15bc 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java
@@ -7,9 +7,9 @@
* 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.
@@ -49,10 +49,10 @@ import aaf.v2_0.Users.User;
*/
public class ListUsersInRole extends Cmd {
private static final String HEADER="List Users in Roles of Namespace ";
-
+
public ListUsersInRole(ListUsers parent) {
- super(parent,"role",
- new Param("ns-name",true));
+ super(parent,"role",
+ new Param("ns-name",true));
}
@Override
@@ -76,7 +76,7 @@ public class ListUsersInRole extends Cmd {
((ListUsers)parent).report(r.getName());
}
Future<Users> fus = client.read(
- "/authz/users/role/"+r.getName(),
+ "/authz/users/role/"+r.getName(),
getDF(Users.class)
);
if (fus.get(AAFcli.timeout())) {
@@ -102,7 +102,7 @@ public class ListUsersInRole extends Cmd {
}
} else if (fn.code()==404) {
return 200;
- } else {
+ } else {
error(fn);
}
return fn.code();
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java
index 96ca95ee..cbd21a71 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java
@@ -7,9 +7,9 @@
* 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.
@@ -49,10 +49,10 @@ import aaf.v2_0.Users.User;
*/
public class ListUsersWithPerm extends Cmd {
private static final String HEADER="List Users of Permissions of Namespace ";
-
+
public ListUsersWithPerm(ListUsers parent) {
- super(parent,"perm",
- new Param("ns-name",true));
+ super(parent,"perm",
+ new Param("ns-name",true));
}
@Override
@@ -68,7 +68,7 @@ public class ListUsersWithPerm extends Cmd {
if (fn.get(AAFcli.timeout())) {
if (fn.value!=null) {
Set<String> uset = detail?null:new HashSet<>();
-
+
for (Ns n : fn.value.getNs()) {
Future<Perms> fp = client.read("/authz/perms/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":"")
, getDF(Perms.class));
@@ -77,14 +77,14 @@ public class ListUsersWithPerm extends Cmd {
String perm = p.getType()+'/'+p.getInstance()+'/'+p.getAction();
if (detail)((ListUsers)parent).report(perm);
Future<Users> fus = client.read(
- "/authz/users/perm/"+perm,
+ "/authz/users/perm/"+perm,
getDF(Users.class)
);
if (fus.get(AAFcli.timeout())) {
for (User u : fus.value.getUser()) {
if (detail)
((ListUsers)parent).report(" ",u);
- else
+ else
uset.add(u.getId());
}
} else if (fn.code()==404) {
@@ -102,7 +102,7 @@ public class ListUsersWithPerm extends Cmd {
}
} else if (fn.code()==404) {
return 200;
- } else {
+ } else {
error(fn);
}
return fn.code();
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/NS.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/NS.java
index 092610c5..505417ec 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/NS.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/NS.java
@@ -9,9 +9,9 @@
* 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.
@@ -31,7 +31,7 @@ public class NS extends BaseCmd<NS> {
public NS(AAFcli aafcli) {
super(aafcli, "ns");
-
+
cmds.add(new Create(this));
cmds.add(new Delete(this));
cmds.add(new Admin(this));
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java
index 9ca3d21f..fd43e8da 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java
@@ -7,9 +7,9 @@
* 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.
@@ -59,18 +59,18 @@ public class Owner extends BaseCmd<NS> {
id=fullID(id);
String verb;
switch(option) {
- case 0:
+ case 0:
fp = client.create("/authz/ns/"+ns+"/responsible/"+id,Void.class);
verb = " is now ";
break;
- case 1:
+ case 1:
fp = client.delete("/authz/ns/"+ns+"/responsible/"+id,Void.class);
verb = " is no longer ";
break;
default:
throw new CadiException("Bad Argument");
};
-
+
if (fp.get(AAFcli.timeout())) {
pw().append(id);
pw().append(verb);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java
index be49cf28..559ae070 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,14 +36,14 @@ import aaf.v2_0.PermRequest;
import aaf.v2_0.RoleRequest;
/**
- *
+ *
* @author Jonathan
*
*/
public class Create extends Cmd {
public Create(Perm parent) {
- super(parent,"create",
- new Param("type",true),
+ super(parent,"create",
+ new Param("type",true),
new Param("instance",true),
new Param("action", true),
new Param("role[,role]* (to Grant to)", false)
@@ -56,7 +56,7 @@ public class Create extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
int idx = index;
- final PermRequest pr = new PermRequest();
+ final PermRequest pr = new PermRequest();
pr.setType(args[idx++]);
pr.setInstance(args[idx++]);
pr.setAction(args[idx++]);
@@ -64,7 +64,7 @@ public class Create extends Cmd {
String[] roles = roleCommas==null?null:roleCommas.split("\\s*,\\s*");
boolean force = aafcli.forceString()!=null;
int rv;
-
+
if (roles!=null && force) { // Make sure Roles are Created
RoleRequest rr = new RoleRequest();
for (String role : roles) {
@@ -81,7 +81,7 @@ public class Create extends Cmd {
break;
case 409:
break;
- default:
+ default:
pw().println("Role [" + role + "] does not exist, and cannot be created.");
return 206 /*HttpStatus.PARTIAL_CONTENT_206*/;
}
@@ -113,14 +113,14 @@ public class Create extends Cmd {
switch(fr.code()){
case 201:
case 409:break;
- default:
-
+ default:
+
}
}
}
-
+
try {
- if (201!=(rv=((Perm)parent)._exec(0,
+ if (201!=(rv=((Perm)parent)._exec(0,
new String[] {"grant",pr.getType(),pr.getInstance(),pr.getAction(),roleCommas}))) {
rv = 206 /*HttpStatus.PARTIAL_CONTENT_206*/;
}
@@ -144,7 +144,7 @@ public class Create extends Cmd {
}
});
}
-
+
@Override
public void detailedHelp(int _indent, StringBuilder sb) {
int indent = _indent;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java
index feffbdb0..fc1f9363 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,8 +41,8 @@ import aaf.v2_0.PermRequest;
*/
public class Delete extends Cmd {
public Delete(Perm parent) {
- super(parent,"delete",
- new Param("type",true),
+ super(parent,"delete",
+ new Param("type",true),
new Param("instance",true),
new Param("action", true));
}
@@ -58,7 +58,7 @@ public class Delete extends Cmd {
pk.setType(args[idx++]);
pk.setInstance(args[idx++]);
pk.setAction(args[idx++]);
-
+
if(pk.getType().contains("@")) { // User Perm deletion... Must remove from hidden role
client.setQueryParams("force");
} else {
@@ -66,7 +66,7 @@ public class Delete extends Cmd {
setQueryParamsOn(client);
}
Future<PermRequest> fp = client.delete(
- "/authz/perm",
+ "/authz/perm",
getDF(PermRequest.class),
pk);
if (fp.get(AAFcli.timeout())) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java
index bb894ca7..02c57bd1 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,11 +37,11 @@ import aaf.v2_0.PermRequest;
public class Describe extends Cmd {
private static final String PERM_PATH = "/authz/perm";
public Describe(Perm parent) {
- super(parent,"describe",
+ super(parent,"describe",
new Param("type",true),
new Param("instance", true),
new Param("action", true),
- new Param("description",true));
+ new Param("description",true));
}
@Override
@@ -57,16 +57,16 @@ public class Describe extends Cmd {
while (idx < args.length) {
desc.append(args[idx++] + ' ');
}
-
+
PermRequest pr = new PermRequest();
pr.setType(type);
pr.setInstance(instance);
pr.setAction(action);
pr.setDescription(desc.toString());
-
+
// Set Start/End commands
setStartEnd(pr);
-
+
Future<PermRequest> fp = null;
int rv;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java
index f27a2609..eb206970 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java
@@ -9,9 +9,9 @@
* 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.
@@ -38,7 +38,7 @@ import aaf.v2_0.Pkey;
import aaf.v2_0.RolePermRequest;
/**
- *
+ *
* @author Jonathan
*
*/
@@ -52,7 +52,7 @@ public class Grant extends Cmd {
new Param("instance",true),
new Param("action",true),
new Param("role[,role]*",false)
- );
+ );
}
@Override
@@ -63,7 +63,7 @@ public class Grant extends Cmd {
int idx = index;
String action = args[idx++];
int option = whichOption(options, action);
-
+
RolePermRequest rpr = new RolePermRequest();
Pkey pk = new Pkey();
pk.setType(args[idx++]);
@@ -71,9 +71,9 @@ public class Grant extends Cmd {
pk.setAction(args[idx++]);
rpr.setPerm(pk);
setStartEnd(rpr);
-
+
Future<RolePermRequest> frpr = null;
-
+
String[] roles = args[idx++].split(",");
String strA;
String strB;
@@ -83,7 +83,7 @@ public class Grant extends Cmd {
// You can request to Grant Permission to a Role
setQueryParamsOn(client);
frpr = client.create(
- "/authz/role/perm",
+ "/authz/role/perm",
getDF(RolePermRequest.class),
rpr
);
@@ -93,7 +93,7 @@ public class Grant extends Cmd {
// You can request to UnGrant Permission to a Role
setQueryParamsOn(client);
frpr = client.delete(
- "/authz/role/" + role + "/perm",
+ "/authz/role/" + role + "/perm",
getDF(RolePermRequest.class),
rpr
);
@@ -101,7 +101,7 @@ public class Grant extends Cmd {
strB = "] from Role [";
}
if (frpr.get(AAFcli.timeout())) {
- pw().println(strA + pk.getType() + '|' + pk.getInstance() + '|' + pk.getAction()
+ pw().println(strA + pk.getType() + '|' + pk.getInstance() + '|' + pk.getAction()
+ strB + role +']');
} else {
if (frpr.code()==202) {
@@ -111,7 +111,7 @@ public class Grant extends Cmd {
} else {
error(frpr);
idx=Integer.MAX_VALUE;
- }
+ }
}
}
return frpr==null?0:frpr.code();
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java
index 8ff2763a..2af8d45a 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java
@@ -9,9 +9,9 @@
* 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.
@@ -61,7 +61,7 @@ public class List extends BaseCmd<Perm> {
// Package Level on purpose
abstract class ListPerms extends Retryable<Integer> {
protected int list(Future<Perms> fp,String header, String parentPerm) throws CadiException {
- if (fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
report(fp,header, parentPerm);
} else {
error(fp);
@@ -69,10 +69,10 @@ public class List extends BaseCmd<Perm> {
return fp.code();
}
}
-
+
void report(Future<Perms> fp, String ... str) {
reportHead(str);
- if (this.aafcli.isDetailed()) {
+ if (this.aafcli.isDetailed()) {
String format = "%-36s %-30s %-15s\n";
String descFmt = " %-75s\n";
reportColHead(format + descFmt,"[PERM NS].Type","Instance","Action", "Description");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java
index c96220a5..6400aad3 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,9 +40,9 @@ import aaf.v2_0.History;
*/
public class ListActivity extends Cmd {
private static final String HEADER = "List Activity of Permission";
-
+
public ListActivity(List parent) {
- super(parent,"activity",
+ super(parent,"activity",
new Param("type",true));
}
@@ -54,7 +54,7 @@ public class ListActivity extends Cmd {
int idx = index;
String type = args[idx++];
Future<History> fp = client.read(
- "/authz/hist/perm/"+type,
+ "/authz/hist/perm/"+type,
getDF(History.class)
);
if (fp.get(AAFcli.timeout())) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByNS.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByNS.java
index 7469eed5..e4b0cdb1 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByNS.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByNS.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,16 +34,16 @@ import aaf.v2_0.Perms;
/**
* Return Perms by NS
- *
+ *
* @author Jeremiah
*
*/
public class ListByNS extends Cmd {
private static final String HEADER = "List Perms by NS ";
-
+
public ListByNS(List parent) {
- super(parent,"ns",
- new Param("name",true));
+ super(parent,"ns",
+ new Param("name",true));
}
public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException {
@@ -53,14 +53,14 @@ public class ListByNS extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Perms> fp = client.read(
- "/authz/perms/ns/"+ns+(aafcli.isDetailed()?"?ns":""),
+ "/authz/perms/ns/"+ns+(aafcli.isDetailed()?"?ns":""),
getDF(Perms.class)
);
return list(fp, HEADER, ns);
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByName.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByName.java
index 099fb5f8..e13bbede 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByName.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByName.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,16 +33,16 @@ import org.onap.aaf.misc.env.APIException;
import aaf.v2_0.Perms;
/**
- *
+ *
* @author Jonathan
*
*/
public class ListByName extends Cmd {
private static final String HEADER = "List Child Permissions";
-
+
public ListByName(List parent) {
- super(parent,"name",
- new Param("root perm name",true));
+ super(parent,"name",
+ new Param("root perm name",true));
}
public int _exec(final int index, final String ... args) throws CadiException, APIException, LocatorException {
@@ -50,10 +50,10 @@ public class ListByName extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
String parentPerm=args[index];
-
+
Future<Perms> fp = client.read(
- "/authz/perms/"+parentPerm+(aafcli.isDetailed()?"?ns":""),
- getDF(Perms.class)
+ "/authz/perms/"+parentPerm+(aafcli.isDetailed()?"?ns":""),
+ getDF(Perms.class)
);
return list(fp,HEADER,parentPerm);
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByRole.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByRole.java
index 32b78a6b..294f6ad1 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByRole.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByRole.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,16 +34,16 @@ import aaf.v2_0.Perms;
/**
* Return Perms by Role
- *
+ *
* @author Jeremiah
*
*/
public class ListByRole extends Cmd {
private static final String HEADER = "List Perms by Role ";
-
+
public ListByRole(List parent) {
- super(parent,"role",
- new Param("name",true));
+ super(parent,"role",
+ new Param("name",true));
}
public int _exec(final int idx, final String ... args) throws CadiException, APIException, LocatorException {
@@ -54,14 +54,14 @@ public class ListByRole extends Cmd {
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Perms> fp = client.read(
- "/authz/perms/role/"+role+(aafcli.isDetailed()?"?ns":""),
+ "/authz/perms/role/"+role+(aafcli.isDetailed()?"?ns":""),
getDF(Perms.class)
);
return list(fp, HEADER, role);
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java
index 00972a18..6b1fe35e 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,20 +33,20 @@ import org.onap.aaf.misc.env.APIException;
import aaf.v2_0.Perms;
/**
- *
+ *
* @author Jonathan
*
*/
public class ListByUser extends Cmd {
private static final String HEADER = "List Permissions by User";
public ListByUser(List parent) {
- super(parent,"user",
- new Param("id",true));
+ super(parent,"user",
+ new Param("id",true));
}
public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException {
final String user=fullID(args[idx]);
-
+
return same(((List)parent).new ListPerms() {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
@@ -64,14 +64,14 @@ public class ListByUser extends Cmd {
sb.append("ns");
}
Future<Perms> fp = client.read(
- "/authz/perms/user/"+user+(sb==null?"":sb),
+ "/authz/perms/user/"+user+(sb==null?"":sb),
getDF(Perms.class)
);
return list(fp,HEADER, user);
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Perm.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Perm.java
index 40a07f4e..499ce736 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Perm.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Perm.java
@@ -9,9 +9,9 @@
* 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.
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java
index 5a7b5dee..d868a7c8 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,16 +41,16 @@ import aaf.v2_0.PermRequest;
public class Rename extends Cmd {
public Rename(Perm parent) {
- super(parent,"rename",
- new Param("type",true),
+ super(parent,"rename",
+ new Param("type",true),
new Param("instance",true),
new Param("action", true),
- new Param("new type",true),
+ new Param("new type",true),
new Param("new instance",true),
new Param("new action", true)
);
}
-
+
@Override
public int _exec(final int index, final String ... args) throws CadiException, APIException, LocatorException {
return same(new Retryable<Integer>() {
@@ -60,13 +60,13 @@ public class Rename extends Cmd {
String origType = args[idx++];
String origInstance = args[idx++];
String origAction = args[idx++];
-
+
//Create new permission
PermRequest pr = new PermRequest();
pr.setType(args[idx++]);
pr.setInstance(args[idx++]);
pr.setAction(args[idx++]);
-
+
// Set Start/End commands
setStartEnd(pr);
try {
@@ -96,9 +96,9 @@ public class Rename extends Cmd {
}
}
});
-
+
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,"Rename a Permission from:");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java
index e44185ec..a41256be 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java
@@ -9,9 +9,9 @@
* 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.
@@ -37,7 +37,7 @@ import org.onap.aaf.misc.env.APIException;
import aaf.v2_0.RoleRequest;
/**
- *
+ *
* @author Jonathan
*
*/
@@ -45,9 +45,9 @@ public class CreateDelete extends Cmd {
private static final String ROLE_PATH = "/authz/role";
private static final String[] options = {"create","delete"};
public CreateDelete(Role parent) {
- super(parent,null,
+ super(parent,null,
new Param(optionsToString(options),true),
- new Param("name",true));
+ new Param("name",true));
}
@Override
@@ -58,13 +58,13 @@ public class CreateDelete extends Cmd {
int idx = index;
String action = args[idx++];
int option = whichOption(options, action);
-
+
RoleRequest rr = new RoleRequest();
rr.setName(args[idx++]);
-
+
// Set Start/End commands
setStartEnd(rr);
-
+
Future<RoleRequest> fp = null;
String verb = null;
int rv;
@@ -81,7 +81,7 @@ public class CreateDelete extends Cmd {
// Send "Force" if set
setQueryParamsOn(client);
fp = client.delete(
- ROLE_PATH, // +args[idx++],
+ ROLE_PATH, // +args[idx++],
getDF(RoleRequest.class),
rr
);
@@ -89,11 +89,11 @@ public class CreateDelete extends Cmd {
break;
default: // note, if not an option, whichOption throws Exception
break;
-
+
}
boolean rolesSupplied = (args.length>idx);
if (fp == null) {// This useless code brought to you by Sonar.
- throw new CadiException("No call made.");
+ throw new CadiException("No call made.");
}
if (fp.get(AAFcli.timeout())) {
rv=fp.code();
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java
index f4d24fb1..5341a7ce 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,9 +37,9 @@ import aaf.v2_0.RoleRequest;
public class Describe extends Cmd {
private static final String ROLE_PATH = "/authz/role";
public Describe(Role parent) {
- super(parent,"describe",
+ super(parent,"describe",
new Param("name",true),
- new Param("description",true));
+ new Param("description",true));
}
@Override
@@ -53,14 +53,14 @@ public class Describe extends Cmd {
while (idx < args.length) {
desc.append(args[idx++] + ' ');
}
-
+
RoleRequest rr = new RoleRequest();
rr.setName(role);
rr.setDescription(desc.toString());
-
+
// Set Start/End commands
setStartEnd(rr);
-
+
Future<RoleRequest> fp = null;
int rv;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java
index 37d328bd..2e3d1757 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java
@@ -9,9 +9,9 @@
* 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.
@@ -59,7 +59,7 @@ public class List extends BaseCmd<Role> {
cmds.add(new ListByPerm(this));
cmds.add(new ListActivity(this));
}
-
+
// Package Level on purpose
abstract class ListRoles extends Retryable<Integer> {
protected int list(Future<Roles> fr,Rcli<?> client, String header) throws APIException, CadiException {
@@ -68,7 +68,7 @@ public class List extends BaseCmd<Role> {
if (aafcli.isDetailed()) {
for (aaf.v2_0.Role r : fr.value.getRole()) {
Future<Perms> fp = client.read(
- "/authz/perms/role/"+r.getName()+(aafcli.isDetailed()?"?ns":""),
+ "/authz/perms/role/"+r.getName()+(aafcli.isDetailed()?"?ns":""),
getDF(Perms.class)
);
if (fp.get(AAFcli.timeout())) {
@@ -93,7 +93,7 @@ public class List extends BaseCmd<Role> {
private static final String roleExpiredFormat = "%-53s !!! EXPIRED !!! %s\n";
private static final String permFormat = " %-30s %-30s %-15s\n";
-
+
private static final Comparator<aaf.v2_0.Role> roleCompare = new Comparator<aaf.v2_0.Role>() {
@Override
public int compare(aaf.v2_0.Role a, aaf.v2_0.Role b) {
@@ -152,13 +152,13 @@ public class List extends BaseCmd<Role> {
for (Pkey pkey : r.getPerms()) {
Perm perm = get(pkey,perms);
if (perm==null || perm.getNs()==null) {
- pw().format(permFormat,
+ pw().format(permFormat,
pkey.getType(),
pkey.getInstance(),
pkey.getAction());
} else {
String ns1 = perm.getNs();
- pw().format(permFormat,
+ pw().format(permFormat,
'['+ns1+"]"+perm.getType().substring(ns1.length()),
perm.getInstance(),
perm.getAction());
@@ -185,7 +185,7 @@ public class List extends BaseCmd<Role> {
} else {
pw().format(roleFormatNoDate, r.getName());
for (Pkey perm : r.getPerms()) {
- pw().format(permFormat,
+ pw().format(permFormat,
perm.getType(),
perm.getInstance(),
perm.getAction());
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java
index 603ec33b..b6a8a0da 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,7 +42,7 @@ public class ListActivity extends Cmd {
private static final String HEADER = "List Activity of Role";
public ListActivity(List parent) {
- super(parent,"activity",
+ super(parent,"activity",
new Param("name",true));
}
@@ -54,7 +54,7 @@ public class ListActivity extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<History> fp = client.read(
- "/authz/hist/role/"+role,
+ "/authz/hist/role/"+role,
getDF(History.class)
);
if (fp.get(AAFcli.timeout())) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNS.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNS.java
index 361676a4..02a34f78 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNS.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNS.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,16 +34,16 @@ import aaf.v2_0.Roles;
/**
* Return Roles by NS
- *
+ *
* @author Jonathan
*
*/
public class ListByNS extends Cmd {
private static final String HEADER = "List Roles by NS ";
-
+
public ListByNS(List parent) {
- super(parent,"ns",
- new Param("name",true));
+ super(parent,"ns",
+ new Param("name",true));
}
@Override
@@ -54,14 +54,14 @@ public class ListByNS extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Roles> fp = client.read(
- "/authz/roles/ns/"+ns+(aafcli.isDetailed()?"?ns":""),
+ "/authz/roles/ns/"+ns+(aafcli.isDetailed()?"?ns":""),
getDF(Roles.class)
);
return list(fp,client, HEADER+"["+ns+"]");
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNameOnly.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNameOnly.java
index 4d77c460..6e5a5622 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNameOnly.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNameOnly.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,16 +34,16 @@ import aaf.v2_0.Roles;
/**
* Return Roles by NS
- *
+ *
* @author Jonathan
*
*/
public class ListByNameOnly extends Cmd {
private static final String HEADER = "List Roles by Name ";
-
+
public ListByNameOnly(List parent) {
- super(parent,"name",
- new Param("name",true));
+ super(parent,"name",
+ new Param("name",true));
}
@Override
@@ -54,14 +54,14 @@ public class ListByNameOnly extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Roles> fp = client.read(
- "/authz/roles/name/"+name+(aafcli.isDetailed()?"?ns":""),
+ "/authz/roles/name/"+name+(aafcli.isDetailed()?"?ns":""),
getDF(Roles.class)
);
return list(fp,client, HEADER+"["+name+"]");
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java
index 5d291ace..3d3e5e41 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java
@@ -8,9 +8,9 @@
* 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.
@@ -39,18 +39,18 @@ import aaf.v2_0.Roles;
/**
* Return Roles by NS
- *
+ *
* @author Jonathan
*
*/
public class ListByPerm extends Cmd {
private static final String HEADER = "List Roles by Perm ";
-
+
public ListByPerm(List parent) {
- super(parent,"perm",
+ super(parent,"perm",
new Param("type",true),
new Param("instance", true),
- new Param("action", true));
+ new Param("action", true));
}
@Override
@@ -59,15 +59,15 @@ public class ListByPerm extends Cmd {
final String type=args[idx];
final String instance=args[++idx];
final String action = args[++idx];
-
+
return same(((List)parent).new ListRoles() {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
try {
Future<Roles> fp = client.read(
- "/authz/roles/perm/"+type+'/' +
+ "/authz/roles/perm/"+type+'/' +
URLEncoder.encode(instance,Config.UTF_8)+'/'+
- action,
+ action,
getDF(Roles.class)
);
return list(fp,client, HEADER+type+'|'+instance+'|'+action);
@@ -77,7 +77,7 @@ public class ListByPerm extends Cmd {
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByRole.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByRole.java
index 761df695..6520140f 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByRole.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByRole.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,16 +33,16 @@ import org.onap.aaf.misc.env.APIException;
import aaf.v2_0.Roles;
/**
- *
+ *
* @author Jonathan
*
*/
public class ListByRole extends Cmd {
private static final String HEADER="List Roles for Role";
-
+
public ListByRole(List parent) {
- super(parent,"role",
- new Param("role",true));
+ super(parent,"role",
+ new Param("role",true));
}
@Override
@@ -50,16 +50,16 @@ public class ListByRole extends Cmd {
return same(((List)parent).new ListRoles() {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
- String role=args[idx];
+ String role=args[idx];
Future<Roles> fp = client.read(
- "/authz/roles/"+role+(aafcli.isDetailed()?"?ns":""),
- getDF(Roles.class)
+ "/authz/roles/"+role+(aafcli.isDetailed()?"?ns":""),
+ getDF(Roles.class)
);
return list(fp,client,HEADER+"["+role+"]");
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java
index 8111fedc..9657721a 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,17 +50,17 @@ import aaf.v2_0.UserRoles;
*/
public class ListByUser extends Cmd {
private static final String HEADER = "List Roles for User ";
-
+
public ListByUser(List parent) {
- super(parent,"user",
+ super(parent,"user",
new Param("id",true),
- new Param("detail", false));
+ new Param("detail", false));
}
@Override
public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException {
final String user=fullID(args[idx]);
-
+
return same(new Retryable<Integer>() {
@Override
@@ -84,7 +84,7 @@ public class ListByUser extends Cmd {
if (aafcli.isDetailed()) {
roles = new Roles();
Future<Perms> fp = client.read(
- "/authz/perms/user/"+user+"?ns&force",
+ "/authz/perms/user/"+user+"?ns&force",
getDF(Perms.class)
);
if (fp.get(AAFcli.timeout())) {
@@ -108,7 +108,7 @@ public class ListByUser extends Cmd {
r.getPerms().add(p);
}
}
- }
+ }
code = fp.code();
} else {
roles = new Roles();
@@ -120,14 +120,14 @@ public class ListByUser extends Cmd {
lr.add(r);
}
}
-
-
+
+
((List)parent).report(roles,perms,urs,HEADER,user);
return code;
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,HEADER);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Role.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Role.java
index c49df031..b06bc5e5 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Role.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Role.java
@@ -9,9 +9,9 @@
* 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.
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java
index 45361a3f..4641ade7 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,10 +42,10 @@ import aaf.v2_0.UserRoleRequest;
public class User extends Cmd {
private final static String[] options = {"add","del","extend"};
public User(Role parent) {
- super(parent,"user",
+ super(parent,"user",
new Param(optionsToString(options),true),
new Param("role",true),
- new Param("id[,id]*",false));
+ new Param("id[,id]*",false));
}
@Override
@@ -60,9 +60,9 @@ public class User extends Cmd {
urr.setRole(args[idx++]);
// Set Start/End commands
setStartEnd(urr);
-
+
Future<?> fp = null;
-
+
String[] ids = args[idx++].split(",");
String verb=null,participle=null;
// You can request to be added or removed from role.
@@ -74,15 +74,15 @@ public class User extends Cmd {
switch(option) {
case 0:
fp = client.create(
- "/authz/userRole",
- getDF(UserRoleRequest.class),
+ "/authz/userRole",
+ getDF(UserRoleRequest.class),
urr);
verb = "Added";
participle = "] to Role [" ;
break;
case 1:
fp = client.delete(
- "/authz/userRole/"+urr.getUser()+'/'+urr.getRole(),
+ "/authz/userRole/"+urr.getUser()+'/'+urr.getRole(),
Void.class);
verb = "Removed";
participle = "] from Role [" ;
@@ -124,7 +124,7 @@ public class User extends Cmd {
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
detailLine(sb,indent,"Add OR Delete a User to/from a Role OR extend Expiration");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java
index 1613b2f9..1a410088 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java
@@ -9,9 +9,9 @@
* 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.
@@ -72,7 +72,7 @@ public class Cred extends Cmd {
if (args.length>idx) {
cr.setEntry(args[idx]);
}
-
+
// Set Start/End commands
setStartEnd(cr);
Integer ret = same(new Retryable<Integer>() {
@@ -83,8 +83,8 @@ public class Cred extends Cmd {
switch(option) {
case 0:
fp = client.create(
- CRED_PATH,
- getDF(CredRequest.class),
+ CRED_PATH,
+ getDF(CredRequest.class),
cr
);
verb = "Added Credential [";
@@ -129,7 +129,7 @@ public class Cred extends Cmd {
Error err = em.getError(fp);
String text = err.getText();
List<String> vars = err.getVariables();
-
+
// IMPORTANT! We do this backward, because it is looking for string
// %1 or %13. If we replace %1 first, that messes up %13
for(int i=vars.size()-1;i>0;--i) {
@@ -153,7 +153,7 @@ public class Cred extends Cmd {
}
return ret;
}
-
+
@Override
public void detailedHelp(int indentVar, StringBuilder sb) {
int indent = indentVar;
@@ -169,7 +169,7 @@ public class Cred extends Cmd {
sb.append('\n');
detailLine(sb,indent,"NOTE: AAF does support multiple creds with the same ID. Check with your org if you");
detailLine(sb,indent+2,"have this implemented. (For example, this is implemented for MechIDs at AT&T)");
- sb.append('\n');
+ sb.append('\n');
detailLine(sb,indent,"*NOTE: com.att.csp is a reserved Domain for Global Sign On");
detailLine(sb,indent,"Delegates can be listed by the User or by the Delegate");
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java
index 3d226f7e..f5cb4499 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java
@@ -9,9 +9,9 @@
* 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.
@@ -62,7 +62,7 @@ public class Delg extends BaseCmd<User> {
int idx = index;
DelgRequest dr = new DelgRequest();
setStartEnd(dr);
-
+
int option= whichOption(options, args[idx++]);
String user = fullID(args[idx++]);
dr.setUser(user);
@@ -79,29 +79,29 @@ public class Delg extends BaseCmd<User> {
dr.setEnd(Chrono.timeStamp(date));
}
}
-
+
Future<DelgRequest> fp;
RosettaDF<DelgRequest> df = getDF(DelgRequest.class);
String verb;
setQueryParamsOn(client);
switch(option) {
- case 0:
+ case 0:
fp = client.create(AUTHZ_DELG, df, dr);
verb = "Added";
break;
- case 1:
- fp = client.update(AUTHZ_DELG, df, dr);
+ case 1:
+ fp = client.update(AUTHZ_DELG, df, dr);
verb = "Updated";
break;
- case 2:
- fp = client.delete(AUTHZ_DELG, df, dr);
+ case 2:
+ fp = client.delete(AUTHZ_DELG, df, dr);
verb = "Deleted";
break;
default:
throw new CadiException("Bad Argument");
};
-
+
if (fp.get(AAFcli.timeout())) {
pw().append("Delegate ");
pw().println(verb);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java
index 71d61f79..2c88e9fe 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,7 +45,7 @@ public class ID extends Cmd {
}
@Override
- public int _exec(int _idx, final String ... args) throws CadiException, APIException, LocatorException {
+ public int _exec(int _idx, final String ... args) throws CadiException, APIException, LocatorException {
int idx = _idx;
String key = args[idx++];
final int option = whichOption(options,key);
@@ -55,7 +55,7 @@ public class ID extends Cmd {
cr.setType(10);
if (args.length>idx)
cr.setEntry(args[idx]);
-
+
// Set Start/End commands
setStartEnd(cr);
Integer ret = same(new Retryable<Integer>() {
@@ -66,8 +66,8 @@ public class ID extends Cmd {
switch(option) {
case 0:
fp = client.create(
- CRED_PATH,
- getDF(CredRequest.class),
+ CRED_PATH,
+ getDF(CredRequest.class),
cr
);
verb = "Added ID [";
@@ -105,7 +105,7 @@ public class ID extends Cmd {
if (ret==null)ret = -1;
return ret;
}
-
+
@Override
public void detailedHelp(int _indent, StringBuilder sb) {
int indent = _indent;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
index 212df8ab..b3011369 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,7 +45,7 @@ public class List extends BaseCmd<User> {
cmds.add(new ListActivity(this));
}
-
+
void report(Users users, boolean count, String ... str) {
reportHead(str);
java.util.List<aaf.v2_0.Users.User> sorted = users.getUser();
@@ -68,7 +68,7 @@ public class List extends BaseCmd<User> {
} else if(type!=null && type>=200) {
tag = "\n\tfingerprint: " + tag;
}
- pw().format(format,
+ pw().format(format,
user.getId(),
org.onap.aaf.auth.cmd.ns.List.getType(user),
date,
@@ -107,9 +107,9 @@ public class List extends BaseCmd<User> {
String format = reportColHead(" %-25s %-25s %-10s\n","User","Delegate","Expires");
String date = "XXXX-XX-XX";
for (Delg delg : delgs.getDelgs()) {
- if (!this.aafcli.isTest())
+ if (!this.aafcli.isTest())
date = Chrono.dateOnlyStamp(delg.getExpires());
- pw().printf(format,
+ pw().printf(format,
delg.getUser(),
delg.getDelegate(),
date
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java
index 162dadac..30c71e55 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,7 +42,7 @@ public class ListActivity extends Cmd {
private static final String HEADER = "List Activity of User";
public ListActivity(List parent) {
- super(parent,"activity",
+ super(parent,"activity",
new Param("user",true));
}
@@ -53,9 +53,9 @@ public class ListActivity extends Cmd {
return same(new Retryable<Integer>() {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
-
+
Future<History> fp = client.read(
- "/authz/hist/user/"+user,
+ "/authz/hist/user/"+user,
getDF(History.class)
);
if (fp.get(AAFcli.timeout())) {
@@ -67,7 +67,7 @@ public class ListActivity extends Cmd {
}
});
}
-
+
@Override
public void detailedHelp(int indent, StringBuilder sb) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java
index 068aacb1..828cdcbf 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,17 +35,17 @@ import org.onap.aaf.misc.env.APIException;
import aaf.v2_0.Approvals;
/**
- *
+ *
* @author Jonathan
*
*/
public class ListApprovals extends Cmd {
- private static final String HEADER = "List Approvals";
+ private static final String HEADER = "List Approvals";
private final static String[] options = {"user","approver","ticket"};
public ListApprovals(List parent) {
- super(parent,"approvals",
+ super(parent,"approvals",
new Param(optionsToString(options),true),
- new Param("value",true));
+ new Param("value",true));
}
@Override
@@ -64,7 +64,7 @@ public class ListApprovals extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Approvals> fp = client.read(
- "/authz/approval/"+type+'/'+fullValue,
+ "/authz/approval/"+type+'/'+fullValue,
getDF(Approvals.class)
);
if (fp.get(AAFcli.timeout())) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java
index 28b5c9e7..788f1c77 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,10 +39,10 @@ import aaf.v2_0.Delgs;
*
*/
public class ListDelegates extends Cmd {
- private static final String HEADER = "List Delegates";
+ private static final String HEADER = "List Delegates";
private static final String[] options = {"user","delegate"};
public ListDelegates(List parent) {
- super(parent,"delegates",
+ super(parent,"delegates",
new Param(optionsToString(options),true),
new Param("id",true));
}
@@ -56,9 +56,9 @@ public class ListDelegates extends Cmd {
return same(new Retryable<Integer>() {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
-
+
Future<Delgs> fp = client.read(
- "/authz/delegates/" + key + '/' + id,
+ "/authz/delegates/" + key + '/' + id,
getDF(Delgs.class)
);
if (fp.get(AAFcli.timeout())) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java
index 176787ea..07a19d36 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java
@@ -9,9 +9,9 @@
* 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.
@@ -52,7 +52,7 @@ public class ListForCreds extends Cmd {
public ListForCreds(List parent) {
super(parent,"cred",
new Param(optionsToString(options),true),
- new Param("value",true));
+ new Param("value",true));
}
@Override
@@ -65,7 +65,7 @@ public class ListForCreds extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Users> fp = client.read(
- "/authn/creds/"+which+'/'+value,
+ "/authn/creds/"+which+'/'+value,
getDF(Users.class)
);
if (fp.get(AAFcli.timeout())) {
@@ -74,7 +74,7 @@ public class ListForCreds extends Cmd {
@Override
public int compare(User u1, User u2) {
return u1.getId().compareTo(u2.getId());
- }
+ }
});
((org.onap.aaf.auth.cmd.user.List)parent).report(fp.value,option==1,HEADER+which,value);
if (fp.code()==404) {
@@ -87,7 +87,7 @@ public class ListForCreds extends Cmd {
}
});
}
-
+
@Override
public void detailedHelp(int indentParam, StringBuilder sb) {
int indent = indentParam;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java
index b40c96ce..0ab24900 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java
@@ -7,9 +7,9 @@
* 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.
@@ -49,10 +49,10 @@ import aaf.v2_0.Users.User;
public class ListForPermission extends Cmd {
private static final String HEADER = "List Users for Permission";
public ListForPermission(List parent) {
- super(parent,"perm",
+ super(parent,"perm",
new Param("type",true),
new Param("instance",true),
- new Param("action",true));
+ new Param("action",true));
}
@Override
@@ -68,10 +68,10 @@ public class ListForPermission extends Cmd {
if ("\\*".equals(action))action="*";
try {
Future<Users> fp = client.read(
- "/authz/users/perm/" +
+ "/authz/users/perm/" +
type + '/' +
- URLEncoder.encode(instance,Config.UTF_8) + '/' +
- action,
+ URLEncoder.encode(instance,Config.UTF_8) + '/' +
+ action,
getDF(Users.class)
);
if (fp.get(AAFcli.timeout())) {
@@ -89,7 +89,7 @@ public class ListForPermission extends Cmd {
}
});
}
-
+
@Override
public void detailedHelp(int _indent, StringBuilder sb) {
int indent = _indent;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java
index 4e539ac2..6fdf1628 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,7 +42,7 @@ import aaf.v2_0.Users;
public class ListForRoles extends Cmd {
private static final String HEADER = "List Users for Role";
public ListForRoles(List parent) {
- super(parent,"role", new Param("role",true));
+ super(parent,"role", new Param("role",true));
}
@Override
@@ -53,7 +53,7 @@ public class ListForRoles extends Cmd {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Users> fp = client.read(
- "/authz/users/role/"+role,
+ "/authz/users/role/"+role,
getDF(Users.class)
);
if (fp.get(AAFcli.timeout())) {
@@ -66,7 +66,7 @@ public class ListForRoles extends Cmd {
}
});
}
-
+
@Override
public void detailedHelp(int _indent, StringBuilder sb) {
int indent = _indent;
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java
index b177778e..4261df67 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,7 +36,7 @@ import aaf.v2_0.UserRoleRequest;
/**
* p
- *
+ *
* @author Jonathan
*
*/
@@ -65,7 +65,7 @@ public class Role extends Cmd {
Future<?> fp = null;
if (args.length < 5) {
- throw new CadiException(build(new StringBuilder("Too few args: "), null).toString());
+ throw new CadiException(build(new StringBuilder("Too few args: "), null).toString());
}
String[] roles = args[idx++].split(",");
for (String role : roles) {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/User.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/User.java
index 746f9c22..7176cbef 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/User.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/User.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/HMangrStub.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/HMangrStub.java
index bd2eeae5..6d366ed2 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/HMangrStub.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/HMangrStub.java
@@ -7,9 +7,9 @@
* * 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.
@@ -34,7 +34,7 @@ import org.onap.aaf.cadi.client.Retryable;
import org.onap.aaf.cadi.http.HMangr;
public class HMangrStub extends HMangr {
-
+
private Rcli<HttpURLConnection> clientMock;
public HMangrStub(Access access, Locator<URI> loc, Rcli<HttpURLConnection> clientMock) throws LocatorException {
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java
index abe4c342..1a43a30a 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_AAFCli.java
@@ -7,9 +7,9 @@
* * 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.
@@ -147,12 +147,12 @@ public class JU_AAFCli {
public void eval10() throws Exception {
assertTrue(cli.eval("set @[ 123"));
}
-
+
@Test
public void eval11() throws Exception {
assertTrue(cli.eval("DETAILS @[ 123"));
}
-
+
@Test
public void eval12() throws Exception {
assertTrue(cli.eval(". |/, .\"0 \" "));
@@ -179,7 +179,7 @@ public class JU_AAFCli {
}
assertTrue(noError);
}
-
+
@Test
public void eval_randomString() throws Exception {
assertTrue(cli.eval("Some random string @#&*& to check complete 100 coverage"));
@@ -198,64 +198,64 @@ public class JU_AAFCli {
// TODO: Consider requiring a default in properties
env.setProperty(Config.AAF_DEFAULT_REALM,
System.getProperty(Config.AAF_DEFAULT_REALM, Config.getDefaultRealm()));
-
+
HBasicAuthSS ss = mock(HBasicAuthSS.class);
env.setProperty(Config.AAF_APPPASS, "test");
return new AAFcli(env, new OutputStreamWriter(System.out), hman, si, ss);
}
-
+
@Test
public void testVerbose() {
cli.verbose(true);
cli.verbose(false);
}
-
+
@Test
public void testClose() {
cli.close();
}
-
+
@Test
public void testTimeout() {
Assert.assertNotNull(cli.timeout());
}
-
+
@Test
public void testTest() {
Assert.assertNotNull(cli.isTest());
}
-
+
@Test
public void testIsDetailed() {
Assert.assertNotNull(cli.isDetailed());
}
-
+
@Test
public void testAddRequest() {
Assert.assertNotNull(cli.addRequest());
}
-
+
@Test
public void testForceString() {
cli.clearSingleLineProperties();
Assert.assertNull(cli.forceString());
}
-
+
@Test
public void testClearSingleLineProperties() {
cli.clearSingleLineProperties();
}
-
+
@Test
public void testGui() {
cli.gui(true);
cli.gui(false);
}
-
+
@Test
public void testMain() {
String[] strArr = {"\\*","test1"};
//cli.main(strArr);
}
-
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java
index e2e2bff5..92fdc833 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BaseCmd.java
@@ -7,9 +7,9 @@
* * 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.
@@ -65,7 +65,7 @@ public class JU_BaseCmd {
assertEquals(bCmd._exec(4, "add", "del", "reset", "extend"), 0);
}
-
+
@Test
public void exec1() throws CadiException, APIException, LocatorException {
assertEquals(bCmd._exec(0, "add", "del", "reset", "extend"), 0);
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BasicAuth.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BasicAuth.java
index bfb4b671..a2074bf8 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BasicAuth.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_BasicAuth.java
@@ -7,9 +7,9 @@
* * 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.
@@ -36,7 +36,7 @@ import junit.framework.Assert;
//TODO: Gabe [JUnit] Import missing
@RunWith(MockitoJUnitRunner.class)
public class JU_BasicAuth {
-
+
// @Test
// public void getID () {
// try {
@@ -47,9 +47,9 @@ public class JU_BasicAuth {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
-//
+//
// }
-
+
@Test
public void netYetTested() {
Assert.assertTrue(true);
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java
index e3cfbd17..b31f1048 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java
@@ -7,9 +7,9 @@
* * 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.
@@ -67,7 +67,7 @@ public class JU_Cmd {
CmdStub cmd1;
CmdStub cmd2;
AAFcli cli;
-
+
private class CmdStub extends Cmd {
@@ -75,7 +75,7 @@ public class JU_Cmd {
super(aafcli, name, params);
// TODO Auto-generated constructor stub
}
-
+
public CmdStub(Cmd parent, String name, Param[] params) {
super(parent, name, params);
// TODO Auto-generated constructor stub
@@ -86,40 +86,40 @@ public class JU_Cmd {
// TODO Auto-generated method stub
return 0;
}
-
+
@Override
public void error(Future<?> future) {
super.error(future);
}
}
-
+
@Before
public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException {
cli = JU_AAFCli.getAAfCli();
Param[] param = new Param[] {new Param("name",true)};
-
+
cmd = new CmdStub(cli,"test", param);
cmd1 = new CmdStub(cmd,"test", param);
cmd2 = new CmdStub(cmd,"test", param);
}
-
+
@Test
public void testReportColHead() {
String[] args = new String[] {new String("test")};
cmd.reportColHead("format", args);
}
-
+
@Test
public void testBuilder() {
StringBuilder detail = new StringBuilder();
StringBuilder sb = new StringBuilder("test 123");
-
+
cmd.build(sb, detail);
detail.append("test");
cmd.build(sb, detail);
}
-
+
@Test
public void testApi() throws APIException, CadiException {
StringBuilder sb = new StringBuilder("test 123");
@@ -131,19 +131,19 @@ public class JU_Cmd {
Clear clr = new Clear(cache);
clr.detailedHelp(0, sb);
}
-
+
@Test
public void testToString() {
cmd.toString();
}
-
+
@Test
public void testFullID() {
cmd.fullID("test");
cmd.fullID("t@st");
cmd.fullID(null);
}
-
+
@Test
public void testError() {
Future<?> future = mock(Future.class);
@@ -161,32 +161,32 @@ public class JU_Cmd {
when(future.body()).thenReturn("<html>NotNull");
cmd.error(future);
}
-
+
@Test
public void testActivity() {
History hist = new History();
cmd.activity(hist, "test");
cmd.activity(hist, "te[st");
}
-
+
@Test
public void testWhichOption() throws CadiException {
String[] strArr = {"a", "b", "c"};
cmd.whichOption(strArr, "b");
}
-
+
@Test
public void testOneOf() throws APIException, CadiException, LocatorException {
Retryable retryable = mock(Retryable.class);
//cmd.oneOf(retryable, "host"); //TODO: AAF-111 need input for hMan
}
-
+
@Test
public void testExec() throws CadiException, APIException, LocatorException {
String[] strArr = {"a", "b", "c"};
cmd.exec(1, strArr);
}
-
-
+
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java
index 32697473..c6dcc148 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_DeprecatedCMD.java
@@ -7,9 +7,9 @@
* * 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.
@@ -49,7 +49,7 @@ public class JU_DeprecatedCMD {
CmdStub cmd;
AAFcli cli;
-
+
private class CmdStub extends Cmd {
public CmdStub(AAFcli aafcli, String name, Param[] params) {
@@ -62,14 +62,14 @@ public class JU_DeprecatedCMD {
// TODO Auto-generated method stub
return 0;
}
-
+
}
-
+
@Test
public void testExec() throws CadiException, APIException, LocatorException, GeneralSecurityException, IOException {
cli = JU_AAFCli.getAAfCli();
Param[] param = new Param[] {new Param("name",true)};
-
+
cmd = new CmdStub(cli,"test", param);
DeprecatedCMD deprecatedcmd = new DeprecatedCMD(cmd,"test", "test");
deprecatedcmd._exec(0, "test");
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Help.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Help.java
index d2e7b971..92cb9b8a 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Help.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Help.java
@@ -7,9 +7,9 @@
* * 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.
@@ -51,7 +51,7 @@ import junit.framework.Assert;
@RunWith(MockitoJUnitRunner.class)
public class JU_Help {
-
+
private static AAFcli cli;
private static Help help;
String[] strArr = {"null","null","b","c"};
@@ -62,7 +62,7 @@ public class JU_Help {
super(aafcli, name, params);
// TODO Auto-generated constructor stub
}
-
+
public CmdStub(Cmd parent, String name, Param[] params) {
super(parent, name, params);
// TODO Auto-generated constructor stub
@@ -73,17 +73,17 @@ public class JU_Help {
// TODO Auto-generated method stub
return 0;
}
-
+
@Override
public void error(Future<?> future) {
super.error(future);
- }
-
+ }
+
}
-
+
@Mock
private static List<Cmd> cmds;
-
+
@Before
public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException {
cli = JU_AAFCli.getAAfCli();
@@ -93,7 +93,7 @@ public class JU_Help {
cmds.add(cmd);
help = new Help(cli, cmds);
}
-
+
@Test
public void exec_HTTP_200() {
try {
@@ -104,7 +104,7 @@ public class JU_Help {
e.printStackTrace();
}
}
-
+
@Test
public void exec_HTTP_200_1() {
try {
@@ -114,7 +114,7 @@ public class JU_Help {
e.printStackTrace();
}
}
-
+
@Test
public void detailhelp() {
boolean hasError=false;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java
index de8e83a6..e2bdcaee 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Version.java
@@ -7,9 +7,9 @@
* * 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.
@@ -46,22 +46,22 @@ import junit.framework.Assert;
//TODO: Gabe [JUnit] Import missing
@RunWith(MockitoJUnitRunner.class)
public class JU_Version {
-
+
private static AAFcli cli;
private static Version version;
-
+
@BeforeClass
public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException {
cli = JU_AAFCli.getAAfCli();
version = new Version(cli);
}
-
+
// @Test
// public void exec_HTTP_200() throws CadiException, APIException, LocatorException {
// assertEquals(version._exec(0, "Version"), HttpStatus.OK_200);
//
// }
-
+
@Test //TODO: Temporary fix AAF-111
public void netYetTested() {
Assert.assertTrue(true);
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java
index 4102e595..b5fb99da 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Clear.java
@@ -7,9 +7,9 @@
* * 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.
@@ -59,17 +59,17 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Clear {
-
+
private static Clear clr;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
Cache cache;
Mgmt mgmt;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -77,14 +77,14 @@ public class JU_Clear {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
-// hman = new HMangr(aEnv, loc);
+// hman = new HMangr(aEnv, loc);
// aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
// mgmt = new Mgmt(aafcli);
// cache = new Cache(mgmt);
// clr = new Clear(cache);
-
+
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -95,10 +95,10 @@ public class JU_Clear {
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
// HRcli hcli = new HRcli(hman, uri, value, secSet);
// String[] strArr = {"grant","ungrant","setTo","grant","ungrant","setTo"};
- //clr._exec(0, strArr);
+ //clr._exec(0, strArr);
}
-
+
@Test
public void testDetailedHelp() throws CadiException {
Define define = new Define();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java
index 5b372881..ac33afdc 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Deny.java
@@ -7,9 +7,9 @@
* * 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.
@@ -59,14 +59,14 @@ import java.net.URISyntaxException;
import org.junit.Test;
public class JU_Deny {
-
+
Deny deny;
DenySomething denyS;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
@Before
@@ -76,15 +76,15 @@ public class JU_Deny {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
-// hman = new HMangr(aEnv, loc);
+// hman = new HMangr(aEnv, loc);
// aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
// Mgmt mgmt = new Mgmt(aafcli);
// deny = new Deny(mgmt);
//denyS = deny.new DenySomething(deny,"ip","ipv4or6[,ipv4or6]*");
}
-
-
+
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
@@ -99,10 +99,10 @@ public class JU_Deny {
// String[] strArr = {"add","del", "add","del"};
// deny._exec(0, strArr);
-//
+//
// String[] strArr1 = {"del", "add","del"};
// deny._exec(0, strArr1);
-
+
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java
index 7edeaa11..01100575 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_Log.java
@@ -7,9 +7,9 @@
* * 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.
@@ -56,16 +56,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Log {
-
+
private static Log log;
private static Log log1;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp() throws APIException, LocatorException, CadiException {
prop = new PropAccess();
@@ -73,12 +73,12 @@ public class JU_Log {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Mgmt mgmt = new Mgmt(aafcli);
log1 = new Log(mgmt);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -97,7 +97,7 @@ public class JU_Log {
// log1._exec(0, strArr1);
}
-
+
@Test
public void testDetailedHelp() throws CadiException {
Define define = new Define();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java
index 5e88dcad..a51dbf48 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/mgmt/JU_SessClear.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,15 +57,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_SessClear {
-
+
private static SessClear sessclr;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp() throws LocatorException, APIException, CadiException {
prop = new PropAccess();
@@ -73,13 +73,13 @@ public class JU_SessClear {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
-// hman = new HMangr(aEnv, loc);
+// hman = new HMangr(aEnv, loc);
// aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
// Mgmt mgmt = new Mgmt(aafcli);
// Session sess = new Session(mgmt);
// sessclr = new SessClear(sess);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -95,7 +95,7 @@ public class JU_SessClear {
//sessclr._exec(0, strArr);
}
-
+
@Test
public void testDetailedHelp() throws CadiException {
Define define = new Define();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
index 8a080ee8..faca9fff 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
@@ -7,9 +7,9 @@
* * 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.
@@ -58,14 +58,14 @@ import org.onap.aaf.misc.env.APIException;
public class JU_Admin {
private static Admin admin;
-
+
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
@@ -74,13 +74,13 @@ public class JU_Admin {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
NS ns = new NS(aafcli);
admin = new Admin(ns);
-
+
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -93,10 +93,10 @@ public class JU_Admin {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"add", "del","add","add"};
// admin._exec(0, strArr);
-//
+//
// String[] strArr1 = {"del","add","add"};
// admin._exec(0, strArr1);
-
+
}
@Test
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
index 7ccf6578..62e32706 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
@@ -7,9 +7,9 @@
* * 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.
@@ -67,7 +67,7 @@ public class JU_Attrib {
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
@Before
@@ -77,7 +77,7 @@ public class JU_Attrib {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
NS ns = new NS(aafcli);
attrib = new Attrib(ns);
@@ -95,13 +95,13 @@ public class JU_Attrib {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"add","upd","del","add","upd","del"};
// attrib._exec(0, strArr);
-//
+//
// String[] strArr1 = {"upd","del","add","upd","del","add"};
// attrib._exec(0, strArr1);
-//
+//
// String[] strArr2 = {"del","add","upd","del","add","upd"};
// attrib._exec(0, strArr2);
-
+
}
@Test
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java
index a0e95ab8..f76fcd52 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,9 +57,9 @@ public class JU_Create {
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -67,13 +67,13 @@ public class JU_Create {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
NS ns = new NS(aafcli);
create = new Create(ns);
}
-
-
+
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
@@ -87,7 +87,7 @@ public class JU_Create {
HRcli hcli = new HRcli(hman, uri, item, secSet);
String[] strArr = {"add","upd","del","add","upd","del"};
create._exec(0, strArr);
-
+
}
@Test
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java
index 2c12d51f..3ac84029 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java
@@ -7,9 +7,9 @@
* * 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.
@@ -55,9 +55,9 @@ public class JU_Delete {
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException {
prop = new PropAccess();
@@ -65,7 +65,7 @@ public class JU_Delete {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
NS ns = new NS(aafcli);
delete = new Delete(ns);
@@ -84,7 +84,7 @@ public class JU_Delete {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"add","upd","del","add","upd","del"};
// delete._exec(0, strArr);
-
+
}
@Test
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java
index 9cc8ed17..601f0a23 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java
@@ -7,9 +7,9 @@
* * 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.
@@ -49,15 +49,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Describe {
-
+
private static Describe desc;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -65,12 +65,12 @@ public class JU_Describe {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
NS ns = new NS(aafcli);
desc = new Describe(ns);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -83,9 +83,9 @@ public class JU_Describe {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"add","upd","del","add","upd","del"};
// desc._exec(0, strArr);
-
+
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java
index e4100a02..683db0b3 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java
@@ -54,19 +54,19 @@ import static org.mockito.Mockito.*;
import org.junit.Test;
public class JU_List {
-
+
List list;
AAFcli aafcli;
User user;
-
+
private class NssStub extends Nss {
- public void addNs(Nss.Ns ns) {
+ public void addNs(Nss.Ns ns) {
if (this.ns == null) {
this.ns = new ArrayList<>();
}
this.ns.add(ns);
}
-
+
private class NsStub extends Ns{
public void addAttrib(Nss.Ns.Attrib attrib) {
if ( this.attrib == null) {
@@ -74,14 +74,14 @@ public class JU_List {
}
this.attrib.add(attrib);
}
-
+
public void addResponsible(String str) {
if (this.responsible == null) {
this.responsible = new ArrayList<>();
}
this.responsible.add(str);
}
-
+
public void addAdmin(String str) {
if (this.admin == null) {
this.admin = new ArrayList<>();
@@ -89,12 +89,12 @@ public class JU_List {
this.admin.add(str);
}
}
-
-
-
-
+
+
+
+
}
-
+
@Before
public void setUp() throws APIException, LocatorException, CadiException {
@@ -102,14 +102,14 @@ public class JU_List {
AuthzEnv aEnv = new AuthzEnv();
Writer wtr = mock(Writer.class);
Locator loc = mock(Locator.class);
- HMangr hman = new HMangr(aEnv, loc);
+ HMangr hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, null);
user = new User();
NS ns = new NS(aafcli);
-
+
list = new List(ns);
}
-
+
@Test
public void testReport() throws Exception {
Future<Nss> fu = mock(Future.class);
@@ -124,10 +124,10 @@ public class JU_List {
nssStub.addNs(nsStub);
fu.value = nssStub;
aafcli.eval("DETAILS @[ 123");
-
+
list.report(fu, "test");
}
-
+
@Test
public void testGetType() {
Assert.assertEquals("n/a", list.getType(user));
@@ -140,5 +140,5 @@ public class JU_List {
user.setType(200);
Assert.assertEquals("x509", list.getType(user));
}
-
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java
index 0f8ae5c4..f534c7fa 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java
@@ -7,9 +7,9 @@
* * 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.
@@ -58,15 +58,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListActivity {
-
+
private static ListActivity lsActivity;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -74,13 +74,13 @@ public class JU_ListActivity {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
NS ns = new NS(aafcli);
List ls = new List(ns);
lsActivity = new ListActivity(ls);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -93,9 +93,9 @@ public class JU_ListActivity {
HRcli hcli = new HRcli(hman, uri, item, secSet);
String[] strArr = {"add","upd","del","add","upd","del"};
//lsActivity._exec(0, strArr);
-
+
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java
index 2315f8cf..31bfa504 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,15 +57,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListAdminResponsible {
-
+
private static ListAdminResponsible lsAdminRes;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -73,13 +73,13 @@ public class JU_ListAdminResponsible {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
NS ns = new NS(aafcli);
List ls = new List(ns);
lsAdminRes = new ListAdminResponsible(ls);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -92,9 +92,9 @@ public class JU_ListAdminResponsible {
HRcli hcli = new HRcli(hman, uri, item, secSet);
String[] strArr = {"add","upd","del","add","upd","del"};
//lsAdminRes._exec(0, strArr);
-
+
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java
index 63ebd744..c2106ebe 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java
@@ -8,9 +8,9 @@
* * 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.
@@ -58,15 +58,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByName {
-
+
private static ListByName lsByName;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -74,13 +74,13 @@ public class JU_ListByName {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
NS ns = new NS(aafcli);
List ls = new List(ns);
lsByName = new ListByName(ls);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -93,9 +93,9 @@ public class JU_ListByName {
HRcli hcli = new HRcli(hman, uri, item, secSet);
String[] strArr = {"add","upd","del","add","upd","del"};
//lsByName._exec(0, strArr);
-
+
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java
index 3f76cd23..6cc38339 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java
@@ -7,9 +7,9 @@
* * 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.
@@ -42,9 +42,9 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListChildren {
-
+
private static ListChildren lsChildren;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
@@ -52,7 +52,7 @@ public class JU_ListChildren {
List ls = new List(ns);
lsChildren = new ListChildren(ls);
}
-
+
// @Test
// public void exec() {
// try {
@@ -68,7 +68,7 @@ public class JU_ListChildren {
// e.printStackTrace();
// }
// }
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java
index 68a0337c..c355948c 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,9 +41,9 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListNsKeysByAttrib {
-
+
private static ListNsKeysByAttrib lsNsKeys;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
@@ -51,7 +51,7 @@ public class JU_ListNsKeysByAttrib {
List ls = new List(ns);
lsNsKeys = new ListNsKeysByAttrib(ls);
}
-
+
// @Test
// public void exec() {
// try {
@@ -67,7 +67,7 @@ public class JU_ListNsKeysByAttrib {
// e.printStackTrace();
// }
// }
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java
index f400e16d..264a42c0 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,7 +56,7 @@ public class JU_ListUsers {
NS ns;
List list;
ListUsers lUsers;
-
+
@Before
public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException {
cli = JU_AAFCli.getAAfCli();
@@ -64,14 +64,14 @@ public class JU_ListUsers {
list = new List(ns);
lUsers = new ListUsers(list);
}
-
+
@Test
public void testReports() throws DatatypeConfigurationException {
Users.User user = new Users.User();
GregorianCalendar gcal = new GregorianCalendar();
XMLGregorianCalendar xgcal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal);
user.setExpires(xgcal);
-
+
lUsers.report("header", "ns");
lUsers.report("subHead");
lUsers.report("prefix", user);
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java
index e0029791..19f12e08 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java
@@ -7,9 +7,9 @@
* 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.
@@ -59,13 +59,13 @@ public class JU_ListUsersContact {
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
NS ns;
List list;
ListUsers lUsers;
ListUsersContact lUContact;
-
+
@Before
public void setUp() throws LocatorException, APIException, CadiException {
prop = new PropAccess();
@@ -73,13 +73,13 @@ public class JU_ListUsersContact {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
ns = new NS(aafcli);
list = new List(ns);
lUsers = new ListUsers(list);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
lUContact = new ListUsersContact(lUsers);
@@ -92,9 +92,9 @@ public class JU_ListUsersContact {
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
HRcli hcli = new HRcli(hman, uri, item, secSet);
//lUContact._exec(0, "test");
-
+
}
-
+
@Test
public void testDetailedHelp() {
lUContact = new ListUsersContact(lUsers);
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java
index 4abc6e3c..ad4f8608 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java
index ee514db6..9fb8a0c4 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java
@@ -7,9 +7,9 @@
* * 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.
@@ -71,7 +71,7 @@ public class JU_ListUsersWithPerm {
}
assertEquals(hasNoError, true);
}
-
+
@Test //TODO: Temporary fix AAF-111
public void netYetTested() {
Assert.assertTrue(true);
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java
index 2b552b91..c418b389 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java
@@ -7,9 +7,9 @@
* * 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.
@@ -60,14 +60,14 @@ public class JU_Owner {
NS ns = new NS(cli);
owner = new Owner(ns);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
String[] strArr = {"add","del","add","del"};
//owner._exec(0, strArr);
}
-
+
@Test
public void detailedHelp() {
boolean hasNoError = true;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Responsible.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Responsible.java
index 515a6768..5fcf3109 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Responsible.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Responsible.java
@@ -7,9 +7,9 @@
* * 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.
@@ -67,7 +67,7 @@ public class JU_Responsible {
// }
// assertEquals(hasNoError, true);
// }
-
+
@Test
public void netYetTested() {
Assert.assertTrue(true);
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java
index 80c6d825..6118e3d7 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Create.java
@@ -7,9 +7,9 @@
* * 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.
@@ -60,19 +60,19 @@ public class JU_Create {
@Mock private Writer wrtMock;
@Mock private Rcli<HttpURLConnection> clientMock;
@Mock private Future<String> futureMock;
-
+
private static Create create;
private NS ns;
private PropAccess access;
- private HMangrStub hman;
+ private HMangrStub hman;
private AuthzEnv aEnv;
private AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
MockitoAnnotations.initMocks(this);
-
+
when(clientMock.create(any(), any(), any(String.class))).thenReturn(futureMock);
when(clientMock.delete(any(), any(), any(String.class))).thenReturn(futureMock);
when(clientMock.update(any(), any(), any(String.class))).thenReturn(futureMock);
@@ -81,18 +81,18 @@ public class JU_Create {
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
aEnv = new AuthzEnv();
aafcli = new AAFcli(access, aEnv, wrtMock, hman, null, ssMock);
-
+
ns = new NS(aafcli);
create = new Create(ns);
}
-
+
@Test
public void testError() throws APIException, LocatorException, CadiException, URISyntaxException {
create._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"});
create._exec(4, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"});
}
-
+
@Test
public void testSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException {
when(futureMock.code()).thenReturn(202);
@@ -104,11 +104,11 @@ public class JU_Create {
when(futureMock.get(any(Integer.class))).thenReturn(true);
create._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"});
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
create.detailedHelp(0, sb);
}
-
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java
index 3cfdf5c9..232e5d87 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Delete.java
@@ -7,9 +7,9 @@
* * 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.
@@ -58,7 +58,7 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Delete {
-
+
@Mock private SecuritySetter<HttpURLConnection> ssMock;
@Mock private Locator<URI> locMock;
@Mock private Writer wrtMock;
@@ -66,12 +66,12 @@ public class JU_Delete {
@Mock private Future<String> futureMock;
private static Delete del;
-
+
private PropAccess access;
- private HMangrStub hman;
+ private HMangrStub hman;
private AuthzEnv aEnv;
private AAFcli aafcli;
-
+
@Before
public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
MockitoAnnotations.initMocks(this);
@@ -90,7 +90,7 @@ public class JU_Delete {
del = new Delete(perm);
}
-
+
@Test
public void testExecError() throws APIException, LocatorException, CadiException, URISyntaxException {
del._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"});
@@ -101,17 +101,17 @@ public class JU_Delete {
when(futureMock.code()).thenReturn(202);
del._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"});
}
-
+
@Test
public void testExecSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException {
when(futureMock.get(any(Integer.class))).thenReturn(true);
del._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"});
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
del.detailedHelp(0, sb);
}
-
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java
index 29a72a3c..435d03e1 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Describe.java
@@ -7,9 +7,9 @@
* * 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.
@@ -65,12 +65,12 @@ public class JU_Describe {
@Mock private Future<String> futureMock;
private PropAccess access;
- private HMangrStub hman;
+ private HMangrStub hman;
private AuthzEnv aEnv;
private AAFcli aafcli;
-
+
private Describe desc;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
MockitoAnnotations.initMocks(this);
@@ -89,24 +89,24 @@ public class JU_Describe {
desc = new Describe(perm);
}
-
+
@Test
public void testExecError() throws APIException, LocatorException, CadiException, URISyntaxException {
desc._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"});
}
-
+
@Test
public void testExecSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException {
when(futureMock.code()).thenReturn(202);
desc._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"});
}
-
+
@Test
public void testExecSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException {
when(futureMock.get(any(Integer.class))).thenReturn(true);
desc._exec(0, new String[] {"grant","ungrant","setTo","grant","ungrant","setTo"});
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java
index ebd5f5f9..02f3e13a 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Grant.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,7 +57,7 @@ import org.onap.aaf.auth.cmd.test.HMangrStub;
@RunWith(MockitoJUnitRunner.class)
public class JU_Grant {
-
+
private static Grant grant;
@Mock private SecuritySetter<HttpURLConnection> ssMock;
@@ -67,10 +67,10 @@ public class JU_Grant {
@Mock private Future<String> futureMock;
private PropAccess access;
- private HMangrStub hman;
+ private HMangrStub hman;
private AuthzEnv aEnv;
private AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
MockitoAnnotations.initMocks(this);
@@ -94,20 +94,20 @@ public class JU_Grant {
public void testExecError() throws APIException, LocatorException, CadiException, URISyntaxException {
grant._exec(0, new String[] {"grant","type","instance","action","role"});
}
-
+
@Test
public void testExecSuccess1() throws APIException, LocatorException, CadiException, URISyntaxException {
when(futureMock.code()).thenReturn(202);
grant._exec(0, new String[] {"grant","type","instance","action","role"});
}
-
+
@Test
public void testExecSuccess2() throws APIException, LocatorException, CadiException, URISyntaxException {
when(futureMock.get(any(Integer.class))).thenReturn(true);
grant._exec(0, new String[] {"grant","type","instance","action","role"});
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java
index c28f65bd..a658ec7a 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListActivity.java
@@ -7,9 +7,9 @@
* * 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.
@@ -58,15 +58,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListActivity {
-
+
private static ListActivity lsActivity;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -74,14 +74,14 @@ public class JU_ListActivity {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Role role = new Role(aafcli);
Perm perm = new Perm(role);
List ls = new List(perm);
lsActivity = new ListActivity(ls);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -96,7 +96,7 @@ public class JU_ListActivity {
//lsActivity._exec(0, strArr);
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByNS.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByNS.java
index c6113003..96106797 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByNS.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByNS.java
@@ -7,9 +7,9 @@
* * 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.
@@ -42,9 +42,9 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByNS {
-
+
private static ListByNS lsByNS;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
@@ -53,7 +53,7 @@ public class JU_ListByNS {
List ls = new List(perm);
lsByNS = new ListByNS(ls);
}
-
+
// @Test
// public void exec() {
// try {
@@ -69,7 +69,7 @@ public class JU_ListByNS {
// e.printStackTrace();
// }
// }
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java
index 856867c8..b319a7b2 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByName.java
@@ -7,9 +7,9 @@
* * 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.
@@ -58,15 +58,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByName {
-
+
private static ListByName lsByName;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -74,14 +74,14 @@ public class JU_ListByName {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Role role = new Role(aafcli);
Perm perm = new Perm(role);
List ls = new List(perm);
lsByName = new ListByName(ls);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -96,7 +96,7 @@ public class JU_ListByName {
//lsByName._exec(0, strArr);
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java
index 600d1c4f..f471e4e4 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByRole.java
@@ -7,9 +7,9 @@
* * 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.
@@ -42,9 +42,9 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByRole {
-
+
private static ListByRole lsByRole;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
@@ -53,7 +53,7 @@ public class JU_ListByRole {
List ls = new List(perm);
lsByRole = new ListByRole(ls);
}
-
+
// @Test
// public void exec() {
// try {
@@ -69,7 +69,7 @@ public class JU_ListByRole {
// e.printStackTrace();
// }
// }
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java
index 6c451d08..f7a48d9b 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_ListByUser.java
@@ -7,9 +7,9 @@
* * 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.
@@ -42,9 +42,9 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByUser {
-
+
private static ListByUser lsByName;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
@@ -53,7 +53,7 @@ public class JU_ListByUser {
List ls = new List(perm);
lsByName = new ListByUser(ls);
}
-
+
// @Test
// public void exec() {
// try {
@@ -69,7 +69,7 @@ public class JU_ListByUser {
// e.printStackTrace();
// }
// }
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java
index c5ae3d2c..b7eef51e 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/perm/JU_Rename.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,15 +57,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Rename {
-
+
private static Rename rename;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -73,13 +73,13 @@ public class JU_Rename {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Role role = new Role(aafcli);
Perm perm = new Perm(role);
rename = new Rename(perm);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -92,9 +92,9 @@ public class JU_Rename {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"grant","ungrant","setTo","grant","ungrant","setTo"};
// rename._exec(0, strArr);
-
+
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java
index c863f9e9..3c7d4c03 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java
@@ -7,9 +7,9 @@
* * 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.
@@ -56,15 +56,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_CreateDelete {
-
+
private static CreateDelete createDel;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -72,12 +72,12 @@ public class JU_CreateDelete {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Role role = new Role(aafcli);
createDel = new CreateDelete(role);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -90,12 +90,12 @@ public class JU_CreateDelete {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"create","delete","create","delete"};
// createDel._exec(0, strArr);
-//
+//
// String[] strArr1 = {"delete","create","delete"};
// createDel._exec(0, strArr1);
-
+
}
-
+
@Test
public void testDetailedHelp() {
boolean hasNoError = true;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java
index a93a2ae4..9bddbeb8 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java
@@ -7,9 +7,9 @@
* * 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.
@@ -50,15 +50,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Describe {
-
+
private static Describe desc;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -66,12 +66,12 @@ public class JU_Describe {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Role role = new Role(aafcli);
desc = new Describe(role);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -84,9 +84,9 @@ public class JU_Describe {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"add","upd","del","add","upd","del"};
// desc._exec(0, strArr);
-
+
}
-
+
@Test
public void detailedHelp() {
boolean hasNoError = true;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java
index 4ddd421a..bbdb77e8 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java
@@ -66,7 +66,7 @@ import java.util.ArrayList;
import org.junit.Test;
public class JU_List {
-
+
AAFcli cli;
Role role;
List list;
@@ -74,7 +74,7 @@ public class JU_List {
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
private class ListRolesStub extends List {
@@ -84,7 +84,7 @@ public class JU_List {
// TODO Auto-generated constructor stub
}
}
-
+
private class RolesStub extends Roles {
public void addRole(aaf.v2_0.Role role) {
if (this.role == null) {
@@ -93,17 +93,17 @@ public class JU_List {
this.role.add(role);
}
}
-
+
private class RoleStub extends aaf.v2_0.Role {
-
+
public void addPerms(Pkey perms) {
if (this.perms == null) {
this.perms = new ArrayList<>();
}
- this.perms.add(perms);
+ this.perms.add(perms);
}
}
-
+
@Before
public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException, CadiException{
prop = new PropAccess();
@@ -111,19 +111,19 @@ public class JU_List {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
role = new Role(aafcli);
list = new List(role);
}
-
+
@Test
public void testRoles() throws APIException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Role role = new Role(aafcli);
ListRolesStub listStub = new ListRolesStub(role);
Future future = mock(Future.class);
Rcli rcli = mock(Rcli.class);
-
+
Class c = listStub.getClass();
Class[] cArg = new Class[3];
cArg[0] = Future.class;
@@ -132,9 +132,9 @@ public class JU_List {
//Method listMethod = c.getDeclaredMethod("list", cArg);
//listMethod.setAccessible(true);
//listMethod.invoke(listStub, future, rcli, "test");
-
+
}
-
+
@Test
public void testReport() throws Exception {
UserRoles urs = new UserRoles();
@@ -152,7 +152,7 @@ public class JU_List {
role.addPerms(pkey);
list.report(roles, perms , null , "test");
list.report(roles, perms , urs , "test");
-
+
aafcli.eval("DETAILS @[ 123");
role.setName("test");
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java
index c8ff94f3..1c5e586b 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,15 +57,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListActivity {
-
+
private static ListActivity lsActivity;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -73,13 +73,13 @@ public class JU_ListActivity {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Role role = new Role(aafcli);
List ls = new List(role);
lsActivity = new ListActivity(ls);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -92,9 +92,9 @@ public class JU_ListActivity {
HRcli hcli = new HRcli(hman, uri, item, secSet);
String[] strArr = {"add","upd","del","add","upd","del"};
//lsActivity._exec(0, strArr);
-
+
}
-
+
@Test
public void detailedHelp() {
boolean hasNoError = true;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java
index b58e44f5..2369f143 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,9 +41,9 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByNS {
-
+
private static ListByNS lsByNS;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
@@ -51,7 +51,7 @@ public class JU_ListByNS {
List ls = new List(role);
lsByNS = new ListByNS(ls);
}
-
+
// @Test
// public void exec() {
// try {
@@ -67,7 +67,7 @@ public class JU_ListByNS {
// e.printStackTrace();
// }
// }
-
+
@Test
public void detailedHelp() {
boolean hasNoError = true;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java
index c8a87170..79156c19 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,15 +57,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByNameOnly {
-
+
private static ListByNameOnly lsByName;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -73,13 +73,13 @@ public class JU_ListByNameOnly {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Role role = new Role(aafcli);
List ls = new List(role);
lsByName = new ListByNameOnly(ls);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -92,9 +92,9 @@ public class JU_ListByNameOnly {
HRcli hcli = new HRcli(hman, uri, item, secSet);
String[] strArr = {"add","upd","del","add","upd","del"};
//lsByName._exec(0, strArr);
-
+
}
-
+
@Test
public void detailedHelp() {
boolean hasNoError = true;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java
index 44f642e1..646bffd8 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,9 +41,9 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByPerm {
-
+
private static ListByPerm lsByPerm;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
@@ -51,7 +51,7 @@ public class JU_ListByPerm {
List ls = new List(role);
lsByPerm = new ListByPerm(ls);
}
-
+
// @Test
// public void exec() {
// try {
@@ -67,7 +67,7 @@ public class JU_ListByPerm {
// e.printStackTrace();
// }
// }
-
+
@Test
public void detailedHelp() {
boolean hasNoError = true;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java
index 38b42904..a93e18f5 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,9 +41,9 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByRole {
-
+
private static ListByRole lsByRole;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
@@ -51,7 +51,7 @@ public class JU_ListByRole {
List ls = new List(role);
lsByRole = new ListByRole(ls);
}
-
+
// @Test
// public void exec() {
// try {
@@ -67,7 +67,7 @@ public class JU_ListByRole {
// e.printStackTrace();
// }
// }
-
+
@Test
public void detailedHelp() {
boolean hasNoError = true;
@@ -78,5 +78,5 @@ public class JU_ListByRole {
}
assertEquals(hasNoError, true);
}
-
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java
index e4dd4ad1..1ab4da80 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,15 +57,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByUser {
-
+
private static ListByUser lsByUser;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -73,13 +73,13 @@ public class JU_ListByUser {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Role role = new Role(aafcli);
List ls = new List(role);
lsByUser = new ListByUser(ls);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -92,9 +92,9 @@ public class JU_ListByUser {
HRcli hcli = new HRcli(hman, uri, item, secSet);
String[] strArr = {"add","upd","del","add","upd","del"};
//lsByUser._exec(0, strArr);
-
+
}
-
+
@Test
public void detailedHelp() {
boolean hasNoError = true;
@@ -105,5 +105,5 @@ public class JU_ListByUser {
}
assertEquals(hasNoError, true);
}
-
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java
index a2625574..6e7f8c1b 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,15 +57,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_User {
-
+
private static User user;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -73,12 +73,12 @@ public class JU_User {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
Role role = new Role(aafcli);
user = new User(role);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -91,18 +91,18 @@ public class JU_User {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"add","del","setTo","extend","add","del","setTo","extend"};
// user._exec(0, strArr);
-//
+//
// String[] strArr1 = {"del","setTo","extend","add","del","setTo","extend"};
// user._exec(0, strArr1);
-//
+//
// String[] strArr2 = {"setTo","extend","add","del","setTo","extend"};
// user._exec(0, strArr2);
-//
+//
// String[] strArr3 = {"extend","add","del","setTo","extend"};
// user._exec(0, strArr3);
-
+
}
-
+
@Test
public void detailedHelp() {
boolean hasNoError = true;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java
index 0855a2a3..f9111c23 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Cred.java
@@ -7,9 +7,9 @@
* * 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.
@@ -66,7 +66,7 @@ public class JU_Cred {
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
@Before
@@ -76,12 +76,12 @@ public class JU_Cred {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
user = new User(aafcli);
cred = new Cred(user);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -94,18 +94,18 @@ public class JU_Cred {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"add","del","reset","extend"};
// cred._exec(0, strArr);
-//
+//
// String[] strArr1 = {"del","reset","extend","add"};
// cred._exec(0, strArr1);
-//
+//
// String[] strArr2 = {"reset","extend", "add","del"};
// cred._exec(0, strArr2);
-//
+//
// String[] strArr3 = {"extend","add","del","reset"};
// cred._exec(0, strArr3);
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java
index 4888f28f..628b8a6b 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Delg.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,7 +57,7 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Delg {
-
+
private static User testUser;
private static Delg delg;
User user;
@@ -65,7 +65,7 @@ public class JU_Delg {
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
@Before
@@ -75,12 +75,12 @@ public class JU_Delg {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = mock(HMangr.class); //new HMangr(aEnv, loc);
+ hman = mock(HMangr.class); //new HMangr(aEnv, loc);
aafcli = mock(AAFcli.class);//new AAFcli(prop, aEnv, wtr, hman, null, secSet);
// user = mock(User.class); //new User(aafcli);
// delg = new Delg(user);
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -93,19 +93,19 @@ public class JU_Delg {
HRcli hcli = new HRcli(hman, uri, item, secSet);
String[] strArr = {"add","upd","del"};
// delg._exec(0, strArr);
-
+
String[] strArr1 = {"upd","del","add"};
// delg._exec(0, strArr1);
-
+
String[] strArr2 = {"del","add"};
// delg._exec(0, strArr2);
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
// delg.detailedHelp(0, sb);
}
-
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java
index a299fcf5..93b5081f 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListActivity.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,34 +41,34 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListActivity {
-
+
private static ListActivity lsActivity;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
User usr = new User(cli);
List parent = new List(usr);
lsActivity = new ListActivity(parent);
-
+
}
-//
+//
// @Test
// public void exec() {
// try {
// assertEquals(lsActivity._exec(0, "add","del","reset","extend","clear", "rename", "create"),500);
// } catch (CadiException e) {
-//
+//
// e.printStackTrace();
// } catch (APIException e) {
-//
+//
// e.printStackTrace();
// } catch (LocatorException e) {
-//
+//
// e.printStackTrace();
// }
// }
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java
index 9ef4c16f..5a972b10 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListApprovals.java
@@ -7,9 +7,9 @@
* * 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.
@@ -59,15 +59,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListApprovals {
-
+
private static ListApprovals lsApprovals;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -75,14 +75,14 @@ public class JU_ListApprovals {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
User usr = new User(aafcli);
List parent = new List(usr);
lsApprovals = new ListApprovals(parent);
}
-
-
+
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
@@ -96,9 +96,9 @@ public class JU_ListApprovals {
HRcli hcli = new HRcli(hman, uri, item, secSet);
String[] strArr = {"user","approver","ticket"};
//lsApprovals._exec(0, strArr);
-
+
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java
index 16a5dae0..473c64fa 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListDelegates.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,34 +41,34 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListDelegates {
-
+
private static ListDelegates lsDelegates;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
User usr = new User(cli);
List parent = new List(usr);
lsDelegates = new ListDelegates(parent);
-
+
}
-
+
// @Test
// public void exec() {
// try {
// assertEquals(lsDelegates._exec(0, "add","del","reset","extend","clear", "rename", "create"),500);
// } catch (CadiException e) {
-//
+//
// e.printStackTrace();
// } catch (APIException e) {
-//
+//
// e.printStackTrace();
// } catch (LocatorException e) {
-//
+//
// e.printStackTrace();
// }
// }
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java
index 9db943e2..a2b4e860 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForCreds.java
@@ -7,9 +7,9 @@
* * 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.
@@ -57,16 +57,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListForCreds {
-
+
private static ListForCreds lsForCreds;
User user;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -74,14 +74,14 @@ public class JU_ListForCreds {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
User usr = new User(aafcli);
List parent = new List(usr);
lsForCreds = new ListForCreds(parent);
-
+
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -96,7 +96,7 @@ public class JU_ListForCreds {
//lsForCreds._exec(0, strArr);
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java
index 9087626a..36399d64 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForPermission.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,34 +41,34 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListForPermission {
-
+
private static ListForPermission lsForPermission;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
User usr = new User(cli);
List parent = new List(usr);
lsForPermission = new ListForPermission(parent);
-
+
}
-
+
// @Test
// public void exec() {
// try {
// assertEquals(lsForPermission._exec(0, "add","del","reset","extend","clear", "rename", "create"),500);
// } catch (CadiException e) {
-//
+//
// e.printStackTrace();
// } catch (APIException e) {
-//
+//
// e.printStackTrace();
// } catch (LocatorException e) {
-//
+//
// e.printStackTrace();
// }
// }
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java
index 2b64f0a1..a0d940d4 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_ListForRoles.java
@@ -7,9 +7,9 @@
* * 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.
@@ -41,34 +41,34 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListForRoles {
-
+
private static ListForRoles lsForRoles;
-
+
@BeforeClass
public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
AAFcli cli = JU_AAFCli.getAAfCli();
User usr = new User(cli);
List parent = new List(usr);
lsForRoles = new ListForRoles(parent);
-
+
}
-
+
// @Test
// public void exec() {
// try {
// assertEquals(lsForRoles._exec(0, "add","del","reset","extend","clear", "rename", "create"),500);
// } catch (CadiException e) {
-//
+//
// e.printStackTrace();
// } catch (APIException e) {
-//
+//
// e.printStackTrace();
// } catch (LocatorException e) {
-//
+//
// e.printStackTrace();
// }
// }
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java
index e44ee02d..3a47fbad 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/user/JU_Role.java
@@ -7,9 +7,9 @@
* * 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.
@@ -56,16 +56,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Role {
-
+
private static Role role;
User user;
PropAccess prop;
AuthzEnv aEnv;
Writer wtr;
Locator<URI> loc;
- HMangr hman;
+ HMangr hman;
AAFcli aafcli;
-
+
@Before
public void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
prop = new PropAccess();
@@ -73,13 +73,13 @@ public class JU_Role {
wtr = mock(Writer.class);
loc = mock(Locator.class);
SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
- hman = new HMangr(aEnv, loc);
+ hman = new HMangr(aEnv, loc);
aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
User usr = new User(aafcli);
role = new Role(usr);
-
+
}
-
+
@Test
public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
Item value = mock(Item.class);
@@ -92,18 +92,18 @@ public class JU_Role {
// HRcli hcli = new HRcli(hman, uri, item, secSet);
// String[] strArr = {"add", "del", "setTo","extend", "del", "setTo","extend"};
// Assert.assertEquals(200, role._exec(0, strArr));
-//
+//
// String[] strArr1 = { "del", "setTo","extend","add", "del", "setTo","extend"};
// Assert.assertEquals(501, role._exec(0, strArr1));
-//
+//
// String[] strArr2 = {"setTo","extend","add", "del", "del", "setTo","extend" };
// Assert.assertEquals(501, role._exec(0, strArr2));
-//
+//
// String[] strArr3 = {"extend","add", "del","setTo", "del", "setTo","extend" };
// Assert.assertEquals(501, role._exec(0, strArr3));
}
-
+
@Test
public void testDetailedHelp() {
StringBuilder sb = new StringBuilder();
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java
index 6a8ccf1e..ca387dc5 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/cache/Cache.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ import org.onap.aaf.misc.env.Trans;
/**
* Create and maintain a Map of Maps used for Caching
- *
+ *
* @author Jonathan
*
* @param <TRANS>
@@ -58,7 +58,7 @@ public class Cache<TRANS extends Trans, DATA> {
/**
* Dated Class - store any Data with timestamp
- *
+ *
* @author Jonathan
*
*/
@@ -66,7 +66,7 @@ public class Cache<TRANS extends Trans, DATA> {
public Date timestamp;
public List<?> data;
private long expireIn;
-
+
public Dated(List<?> data, long expireIn) {
timestamp = new Date(System.currentTimeMillis()+expireIn);
this.data = data;
@@ -85,7 +85,7 @@ public class Cache<TRANS extends Trans, DATA> {
timestamp = new Date(System.currentTimeMillis()+expireIn);
}
}
-
+
public static Map<String,Dated> obtain(String key) {
Map<String, Dated> m = cacheMap.get(key);
if (m==null) {
@@ -99,24 +99,24 @@ public class Cache<TRANS extends Trans, DATA> {
/**
* Clean will examine resources, and remove those that have expired.
- *
+ *
* If "highs" have been exceeded, then we'll expire 10% more the next time. This will adjust after each run
* without checking contents more than once, making a good average "high" in the minimum speed.
- *
+ *
* @author Jonathan
*
*/
private static final class Clean extends TimerTask {
private final Env env;
private Set<String> set;
-
- // The idea here is to not be too restrictive on a high, but to Expire more items by
+
+ // The idea here is to not be too restrictive on a high, but to Expire more items by
// shortening the time to expire. This is done by judiciously incrementing "advance"
// when the "highs" are exceeded. This effectively reduces numbers of cached items quickly.
private final int high;
private long advance;
private final long timeInterval;
-
+
public Clean(Env env, long cleanInterval, int highCount) {
this.env = env;
high = highCount;
@@ -124,7 +124,7 @@ public class Cache<TRANS extends Trans, DATA> {
advance = 0;
set = new HashSet<>();
}
-
+
public synchronized void add(String key) {
set.add(key);
}
@@ -134,8 +134,8 @@ public class Cache<TRANS extends Trans, DATA> {
int total = 0;
// look at now. If we need to expire more by increasing "now" by "advance"
Date now = new Date(System.currentTimeMillis() + advance);
-
-
+
+
for (String name : set) {
Map<String,Dated> map = cacheMap.get(name);
if (map==null) {
@@ -150,7 +150,7 @@ public class Cache<TRANS extends Trans, DATA> {
}
}
}
-
+
if (count>0) {
env.debug().log("Cache removed",count,"expired Cached Elements out of", total);
}
@@ -170,11 +170,11 @@ public class Cache<TRANS extends Trans, DATA> {
public static synchronized void startCleansing(Env env, String ... keys) {
if (cleanseTimer==null) {
cleanseTimer = new Timer("Cache Cleanup Timer");
- int cleanInterval = Integer.parseInt(env.getProperty(CACHE_CLEAN_INTERVAL,"60000")); // 1 minute clean cycles
+ int cleanInterval = Integer.parseInt(env.getProperty(CACHE_CLEAN_INTERVAL,"60000")); // 1 minute clean cycles
int highCount = Integer.parseInt(env.getProperty(CACHE_HIGH_COUNT,"5000"));
cleanseTimer.schedule(clean = new Clean(env, cleanInterval, highCount), cleanInterval, cleanInterval);
}
-
+
for (String key : keys) {
clean.add(key);
}
@@ -193,7 +193,7 @@ public class Cache<TRANS extends Trans, DATA> {
public void run() {
Cache.stopTimer();
}
- });
+ });
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
index 5fb590c1..77d9e8a0 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/common/Define.java
@@ -7,9 +7,9 @@
* * 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.
@@ -44,14 +44,14 @@ public class Define {
}
return ROOT_NS;
}
-
+
public static String ROOT_COMPANY() {
if (ROOT_NS==null) {
throw new RuntimeException(Define.class.getName() + MSG);
}
return ROOT_COMPANY;
}
-
+
public static void set(Access access) throws CadiException {
ROOT_NS = access.getProperty(Config.AAF_ROOT_NS,"org.osaaf.aaf");
ROOT_COMPANY = access.getProperty(Config.AAF_ROOT_COMPANY,null);
@@ -63,7 +63,7 @@ public class Define {
throw new CadiException(Config.AAF_ROOT_COMPANY + " or " + Config.AAF_ROOT_NS + " property with 3 positions is required.");
}
}
-
+
for ( Entry<Object, Object> es : access.getProperties().entrySet()) {
if (es.getKey().toString().startsWith(ROOT_NS_TAG_DOT)) {
access.getProperties().setProperty(es.getKey().toString(),varReplace(es.getValue().toString()));
@@ -90,7 +90,7 @@ public class Define {
public static boolean isInitialized() {
return initialized;
}
-
+
public static String getCredType(int type) {
switch(type) {
case 0: return "NoCrd";
@@ -102,5 +102,5 @@ public class Define {
return "n/a";
}
}
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
index a46be8ef..0e2d4145 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzEnv.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,10 +39,10 @@ import org.onap.aaf.misc.rosetta.env.RosettaEnv;
/**
* AuthzEnv is the Env tailored to Authz Service
- *
+ *
* Most of it is derived from RosettaEnv, but it also implements Access, which
* is an Interface that Allows CADI to interact with Container Logging
- *
+ *
* @author Jonathan
*
*/
@@ -65,14 +65,14 @@ public class AuthzEnv extends RosettaEnv implements Access {
super();
_init(new PropAccess(props));
}
-
+
public AuthzEnv(PropAccess pa) {
super();
_init(pa);
}
-
- private final void _init(PropAccess pa) {
+
+ private final void _init(PropAccess pa) {
access = pa;
times = new long[20];
idx = 0;
@@ -85,16 +85,16 @@ public class AuthzEnv extends RosettaEnv implements Access {
debug = new AccessLogTarget(access, Level.DEBUG);
trace = new AccessLogTarget(access, Level.TRACE);
}
-
+
private class AccessLogTarget implements LogTarget {
private final Level level;
private final Access access;
-
+
public AccessLogTarget(final Access access, final Level level) {
this.level = level;
this.access = access;
}
-
+
@Override
public void log(Object... msgs) {
access.log(level, msgs);
@@ -117,7 +117,7 @@ public class AuthzEnv extends RosettaEnv implements Access {
public void printf(String fmt, Object... vars) {
access.printf(level, fmt, vars);
}
-
+
}
@Override
public AuthzTransImpl newTrans() {
@@ -146,7 +146,7 @@ public class AuthzEnv extends RosettaEnv implements Access {
++count;
pot += times[i]-prev;
}
- prev = times[i];
+ prev = times[i];
}
}
for (int i=0;i<idx;++i) {
@@ -155,13 +155,13 @@ public class AuthzEnv extends RosettaEnv implements Access {
++count;
pot += times[i]-prev;
}
- prev = times[i];
+ prev = times[i];
}
}
return count==0?300000L:pot/count; // Return Weighted Avg, or 5 mins, if none avail.
}
-
+
@Override
public ClassLoader classLoader() {
return getClass().getClassLoader();
@@ -199,7 +199,7 @@ public class AuthzEnv extends RosettaEnv implements Access {
public void setLogLevel(Level level) {
access.setLogLevel(level);
}
-
+
private static final byte[] ENC="enc:".getBytes();
public String decrypt(String encrypted, final boolean anytext) throws IOException {
if (encrypted==null) {
@@ -237,7 +237,7 @@ public class AuthzEnv extends RosettaEnv implements Access {
return "";
}
}
-
+
};
}
return decryptor.decrypt(encrypted);
@@ -290,5 +290,5 @@ public class AuthzEnv extends RosettaEnv implements Access {
public Properties getProperties() {
return access.getProperties();
};
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java
index ac16833d..934b8417 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTrans.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,13 +45,13 @@ public interface AuthzTrans extends TransStore {
public abstract AuthzTrans set(HttpServletRequest req, HttpServletResponse resp);
public abstract HttpServletRequest hreq();
-
+
public abstract HttpServletResponse hresp();
public abstract String user();
public abstract void setUser(TaggedPrincipal p);
-
+
public abstract TaggedPrincipal getUserPrincipal();
public abstract String ip();
@@ -63,27 +63,27 @@ public interface AuthzTrans extends TransStore {
public abstract String path();
public abstract String agent();
-
+
public abstract AuthzEnv env();
public abstract void setLur(Lur lur);
-
+
public abstract Lur getLur();
public abstract boolean fish(Permission ... p);
-
+
public abstract Organization org();
public abstract boolean requested(REQD_TYPE requested);
-
+
public void requested(REQD_TYPE requested, boolean b);
-
+
public abstract void logAuditTrail(LogTarget lt);
-
+
public abstract Date now();
-
+
public abstract void setTag(String tag);
-
+
public abstract String getTag();
public abstract void clearCache();
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
index bd9f8875..e78a4889 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransFilter.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,7 +48,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
public static final String SPECIAL_LOG_SLOT = "SPECIAL_LOG_SLOT";
public static final int BUCKETSIZE = 2;
-
+
public AuthzTransFilter(AuthzEnv env, Connector con, TrustChecker tc, Object ... additionalTafLurs) throws CadiException, LocatorException {
super(env.access(),con, tc, additionalTafLurs);
this.env = env;
@@ -61,7 +61,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
specialLogSlot = env.slot(SPECIAL_LOG_SLOT);
}
}
-
+
@Override
protected AuthzTrans newTrans(HttpServletRequest req, HttpServletResponse resp) {
AuthzTrans at = env.newTrans();
@@ -87,7 +87,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
protected void tallyHo(AuthzTrans trans, String target) {
Boolean b = trans.get(specialLogSlot, false);
LogTarget lt = b?trans.warn():trans.debug();
-
+
if (lt.isLoggable()) {
// Transaction is done, now post full Audit Trail
StringBuilder sb = new StringBuilder("AuditTrail\n");
@@ -100,7 +100,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
for (int i=0;i<serviceMetric.buckets.length;++i) {
serviceMetric.buckets[i]+=m.buckets[i];
}
-
+
Long tsi;
if ((tsi=trans.get(transIDslot, null))!=null) {
sb.append(" TraceID=");
@@ -118,14 +118,14 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
} else {
// Single Line entry
// IMPORTANT!!! if you add more entries here, change "BUCKETSIZE"!!!
- StringBuilder content = new StringBuilder();
+ StringBuilder content = new StringBuilder();
Metric m = trans.auditTrail(lt,1, content, Env.REMOTE,Env.JSON);
// Add current Metrics to total metrics
serviceMetric.total+= m.total;
for (int i=0;i<serviceMetric.buckets.length;++i) {
serviceMetric.buckets[i]+=m.buckets[i];
}
-
+
StringBuilder sb = new StringBuilder();
sb.append("user=");
Principal p = trans.getUserPrincipal();
@@ -140,7 +140,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
sb.append('(');
sb.append(((TrustPrincipal)p).personalName()); // UserChain
sb.append(')');
- } else {
+ } else {
sb.append('[');
if (p instanceof TaggedPrincipal) {
sb.append(((TaggedPrincipal)p).tag());
@@ -184,7 +184,7 @@ public class AuthzTransFilter extends TransFilter<AuthzTrans> {
}
sb.append('"');
}
-
+
lt.log(sb);
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
index 037ce4ee..c3d0298d 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -60,7 +60,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
hreq = req;
hresp = resp;
user = (TaggedPrincipal)req.getUserPrincipal();
-
+
for (REQD_TYPE rt : REQD_TYPE.values()) {
requested(rt,req);
}
@@ -73,7 +73,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
org=null;
return this;
}
-
+
@Override
public HttpServletRequest hreq() {
return hreq;
@@ -96,7 +96,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
public String user() {
return user==null?N_A:user.getName();
}
-
+
/**
* @see org.onap.aaf.auth.env.test.AuthTrans#getUserPrincipal()
*/
@@ -150,12 +150,12 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
public AuthzEnv env() {
return (AuthzEnv)delegate;
}
-
+
@Override
public boolean requested(REQD_TYPE requested) {
return (mask&requested.bit)==requested.bit;
}
-
+
public void requested(REQD_TYPE requested, boolean b) {
if (b) {
mask|=requested.bit;
@@ -163,7 +163,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
mask&=~requested.bit;
}
}
-
+
private void requested(REQD_TYPE reqtype, HttpServletRequest req) {
String p = req.getParameter(reqtype.name());
if (p!=null) {
@@ -175,12 +175,12 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
public void setLur(Lur lur) {
this.lur = lur;
}
-
+
@Override
public Lur getLur() {
- return lur;
+ return lur;
}
-
+
@Override
public boolean fish(Permission ... pond) {
if (lur!=null) {
@@ -188,7 +188,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
}
return false;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.env.test.AuthzTrans#org()
*/
@@ -200,10 +200,10 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
org = Organization.NULL;
}
} catch (Exception e) {
-
+
org = Organization.NULL;
}
- }
+ }
return org;
}
@@ -229,7 +229,7 @@ public class AuthzTransImpl extends BasicTrans implements AuthzTrans {
}
return now;
}
-
+
/*
* (non-Javadoc)
* @see org.onap.aaf.auth.env.AuthzTrans#setTag(java.lang.String)
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
index 5545c7da..396f0d11 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/AuthzTransOnlyFilter.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,9 +39,9 @@ public class AuthzTransOnlyFilter extends TransOnlyFilter<AuthzTrans> {
public AuthzTransOnlyFilter(AuthzEnv env) {
this.env = env;
serviceMetric = new Metric();
- serviceMetric.buckets = new float[BUCKETSIZE];
+ serviceMetric.buckets = new float[BUCKETSIZE];
}
-
+
@Override
protected AuthzTrans newTrans(HttpServletRequest req, HttpServletResponse resp) {
AuthzTrans trans = env.newTrans();
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
index df086cda..a10cae9c 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/env/NullTrans.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,13 +42,13 @@ import org.onap.aaf.misc.env.TimeTaken;
*/
public class NullTrans implements AuthzTrans {
private static final AuthzTrans singleton = new NullTrans();
-
+
public static final AuthzTrans singleton() {
return singleton;
}
private Date now;
-
+
public void checkpoint(String text) {}
public void checkpoint(String text, int additionalFlag) {}
public Metric auditTrail(int indent, StringBuilder sb, int... flag) {return null;}
@@ -144,7 +144,7 @@ public class NullTrans implements AuthzTrans {
public HttpServletResponse hresp() {
return null;
}
-
+
@Override
public String user() {
@@ -159,7 +159,7 @@ public class NullTrans implements AuthzTrans {
@Override
public void setUser(TaggedPrincipal p) {
}
-
+
@Override
public String ip() {
return null;
@@ -209,7 +209,7 @@ public class NullTrans implements AuthzTrans {
@Override
public Lur getLur() {
- return null;
+ return null;
}
@Override
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java
index 41f0e74a..dd3a14d9 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java
index c81504b6..a80ad26f 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/FacadeImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,7 +34,7 @@ public abstract class FacadeImpl {
protected void setContentType(HttpServletResponse response, TYPE type) {
response.setContentType(type==Data.TYPE.JSON?"application/json":"text.xml");
}
-
+
protected void setCacheControlOff(HttpServletResponse response) {
response.setHeader("Cache-Control", "no-store");
response.setHeader("Pragma", "no-cache");
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
index 9d7347ac..9050553c 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/Result.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,7 +28,7 @@ import java.util.Set;
/**
* It would be nice if Java Enums were extensible, but they're not.
- *
+ *
* @author Jonathan
*
*/
@@ -47,12 +47,12 @@ public class Result<RV> {
ERR_ActionNotCompleted = 8,
ERR_Backend = 9,
ERR_General = 20;
-
+
public RV value;
public final int status;
public final String details;
public final Object[] variables;
-
+
public Result(RV value, int status, String details, Object ... variables) {
this.value = value;
if (value==null) {
@@ -66,12 +66,12 @@ public class Result<RV> {
this.variables=variables;
}
}
-
+
/**
* Create a Result class with "OK" status and "Success" for details
- *
+ *
* This is the easiest to use
- *
+ *
* @param value
* @param status
* @return
@@ -126,7 +126,7 @@ public class Result<RV> {
}
/**
- * Create a Status (usually non OK, with a details statement
+ * Create a Status (usually non OK, with a details statement
* @param value
* @param status
* @param details
@@ -135,7 +135,7 @@ public class Result<RV> {
// public static<R> Result<R> err(int status, String details) {
// return new Result<R>(null,status,details,null);
// }
-
+
/**
* Create a Status (usually non OK, with a details statement and variables supported
* @param status
@@ -166,7 +166,7 @@ public class Result<RV> {
}
/**
- * Create a Status (usually non OK, with a details statement
+ * Create a Status (usually non OK, with a details statement
* @param value
* @param status
* @param details
@@ -177,7 +177,7 @@ public class Result<RV> {
}
/**
- * Create a Status from a previous status' result/details
+ * Create a Status from a previous status' result/details
* @param value
* @param status
* @param details
@@ -189,10 +189,10 @@ public class Result<RV> {
private static final int PARTIAL_CONTENT = 0x001;
private static final int EMPTY_LIST = 0x002;
-
+
/**
- * AAF Specific problems, etc
- *
+ * AAF Specific problems, etc
+ *
* @author Jonathan
*
*/
@@ -227,7 +227,7 @@ public class Result<RV> {
/**
* When Result is a List, you can check here to see if it's empty instead of looping
- *
+ *
* @return
*/
public boolean isEmpty() {
@@ -237,7 +237,7 @@ public class Result<RV> {
/**
* A common occurrence is that data comes back, but list is empty. If set, you can skip looking
* at list at the outset.
- *
+ *
* @param emptyList
* @return
*/
@@ -250,8 +250,8 @@ public class Result<RV> {
return this;
}
-
- /**
+
+ /**
* Convenience function. Checks OK, and also if List is not Empty
* Not valid if Data is not a List
* @return
@@ -260,7 +260,7 @@ public class Result<RV> {
return status == OK;
}
- /**
+ /**
* Convenience function. Checks OK, and also if List is not Empty
* Not valid if Data is not a List
* @return
@@ -269,7 +269,7 @@ public class Result<RV> {
return status != OK;
}
- /**
+ /**
* Convenience function. Checks OK, and also if List is not Empty
* Not valid if Data is not a List
* @return
@@ -279,7 +279,7 @@ public class Result<RV> {
}
- /**
+ /**
* Convenience function. Checks OK, and also if List is not Empty
* Not valid if Data is not a List
* @return
@@ -307,7 +307,7 @@ public class Result<RV> {
return sb.toString();
}
}
-
+
public String errorString() {
StringBuilder sb = new StringBuilder();
switch(status) {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java
index 6f644bd4..cdc0e486 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/AbsData.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,21 +55,21 @@ public abstract class AbsData implements Iterable<String> {
this.fieldOffset = fieldOffset;
idxf = new File(dir,name.concat(".idx"));
lockf = new File(dir,name.concat(".lock"));
-
-
+
+
data = new DataFile(dataf,"r");
ti = new TextIndex(idxf);
skipLines=0;
}
-
+
public void skipLines(int lines) {
skipLines=lines;
}
-
+
public String name() {
return name;
}
-
+
public void open(AuthzTrans trans, long timeout) throws IOException {
TimeTaken tt = trans.start("Open Data File", Env.SUB);
boolean first = true;
@@ -84,7 +84,7 @@ public abstract class AbsData implements Iterable<String> {
if (first) {
trans.warn().log("Waiting for",lockf.getCanonicalPath(),"to close");
first = false;
- }
+ }
try {
Thread.sleep(200);
} catch (InterruptedException e) {
@@ -103,12 +103,12 @@ public abstract class AbsData implements Iterable<String> {
throw e;
}
ti.open();
-
+
} finally {
tt.done();
}
}
-
+
private synchronized void ensureIdxGood(AuthzTrans trans) throws IOException {
if (!idxf.exists() || idxf.length()==0 || dataf.lastModified()>idxf.lastModified()) {
trans.warn().log(idxf.getAbsolutePath(),"is missing, empty or out of date, creating");
@@ -129,7 +129,7 @@ public abstract class AbsData implements Iterable<String> {
ti.close();
data.close();
}
-
+
public class Reuse {
public Token tokenData;
private Field fieldData;
@@ -138,7 +138,7 @@ public abstract class AbsData implements Iterable<String> {
tokenData = data.new Token(size);
fieldData = tokenData.new Field(delim);
}
-
+
public void reset() {
getFieldData().reset();
}
@@ -151,7 +151,7 @@ public abstract class AbsData implements Iterable<String> {
public String next() {
return getFieldData().next();
}
-
+
public String at(int field) {
return getFieldData().at(field);
}
@@ -164,7 +164,7 @@ public abstract class AbsData implements Iterable<String> {
return fieldData;
}
}
-
+
public Reuse reuse() {
return new Reuse(maxLineSize,delim);
}
@@ -172,7 +172,7 @@ public abstract class AbsData implements Iterable<String> {
public Iter iterator() {
return new Iter();
}
-
+
public class Iter implements Iterator<String> {
private Reuse reuse;
private org.onap.aaf.auth.local.TextIndex.Iter tii;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java
index a65c13db..2ca6e1f9 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/DataFile.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ public class DataFile {
public MappedByteBuffer mapBuff;
private final File file;
private final String access;
-
+
public DataFile(File file, String access) {
this.file = file;
this.access = access;
@@ -73,21 +73,21 @@ public class DataFile {
}
return len<0?0:len;
}
-
+
public class Token {
private byte[] buff;
int pos, next, end;
-
+
public Token(int size) {
buff = new byte[size];
pos = next = end = 0;
}
-
+
public boolean pos(int to) {
pos = next = to;
return (end=load(this))>0;
}
-
+
public boolean nextLine() {
end = load(this);
pos = next;
@@ -100,7 +100,7 @@ public class DataFile {
}
return false;
}
-
+
public IntBuffer getIntBuffer() {
return ByteBuffer.wrap(buff).asIntBuffer();
}
@@ -108,7 +108,7 @@ public class DataFile {
public String toString() {
return new String(buff,0,end);
}
-
+
public class Field {
char delim;
int idx;
@@ -119,12 +119,12 @@ public class DataFile {
idx = 0;
bb = null;
}
-
+
public Field reset() {
idx = 0;
return this;
}
-
+
public String next() {
if (idx>=end)return null;
int start = idx;
@@ -134,7 +134,7 @@ public class DataFile {
if (c=='\r')endStr=idx;
++idx;
}
-
+
if (endStr<0) {
endStr=idx-start;
} else {
@@ -157,7 +157,7 @@ public class DataFile {
}
return new String(buff,start,(idx-start-(c=='\r'?1:0)));
}
-
+
public String atToEnd(int fieldOffset) {
int start;
byte c=0;
@@ -169,7 +169,7 @@ public class DataFile {
start = idx+1;
}
}
-
+
for (; idx<end && idx<buff.length && (c=buff[idx])!='\n'; ++idx) {
++idx;
}
@@ -186,5 +186,5 @@ public class DataFile {
public File file() {
return file;
}
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
index 73ad07c7..b36ed4b9 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,19 +40,19 @@ import org.onap.aaf.misc.env.Trans;
public class TextIndex {
private static final int REC_SIZE=8;
-
+
private File file;
private DataFile dataFile=null;
-
+
public TextIndex(File theFile) {
file = theFile;
}
-
+
public void open() throws IOException {
dataFile = new DataFile(file,"r");
dataFile.open();
}
-
+
public void close() throws IOException {
if (dataFile!=null) {
dataFile.close();
@@ -63,7 +63,7 @@ public class TextIndex {
public int find(Object key, AbsData.Reuse reuse, int offset) throws IOException {
return find(key,reuse.tokenData,reuse.getFieldData(),offset);
}
-
+
public int find(Object key, DataFile.Token dtok, Field df, int offset) throws IOException {
if (dataFile==null) {
throw new IOException("File not opened");
@@ -88,7 +88,7 @@ public class TextIndex {
break;
}
}
-
+
List<Integer> entries = new ArrayList<>();
for (int i=min;i<=max;++i) {
ttok.pos(i*REC_SIZE);
@@ -100,7 +100,7 @@ public class TextIndex {
break;
}
}
-
+
for (Integer i : entries) {
dtok.pos(i);
if (df.at(offset).equals(key)) {
@@ -109,7 +109,7 @@ public class TextIndex {
}
return -1;
}
-
+
/*
* Have to change Bytes into a Long, to avoid the inevitable signs in the Hash
@@ -123,10 +123,10 @@ public class TextIndex {
}
return rv;
}
-
+
public void create(final Trans trans,final DataFile data, int maxLine, char delim, int fieldOffset, int skipLines) throws IOException {
FileChannel fos;
-
+
List<Idx> list = new LinkedList<>(); // Some hashcodes will double... DO NOT make a set
TimeTaken tt2 = trans.start("Open Files", Env.SUB);
RandomAccessFile raf=null;
@@ -138,12 +138,12 @@ public class TextIndex {
} finally {
tt2.done();
}
-
+
try {
-
- Token t = data.new Token(maxLine);
+
+ Token t = data.new Token(maxLine);
Field f = t.new Field(delim);
-
+
int count = 0;
if (skipLines>0) {
trans.info().log("Skipping",skipLines,"line"+(skipLines==1?" in":"s in"),data.file().getName());
@@ -184,14 +184,14 @@ public class TextIndex {
}
} finally {
fos.close();
- }
+ }
} finally {
if (raf!=null) {
raf.close(); // closed by fos
}
}
}
-
+
public class Iter {
private int idx;
private Token t;
@@ -210,7 +210,7 @@ public class TextIndex {
end = -1L;
}
}
-
+
public int next() {
t.pos(idx);
ib.clear();
@@ -224,14 +224,14 @@ public class TextIndex {
return idx<end;
}
}
-
+
private static class Idx implements Comparable<Idx> {
public int hash, pos;
public Idx(Object obj, int pos) {
hash = obj.hashCode();
this.pos = pos;
}
-
+
@Override
public int compareTo(Idx ib) {
long a = hashToLong(hash);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java
index 165295d9..7cb25c73 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java
index 7084fbd8..be5d6e0e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/EmailWarnings.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java
index 48ac9dce..bfe588f3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Executor.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,9 +26,9 @@ public interface Executor {
// remove user from Admins
// if # of Owners > 1, remove User from Owner
// if # of Owners = 1, changeOwner to X Remove Owner????
- boolean hasPermission(String user, String ns, String type, String instance, String action);
+ boolean hasPermission(String user, String ns, String type, String instance, String action);
boolean inRole(String name);
-
+
public String namespace() throws Exception;
public String id();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java
index 9478832b..8896ca87 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/FileMailer.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,7 +41,7 @@ public class FileMailer implements Mailer {
public FileMailer(Access access) throws APIException {
count = 0;
-
+
mail_from = access.getProperty("MAIL_FROM", null);
if(mail_from==null) {
throw new APIException("MAIL_FROM property is required for Email Notifications");
@@ -59,7 +59,7 @@ public class FileMailer implements Mailer {
throw new APIException("Cannot create directory: " + dir.toString(),e);
}
}
-
+
boolean dryrun = Boolean.parseBoolean(access.getProperty("DRY_RUN","false"));
String str = access.getProperty("MAX_EMAIL", null);
int maxEmail = str==null || str.isEmpty()?Integer.MAX_VALUE:Integer.parseInt(str);
@@ -94,7 +94,7 @@ public class FileMailer implements Mailer {
bw.write(to);
}
bw.newLine();
-
+
bw.write("CC: ");
first = true;
for(String cc : ccList) {
@@ -106,17 +106,17 @@ public class FileMailer implements Mailer {
bw.write(cc);
}
bw.newLine();
-
+
bw.write("FROM: ");
bw.write(mail_from);
bw.newLine();
-
+
bw.write("SUBJECT: ");
bw.write(subject);
bw.newLine();
-
+
if(urgent) {
- bw.write("Importance: High");
+ bw.write("Importance: High");
bw.newLine();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java
index 64a2e8dd..ad1d5a23 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Mailer.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,9 +28,9 @@ public interface Mailer {
public boolean sendEmail(
AuthzTrans trans,
String test,
- List<String> toList,
- List<String> ccList,
- String subject,
+ List<String> toList,
+ List<String> ccList,
+ String subject,
String body,
Boolean urgent) throws OrganizationException;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
index 75669632..288d79d3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,13 +32,13 @@ import org.onap.aaf.auth.env.AuthzTrans;
/**
* Organization
- *
+ *
* There is Organizational specific information required which we have extracted to a plugin
- *
+ *
* It supports using Company Specific User Directory lookups, as well as supporting an
* Approval/Validation Process to simplify control of Roles and Permissions for large organizations
- * in lieu of direct manipulation by a set of Admins.
- *
+ * in lieu of direct manipulation by a set of Admins.
+ *
* @author Jonathan
*
*/
@@ -55,7 +55,7 @@ public interface Organization {
public String fullName();
public String firstName();
/**
- * If Responsible entity, then String returned is "null" meaning "no Objection".
+ * If Responsible entity, then String returned is "null" meaning "no Objection".
* If String exists, it is the Policy objection text setup by the entity.
* @return
*/
@@ -90,7 +90,7 @@ public interface Organization {
* @return
*/
public String getRealm();
-
+
public boolean supportsRealm(String user);
public void addSupportedRealm(String r);
@@ -99,44 +99,44 @@ public interface Organization {
/**
* Get Identity information based on userID
- *
+ *
* @param id
* @return
*/
public Identity getIdentity(AuthzTrans trans, String id) throws OrganizationException;
-
+
/**
* Is Revoked
- *
- * Deletion of an Identity that has been removed from an Organization can be dangerous. Mistakes may have been made
- * in the Organization side, a Feed might be corrupted, an API might not be quite right.
- *
+ *
+ * Deletion of an Identity that has been removed from an Organization can be dangerous. Mistakes may have been made
+ * in the Organization side, a Feed might be corrupted, an API might not be quite right.
+ *
* The implementation of this method can use a double check of some sort, such as comparison of missing ID in Organization
- * feed with a "Deleted ID" feed.
- *
+ * feed with a "Deleted ID" feed.
+ *
*/
public boolean isRevoked(AuthzTrans trans, String id);
/**
* Does the ID pass Organization Standards
- *
- * Return a Blank (empty) String if empty, otherwise, return a "\n" separated list of
+ *
+ * Return a Blank (empty) String if empty, otherwise, return a "\n" separated list of
* reasons why it fails
- *
+ *
* @param id
* @return
*/
public String isValidID(AuthzTrans trans, String id);
/**
- * Return a Blank (empty) String if empty, otherwise, return a "\n" separated list of
+ * Return a Blank (empty) String if empty, otherwise, return a "\n" separated list of
* reasons why it fails
- *
+ *
* Identity is passed in to allow policies regarding passwords that are the same as user ID
- *
+ *
* any entries for "prev" imply a reset
- *
+ *
* @param id
* @param password
* @return
@@ -149,7 +149,7 @@ public interface Organization {
public String[] getPasswordRules();
/**
- *
+ *
* @param id
* @return
*/
@@ -157,7 +157,7 @@ public interface Organization {
/**
* If response is Null, then it is valid. Otherwise, the Organization specific reason is returned.
- *
+ *
* @param trans
* @param policy
* @param executor
@@ -169,7 +169,7 @@ public interface Organization {
/**
* Does your Company distinguish essential permission structures by kind of Identity?
- * i.e. Employee, Contractor, Vendor
+ * i.e. Employee, Contractor, Vendor
* @return
*/
public Set<String> getIdentityTypes();
@@ -198,30 +198,30 @@ public interface Organization {
ERR_UserNotExist,
ERR_NotificationFailure,
};
-
+
public enum Expiration {
Password,
- TempPassword,
+ TempPassword,
Future,
UserInRole,
- UserDelegate,
+ UserDelegate,
ExtendPassword
}
-
+
public enum Policy {
- CHANGE_JOB,
- LEFT_COMPANY,
- CREATE_MECHID,
+ CHANGE_JOB,
+ LEFT_COMPANY,
+ CREATE_MECHID,
CREATE_MECHID_BY_PERM_ONLY,
OWNS_MECHID,
- AS_RESPONSIBLE,
+ AS_RESPONSIBLE,
MAY_EXTEND_CRED_EXPIRES,
MAY_APPLY_DEFAULT_REALM
}
-
+
/**
* Notify a User of Action or Info
- *
+ *
* @param type
* @param url
* @param users (separated by commas)
@@ -233,7 +233,7 @@ public interface Organization {
/**
* (more) generic way to send an email
- *
+ *
* @param toList
* @param ccList
* @param subject
@@ -245,36 +245,36 @@ public interface Organization {
/**
* whenToValidate
- *
+ *
* Authz support services will ask the Organization Object at startup when it should
- * kickoff Validation processes given particular types.
- *
+ * kickoff Validation processes given particular types.
+ *
* This allows the Organization to express Policy
- *
+ *
* Turn off Validation behavior by returning "null"
- *
+ *
*/
public Date whenToValidate(Notify type, Date lastValidated);
-
+
/**
* Expiration
- *
+ *
* Given a Calendar item of Start (or now), set the Expiration Date based on the Policy
* based on type.
- *
+ *
* For instance, "Passwords expire in 3 months"
- *
+ *
* The Extra Parameter is used by certain Orgs.
- *
+ *
* For Password, the extra is UserID, so it can check the User Type
- *
+ *
* @param gc
* @param exp
* @return
*/
public GregorianCalendar expiration(GregorianCalendar gc, Expiration exp, String ... extra);
-
+
/**
* Get Email Warning timing policies
* @return
@@ -282,7 +282,7 @@ public interface Organization {
public EmailWarnings emailWarningPolicy();
/**
- *
+ *
* @param trans
* @param user
* @return
@@ -295,23 +295,23 @@ public interface Organization {
* 2 = expects both self and immediate responsible party
* 3 = expects self, immediate report and any higher that the Organization wants to escalate to in the
* hierarchy.
- *
+ *
* Note: this is used to notify of imminent danger of Application's Cred or Role expirations.
*/
public List<Identity> getIDs(AuthzTrans trans, String user, int escalate) throws OrganizationException ;
-
+
/*
- *
+ *
* @param user
* @param type
* @param users
* @return
public Response notifyRequest(AuthzTrans trans, String user, Approval type, List<User> approvers);
*/
-
+
/**
- *
+ *
* @return
*/
public String getApproverType();
@@ -319,7 +319,7 @@ public interface Organization {
/*
* startOfDay - define for company what hour of day business starts (specifically for password and other expiration which
* were set by Date only.)
- *
+ *
* @return
*/
public int startOfDay();
@@ -333,12 +333,12 @@ public interface Organization {
* @return
*/
public boolean canHaveMultipleCreds(String id);
-
+
boolean isTestEnv();
public void setTestMode(boolean dryRun);
- public static final Organization NULL = new Organization()
+ public static final Organization NULL = new Organization()
{
private final GregorianCalendar gc = new GregorianCalendar(1900, 1, 1);
private final List<Identity> nullList = new ArrayList<>();
@@ -355,27 +355,27 @@ public interface Organization {
public String mayOwn() {
return N_A; // negative case
}
-
+
@Override
public boolean isFound() {
return false;
}
-
+
@Override
public String id() {
return N_A;
}
-
+
@Override
public String fullID() {
return N_A;
}
-
+
@Override
public String email() {
return N_A;
}
-
+
@Override
public List<String> delegate() {
return nullUser;
@@ -406,12 +406,12 @@ public interface Organization {
public String getName() {
return N_A;
}
-
+
@Override
public String getRealm() {
return N_A;
}
-
+
@Override
public boolean supportsRealm(String r) {
return false;
@@ -425,87 +425,87 @@ public interface Organization {
public String getDomain() {
return N_A;
}
-
+
@Override
public Identity getIdentity(AuthzTrans trans, String id) {
return nullIdentity;
}
-
+
@Override
public String isValidID(final AuthzTrans trans, String id) {
return N_A;
}
-
+
@Override
public String isValidPassword(final AuthzTrans trans, final String user, final String password, final String... prev) {
return N_A;
}
-
+
@Override
public Set<String> getIdentityTypes() {
return nullStringSet;
}
-
+
@Override
public Response notify(AuthzTrans trans, Notify type, String url,
String[] users, String[] ccs, String summary, Boolean urgent) {
return Response.ERR_NotImplemented;
}
-
+
@Override
public int sendEmail(AuthzTrans trans, List<String> toList, List<String> ccList,
String subject, String body, Boolean urgent) throws OrganizationException {
return 0;
}
-
+
@Override
public Date whenToValidate(Notify type, Date lastValidated) {
return gc.getTime();
}
-
+
@Override
public GregorianCalendar expiration(GregorianCalendar gc,
Expiration exp, String... extra) {
return gc;
}
-
+
@Override
public List<Identity> getApprovers(AuthzTrans trans, String user)
throws OrganizationException {
return nullList;
}
-
+
@Override
public String getApproverType() {
return "";
}
-
+
@Override
public int startOfDay() {
return 0;
}
-
+
@Override
public boolean canHaveMultipleCreds(String id) {
return false;
}
-
+
@Override
public boolean isValidCred(final AuthzTrans trans, final String id) {
return false;
}
-
+
@Override
public String validate(AuthzTrans trans, Policy policy, Executor executor, String ... vars)
throws OrganizationException {
return "Null Organization rejects all Policies";
}
-
+
@Override
public boolean isTestEnv() {
return false;
}
-
+
@Override
public void setTestMode(boolean dryRun) {
}
@@ -519,24 +519,24 @@ public interface Organization {
{
return 604800000L; // 7 days in millis 1000 * 86400 * 7
}
-
+
@Override
public long roleEmailInterval()
{
return 604800000L; // 7 days in millis 1000 * 86400 * 7
}
-
+
@Override
public long apprEmailInterval() {
return 259200000L; // 3 days in millis 1000 * 86400 * 3
}
-
+
@Override
public long credExpirationWarning()
{
return( 2592000000L ); // One month, in milliseconds 1000 * 86400 * 30 in milliseconds
}
-
+
@Override
public long roleExpirationWarning()
{
@@ -550,15 +550,15 @@ public interface Organization {
}
};
-
+
}
@Override
public String[] getPasswordRules() {
- return nullStringArray;
+ return nullStringArray;
}
-
+
@Override
public boolean isRevoked(AuthzTrans trans, String id) {
// provide a corresponding feed that indicates that an ID has been intentionally removed from identities.dat table.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java
index 347e2d35..c291c65b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationException.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ package org.onap.aaf.auth.org;
public class OrganizationException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
index 2ada75d2..867d2984 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,10 +36,10 @@ import org.onap.aaf.misc.env.impl.BasicEnv;
/**
* Organization Plugin Mechanism
- *
- * Define a NameSpace for the company (i.e. com.att), and put in Properties as
- * "Organization.[your NS" and assign the supporting Class.
- *
+ *
+ * Define a NameSpace for the company (i.e. com.att), and put in Properties as
+ * "Organization.[your NS" and assign the supporting Class.
+ *
* Example:
* Organization.com.att=org.onap.aaf.auth.org.test.att.ATT
*
@@ -53,7 +53,7 @@ public class OrganizationFactory {
public static Organization init(BasicEnv env) throws OrganizationException {
int idx = ORGANIZATION_DOT.length();
Organization org,firstOrg = null;
-
+
for (Entry<Object, Object> es : env.getProperties().entrySet()) {
String key = es.getKey().toString();
if (key.startsWith(ORGANIZATION_DOT)) {
@@ -117,8 +117,8 @@ public class OrganizationFactory {
org.addSupportedRealm(r);
}
}
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException |
- InstantiationException | IllegalAccessException | IllegalArgumentException |
+ } catch (ClassNotFoundException | NoSuchMethodException | SecurityException |
+ InstantiationException | IllegalAccessException | IllegalArgumentException |
InvocationTargetException e) {
env.error().log(e, "Error on Organization Construction");
throw new OrganizationException(e);
@@ -138,7 +138,7 @@ public class OrganizationFactory {
}
}
}
-
+
return org;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java
index 0e70e25e..bd718e46 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Acceptor.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,7 +29,7 @@ import org.onap.aaf.misc.env.Trans;
/**
* Find Acceptable Paths and place them where TypeCode can evaluate.
- *
+ *
* If there are more than one, TypeCode will choose based on "q" value
* @author Jonathan
*
@@ -38,12 +38,12 @@ import org.onap.aaf.misc.env.Trans;
class Acceptor<TRANS extends Trans> {
private List<Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>>> types;
List<Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>>> acceptable;
-
+
public Acceptor(List<Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>>> types) {
this.types = types;
acceptable = new ArrayList<>();
}
-
+
private boolean eval(HttpCode<TRANS,?> code, String str, List<String> props) {
// int plus = str.indexOf('+');
// if (plus<0) {
@@ -67,7 +67,7 @@ class Acceptor<TRANS extends Trans> {
// String nstr;
// while (prev!=0) {
// nstr = first + (plus<0?str.substring(prev):str.substring(prev,plus));
-//
+//
// for (Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> type : types) {
// if (type.x.equals(nstr)) {
// acceptable.add(type);
@@ -114,17 +114,17 @@ class Acceptor<TRANS extends Trans> {
}
/**
- * parse
- *
+ * parse
+ *
* Note: I'm processing by index to avoid lots of memory creation, which speeds things
- * up for this time critical section of code.
+ * up for this time critical section of code.
* @param code
* @param cntnt
* @return
*/
protected boolean parse(HttpCode<TRANS, ?> code, String cntnt) {
byte bytes[] = cntnt.getBytes();
-
+
int cis,cie=-1,cend;
int sis,sie,send;
String name;
@@ -133,17 +133,17 @@ class Acceptor<TRANS extends Trans> {
// Clear these in case more than one Semi
props.clear(); // on loop, do not want mixed properties
name=null;
-
+
cis = cie+1; // find comma start
while (cis<bytes.length && Character.isSpaceChar(bytes[cis]))++cis;
cie = cntnt.indexOf(',',cis); // find comma end
cend = cie<0?bytes.length:cie; // If no comma, set comma end to full length, else cie
while (cend>cis && Character.isSpaceChar(bytes[cend-1]))--cend;
// Start SEMIS
- sie=cis-1;
+ sie=cis-1;
do {
sis = sie+1; // semi start is one after previous end
- while (sis<bytes.length && Character.isSpaceChar(bytes[sis]))++sis;
+ while (sis<bytes.length && Character.isSpaceChar(bytes[sis]))++sis;
sie = cntnt.indexOf(';',sis);
send = sie>cend || sie<0?cend:sie; // if the Semicolon is after the comma, or non-existent, use comma end, else keep
while (send>sis && Character.isSpaceChar(bytes[send-1]))--send;
@@ -165,5 +165,5 @@ class Acceptor<TRANS extends Trans> {
} while (cie>=0); // loop to next comma
return false; // didn't get even one match
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java
index ac87d80e..3c76e928 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CachingFileAccess.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,15 +55,15 @@ import org.onap.aaf.misc.env.Store;
import org.onap.aaf.misc.env.Trans;
/*
* CachingFileAccess
- *
+ *
* Author: Jonathan Gathman, Gathsys 2010
- *
+ *
*/
public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void> {
public static void setEnv(Store store, String[] args) {
- for (int i=0;i<args.length-1;i+=2) { // cover two parms required for each
+ for (int i=0;i<args.length-1;i+=2) { // cover two parms required for each
if (CFA_WEB_PATH.equals(args[i])) {
- store.put(store.staticSlot(CFA_WEB_PATH), args[i+1]);
+ store.put(store.staticSlot(CFA_WEB_PATH), args[i+1]);
} else if (CFA_CACHE_CHECK_INTERVAL.equals(args[i])) {
store.put(store.staticSlot(CFA_CACHE_CHECK_INTERVAL), Long.parseLong(args[i+1]));
} else if (CFA_MAX_SIZE.equals(args[i])) {
@@ -71,7 +71,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
}
}
}
-
+
private static String MAX_AGE = "max-age=3600"; // 1 hour Caching
private final Map<String,String> typeMap;
private final NavigableMap<String,Content> content;
@@ -79,7 +79,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
public final static String CFA_WEB_PATH = "aaf_cfa_web_path";
// when to re-validate from file
// Re validating means comparing the Timestamp on the disk, and seeing it has changed. Cache is not marked
- // dirty unless file has changed, but it still makes File IO, which for some kinds of cached data, i.e.
+ // dirty unless file has changed, but it still makes File IO, which for some kinds of cached data, i.e.
// deployed GUI elements is unnecessary, and wastes time.
// This parameter exists to cover the cases where data can be more volatile, so the user can choose how often the
// File IO will be accessed, based on probability of change. "0", of course, means, check every time.
@@ -96,10 +96,10 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
private String web_path;
// A command key is set in the Properties, preferably changed on deployment.
// it is compared at the beginning of the path, and if so, it is assumed to issue certain commands
- // It's purpose is to protect, to some degree the command, even though it is HTTP, allowing
+ // It's purpose is to protect, to some degree the command, even though it is HTTP, allowing
// local batch files to, for instance, clear caches on resetting of files.
private String clear_command;
-
+
public CachingFileAccess(EnvJAXB env, String ... args) throws IOException {
super(null,"Caching File Access");
setEnv(env,args);
@@ -130,16 +130,16 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
typeMap.put("class", "application/java");
typeMap.put("props", "text/plain");
typeMap.put("jks", "application/octet-stream");
-
+
// Fonts
typeMap.put("ttf","font/ttf");
typeMap.put("woff","font/woff");
typeMap.put("woff2","font/woff2");
-
+
timer = new Timer("Caching Cleanup",true);
timer.schedule(new Cleanup(content,500),60000,60000);
-
+
// Property params
web_path = env.get(env.staticSlot(CFA_WEB_PATH));
env.init().log("CachingFileAccess path: " + new File(web_path).getCanonicalPath());
@@ -150,18 +150,18 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
} else {
checkInterval=Long.parseLong((String)obj);
}
-
+
obj = env.get(env.staticSlot(CFA_MAX_SIZE), 512000); // Default is max file 500k
if (obj instanceof Integer) {
maxItemSize=(Integer)obj;
} else {
maxItemSize =Integer.parseInt((String)obj);
}
-
+
clear_command = env.getProperty(CFA_CLEAR_COMMAND,null);
}
-
+
@Override
public void handle(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws IOException {
@@ -190,12 +190,12 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
public String webPath() {
return web_path;
}
-
+
/**
* Reset the Cleanup size and interval
- *
+ *
* The size and interval when started are 500 items (memory size unknown) checked every minute in a background thread.
- *
+ *
* @param size
* @param interval
*/
@@ -204,13 +204,13 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
timer = new Timer();
timer.schedule(new Cleanup(content,size), interval, interval);
}
-
-
+
+
/**
* Load a file, first checking cache
- *
- *
+ *
+ *
* @param logTarget - logTarget can be null (won't log)
* @param dataRoot - data root storage directory
* @param key - relative File Path
@@ -234,7 +234,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
isRoot = false;
}
Content c = content.get(key);
- long systime = System.currentTimeMillis();
+ long systime = System.currentTimeMillis();
File f=null;
if (c!=null) {
// Don't check every hit... only after certain time value
@@ -245,11 +245,11 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
}
}
}
- if (c==null) {
+ if (c==null) {
if (logTarget!=null) {
logTarget.log("File Read: ",key);
}
-
+
if (f==null){
f = new File(fileName);
}
@@ -266,7 +266,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
c = new CachedContent(f);
cacheMe = checkInterval>0;
}
-
+
if (mediaType==null) { // determine from file Ending
int idx = key.lastIndexOf('.');
String subkey = key.substring(++idx);
@@ -279,9 +279,9 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
c.contentType=mediaType;
c.attachmentOnly = false;
}
-
+
c.date = f.lastModified();
-
+
if (cacheMe) {
content.put(key, c);
}
@@ -297,14 +297,14 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
c.access = systime;
return c;
}
-
+
public void invalidate(String key) {
content.remove(key);
}
-
+
private static final Content NULL=new Content() {
-
+
@Override
public void setHeader(HttpServletResponse resp) {
resp.setStatus(404/*NOT_FOUND_404*/);
@@ -318,37 +318,37 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
@Override
public void write(OutputStream os) throws IOException {
}
-
+
};
private static abstract class Content {
private long date; // date of the actual artifact (i.e. File modified date)
private long access; // last accessed
-
+
protected String contentType;
protected boolean attachmentOnly;
-
+
public void setHeader(HttpServletResponse resp) {
resp.setStatus(200/*OK_200*/);
resp.setHeader("Content-Type",contentType);
resp.setHeader("Cache-Control", MAX_AGE);
}
-
+
public abstract void write(Writer writer) throws IOException;
public abstract void write(OutputStream os) throws IOException;
}
private static class DirectFileContent extends Content {
- private File file;
+ private File file;
public DirectFileContent(File f) {
file = f;
}
-
+
public String toString() {
return file.getName();
}
-
+
public void write(Writer writer) throws IOException {
FileReader fr = new FileReader(file);
char[] buff = new char[1024];
@@ -387,7 +387,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
public DirectoryContent(File directory, boolean isRoot) {
notRoot = !isRoot;
-
+
files = directory.listFiles();
Arrays.sort(files,new Comparator<File>() {
@Override
@@ -399,7 +399,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
// if numbers, are the numbers in the same start position
int i1 = m1.start();
int i2 = m2.start();
-
+
// If same start position and the text is the same, then reverse sort
if (i1==i2 && f1.getName().startsWith(f2.getName().substring(0,i1))) {
// reverse sort files that start similarly, but have numbers in them
@@ -408,14 +408,14 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
}
return f1.compareTo(f2);
}
-
+
});
name = directory.getName();
attachmentOnly = false;
contentType = "text/html";
}
-
-
+
+
@Override
public void write(Writer w) throws IOException {
w.append(H1);
@@ -435,19 +435,19 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
w.append(F);
w.flush();
}
-
+
@Override
public void write(OutputStream os) throws IOException {
write(new OutputStreamWriter(os));
}
-
+
}
private static class CachedContent extends Content {
private byte[] data;
private int end;
- private char[] cdata;
-
+ private char[] cdata;
+
public CachedContent(File f) throws IOException {
// Read and Cache
ByteBuffer bb = ByteBuffer.allocate((int)f.length());
@@ -462,11 +462,11 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
end = bb.position();
cdata=null;
}
-
+
public String toString() {
return Arrays.toString(data);
}
-
+
public void write(Writer writer) throws IOException {
synchronized(this) {
// do the String Transformation once, and only if actually used
@@ -495,24 +495,24 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
private static class Cleanup extends TimerTask {
private int maxSize;
private NavigableMap<String, Content> content;
-
+
public Cleanup(NavigableMap<String, Content> content, int size) {
maxSize = size;
this.content = content;
}
-
+
private class Comp implements Comparable<Comp> {
public Map.Entry<String, Content> entry;
-
+
public Comp(Map.Entry<String, Content> en) {
entry = en;
}
-
+
@Override
public int compareTo(Comp o) {
return (int)(entry.getValue().access-o.entry.getValue().access);
}
-
+
}
@SuppressWarnings("unchecked")
@Override
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java
index 1c171fd7..761fd8cc 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/CodeSetter.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,13 +39,13 @@ class CodeSetter<TRANS extends Trans> {
this.trans = trans;
this.req = req;
this.resp = resp;
-
+
}
public boolean matches(Route<TRANS> route) throws IOException, ServletException {
// Find best Code in Route based on "Accepts (Get) or Content-Type" (if exists)
return (code = route.getCode(trans, req, resp))!=null;
}
-
+
public HttpCode<TRANS,?> code() {
return code;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java
index 63a2eeaa..e9c8adb0 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Content.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,14 +29,14 @@ import org.onap.aaf.misc.env.Trans;
/**
* A Class to hold Service "ContentTypes", and to match incoming "Accept" types from HTTP.
- *
+ *
* This is a multi-use class built to use the same Parser for ContentTypes and Accept.
- *
+ *
* Thus, you would create and use "Content.Type" within your service, and use it to match
* Accept Strings. What is returned is an Integer (for faster processing), which can be
* used in a switch statement to act on match different Actions. The server should
* know which behaviors match.
- *
+ *
* "bestMatch" returns an integer for the best match, or -1 if no matches.
*
* @author Jonathan
@@ -49,16 +49,16 @@ public abstract class Content<TRANS extends Trans> {
/**
* Parse a Content-Type/Accept. As found, call "types" and "props", which do different
- * things depending on if it's a Content-Type or Accepts.
- *
+ * things depending on if it's a Content-Type or Accepts.
+ *
* For Content-Type, it builds a tree suitable for Comparison
* For Accepts, it compares against the tree, and builds an acceptable type list
- *
+ *
* Since this parse code is used for every incoming HTTP transaction, I have removed the implementation
* that uses String.split, and replaced with integers evaluating the Byte array. This results
- * in only the necessary strings created, resulting in 1/3 better speed, and less
+ * in only the necessary strings created, resulting in 1/3 better speed, and less
* Garbage collection.
- *
+ *
* @param trans
* @param code
* @param cntnt
@@ -111,5 +111,5 @@ public abstract class Content<TRANS extends Trans> {
} while (cie>=0);
return contType && contProp; // for use in finds, True if a type found AND all props matched
}
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java
index 0768145f..8c533f6e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpCode.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,13 +28,13 @@ import org.onap.aaf.misc.env.Trans;
/**
* HTTP Code element, which responds to the essential "handle Method".
- *
+ *
* Use Native HttpServletRe[quest|sponse] calls for questions like QueryParameters (getParameter, etc)
- *
+ *
* Use local "pathParam" method to obtain in an optimized manner the path parameter, which must be interpreted by originating string
- *
+ *
* i.e. my/path/:id/:other/*
- *
+ *
* @author Jonathan
*
* @param <TRANS>
@@ -45,14 +45,14 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
private String desc;
protected String [] roles;
private boolean all;
-
+
// Package by design... Set by Route when linked
Match match;
-
+
public HttpCode(CONTEXT context, String description, String ... roles) {
this.context = context;
desc = description;
-
+
// Evaluate for "*" once...
all = false;
for (String srole : roles) {
@@ -63,16 +63,16 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
}
this.roles = all?null:roles;
}
-
+
public abstract void handle(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws Exception;
-
+
public String desc() {
return desc;
}
-
+
/**
* Get the variable element out of the Path Parameter, as set by initial Code
- *
+ *
* @param req
* @param key
* @return
@@ -92,12 +92,12 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
}
// Note: get Query Params from Request
-
+
/**
* Check for Authorization when set.
- *
+ *
* If no Roles set, then accepts all users
- *
+ *
* @param req
* @return
*/
@@ -110,11 +110,11 @@ public abstract class HttpCode<TRANS extends Trans, CONTEXT> {
}
return false;
}
-
+
public boolean no_cache() {
return false;
}
-
+
public String toString() {
return desc;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java
index 3f7f93c7..2ea340e3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/HttpMethods.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java
index 599e45b2..8f47126f 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Match.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,9 +27,9 @@ import java.util.Set;
/**
* This path matching algorithm avoids using split strings during the critical transactional run-time. By pre-analyzing the
- * content at "set Param" time, and storing data in an array-index model which presumably is done once and at the beginning,
+ * content at "set Param" time, and storing data in an array-index model which presumably is done once and at the beginning,
* we can match in much less time when it actually counts.
- *
+ *
* @author Jonathan
*
*/
@@ -39,14 +39,14 @@ public class Match {
private Integer vars[];
private boolean wildcard;
-
+
/*
* These two methods are pairs of searching performance for variables Spark Style.
* setParams evaluates the target path, and sets a HashMap that will return an Integer.
* the Keys are both :key and key so that there will be no string operations during
* a transaction
- *
- * For the Integer, if the High Order is 0, then it is just one value. If High Order >0, then it is
+ *
+ * For the Integer, if the High Order is 0, then it is just one value. If High Order >0, then it is
* a multi-field option, i.e. ending with a wild-card.
*/
public Match(String path) {
@@ -56,7 +56,7 @@ public class Match {
String[] pa = path.split("/");
values = new byte[pa.length][];
vars = new Integer[pa.length];
-
+
int val = 0;
String key;
for (int i=0;i<pa.length && !wildcard;++i) {
@@ -69,7 +69,7 @@ public class Match {
val = i;
key = pa[i];
}
- params.put(key,val); //put in :key
+ params.put(key,val); //put in :key
params.put(key.substring(1,key.length()), val); // put in just key, better than adding a missing one, like Spark
// values[i]=null; // null stands for Variable
vars[i]=val;
@@ -96,14 +96,14 @@ public class Match {
/*
* This is the second of the param evaluation functions. First, we look up to see if there is
* any reference by key in the params Map created by the above.
- *
+ *
* The resulting Integer, if not null, is split high/low order into start and end.
* We evaluate the string for '/', rather than splitting into String[] to avoid the time/mem needed
- * We traverse to the proper field number for slash, evaluate the end (whether wild card or no),
- * and return the substring.
- *
+ * We traverse to the proper field number for slash, evaluate the end (whether wild card or no),
+ * and return the substring.
+ *
* The result is something less than .003 milliseconds per evaluation
- *
+ *
*/
public String param(String path,String key) {
Integer val = params.get(key); // :key or key
@@ -116,7 +116,7 @@ public class Match {
idx = path.indexOf('/',idx+1);
if (idx<0)break;
}
- if (i==start) {
+ if (i==start) {
++idx;
if (end==0) {
end = path.indexOf('/',idx);
@@ -131,7 +131,7 @@ public class Match {
}
return null;
}
-
+
public boolean match(String path) {
if (path==null|| path.length()==0 || "/".equals(path) ) {
if (values==null)return true;
@@ -140,7 +140,7 @@ public class Match {
case 1: return values[0].length==0;
default: return false;
}
- }
+ }
boolean rv = true;
byte[] pabytes = path.getBytes();
int field=0;
@@ -169,7 +169,7 @@ public class Match {
++j;
}
}
-
+
if (k==lastByte && pabytes[k-1]!='/')++field;
if (k>i)i=k-1; // if we've incremented, have to accommodate the outer for loop incrementing as well
fieldMatched = false; // reset
@@ -183,10 +183,10 @@ public class Match {
}
rv = fieldMatched && ++field<lastField;
// reset
- fieldMatched = false;
+ fieldMatched = false;
fieldIdx = 0;
} else if (values[field].length==0) {
- // double slash in path, but content in field. We check specially here to avoid
+ // double slash in path, but content in field. We check specially here to avoid
// Array out of bounds issues.
rv = false;
} else {
@@ -204,7 +204,7 @@ public class Match {
if (field!=lastField || pabytes.length!=lastByte) rv = false; // have we matched all the fields and all the bytes?
return rv;
}
-
+
public Set<String> getParamNames() {
return params.keySet();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java
index f4d1394b..54b2e59e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Pair.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,8 +22,8 @@
package org.onap.aaf.auth.rserv;
/**
- * A pair of generic Objects.
- *
+ * A pair of generic Objects.
+ *
* @author Jonathan
*
* @param <X>
@@ -32,12 +32,12 @@ package org.onap.aaf.auth.rserv;
public class Pair<X,Y> {
public X x;
public Y y;
-
+
public Pair(X x, Y y) {
this.x = x;
this.y = y;
}
-
+
public String toString() {
return "X: " + x.toString() + "-->" + y.toString();
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java
index 9dec87db..7f94acba 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RServlet.java
@@ -7,9 +7,9 @@
* 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.
@@ -59,19 +59,19 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
r.add(code,moreTypes);
env.init().log(r.report(code),code);
}
-
+
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest)req;
HttpServletResponse response = (HttpServletResponse)res;
-
+
@SuppressWarnings("unchecked")
TRANS trans = (TRANS)req.getAttribute(TransFilter.TRANS_TAG);
if (trans==null) {
response.setStatus(404); // Not Found, because it didn't go through TransFilter
return;
}
-
+
Route<TRANS> route;
HttpCode<TRANS,?> code=null;
String ct = req.getContentType();
@@ -93,7 +93,7 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
} finally {
tt.done();
}
-
+
if (route!=null && code!=null) {
StringBuilder sb = new StringBuilder(72);
sb.append(route.auditText);
@@ -119,7 +119,7 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
}
}
}
-
+
@Override
public String getServletInfo() {
return "RServlet for Jetty";
@@ -127,9 +127,9 @@ public abstract class RServlet<TRANS extends Trans> implements Servlet {
/**
* Allow Service to instantiate certain actions after service starts up
- * @throws LocatorException
- * @throws CadiException
- * @throws APIException
+ * @throws LocatorException
+ * @throws CadiException
+ * @throws APIException
*/
public void postStartup(String hostname, int port) throws APIException {
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java
index 46a3a955..a3282849 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,12 +36,12 @@ public class Route<TRANS extends Trans> {
public final String auditText;
public final HttpMethods meth;
public final String path;
-
+
private Match match;
// package on purpose
private final TypedCode<TRANS> content;
private final boolean isContentType;
-
+
public Route(HttpMethods meth, String path) {
this.path = path;
auditText = meth.name() + ' ' + path;
@@ -50,12 +50,12 @@ public class Route<TRANS extends Trans> {
match = new Match(path);
content = new TypedCode<TRANS>();
}
-
+
public void add(HttpCode<TRANS,?> code, String ... others) {
code.match = match;
content.add(code, others);
}
-
+
public HttpCode<TRANS,?> getCode(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
// Type is associated with Accept for GET (since it is what is being returned
// We associate the rest with ContentType.
@@ -82,11 +82,11 @@ public class Route<TRANS extends Trans> {
}
return null;
}
-
+
public Route<TRANS> matches(String method, String path) {
return meth.name().equalsIgnoreCase(method) && match.match(path)?this:null;
}
-
+
public TimeTaken start(Trans trans, String auditText, HttpCode<TRANS,?> code, String type) {
StringBuilder sb = new StringBuilder(auditText);
sb.append(", ");
@@ -100,9 +100,9 @@ public class Route<TRANS extends Trans> {
boolean resolvesTo(HttpMethods hm, String p) {
return(path.equals(p) && hm.equals(meth));
}
-
+
public String toString() {
- return auditText + ' ' + content;
+ return auditText + ' ' + content;
}
public String report(HttpCode<TRANS, ?> code) {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java
index cb7c48bc..4e4cdb5b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/RouteReport.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java
index ed6326a8..3afe223f 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Routes.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,14 +35,14 @@ public class Routes<TRANS extends Trans> {
// Since this must be very, very fast, and only needs one creation, we'll use just an array.
private Route<TRANS>[] routes;
private int end;
-
+
@SuppressWarnings("unchecked")
public Routes() {
routes = new Route[10];
end = 0;
}
-
+
// This method for setup of Routes only...
// Package on purpose
synchronized Route<TRANS> findOrCreate(HttpMethods meth, String path) {
@@ -50,7 +50,7 @@ public class Routes<TRANS extends Trans> {
for (int i=0;i<end;++i) {
if (routes[i].resolvesTo(meth,path))rv = routes[i];
}
-
+
if (rv==null) {
if (end>=routes.length) {
@SuppressWarnings("unchecked")
@@ -58,12 +58,12 @@ public class Routes<TRANS extends Trans> {
System.arraycopy(routes, 0, temp, 0, routes.length);
routes = temp;
}
-
+
routes[end++]=rv=new Route<TRANS>(meth,path);
}
return rv;
}
-
+
public Route<TRANS> derive(HttpServletRequest req, CodeSetter<TRANS> codeSetter) throws IOException, ServletException {
Route<TRANS> rv = null;
String path = req.getPathInfo();
@@ -71,13 +71,13 @@ public class Routes<TRANS extends Trans> {
//TODO a TREE would be better
for (int i=0;rv==null && i<end; ++i) {
rv = routes[i].matches(meth,path);
- if (rv!=null && !codeSetter.matches(rv)) { // potential match, check if has Code
+ if (rv!=null && !codeSetter.matches(rv)) { // potential match, check if has Code
rv = null; // not quite, keep going
}
}
return rv;
}
-
+
public List<RouteReport> routeReport() {
ArrayList<RouteReport> ltr = new ArrayList<>();
for (int i=0;i<end;++i) {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
index 2acfbe34..5b856935 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransFilter.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,22 +52,22 @@ import org.onap.aaf.misc.env.util.Split;
/**
* Create a new Transaction Object for each and every incoming Transaction
- *
+ *
* Attach to Request. User "FilterHolder" mechanism to retain single instance.
- *
+ *
* TransFilter includes CADIFilter as part of the package, so that it can
* set User Data, etc, as necessary.
- *
+ *
* @author Jonathan
*
*/
public abstract class TransFilter<TRANS extends TransStore> implements Filter {
public static final String TRANS_TAG = "__TRANS__";
-
+
private CadiHTTPManip cadi;
private final String[] no_authn;
-
+
public TransFilter(Access access, Connector con, TrustChecker tc, Object ... additionalTafLurs) throws CadiException, LocatorException {
cadi = new CadiHTTPManip(access, con, tc, additionalTafLurs);
String no = access.getProperty(Config.CADI_NOAUTHN, null);
@@ -81,7 +81,7 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
-
+
protected Lur getLur() {
return cadi.getLur();
}
@@ -90,19 +90,19 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
protected abstract TimeTaken start(TRANS trans);
protected abstract void authenticated(TRANS trans, Principal p);
protected abstract void tallyHo(TRANS trans, String target);
-
+
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest)request;
HttpServletResponse res = (HttpServletResponse)response;
-
+
TRANS trans = newTrans(req,res);
-
+
TimeTaken overall = start(trans);
String target = "n/a";
try {
request.setAttribute(TRANS_TAG, trans);
-
+
if (no_authn!=null) {
for (String prefix : no_authn) {
if (req.getPathInfo().startsWith(prefix)) {
@@ -133,7 +133,7 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
} finally {
security.done();
}
-
+
if (r==RESP.IS_AUTHENTICATED) {
trans.checkpoint(resp.desc());
if (cadi.notCadi(cw, res)) {
@@ -141,7 +141,7 @@ public abstract class TransFilter<TRANS extends TransStore> implements Filter {
}
} else {
//TODO this is a good place to check if too many checks recently
- // Would need Cached Counter objects that are cleaned up on
+ // Would need Cached Counter objects that are cleaned up on
// use
trans.checkpoint(resp.desc(),Env.ALWAYS);
if (resp.isFailedAttempt()) {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java
index ef91e485..0cf4b83e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TransOnlyFilter.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,12 +38,12 @@ import org.onap.aaf.misc.env.TransStore;
/**
* Create a new Transaction Object for each and every incoming Transaction
- *
+ *
* Attach to Request. User "FilterHolder" mechanism to retain single instance.
- *
+ *
* TransFilter includes CADIFilter as part of the package, so that it can
* set User Data, etc, as necessary.
- *
+ *
* @author Jonathan
*
*/
@@ -51,14 +51,14 @@ public abstract class TransOnlyFilter<TRANS extends TransStore> implements Filte
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
-
+
protected abstract TRANS newTrans(HttpServletRequest req, HttpServletResponse resp);
protected abstract TimeTaken start(TRANS trans);
protected abstract void authenticated(TRANS trans, TaggedPrincipal p);
protected abstract void tallyHo(TRANS trans);
-
+
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
TRANS trans = newTrans((HttpServletRequest)request,(HttpServletResponse)response);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java
index 6f1372f3..c292fae3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,17 +40,17 @@ import org.onap.aaf.misc.env.Trans;
* FYI: For those in the future wondering why I would create a specialized set of "Pair" for the data content:
* 1) TypeCode is used in Route, and this code is used for every transaction... it needs to be blazingly fast
* 2) The actual number of objects accessed is quite small and built at startup. Arrays are best
- * 3) I needed a small, well defined tree where each level is a different Type. Using a "Pair" Generic definitions,
+ * 3) I needed a small, well defined tree where each level is a different Type. Using a "Pair" Generic definitions,
* I created type-safety at each level, which you can't get from a TreeSet, etc.
* 4) Chaining through the Network is simply object dereferencing, which is as fast as Java can go.
* 5) The drawback is that in your code is that all the variables are named "x" and "y", which can be a bit hard to
- * read both in code, and in the debugger. However, TypeSafety allows your IDE (Eclipse) to help you make the
+ * read both in code, and in the debugger. However, TypeSafety allows your IDE (Eclipse) to help you make the
* choices. Also, make sure you have a good "toString()" method on each object so you can see what's happening
* in the IDE Debugger.
- *
+ *
* Empirically, this method of obtaining routes proved to be much faster than the HashSet implementations available in otherwise
* competent Open Source.
- *
+ *
* @author Jonathan
*
* @param <TRANS>
@@ -61,10 +61,10 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
public TypedCode() {
types = new ArrayList<>();
}
-
+
/**
* Construct Typed Code based on ContentType parameters passed in
- *
+ *
* @param code
* @param others
* @return
@@ -74,17 +74,17 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
boolean first = true;
for (String str : others) {
if (first) {
- first = false;
+ first = false;
} else {
sb.append(',');
}
sb.append(str);
}
parse(code, sb.toString());
-
+
return this;
}
-
+
@Override
protected Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> types(HttpCode<TRANS,?> code, String str) {
Pair<String, Pair<HttpCode<TRANS,?>,List<Pair<String, Object>>>> type = null;
@@ -127,7 +127,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return type.y.y.add(new Pair<String,Object>(tag,"version".equals(tag)?new Version(value):value));
}
-
+
public Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> prep(TRANS trans, String compare){
Pair<String, Pair<HttpCode<TRANS,?>, List<Pair<String, Object>>>> c,rv=null;
if (types.size()==1 && "".equals((c=types.get(0)).x)) { // if there are no checks for type, skip
@@ -146,11 +146,11 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
if (accepted) {
switch(acc.acceptable.size()) {
- case 0:
+ case 0:
// // TODO best Status Code?
// resp.setStatus(HttpStatus.NOT_ACCEPTABLE_406);
break;
- case 1:
+ case 1:
rv = acc.acceptable.get(0);
break;
default: // compare Q values to get Best Match
@@ -177,14 +177,14 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return rv;
}
-
+
/**
* Print on String Builder content related to specific Code
- *
+ *
* This is for Reporting and Debugging purposes, so the content is not cached.
- *
+ *
* If code is "null", then all content is matched
- *
+ *
* @param code
* @return
*/
@@ -211,7 +211,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return sb;
}
-
+
public List<Pair<String, Object>> getContent(HttpCode<TRANS,?> code) {
for (Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> pair : types) {
if (pair.y.x == code) {
@@ -220,17 +220,17 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return null;
}
-
+
public String toString() {
return relatedTo(null,new StringBuilder()).toString();
}
-
+
public void api(RouteReport tr) {
// Need to build up a map, because Prop entries can be in several places.
HashMap<HttpCode<?,?>,StringBuilder> psb = new HashMap<>();
StringBuilder temp;
tr.desc = null;
-
+
// Read through Code/TypeCode trees for all accepted Typecodes
for (Pair<String, Pair<HttpCode<TRANS, ?>, List<Pair<String, Object>>>> tc : types) {
// If new, then it's new Code set, create prefix content
@@ -253,7 +253,7 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
}
// Gather all ContentType possibilities for the same code together
-
+
for (StringBuilder sb : psb.values()) {
tr.contextTypes.add(sb.toString());
}
@@ -265,5 +265,5 @@ public class TypedCode<TRANS extends Trans> extends Content<TRANS> {
}
return null;
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java
index adf05380..37c26fc5 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Version.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ package org.onap.aaf.auth.rserv;
/**
* Analyze and hold Version information for Code
- *
+ *
* @author Jonathan
*
*/
@@ -67,8 +67,8 @@ public class Version {
}
return false;
}
-
-
+
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java
index 684976b9..ab766a6c 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/doc/ApiDoc.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,5 +36,5 @@ public @interface ApiDoc {
String[] text();
/** Format with name|type|[true|false] */
String[] params();
-
+
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
index 4fb81d73..31131314 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsService.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,7 +55,7 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
public final String app_name;
public final String app_version;
public final String ROOT_NS;
-
+
public AbsService(final Access access, final ENV env) throws CadiException {
Define.set(access);
ROOT_NS = Define.ROOT_NS();
@@ -70,14 +70,14 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
str = ROOT_NS + '.' + scomp[0];
}
app_name = str;
-
+
str = access.getProperty(Config.AAF_LOCATOR_VERSION, null);
if(str==null) {
str = Defaults.AAF_VERSION;
env.setProperty(Config.AAF_LOCATOR_VERSION, str);
}
app_version = access.getProperty(Config.AAF_DEPLOYED_VERSION, str);
-
+
// Print Cipher Suites Available
if (access.willLog(Level.DEBUG)) {
SSLContext context;
@@ -99,7 +99,7 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
access.log(Level.DEBUG,sb);
}
}
-
+
public void setProtocol(String proto) {
env.setProperty(Config.AAF_LOCATOR_PROTOCOL, proto);
}
@@ -107,12 +107,12 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
public void setSubprotocol(String subproto) {
env.setProperty(Config.AAF_LOCATOR_SUBPROTOCOL, subproto);
}
-
+
protected abstract Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException;
-
+
/**
* Overload this method to add new TAF or LURs
- *
+ *
* @return
* @throws CadiException
* @throws LocatorException
@@ -134,11 +134,11 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
}
return aafCon;
}
-
+
/**
* Allow to be over ridden for special cases
* @return
- * @throws LocatorException
+ * @throws LocatorException
*/
protected synchronized AAFConHttp _newAAFConHttp() throws CadiException, LocatorException {
if (aafCon==null) {
@@ -147,12 +147,12 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
return aafCon;
}
-
+
// This is a method, so we can overload for AAFAPI
public String aaf_url() {
return access.getProperty(Config.AAF_URL, null);
}
-
+
public Rcli<?> client() throws CadiException {
return aafCon.client();
}
@@ -165,7 +165,7 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
public<RET> RET clientAsUser(TaggedPrincipal p,Retryable<RET> retryable) throws APIException, LocatorException, CadiException {
return aafCon.hman().best(new HTransferSS(p,app_name, aafCon.securityInfo()), retryable);
}
-
+
protected static final String loadFromArgOrSystem(final Properties props, final String tag, final String args[], final String def) {
String tagEQ = tag + '=';
String value;
@@ -177,11 +177,11 @@ public abstract class AbsService<ENV extends BasicEnv, TRANS extends Trans> exte
}
// check System.properties
value = System.getProperty(tag);
- if (value!=null) {
+ if (value!=null) {
props.put(tag, value);
return value;
}
-
+
if (def!=null) {
props.put(tag,def);
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
index 90f4158f..f09a4ff3 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
@@ -7,9 +7,9 @@
* 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.
@@ -68,15 +68,15 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
}
_propertyAdjustment();
}
-
-
+
+
protected abstract void _start(RServlet<TRANS> rserv) throws Exception;
protected abstract void _propertyAdjustment();
-
+
public ENV env() {
return service.env;
}
-
+
public Access access() {
return service.access;
}
@@ -86,8 +86,8 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
ExecutorService es = Executors.newSingleThreadExecutor();
Future<?> app = es.submit(this);
final AbsServiceStarter<?,?> absSS = this;
- // Docker/K8 may separately create startup Status in this dir for startup
- // sequencing. If so, delete ON EXIT
+ // Docker/K8 may separately create startup Status in this dir for startup
+ // sequencing. If so, delete ON EXIT
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
@@ -109,7 +109,7 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
}
}
}
-
+
@SafeVarargs
public final synchronized void register(final Registrant<ENV> ... registrants) {
if (do_register) {
@@ -137,7 +137,7 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
if (registrar!=null) {
registrar.close(env());
registrar=null;
- }
+ }
if (service!=null) {
File status = new File("/opt/app/aaf/status/");
boolean deleted = false;
@@ -147,7 +147,7 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
if(lastdot<0) {
fname = service.app_name + '-' + hostname;
} else {
- fname = service.app_name.substring(lastdot).replace('.', '-')
+ fname = service.app_name.substring(lastdot).replace('.', '-')
+ '-' + hostname;
}
status = new File(status, fname);
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
index 78a7702b..3f0d2ebb 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
@@ -7,9 +7,9 @@
* 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.
@@ -58,7 +58,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
public JettyServiceStarter(final AbsService<ENV,TRANS> service, boolean secure) throws OrganizationException {
super(service, secure);
}
-
+
@Override
public void _propertyAdjustment() {
// System.setProperty("com.sun.management.jmxremote.port", "8081");
@@ -72,7 +72,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
props.put(Config.CADI_PROTOCOLS, httpproto);
}
}
-
+
if ("1.7".equals(System.getProperty("java.specification.version")) && (httpproto==null || (httpproto instanceof String && ((String)httpproto).contains("TLSv1.2")))) {
System.setProperty(Config.HTTPS_CIPHER_SUITES, Config.HTTPS_CIPHER_SUITES_DEFAULT);
}
@@ -84,7 +84,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
final String keystore = access().getProperty(Config.CADI_KEYSTORE, null);
final int IDLE_TIMEOUT = Integer.parseInt(access().getProperty(Config.AAF_CONN_IDLE_TIMEOUT, Config.AAF_CONN_IDLE_TIMEOUT_DEF));
Server server = new Server();
-
+
ServerConnector conn;
String protocol;
if (!secure || keystore==null) {
@@ -92,7 +92,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
protocol = "http";
} else {
protocol = "https";
-
+
String keystorePassword = access().getProperty(Config.CADI_KEYSTORE_PASSWORD, null);
if (keystorePassword==null) {
@@ -104,7 +104,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
sslContextFactory.setKeyStorePassword(temp=access().decrypt(keystorePassword, true)); // don't allow unencrypted
sslContextFactory.setKeyManagerPassword(temp);
temp=null; // don't leave lying around
-
+
String truststore = access().getProperty(Config.CADI_TRUSTSTORE, null);
if (truststore!=null) {
String truststorePassword = access().getProperty(Config.CADI_TRUSTSTORE_PASSWORD, null);
@@ -112,17 +112,17 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
throw new CadiException("No Truststore Password configured for " + truststore);
}
sslContextFactory.setTrustStorePath(truststore);
- sslContextFactory.setTrustStorePassword(access().decrypt(truststorePassword, false));
+ sslContextFactory.setTrustStorePassword(access().decrypt(truststorePassword, false));
}
// Be able to accept only certain protocols, i.e. TLSv1.1+
String subprotocols = access().getProperty(Config.CADI_PROTOCOLS, Config.HTTPS_PROTOCOLS_DEFAULT);
service.setSubprotocol(subprotocols);
final String[] protocols = Split.splitTrim(',', subprotocols);
sslContextFactory.setIncludeProtocols(protocols);
-
+
// Want to use Client Certificates, if they exist.
sslContextFactory.setWantClientAuth(true);
-
+
// Optional future checks.
// sslContextFactory.setValidateCerts(true);
// sslContextFactory.setValidatePeerCerts(true);
@@ -132,13 +132,13 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
if (certAlias!=null) {
sslContextFactory.setCertAlias(certAlias);
}
-
+
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSecureScheme(protocol);
httpConfig.setSecurePort(port);
httpConfig.addCustomizer(new SecureRequestCustomizer());
// httpConfig.setOutputBufferSize(32768); Not sure why take this setting
-
+
conn = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpConfig)
@@ -146,22 +146,22 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
}
service.setProtocol(protocol);
-
- // Setup JMX
+
+ // Setup JMX
// TODO trying to figure out how to set up/log ports
// MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
// MBeanContainer mbContainer=new MBeanContainer(mbeanServer);
// server.addEventListener(mbContainer);
// server.addBean(mbContainer);
-
+
// Add loggers MBean to server (will be picked up by MBeanContainer above)
// server.addBean(Log.getLog());
-
+
conn.setHost(hostname);
conn.setPort(port);
conn.setIdleTimeout(IDLE_TIMEOUT);
server.addConnector(conn);
-
+
server.setHandler(new AbstractHandler() {
private FilterChain fc = buildFilterChain(service,new FilterChain() {
@Override
@@ -169,7 +169,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
rserv.service(req, resp);
}
});
-
+
@Override
public void handle(String target, Request baseRequest, HttpServletRequest hreq, HttpServletResponse hresp) throws IOException, ServletException {
try {
@@ -182,7 +182,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
}
}
);
-
+
try {
access().printf(Level.INIT, "Starting service on %s:%d (%s)",hostname,port,InetAddress.getByName(hostname).getHostAddress());
server.start();
@@ -204,7 +204,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
access().printf(Level.INIT,"'aaf_no_register' is set. %s will not be registered with Locator", service.app_name);
}
access().printf(Level.INIT, "Starting Jetty Service for %s, version %s, on %s://%s:%d", service.app_name,service.app_version,protocol,hostname,port);
-
+
rserv.postStartup(hostname, port);
} catch (Exception e) {
access().log(e,"Error registering " + service.app_name);
@@ -225,15 +225,15 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
}
return fc;
}
-
+
private class FCImpl implements FilterChain {
private Filter f;
private FilterChain next;
-
+
public FCImpl(final Filter f, final FilterChain fc) {
this.f=f;
next = fc;
-
+
}
@Override
public void doFilter(ServletRequest req, ServletResponse resp) throws IOException, ServletException {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
index 894f571d..aa7d14cc 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,7 +35,7 @@ import org.onap.aaf.misc.env.util.Chrono;
public class Log4JLogIt implements LogIt {
protected static final String AAF_LOG4J_PREFIX = "aaf_log4j_prefix";
// Log4j does it's own date. Can't apparently turn it off.
-
+
private final String service;
private final String audit;
private final String init;
@@ -74,13 +74,13 @@ public class Log4JLogIt implements LogIt {
laudit = Logger.getLogger(audit);
linit = Logger.getLogger(init);
ltrace = Logger.getLogger(trace);
-
+
lfn.configure(etc_dir,propsFile, log_level);
} catch (IOException e) {
throw new APIException(e);
}
}
-
+
private static final String getArgOrVM(final String tag, final String args[], final String def) {
String tagEQ = tag + '=';
String value;
@@ -91,10 +91,10 @@ public class Log4JLogIt implements LogIt {
}
// check System.properties
value = System.getProperty(tag);
- if (value!=null) {
+ if (value!=null) {
return value;
}
-
+
return def;
}
@@ -127,7 +127,7 @@ public class Log4JLogIt implements LogIt {
default:
lservice.info(PropAccess.buildMsg(service, Chrono.utcFmt, level, elements));
break;
-
+
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java
index 9004f76b..17aeafa1 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/ServiceStarter.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
index 052f21bf..fcbccb12 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java
@@ -7,9 +7,9 @@
* 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.
@@ -64,7 +64,7 @@ public class Validator {
actionChars = ACTION_CHARS;
instChars = INST_CHARS;
}
-
+
public final String errs() {
return msgs.toString();
}
@@ -96,7 +96,7 @@ public class Validator {
}
protected final boolean nob(String str, Pattern p) {
- return str==null || !p.matcher(str).matches();
+ return str==null || !p.matcher(str).matches();
}
protected final void msg(String ... strs) {
@@ -164,7 +164,7 @@ public class Validator {
}
return this;
}
-
+
public final Validator permType(String type, String ns) {
if (type==null) {
msg("Perm Type is null");
@@ -227,7 +227,7 @@ public class Validator {
return this;
} else if (nob(ns,NAME_CHARS)) {
msg("NS [" + ns + "] is invalid.");
- }
+ }
for (String s : nsKeywords) {
if (ns.endsWith(s)) {
msg("NS [" + ns + "] may not be named with NS keywords");
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/common/test/JU_Define.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/common/test/JU_Define.java
index a94d82da..f572af35 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/common/test/JU_Define.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/common/test/JU_Define.java
@@ -50,7 +50,7 @@ public class JU_Define {
public void setUp() throws CadiException{
acc = mock(Access.class);
}
-
+
@Test
public void testSet() throws CadiException {
PropAccess prop = new PropAccess();
@@ -60,7 +60,7 @@ public class JU_Define {
Define.set(prop);
Define.ROOT_NS();
Define.ROOT_COMPANY();
-
+
PropAccess prop1 = new PropAccess();
prop1.setProperty(AAF_NS_DOT, AAF_NS_DOT);
prop1.setProperty(Config.AAF_ROOT_NS, ".ns_Test");
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java
index 817ec984..80d85fce 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java
@@ -146,7 +146,7 @@ public class JU_AuthzEnv {
@Test
public void testLog1() {
-
+
Exception e = new Exception();
Object msgs = null;
authzEnv.log(e, msgs);
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransFilter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransFilter.java
index ddb2d8c1..7ed2ba69 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransFilter.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransFilter.java
@@ -7,9 +7,9 @@
* * 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.
@@ -55,7 +55,7 @@ public class JU_AuthzTransFilter {
@Mock private TrustChecker tcMock;
@Mock private AuthzTrans authzTransMock;
@Mock private Object additionalTafLurs;
-
+
private PropAccess access;
@Before
@@ -66,7 +66,7 @@ public class JU_AuthzTransFilter {
when(envMock.access()).thenReturn(access);
}
-
+
// TODO: These tests only work on the AT&T network. Fix them - Ian
@Test
public void testAuthenticated() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, CadiException {
@@ -80,7 +80,7 @@ public class JU_AuthzTransFilter {
// authenticatedMethod.setAccessible(true);
// authenticatedMethod.invoke(aTF, authzTransMock, null);
}
-
+
@Test
public void testTallyHo() throws CadiException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
// Slot specialLogSlot = authzEnvMock.slot("SPECIAL_LOG_SLOT");
@@ -107,5 +107,5 @@ public class JU_AuthzTransFilter {
// when(authzTransMock.getUserPrincipal()).thenReturn(tPrin);
// tallyHoMethod.invoke(aTF, authzTransMock);
}
-
+
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransImpl.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransImpl.java
index af92e372..0c697bea 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransImpl.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzTransImpl.java
@@ -7,9 +7,9 @@
* * 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.
@@ -55,13 +55,13 @@ public class JU_AuthzTransImpl {
@Mock
AuthzEnv authzEnvMock;
AuthzTransImpl trans1;
-
+
private Organization org=null;
private AuthzTransImpl mockAuthzTransImpl;
private static HttpServletRequest req;
private static HttpServletResponse res;
private Lur lur1 = mock(Lur.class);
-
+
@Before
public void setUp(){
authzTransImpl = new AuthzTransImpl(authzEnvMock);
@@ -71,9 +71,9 @@ public class JU_AuthzTransImpl {
when(req.getParameter("request")).thenReturn("NotNull");
authzTransImpl.set(req,res);
when(req.getParameter("request")).thenReturn("");
- authzTransImpl.set(req,res);
+ authzTransImpl.set(req,res);
}
-
+
@Test
public void testOrg() {
Organization result=null;
@@ -82,15 +82,15 @@ public class JU_AuthzTransImpl {
//result = OrganizationFactory.obtain(authzTransImpl.env(), authzTransImpl.user());
authzTransImpl.org();
//when(test).thenReturn(null);
- //assertTrue(true);
+ //assertTrue(true);
}
-
+
@Mock
LogTarget logTargetMock;
-
+
@Test
public void testLogAuditTrail(){
-
+
when(logTargetMock.isLoggable()).thenReturn(false);
authzTransImpl.logAuditTrail(logTargetMock);
when(logTargetMock.isLoggable()).thenReturn(true);
@@ -98,7 +98,7 @@ public class JU_AuthzTransImpl {
//when(logTargetMock.isLoggable()).thenReturn(true);//TODO: Figure this out
//authzTransImpl.logAuditTrail(logTargetMock);
}
-
+
// @Test //TODO:Fix this AAF-111
// public void testSetUser() {
// Principal user = mock(Principal.class);
@@ -107,7 +107,7 @@ public class JU_AuthzTransImpl {
// String username = user1.getName();
// Assert.assertNotNull(user1);
// }
-
+
// @Test //TODO:Fix this AAF-111
// public void testUser() {
// Assert.assertEquals("n/a", authzTransImpl.user());
@@ -117,7 +117,7 @@ public class JU_AuthzTransImpl {
// authzTransImpl.setUser(user);
// Assert.assertEquals("name", authzTransImpl.user());
// }
-//
+//
@Test
public void testRequested() {
REQD_TYPE user = REQD_TYPE.move;
@@ -134,10 +134,10 @@ public class JU_AuthzTransImpl {
when(req.getParameter(user1.name())).thenReturn("test");
authzTransImpl.requested(user,false);
*/
-
-
+
+
}
-
+
@Test
public void testFish() {
mockAuthzTransImpl = mock(AuthzTransImpl.class);
@@ -149,7 +149,7 @@ public class JU_AuthzTransImpl {
authzTransImpl.setLur(lur1);
authzTransImpl.fish(p);
}
-
+
@Test
public void testSetVariables() { //TODO: refactor this better
Assert.assertNull(authzTransImpl.agent());
@@ -160,12 +160,12 @@ public class JU_AuthzTransImpl {
Assert.assertNull(authzTransImpl.getUserPrincipal());
Assert.assertNotNull(authzTransImpl.user());
}
-
+
@Test
public void testNow() {
Date date = authzTransImpl.now();
Assert.assertEquals(date,authzTransImpl.now());
when(authzTransImpl.now()).thenReturn(null);
}
-
+
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_NullTrans.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_NullTrans.java
index 9c7212c2..142317d1 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_NullTrans.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_NullTrans.java
@@ -7,9 +7,9 @@
* * 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.
@@ -48,65 +48,65 @@ import org.onap.aaf.misc.env.TimeTaken;
@RunWith(MockitoJUnitRunner.class)
public class JU_NullTrans {
NullTrans nullTrans;
-
+
@Before
public void setUp(){
nullTrans = new NullTrans();
}
-
+
@Test
public void testAuditTrail() {
Assert.assertNull(nullTrans.auditTrail(0, null, 0));
}
-
+
@Test
public void testSingleton() {
AuthzTrans single = nullTrans.singleton();
Assert.assertTrue(single instanceof AuthzTrans);
}
-
+
@Test
public void testCheckpoints() {
nullTrans.checkpoint("Test");
nullTrans.checkpoint(null, 0);
}
-
+
@Test
public void testFatal() {
LogTarget log = nullTrans.fatal();
Assert.assertEquals(LogTarget.NULL, log);
}
-
+
@Test
public void testError() {
LogTarget log = nullTrans.error();
Assert.assertEquals(LogTarget.NULL, log);
}
-
+
@Test
public void testAudit() {
LogTarget log = nullTrans.audit();
Assert.assertEquals(LogTarget.NULL, log);
}
-
+
@Test
public void testInit() {
LogTarget log = nullTrans.init();
Assert.assertEquals(LogTarget.NULL, log);
}
-
+
@Test
public void testWarn() {
LogTarget log = nullTrans.warn();
Assert.assertEquals(LogTarget.NULL, log);
}
-
+
@Test
public void testInfo() {
LogTarget log = nullTrans.info();
Assert.assertEquals(LogTarget.NULL, log);
}
-
+
@Test
public void testDebug() {
LogTarget log = nullTrans.debug();
@@ -118,7 +118,7 @@ public class JU_NullTrans {
LogTarget log = nullTrans.trace();
Assert.assertEquals(LogTarget.NULL, log);
}
-
+
@Test
public void testStart() {
TimeTaken test = nullTrans.start("test", 1);
@@ -131,7 +131,7 @@ public class JU_NullTrans {
s1 = s1.trim();
Assert.assertEquals(s,s1);
}
-
+
@Test
public void testSetProperty() {
String tag = "tag";
@@ -142,19 +142,19 @@ public class JU_NullTrans {
String expectedTag = nullTrans.getProperty(tag);
Assert.assertEquals(expectedTag, tag);
}
-
+
@Test
public void testDecryptor() {
Decryptor decry = nullTrans.decryptor();
Assert.assertNull(decry);
}
-
+
@Test
public void testEncryptor() {
Encryptor encry = nullTrans.encryptor();
Assert.assertNull(encry);
}
-
+
@Test
public void testSet() {
HttpServletRequest req = mock(HttpServletRequest.class);
@@ -162,96 +162,96 @@ public class JU_NullTrans {
AuthzTrans set = nullTrans.set(req,res);
Assert.assertNull(set);
}
-
+
@Test
public void testUser() {
String user = nullTrans.user();
Assert.assertNull(user);
}
-
+
@Test
public void testGetUserPrincipal() {
Principal principal = nullTrans.getUserPrincipal();
Assert.assertNull(principal);
}
-
+
@Test
public void testIp() {
String ip = nullTrans.ip();
Assert.assertNull(ip);
}
-
+
@Test
public void testMeth() {
String meth = nullTrans.meth();
Assert.assertNull(meth);
}
-
+
@Test
public void testPort() {
int port = nullTrans.port();
Assert.assertEquals(port,0);
}
-
+
@Test
public void testPath() {
String path = nullTrans.path();
Assert.assertNull(path);
}
-
+
@Test
public void testPut() {
nullTrans.put(null, nullTrans);
}
-
+
@Test
public void testSetUser() {
Principal principal = mock(Principal.class);
//nullTrans.setUser(principal);
}
-
+
@Test
public void testSlot() {
Slot slot = nullTrans.slot(null);
Assert.assertNull(slot);
}
-
+
@Test
public void testEnv() {
AuthzEnv env = nullTrans.env();
Assert.assertNull(env);
}
-
+
@Test
public void testAgent() {
String agent = nullTrans.agent();
Assert.assertNull(agent);
}
-
+
@Test
public void testSetLur() {
nullTrans.setLur(null);
}
-
+
@Test
public void testFish() {
Permission perm = mock(Permission.class);
Boolean fish = nullTrans.fish(perm);
Assert.assertFalse(fish);
}
-
+
@Test
public void testOrg() {
Organization org = nullTrans.org();
Assert.assertEquals(Organization.NULL, org);
}
-
+
@Test
public void testLogAuditTrail() {
LogTarget lt = mock(LogTarget.class);
nullTrans.logAuditTrail(lt);
}
-
+
@Test
public void testRequested() {
Boolean reqd = nullTrans.requested(null);
@@ -266,7 +266,7 @@ public class JU_NullTrans {
// Assert.assertEquals(date,nullTrans.now());
// //when(nullTrans.now()).thenReturn(null);
// }
-
-
-
+
+
+
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java
index 2bc7dfa0..86cb04bd 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_AbsData.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,16 +54,16 @@ public class JU_AbsData {
String filePath = "test/output_.key";
File keyfile = new File(filePath);
AuthzTrans trans = mock(AuthzTrans.class);
-
+
private class AbsDataStub extends AbsData {
-
+
public AbsDataStub(File dataf, char sepChar, int maxLineSize, int fieldOffset) {
super(dataf, sepChar, maxLineSize, fieldOffset);
// TODO Auto-generated constructor stub
-
+
}
-
+
}
@Test
@@ -81,18 +81,18 @@ public class JU_AbsData {
AbsDataStub ads = new AbsDataStub(keyfile, character, 0, 0);
ads.skipLines(0);
ads.name();
-
+
long lng = 1823286886660L;
//ads.open(trans, lng);
keyfile.delete();
}
-
+
@Test
public void testClose() throws IOException {
AbsDataStub ads = new AbsDataStub(keyfile, character, 0, 0);
ads.close(trans);
}
-
+
@Test
public void testReuse() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
char character = 'x';
@@ -105,7 +105,7 @@ public class JU_AbsData {
//reuse.pos(10);
keyfile.delete();
}
-
+
@Test
public void testIter() throws IOException {
AbsDataStub ads = new AbsDataStub(keyfile, character, 0, 0);
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java
index b0af89ce..8f0ff022 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_DataFile.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,7 +41,7 @@ public class JU_DataFile {
// public void netYetTested() {
// fail("Tests not yet implemented");
// }
-
+
// @Test
// public void test() throws Exception {
// File file = new File("../authz-batch/data/v1.dat");
@@ -52,7 +52,7 @@ public class JU_DataFile {
// df.open();
// Token tok = df.new Token(1024000);
// Field fld = tok.new Field('|');
-//
+//
// while (tok.nextLine()) {
// ++count;
// fld.reset();
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java
index d4330296..30149cf4 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/local/test/JU_TextIndex.java
@@ -7,9 +7,9 @@
* * 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.
@@ -63,20 +63,20 @@ public class JU_TextIndex {
DataFile datafile;
@Mock
File file;
-
+
private class AbsDataStub extends AbsData {
-
+
public AbsDataStub(File dataf, char sepChar, int maxLineSize, int fieldOffset) {
super(dataf, sepChar, maxLineSize, fieldOffset);
// TODO Auto-generated constructor stub
-
+
}
-
+
}
-
+
@Before
- public void setUp() throws IOException{
+ public void setUp() throws IOException{
char character = 'x';
String filePath = "test/output_key";
File keyfile = new File(filePath);
@@ -87,31 +87,31 @@ public class JU_TextIndex {
w.write("a\nsdfasdfxasdf" + i + "\n");
}
w.close();
-
+
datafile = new DataFile(keyfile, "r");
datafile.open();
datafile = new DataFile(keyfile, "rws");// "S" for synchronized
datafile.open();
-
+
trans = mock(Trans.class);
TimeTaken ttMock = mock(TimeTaken.class);
TimeTaken ttMock1 = mock(TimeTaken.class);
when(trans.start("Open Files", Env.SUB)).thenReturn(ttMock);
when(trans.start("Read", Env.SUB)).thenReturn(ttMock);
- textIndex = new TextIndex(keyfile);
+ textIndex = new TextIndex(keyfile);
textIndex.close();
textIndex.open();
//textIndex.create(trans, datafile, 4, character, 2, 0); //TODO: AAF-111 once actual input is aquired
keyfile.delete();
-
+
iter = textIndex.new Iter();
}
-
+
@Test
public void testClose() throws IOException {
textIndex.close();
}
-
+
@Test
public void testFind() throws IOException {
char character = 'x';
@@ -121,13 +121,13 @@ public class JU_TextIndex {
Reuse reuse = ads.reuse();
textIndex.find("a", reuse , 0);
}
-
+
@Test
public void testIterNext() {
iter.next();
iter.hasNext();
}
-
+
@Test
public void testIdx() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
TextIndex outerObject = new TextIndex(file);
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/log4j/test/JU_Log4jAccessAppender.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/log4j/test/JU_Log4jAccessAppender.java
index 8123a82d..551ff0df 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/log4j/test/JU_Log4jAccessAppender.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/log4j/test/JU_Log4jAccessAppender.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,26 +40,26 @@ public class JU_Log4jAccessAppender {
@Mock
Access access;
-
+
@Before
public void setUp() {
initMocks(this);
}
-
+
@Test
public void testRequiresLayout() {
Log4JAccessAppender log4jObj = new Log4JAccessAppender(access);
boolean retObj = log4jObj.requiresLayout();
assertFalse(retObj);
}
-
+
@Test
public void testClose() {
Log4JAccessAppender log4jObj = new Log4JAccessAppender(access);
log4jObj.close();
-
+
}
-
+
@Test
public void testAppend() {
Log4jAccessAppenderImpl log4jObj = new Log4jAccessAppenderImpl(access);
@@ -71,7 +71,7 @@ public class JU_Log4jAccessAppender {
event=new LoggingEvent("com.chililog.server.engine",Logger.getLogger(Log4JAccessAppender.class),(new Date()).getTime(),Level.ALL,"test",Thread.currentThread().getName(),null,null,null,null);
log4jObj.append(event);
}
-
+
@Test
public void testAppendWARN() {
Log4jAccessAppenderImpl log4jObj = new Log4jAccessAppenderImpl(access);
@@ -79,7 +79,7 @@ public class JU_Log4jAccessAppender {
LoggingEvent event=new LoggingEvent("com.chililog.server.engine",Logger.getLogger(Log4JAccessAppender.class),(new Date()).getTime(),Level.WARN,"test",Thread.currentThread().getName(),null,null,null,null);
log4jObj.append(event);
}
-
+
@Test
public void testAppendINFO() {
Log4jAccessAppenderImpl log4jObj = new Log4jAccessAppenderImpl(access);
@@ -87,7 +87,7 @@ public class JU_Log4jAccessAppender {
LoggingEvent event=new LoggingEvent("com.chililog.server.engine",Logger.getLogger(Log4JAccessAppender.class),(new Date()).getTime(),Level.INFO,"test",Thread.currentThread().getName(),null,null,null,null);
log4jObj.append(event);
}
-
+
@Test
public void testAppendWTrace() {
Log4jAccessAppenderImpl log4jObj = new Log4jAccessAppenderImpl(access);
@@ -95,18 +95,18 @@ public class JU_Log4jAccessAppender {
LoggingEvent event=new LoggingEvent("com.chililog.server.engine",Logger.getLogger(Log4JAccessAppender.class),(new Date()).getTime(),Level.TRACE,"test",Thread.currentThread().getName(),null,null,null,null);
log4jObj.append(event);
}
-
+
class Log4jAccessAppenderImpl extends Log4JAccessAppender{
public Log4jAccessAppenderImpl(Access access) {
super(access);
// TODO Auto-generated constructor stub
}
-
+
@Override
protected void append(LoggingEvent event) {
super.append(event);
}
-
+
}
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_Organization.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_Organization.java
index 3d2153e6..8302cad7 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_Organization.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_Organization.java
@@ -7,9 +7,9 @@
* * 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.
@@ -51,9 +51,9 @@ public class JU_Organization {
gc = new GregorianCalendar(1900, 1, 1);
trans = mock(AuthzTrans.class);
}
-
+
@Test
- public void test() throws OrganizationException {
+ public void test() throws OrganizationException {
//tests for Org null
Assert.assertEquals("n/a",Organization.NULL.getName());
Assert.assertEquals("n/a",Organization.NULL.getDomain());
@@ -74,9 +74,9 @@ public class JU_Organization {
Assert.assertEquals("Null Organization rejects all Policies",Organization.NULL.validate(trans, Policy.CHANGE_JOB, null, null));
Assert.assertFalse(Organization.NULL.isTestEnv());
Organization.NULL.setTestMode(true);
-
+
//tests for org emailWarnings
- Assert.assertTrue(Organization.NULL.emailWarningPolicy() instanceof EmailWarnings);
+ Assert.assertTrue(Organization.NULL.emailWarningPolicy() instanceof EmailWarnings);
Assert.assertEquals(604800000L, Organization.NULL.emailWarningPolicy().credEmailInterval());
Assert.assertEquals(604800000L, Organization.NULL.emailWarningPolicy().roleEmailInterval());
Assert.assertEquals(259200000L, Organization.NULL.emailWarningPolicy().apprEmailInterval());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/CredCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/CredCompare.java
index 87a86d7c..ad11ae69 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/CredCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/CredCompare.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ public class CredCompare extends RosettaCompare<CredRequest> {
public CredCompare() {
super(CredRequest.class);
}
-
+
public static CredRequest create() {
CredRequest rr = new CredRequest();
String in = instance();
@@ -46,7 +46,7 @@ public class CredCompare extends RosettaCompare<CredRequest> {
rr.setEnd(Chrono.timeStamp(gc));
return rr;
}
-
+
@Override
public void compare(CredRequest t1, CredRequest t2) {
assertEquals(t1.getId(),t2.getId());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/JU_RequestCheck.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/JU_RequestCheck.java
index 832f5188..02263a9d 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/JU_RequestCheck.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/JU_RequestCheck.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,7 +26,7 @@ import org.onap.aaf.misc.env.APIException;
import org.onap.aaf.misc.rosetta.env.RosettaEnv;
public class JU_RequestCheck {
-
+
@Test
public void testNSRequest() throws APIException {
RosettaEnv env = new RosettaEnv();
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/MultiCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/MultiCompare.java
index 024a5237..803fff44 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/MultiCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/MultiCompare.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ public class MultiCompare extends RosettaCompare<MultiRequest> {
public MultiCompare() {
super(MultiRequest.class);
}
-
+
@Override
public MultiRequest newOne() {
MultiRequest multi = new MultiRequest();
@@ -50,19 +50,19 @@ public class MultiCompare extends RosettaCompare<MultiRequest> {
multi.getUserRoleRequest().add(UserRoleCompare.create());
multi.getRolePermRequest().add(RolePermCompare.create());
multi.getRolePermRequest().add(RolePermCompare.create());
-
-
+
+
GregorianCalendar gc = new GregorianCalendar();
multi.setStart(Chrono.timeStamp(gc));
gc.add(GregorianCalendar.MONTH, 1);
multi.setEnd(Chrono.timeStamp(gc));
return multi;
}
-
+
public void compare(MultiRequest t1, MultiRequest t2) {
new NSCompare().compare(t1.getNsRequest(), t2.getNsRequest());
// Will have to find by key for others.
-
+
assertEquals(t1.getStart(),t2.getStart());
assertEquals(t1.getEnd(),t2.getEnd());
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java
index 0786c134..7f7b09ce 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSAttribCompare.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,11 +35,11 @@ public class NSAttribCompare extends RosettaCompare<NsAttribRequest> {
public NSAttribCompare() {
super(NsAttribRequest.class);
}
-
+
public static NsAttribRequest create() {
NsAttribRequest nar = new NsAttribRequest();
String in = instance();
-
+
nar.setNs("org.osaaf.ns"+in);
Attrib attrib = new Attrib();
attrib.setKey("swm");
@@ -55,7 +55,7 @@ public class NSAttribCompare extends RosettaCompare<NsAttribRequest> {
nar.setEnd(Chrono.timeStamp(gc));
return nar;
}
-
+
@Override
public void compare(NsAttribRequest t1, NsAttribRequest t2) {
assertEquals(t1.getNs(),t2.getNs());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java
index c3504216..a6a3e428 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/NSCompare.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,7 +34,7 @@ public class NSCompare extends RosettaCompare<NsRequest> {
public NSCompare() {
super(NsRequest.class);
}
-
+
public static NsRequest create() {
NsRequest nsr = new NsRequest();
String in = instance();
@@ -51,7 +51,7 @@ public class NSCompare extends RosettaCompare<NsRequest> {
nsr.setEnd(Chrono.timeStamp(gc));
return nsr;
}
-
+
@Override
public void compare(NsRequest t1, NsRequest t2) {
assertEquals(t1.getName(),t2.getName());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/PermCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/PermCompare.java
index 92e07655..f10c9013 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/PermCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/PermCompare.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ public class PermCompare extends RosettaCompare<PermRequest> {
public PermCompare() {
super(PermRequest.class);
}
-
+
public static PermRequest create() {
PermRequest pr = new PermRequest();
String in = instance();
@@ -47,7 +47,7 @@ public class PermCompare extends RosettaCompare<PermRequest> {
pr.setEnd(Chrono.timeStamp(gc));
return pr;
}
-
+
@Override
public void compare(PermRequest t1, PermRequest t2) {
assertEquals(t1.getType(),t2.getType());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RoleCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RoleCompare.java
index 0a3a164c..b0c30e1c 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RoleCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RoleCompare.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ public class RoleCompare extends RosettaCompare<RoleRequest> {
public RoleCompare() {
super(RoleRequest.class);
}
-
+
public static RoleRequest create() {
RoleRequest rr = new RoleRequest();
String in = instance();
@@ -45,7 +45,7 @@ public class RoleCompare extends RosettaCompare<RoleRequest> {
rr.setEnd(Chrono.timeStamp(gc));
return rr;
}
-
+
@Override
public void compare(RoleRequest t1, RoleRequest t2) {
assertEquals(t1.getName(),t2.getName());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RolePermCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RolePermCompare.java
index 24a84b53..73348d1b 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RolePermCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RolePermCompare.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,7 +34,7 @@ public class RolePermCompare extends RosettaCompare<RolePermRequest> {
public RolePermCompare() {
super(RolePermRequest.class);
}
-
+
public static RolePermRequest create() {
RolePermRequest urr = new RolePermRequest();
String in = instance();
@@ -50,7 +50,7 @@ public class RolePermCompare extends RosettaCompare<RolePermRequest> {
urr.setEnd(Chrono.timeStamp(gc));
return urr;
}
-
+
@Override
public void compare(RolePermRequest t1, RolePermRequest t2) {
assertEquals(t1.getRole(),t2.getRole());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RosettaCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RosettaCompare.java
index 43703d29..c09ded28 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RosettaCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/RosettaCompare.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,36 +31,36 @@ import org.onap.aaf.misc.rosetta.env.RosettaEnv;
public abstract class RosettaCompare<T> {
protected Class<T> cls;
private static int count = 0;
-
+
public RosettaCompare(Class<T> cls) {
this.cls = cls;
}
-
+
public void run(RosettaEnv env) throws APIException {
RosettaDF<T> nsrDF = env.newDataFactory(cls);
compare(nsrDF.newData().option(Data.PRETTY),newOne(),this);
}
-
+
private void compare(RosettaData<T> rdt, T t, RosettaCompare<T> comp) throws APIException {
//System.out.println("########### Testing " + cls.getName() + " ##############");
String s = rdt.load(t).out(TYPE.JSON).asString();
//System.out.println(s);
T t2 = rdt.in(TYPE.JSON).load(s).asObject();
comp.compare(t, t2);
-
+
//System.out.println();
-
+
s = rdt.load(t).out(TYPE.XML).asString();
//System.out.println(s);
t2 = rdt.in(TYPE.XML).load(s).asObject();
comp.compare(t, t2);
}
-
+
public synchronized static String instance() {
return "_"+ ++count;
}
-
+
public abstract void compare(T t1, T t2);
public abstract T newOne();
-
+
} \ No newline at end of file
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/UserRoleCompare.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/UserRoleCompare.java
index af61e639..258c6568 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/UserRoleCompare.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/request/test/UserRoleCompare.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ public class UserRoleCompare extends RosettaCompare<UserRoleRequest> {
public UserRoleCompare() {
super(UserRoleRequest.class);
}
-
+
public static UserRoleRequest create() {
UserRoleRequest urr = new UserRoleRequest();
String in = instance();
@@ -45,7 +45,7 @@ public class UserRoleCompare extends RosettaCompare<UserRoleRequest> {
urr.setEnd(Chrono.timeStamp(gc));
return urr;
}
-
+
@Override
public void compare(UserRoleRequest t1, UserRoleRequest t2) {
assertEquals(t1.getUser(),t2.getUser());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch.java
index 031da2fa..98a213de 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch.java
@@ -7,9 +7,9 @@
* * 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.
@@ -51,7 +51,7 @@ public class JU_BetterMatch {
assertFalse(bm.match("/req/1.0.0/wilma/bambam"));
assertFalse(bm.match("/not/valid/234"));
assertFalse(bm.match(""));
-
+
TimeTaken tt = trans.start("A", Env.SUB);
TimeTaken tt2;
int i = 0;
@@ -66,8 +66,8 @@ public class JU_BetterMatch {
} finally {
tt.done();
}
-
-
+
+
tt = trans.start("B", Env.SUB);
i = 0;
try {
@@ -88,9 +88,9 @@ public class JU_BetterMatch {
assertFalse(bm.match("/req/1.0.0/urn:fsdb,1.0,req,newreq/0x12345/xyx"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
-
+
tt = trans.start("C", Env.SUB);
i = 0;
try {
@@ -98,12 +98,12 @@ public class JU_BetterMatch {
bm = new Match(url+":urn*");
tt2 = trans.start(Integer.toString(++i), Env.SUB);
String value = "urn:fsdb,1.0,req,newreq/0x12345";
-
+
assertTrue(bm.match(url+value));
assertEquals("urn:fsdb,1.0,req,newreq/0x12345",bm.param(url+value, ":urn"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
tt = trans.start("D", Env.SUB);
@@ -117,7 +117,7 @@ public class JU_BetterMatch {
assertFalse(bm.match("/req/1.0.0/urn:fsdb,1.0,req,newreq/"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
tt = trans.start("E", Env.SUB);
@@ -134,7 +134,7 @@ public class JU_BetterMatch {
assertTrue(bm.match("this/1.0.0/urn:fsdb,1.0,req,newreq/0x12345/"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
tt = trans.start("F", Env.SUB);
@@ -145,20 +145,20 @@ public class JU_BetterMatch {
assertTrue(bm.match("<pass>/this"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
-
+
StringBuilder sb = new StringBuilder();
trans.auditTrail(0, sb);
//System.out.println(sb);
-
+
}
-
+
@Test
public void specialTest() {
Match match = new Match("/sample");
assertTrue(match.match("/sample"));
-
+
match = new Match("/lpeer//lpeer/:key/:item*");
assertTrue(match.match("/lpeer//lpeer/x/y"));
assertFalse(match.match("/lpeer/x/lpeer/x/y"));
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch1.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch1.java
index 2287889b..e95d626b 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch1.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterMatch1.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,7 +47,7 @@ public class JU_BetterMatch1 {
assertFalse(bm.match("/req/1.0.0/wilma/bambam"));
assertFalse(bm.match("/not/valid/234"));
assertFalse(bm.match(""));
-
+
TimeTaken tt = trans.start("A", Env.SUB);
TimeTaken tt2;
int i = 0;
@@ -62,8 +62,8 @@ public class JU_BetterMatch1 {
} finally {
tt.done();
}
-
-
+
+
tt = trans.start("B", Env.SUB);
i = 0;
try {
@@ -84,9 +84,9 @@ public class JU_BetterMatch1 {
assertFalse(bm.match("/req/1.0.0/urn:fsdb,1.0,req,newreq/0x12345/xyx"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
-
+
tt = trans.start("C", Env.SUB);
i = 0;
try {
@@ -94,12 +94,12 @@ public class JU_BetterMatch1 {
bm = new Match(url+":urn*");
tt2 = trans.start(Integer.toString(++i), Env.SUB);
String value = "urn:fsdb,1.0,req,newreq/0x12345";
-
+
assertTrue(bm.match(url+value));
assertEquals("urn:fsdb,1.0,req,newreq/0x12345",bm.param(url+value, ":urn"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
tt = trans.start("D", Env.SUB);
@@ -113,7 +113,7 @@ public class JU_BetterMatch1 {
assertFalse(bm.match("/req/1.0.0/urn:fsdb,1.0,req,newreq/"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
tt = trans.start("E", Env.SUB);
@@ -130,7 +130,7 @@ public class JU_BetterMatch1 {
assertTrue(bm.match("this/1.0.0/urn:fsdb,1.0,req,newreq/0x12345/"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
tt = trans.start("F", Env.SUB);
@@ -141,20 +141,20 @@ public class JU_BetterMatch1 {
assertTrue(bm.match("whatever/this"));
} finally {
tt2.done();
- tt.done();
+ tt.done();
}
-
+
StringBuilder sb = new StringBuilder();
trans.auditTrail(0, sb);
//System.out.println(sb);
-
+
}
-
+
@Test
public void specialTest() {
Match match = new Match("/sample");
assertTrue(match.match("/sample"));
-
+
match = new Match("/lpeer//lpeer/:key/:item*");
assertTrue(match.match("/lpeer//lpeer/x/y"));
assertFalse(match.match("/lpeer/x/lpeer/x/y"));
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterRoute.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterRoute.java
index 2fa6b5f8..04ddca2a 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterRoute.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_BetterRoute.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,7 +27,7 @@ public class JU_BetterRoute {
@Test
public void test() {
-
+
}
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content.java
index 65cf9bc9..23c0ae80 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,7 +41,7 @@ import org.onap.aaf.misc.env.impl.EnvFactory;
* Test the functioning of the "Content" class, which holds, and routes to the right code based on Accept values
*/
public class JU_Content {
-
+
@Test
public void test() throws Exception {
@@ -78,7 +78,7 @@ public class JU_Content {
//BogusReq req = new BogusReq();
//expected = (expected);
//HttpServletResponse resp = new BogusResp();
-
+
assertNotNull("Same Content String and Accept String",ct.prep(trans,expected));
//expects Null (not run)
@@ -103,35 +103,35 @@ public class JU_Content {
expected = "application/java.lang.Boolean+xml;charset=UTF8;version=1.0";
assertNotNull("Minor Charset in Caps acceptable",ct.prep(trans,expected));
- // expects no run
+ // expects no run
expected="application/java.lang.Boolean+xml;charset=MyType;version=1.0";
assertNull("Unknown Minor Charset",ct.prep(trans,expected));
expected="";
assertNotNull("Blank Acceptance",ct.prep(trans,expected));
-
+
expected=null;
- assertNotNull("Null Acceptance",ct.prep(trans,expected));
+ assertNotNull("Null Acceptance",ct.prep(trans,expected));
expected = ("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
assertNotNull("Matches application/xml, and other content not known",ct.prep(trans,expected));
-
+
// No SemiColon
expected = ("i/am/bogus,application/xml");
assertNotNull("Match second entry, with no Semis",ct.prep(trans,expected));
- } finally {
+ } finally {
StringBuilder sb = new StringBuilder();
trans.auditTrail(0, sb);
//System.out.println(sb);
}
}
-//
+//
// Original API used HTTPServletRequest and HTTPServletResponse. Due to the fact that sometimes we use Accept, and others Content-TYpe
// I changed it to simply accept a string
-//
+//
// Jonathan 3/8/2013
-//
+//
// @SuppressWarnings("rawtypes")
// class BogusReq implements HttpServletRequest {
// private String accept;
@@ -159,175 +159,175 @@ public class JU_Content {
// @Override
// public void setCharacterEncoding(String env)
// throws UnsupportedEncodingException {
-//
+//
//
// }
//
// @Override
// public int getContentLength() {
-//
+//
// return 0;
// }
//
// @Override
// public String getContentType() {
-//
+//
// return null;
// }
//
// @Override
// public ServletInputStream getInputStream() throws IOException {
-//
+//
// return null;
// }
//
// @Override
// public String getParameter(String name) {
-//
+//
// return null;
// }
//
// @Override
// public Enumeration getParameterNames() {
-//
+//
// return null;
// }
//
// @Override
// public String[] getParameterValues(String name) {
-//
+//
// return null;
// }
//
// @Override
// public Map getParameterMap() {
-//
+//
// return null;
// }
//
// @Override
// public String getProtocol() {
-//
+//
// return null;
// }
//
// @Override
// public String getScheme() {
-//
+//
// return null;
// }
//
// @Override
// public String getServerName() {
-//
+//
// return null;
// }
//
// @Override
// public int getServerPort() {
-//
+//
// return 0;
// }
//
// @Override
// public BufferedReader getReader() throws IOException {
-//
+//
// return null;
// }
//
// @Override
// public String getRemoteAddr() {
-//
+//
// return null;
// }
//
// @Override
// public String getRemoteHost() {
-//
+//
// return null;
// }
//
// @Override
// public void setAttribute(String name, Object o) {
-//
+//
//
// }
//
// @Override
// public void removeAttribute(String name) {
-//
+//
//
// }
//
// @Override
// public Locale getLocale() {
-//
+//
// return null;
// }
//
// @Override
// public Enumeration getLocales() {
-//
+//
// return null;
// }
//
// @Override
// public boolean isSecure() {
-//
+//
// return false;
// }
//
// @Override
// public RequestDispatcher getRequestDispatcher(String path) {
-//
+//
// return null;
// }
//
// @Override
// public String getRealPath(String path) {
-//
+//
// return null;
// }
//
// @Override
// public int getRemotePort() {
-//
+//
// return 0;
// }
//
// @Override
// public String getLocalName() {
-//
+//
// return null;
// }
//
// @Override
// public String getLocalAddr() {
-//
+//
// return null;
// }
//
// @Override
// public int getLocalPort() {
-//
+//
// return 0;
// }
//
// @Override
// public String getAuthType() {
-//
+//
// return null;
// }
//
// @Override
// public Cookie[] getCookies() {
-//
+//
// return null;
// }
//
// @Override
// public long getDateHeader(String name) {
-//
+//
// return 0;
// }
//
@@ -338,137 +338,137 @@ public class JU_Content {
//
// @Override
// public Enumeration getHeaders(String name) {
-//
+//
// return null;
// }
//
// @Override
// public Enumeration getHeaderNames() {
-//
+//
// return null;
// }
//
// @Override
// public int getIntHeader(String name) {
-//
+//
// return 0;
// }
//
// @Override
// public String getMethod() {
-//
+//
// return null;
// }
//
// @Override
// public String getPathInfo() {
-//
+//
// return null;
// }
//
// @Override
// public String getPathTranslated() {
-//
+//
// return null;
// }
//
// @Override
// public String getContextPath() {
-//
+//
// return null;
// }
//
// @Override
// public String getQueryString() {
-//
+//
// return null;
// }
//
// @Override
// public String getRemoteUser() {
-//
+//
// return null;
// }
//
// @Override
// public boolean isUserInRole(String role) {
-//
+//
// return false;
// }
//
// @Override
// public Principal getUserPrincipal() {
-//
+//
// return null;
// }
//
// @Override
// public String getRequestedSessionId() {
-//
+//
// return null;
// }
//
// @Override
// public String getRequestURI() {
-//
+//
// return null;
// }
//
// @Override
// public StringBuffer getRequestURL() {
-//
+//
// return null;
// }
//
// @Override
// public String getServletPath() {
-//
+//
// return null;
// }
//
// @Override
// public HttpSession getSession(boolean create) {
-//
+//
// return null;
// }
//
// @Override
// public HttpSession getSession() {
-//
+//
// return null;
// }
//
// @Override
// public boolean isRequestedSessionIdValid() {
-//
+//
// return false;
// }
//
// @Override
// public boolean isRequestedSessionIdFromCookie() {
-//
+//
// return false;
// }
//
// @Override
// public boolean isRequestedSessionIdFromURL() {
-//
+//
// return false;
// }
//
// @Override
// public boolean isRequestedSessionIdFromUrl() {
-//
+//
// return false;
// }
// }
-//
+//
// public class BogusResp implements HttpServletResponse {
// public String contentType;
//
// @Override
// public String getCharacterEncoding() {
-//
+//
// return null;
// }
//
@@ -479,26 +479,26 @@ public class JU_Content {
//
// @Override
// public ServletOutputStream getOutputStream() throws IOException {
-//
+//
// return null;
// }
//
// @Override
// public PrintWriter getWriter() throws IOException {
-//
+//
// return null;
// }
//
// @Override
// public void setCharacterEncoding(String charset) {
-//
-//
+//
+//
// }
//
// @Override
// public void setContentLength(int len) {
-//
-//
+//
+//
// }
//
// @Override
@@ -508,154 +508,154 @@ public class JU_Content {
//
// @Override
// public void setBufferSize(int size) {
-//
-//
+//
+//
// }
//
// @Override
// public int getBufferSize() {
-//
+//
// return 0;
// }
//
// @Override
// public void flushBuffer() throws IOException {
-//
-//
+//
+//
// }
//
// @Override
// public void resetBuffer() {
-//
-//
+//
+//
// }
//
// @Override
// public boolean isCommitted() {
-//
+//
// return false;
// }
//
// @Override
// public void reset() {
-//
-//
+//
+//
// }
//
// @Override
// public void setLocale(Locale loc) {
-//
-//
+//
+//
// }
//
// @Override
// public Locale getLocale() {
-//
+//
// return null;
// }
//
// @Override
// public void addCookie(Cookie cookie) {
-//
-//
+//
+//
// }
//
// @Override
// public boolean containsHeader(String name) {
-//
+//
// return false;
// }
//
// @Override
// public String encodeURL(String url) {
-//
+//
// return null;
// }
//
// @Override
// public String encodeRedirectURL(String url) {
-//
+//
// return null;
// }
//
// @Override
// public String encodeUrl(String url) {
-//
+//
// return null;
// }
//
// @Override
// public String encodeRedirectUrl(String url) {
-//
+//
// return null;
// }
//
// @Override
// public void sendError(int sc, String msg) throws IOException {
-//
-//
+//
+//
// }
//
// @Override
// public void sendError(int sc) throws IOException {
-//
-//
+//
+//
// }
//
// @Override
// public void sendRedirect(String location) throws IOException {
-//
-//
+//
+//
// }
//
// @Override
// public void setDateHeader(String name, long date) {
-//
-//
+//
+//
// }
//
// @Override
// public void addDateHeader(String name, long date) {
-//
-//
+//
+//
// }
//
// @Override
// public void setHeader(String name, String value) {
-//
-//
+//
+//
// }
//
// @Override
// public void addHeader(String name, String value) {
-//
-//
+//
+//
// }
//
// @Override
// public void setIntHeader(String name, int value) {
-//
-//
+//
+//
// }
//
// @Override
// public void addIntHeader(String name, int value) {
-//
-//
+//
+//
// }
//
// @Override
// public void setStatus(int sc) {
-//
-//
+//
+//
// }
//
// @Override
// public void setStatus(int sc, String sm) {
-//
-//
+//
+//
// }
-//
+//
// }
//
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content1.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content1.java
index eb2fe359..b6f220c9 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content1.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Content1.java
@@ -7,9 +7,9 @@
* * 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.
@@ -42,7 +42,7 @@ import org.onap.aaf.misc.env.impl.EnvFactory;
* Test the functioning of the "Content" class, which holds, and routes to the right code based on Accept values
*/
public class JU_Content1 {
-
+
@Test
public void test() throws Exception {
@@ -79,7 +79,7 @@ public class JU_Content1 {
//BogusReq req = new BogusReq();
//expected = (expected);
//HttpServletResponse resp = new BogusResp();
-
+
assertNotNull("Same Content String and Accept String",ct.prep(trans,expected));
//expects Null (not run)
@@ -104,24 +104,24 @@ public class JU_Content1 {
expected = "application/java.lang.Boolean+xml;charset=UTF8;version=1.0";
assertNotNull("Minor Charset in Caps acceptable",ct.prep(trans,expected));
- // expects no run
+ // expects no run
expected="application/java.lang.Boolean+xml;charset=MyType;version=1.0";
assertNull("Unknown Minor Charset",ct.prep(trans,expected));
expected="";
assertNotNull("Blank Acceptance",ct.prep(trans,expected));
-
+
expected=null;
- assertNotNull("Null Acceptance",ct.prep(trans,expected));
+ assertNotNull("Null Acceptance",ct.prep(trans,expected));
expected = ("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
assertNotNull("Matches application/xml, and other content not known",ct.prep(trans,expected));
-
+
// No SemiColon
expected = ("i/am/bogus,application/xml");
assertNotNull("Match second entry, with no Semis",ct.prep(trans,expected));
- } finally {
+ } finally {
StringBuilder sb = new StringBuilder();
trans.auditTrail(0, sb);
//System.out.println(sb);
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Pair.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Pair.java
index b81966db..84383ce5 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Pair.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Pair.java
@@ -7,9 +7,9 @@
* * 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.
@@ -34,7 +34,7 @@ public class JU_Pair {
Pair<Integer, Integer> pair;
Integer x;
Integer y;
-
+
@Before
public void setUp(){
pair = new Pair<Integer, Integer>(1, 2);
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Route.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Route.java
index 26ec6abf..b8fd01c2 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Route.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Route.java
@@ -7,9 +7,9 @@
* * 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.
@@ -37,20 +37,20 @@ public class JU_Route {
HttpCode httpCode;
HttpMethods httpMethod;
Trans trans;
-
+
@Before
public void setUp() { //TODO: AAF-111 complete when actual input is provided
//httpMethod = Matchers.any(HttpMethods.class);
//when(httpMethod.name()).thenReturn("test");
// route = new Route(null,"path/to/place");
}
-
-
+
+
@Test
public void testAdd() {
// route.add(httpCode, "path/to/place");
}
-
+
@Test
public void testStart() {
// trans = mock(Trans.class);
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_RouteReport.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_RouteReport.java
index fffd3944..12b00858 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_RouteReport.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_RouteReport.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Routes.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Routes.java
index 9606d472..b5538b99 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Routes.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Routes.java
@@ -7,9 +7,9 @@
* * 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.
@@ -49,25 +49,25 @@ public class JU_Routes {
//TODO: Gabe [JUnit] Not visible to junit
//CodeSetter<Trans> codeSetterMock;
Route<Trans> routeObj;
-
+
@Before
public void setUp(){
routes = new Routes();
}
-
+
@Test
public void testRouteReport(){
- List listVal = routes.routeReport();
+ List listVal = routes.routeReport();
assertNotNull(listVal);
}
-
+
@Test
public void testDerive() throws IOException, ServletException{
routeObj = routes.derive(reqMock, null);
-
+
}
-
-
-
+
+
+
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_TypedCode.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_TypedCode.java
index 76948ac6..60727b6a 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_TypedCode.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_TypedCode.java
@@ -7,9 +7,9 @@
* * 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.
@@ -50,31 +50,31 @@ public class JU_TypedCode {
TypedCode typedCode;
@Mock
RouteReport routeReportMock;
-
+
@Before
public void setUp(){
typedCode = new TypedCode();
}
-
+
@Test
public void testFirst(){
String returnVal = typedCode.first();
assertNull(returnVal);
}
-
+
@Test
public void testAdd() {
HttpCode<?, ?> code = mock(HttpCode.class);
typedCode.add(code , "test", "test1", "test2");
}
-
+
@Test
public void testPrep() throws IOException, ServletException, ClassNotFoundException {
Trans trans = mock(Trans.class);
TimeTaken time = new TimeTaken("yell", 2) {
@Override
public void output(StringBuilder sb) {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
};
when(trans.start(";na=me;,prop", 8)).thenReturn(time);
@@ -83,20 +83,20 @@ public class JU_TypedCode {
code.isAuthorized(null); //Testing httpcode, currently not working
code.no_cache();
code.toString();
-
+
typedCode.add(code , "");
typedCode.prep(null , "q");
-
+
typedCode.add(code , "t");
typedCode.prep(trans , null);
-
+
typedCode.add(code , "t");
typedCode.prep(trans , "");
-
+
typedCode.add(code, "POST /authn/validate application/CredRequest+json;charset=utf-8;version=2.0,application/json;version=2.0,*/*");
- //typedCode.prep(trans , "POST /authn/validate application/CredRequest+json;charset=utf-8;version=2.0,application/json;version=2.0,*/*");
+ //typedCode.prep(trans , "POST /authn/validate application/CredRequest+json;charset=utf-8;version=2.0,application/json;version=2.0,*/*");
}
-
+
@Test
public void testRelatedTo() {
HttpCode<?, ?> code = mock(HttpCode.class);
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Version.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Version.java
index 47be1acb..a1bbef5a 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Version.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/rserv/test/JU_Version.java
@@ -7,9 +7,9 @@
* * 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.
@@ -38,7 +38,7 @@ public class JU_Version {
Version version;
Version versionTest;
-
+
@Before
public void setUp(){
version = new Version("first\\.123");
@@ -46,7 +46,7 @@ public class JU_Version {
}
@Test
- public void testEquals(){
+ public void testEquals(){
version.equals(versionTest);
versionTest.equals(version);
versionTest = new Version("fail\\.124");
@@ -54,16 +54,16 @@ public class JU_Version {
version.equals("This is not an object of version");
versionTest = new Version("NoVersion\\.number");
version.equals(versionTest);
-
-
+
+
}
-
+
@Test
public void testToString(){
String strVal = version.toString();
assertNotNull(strVal);
}
-
+
@Test
public void testHashCode() {
Assert.assertNotNull(version.hashCode());
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java
index b89e2e5d..c80c8187 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsService.java
@@ -7,9 +7,9 @@
* 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.
@@ -63,9 +63,9 @@ import java.security.Principal;
import javax.servlet.Filter;
public class JU_AbsService {
-
+
ByteArrayOutputStream outStream;
-
+
private class AbsServiceStub extends AbsService {
public AbsServiceStub(Access access, BasicEnv env) throws CadiException {
@@ -84,31 +84,31 @@ public class JU_AbsService {
// TODO Auto-generated method stub
return null;
}
-
+
}
-
+
@Before
public void setUp() {
outStream = new ByteArrayOutputStream();
System.setOut(new PrintStream(outStream));
}
-
+
@After
public void tearDown() {
System.setOut(System.out);
}
-
+
@Test
public void testStub() throws CadiException {
BasicEnv bEnv = new BasicEnv();
PropAccess prop = new PropAccess();
-
+
prop.setProperty(Config.AAF_LOCATOR_ENTRIES, "te.st");
prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st");
prop.setLogLevel(Level.DEBUG);
AbsServiceStub absServiceStub = new AbsServiceStub(prop, bEnv); //Testing other branches requires "fails" due to exception handling, will leave that off for now.
}
-
+
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
index 4972b572..9e0cd9af 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,11 +42,11 @@ import org.onap.aaf.cadi.register.Registrant;
import org.onap.aaf.misc.env.impl.BasicEnv;
public class JU_AbsServiceStarter {
-
+
ByteArrayOutputStream outStream;
AbsServiceStub absServiceStub;
AbsServiceStarterStub absServiceStarterStub;
-
+
private class AbsServiceStarterStub extends AbsServiceStarter {
public AbsServiceStarterStub(AbsService service, boolean secure) {
@@ -57,16 +57,16 @@ public class JU_AbsServiceStarter {
@Override
public void _start(RServlet rserv) throws Exception {
// TODO Auto-generated method stub
-
+
}
@Override
public void _propertyAdjustment() {
// TODO Auto-generated method stub
-
+
}
}
-
+
private class AbsServiceStub extends AbsService {
public AbsServiceStub(Access access, BasicEnv env) throws CadiException {
@@ -85,40 +85,40 @@ public class JU_AbsServiceStarter {
// TODO Auto-generated method stub
return null;
}
-
+
}
-
+
@Before
public void setUp() {
outStream = new ByteArrayOutputStream();
System.setOut(new PrintStream(outStream));
}
-
+
@After
public void tearDown() {
System.setOut(System.out);
}
-
-
+
+
@Test
public void testStub() throws CadiException {
BasicEnv bEnv = new BasicEnv();
PropAccess prop = new PropAccess();
-
+
prop.setProperty(Config.AAF_LOCATOR_ENTRIES, "te.st");
prop.setProperty(Config.AAF_LOCATOR_VERSION, "te.st");
prop.setLogLevel(Level.DEBUG);
absServiceStub = new AbsServiceStub(prop, bEnv);
-
+
absServiceStarterStub = new AbsServiceStarterStub(absServiceStub,true);
}
-
+
// @Test
// public void testStart() throws Exception {
// absServiceStarterStub.env();
// absServiceStarterStub.start();
// }
-
+
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java
index ae76de0f..68077c7c 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_JettyServiceStarter.java
@@ -7,9 +7,9 @@
* * 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.
@@ -76,18 +76,18 @@ public class JU_JettyServiceStarter {
@Before
public void setUp() throws OrganizationException, CadiException {
Access access = mock(Access.class);
-
+
BasicEnv bEnv = mock(BasicEnv.class);
Trans trans = mock(Trans.class); //TODO: Fix this once Gabe has services running to see correct output without mock
//TestService testService = new TestService(access, bEnv);
//jss = new JettyServiceStarter<AuthzEnv,AuthzTrans>(testService);
}
-
+
// @Test
// public void netYetTested() {
// fail("Tests not yet implemented");
// }
-
+
@Test
public void testPropertyAdjustment() {
//jss._propertyAdjustment();
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/JU_Mask.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/JU_Mask.java
index 5bc1b68d..f887ca40 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/JU_Mask.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/JU_Mask.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,12 +40,12 @@ public class JU_Mask {
InetAddress ia = InetAddress.getByName("192.168.0.0");
NetMask mask = new NetMask(ia.getAddress());
assertTrue(mask.isInNet(ia.getAddress()));
-
+
mask = new NetMask("192.168.1/24");
assertTrue(mask.isInNet("192.168.1.20"));
assertTrue(mask.isInNet("192.168.1.255"));
assertFalse(mask.isInNet("192.168.2.20"));
-
+
mask = new NetMask("192.168.1/31");
assertFalse(mask.isInNet("192.168.2.20"));
assertFalse(mask.isInNet("192.168.1.20"));
@@ -56,10 +56,10 @@ public class JU_Mask {
assertTrue(mask.isInNet("192.168.1.1"));
assertTrue(mask.isInNet("192.1.1.1"));
assertFalse(mask.isInNet("193.168.1.1"));
-
+
mask = new NetMask("/0");
assertTrue(mask.isInNet("193.168.1.1"));
-
+
String msg = "Should throw " + MaskFormatException.class.getSimpleName();
try {
mask = new NetMask("256.256.256.256");
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java
index 40e1886e..754d476f 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/util/test/TestKill.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,7 +52,7 @@ public class TestKill implements Runnable {
@Override
public void run() {
}
-
+
private void longProcess() {
System.out.println("Starting long cleanup process");
try {
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
index fa9b5213..46d3db9b 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
@@ -48,7 +48,7 @@ public class DefaultOrg implements Organization {
final String domain;
final String atDomain;
final String realm;
-
+
private final String root_ns;
private final String NAME;
@@ -65,7 +65,7 @@ public class DefaultOrg implements Organization {
atDomain = '@'+domain;
NAME=env.getProperty(realm + ".name","Default Organization");
root_ns = env.getProperty(Config.AAF_ROOT_NS,Config.AAF_ROOT_NS_DEF);
-
+
try {
String defFile;
String temp=env.getProperty(defFile = (getClass().getName()+".file"));
@@ -84,7 +84,7 @@ public class DefaultOrg implements Organization {
}
fIdentities.createNewFile();
}
-
+
}
} else {
fIdentities = new File(temp);
@@ -122,7 +122,7 @@ public class DefaultOrg implements Organization {
} else {
revoked = null;
}
-
+
} catch (IOException e) {
throw new OrganizationException(e);
}
@@ -262,11 +262,11 @@ public class DefaultOrg implements Organization {
/**
* ( # Start of group
* (?=.*[a-z,A-Z]) # must contain one character
- *
- * (?=.*\d) # must contain one digit from 0-9
+ *
+ * (?=.*\d) # must contain one digit from 0-9
* OR
* (?=.*[@#$%]) # must contain one special symbols in the list SPEC_CHARS
- *
+ *
* . # match anything with previous condition checking
* {6,20} # length at least 6 characters and maximum of 20
* ) # End of group
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java
index f2b9d8c9..f1576c4f 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgIdentity.java
@@ -7,9 +7,9 @@
* * 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.
@@ -33,10 +33,10 @@ import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.org.Identities.Data;
/**
- * Org Users are essential representations of Identities within the Org. Since this is a highly individual
+ * Org Users are essential representations of Identities within the Org. Since this is a highly individual
* thing for most Orgs, i.e. some use LDAP, some need feed, some use something else, this object will allow
* the Organization to connect to their own Identity systems...
- *
+ *
*
*/
public class DefaultOrgIdentity implements Identity {
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgWarnings.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgWarnings.java
index d544b709..a0b408a2 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgWarnings.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrgWarnings.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java
index 9f65b418..f5a1149f 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/Identities.java
@@ -7,9 +7,9 @@
* * 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.
@@ -29,29 +29,29 @@ import org.onap.aaf.auth.local.DataFile.Token.Field;
/*
* Example User Data file, which can be modified for many different kinds of Data Feeds.
- *
- * Note: This has shown to be extremely effective in AT&T, an acknowledged very large organizations,
+ *
+ * Note: This has shown to be extremely effective in AT&T, an acknowledged very large organizations,
* because there is no need to synchronize records. AAF simply receives a Data Feed in Organization
* defined intervals. (You might want to check for validity, such as size, etc), then is copied into
* Data Directory. You will want to do so first creating a "lock" file. Assuming the File name is "users.dat",
- * the Lock File is "users.lock".
- *
+ * the Lock File is "users.lock".
+ *
* After the movement of the Datafile into place, it is best to remove the Index File, then remove the lock file.
- *
+ *
* Note, Any AAF Programs needing this data WILL wait on the Lock file, so you should get fresh Data files
* in a "stage" directory, from WEB, or wherever, and then, after it is correct, do the following as fast as feasible.
- *
+ *
* a) lock
* b) copy from stage
* c) remove idx
* d) unlock
- *
+ *
* If the Index File is either non-existent or out of date from the Data File, it will be reindexed, which
* has proven to be a very quick function, even with large numbers of entries.
- *
+ *
* This Sample Feed is set for a file with delimiter of "|". 512 is maximum expected line length. The "0" is the
* field offset for the "key" to the record, which, for user, should be the unique Organization Identity.
- *
+ *
*/
public class Identities extends AbsData {
public final static Data NO_DATA = new Data();
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 f2d29274..9ab83bea 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
@@ -7,9 +7,9 @@
* * 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.
@@ -150,7 +150,7 @@ public class JU_DefaultOrg {
assertEquals(response.name(), "OK");
}
-
+
@Test
public void testDefOrgPasswords() {
assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "new2You!", "Pilgrim"),"");
@@ -255,15 +255,15 @@ public class JU_DefaultOrg {
// 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 32b32910..5281aa32 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
@@ -7,9 +7,9 @@
* * 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.
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 375cdfb1..712d47a0 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
@@ -7,9 +7,9 @@
* * 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.
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 ce34e2a1..fc9e424e 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
@@ -7,9 +7,9 @@
* * 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.
@@ -60,8 +60,8 @@ public class JU_Identities {
// ids = new Identities(fids);
// ids.open(trans, 5000);
// } else {
-//
-// throw new Exception("Data File for Tests, \"" + DATA_IDENTITIES
+//
+// throw new Exception("Data File for Tests, \"" + DATA_IDENTITIES
// + "\" must exist before test can run. (Current dir is " + System.getProperty("user.dir") + ")");
// }
// }
@@ -90,7 +90,7 @@ public class JU_Identities {
// @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.
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 7b0130bf..d627081d 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
@@ -7,9 +7,9 @@
* * 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.
@@ -97,7 +97,7 @@ public class JU_Passwords {
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"),"");
@@ -120,7 +120,7 @@ public class JU_Passwords {
// Solid
assertEquals(defaultOrg.isValidPassword(authzTransMock, null, "new2You!", "Pilgrim"),"");
-
+
}
}
diff --git a/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java b/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
index cee06dd2..19a150da 100644
--- a/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
+++ b/auth/auth-fs/src/main/java/org/onap/aaf/auth/fs/AAF_FS.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,8 +52,8 @@ public class AAF_FS extends AbsService<AuthzEnv, AuthzTrans> {
public AAF_FS(final AuthzEnv env) throws IOException, CadiException {
super(env.access(),env);
try {
- ///////////////////////
- // File Server
+ ///////////////////////
+ // File Server
///////////////////////
// creates StaticSlot, needed for CachingFileAccess, and sets to public Dir
env.staticSlot(CachingFileAccess.CFA_WEB_PATH,"aaf_public_dir");
@@ -70,7 +70,7 @@ public class AAF_FS extends AbsService<AuthzEnv, AuthzTrans> {
e.printStackTrace();
}
}
-
+
private static class Redirect extends HttpCode<AuthzTrans, AAF_FS> {
private final String url;
@@ -85,7 +85,7 @@ public class AAF_FS extends AbsService<AuthzEnv, AuthzTrans> {
resp.sendRedirect(url);
}
};
-
+
@Override
public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
// Note: No TAFs and Lurs on FileServer
@@ -101,7 +101,7 @@ public class AAF_FS extends AbsService<AuthzEnv, AuthzTrans> {
new RemoteRegistrant<AuthzEnv>(aafCon(),port)
};
}
-
+
public static void main(final String[] args) {
try {
Log4JLogIt logIt = new Log4JLogIt(args, "fs");
diff --git a/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java b/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java
index 9de694b7..f41f6ca5 100644
--- a/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java
+++ b/auth/auth-fs/src/test/java/org/onap/aaf/auth/fs/test/JU_AAF_FS.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
index e1870e94..5d243e9b 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java
@@ -7,9 +7,9 @@
* 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.
@@ -104,9 +104,9 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
public static final String HTTP_SERVLET_REQUEST = "HTTP_SERVLET_REQUEST";
public static final int TIMEOUT = 60000;
public static final String app = "AAF GUI";
-
+
// AAF API
-
+
// Certificate manager API
public RosettaDF<Artifacts> artifactsDF;
public RosettaDF<CertInfo> certInfoDF;
@@ -114,7 +114,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
private final AAFConHttp cmCon;
public final AAFConHttp aafCon;
public final AAFLurPerm lur;
-
+
public final Slot slot_httpServletRequest;
protected final String deployedVersion;
private StaticSlot sThemeWebPath;
@@ -126,12 +126,12 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
sDefaultTheme = env.staticSlot(AAF_GUI_THEME);
String defTheme = env.getProperty(AAF_GUI_THEME,"onap");
env.put(sDefaultTheme, defTheme);
-
+
sThemeWebPath = env.staticSlot(CachingFileAccess.CFA_WEB_PATH);
if(env.get(sThemeWebPath)==null) {
env.put(sThemeWebPath,"theme");
}
-
+
slot_httpServletRequest = env.slot(HTTP_SERVLET_REQUEST);
deployedVersion = app_version;
@@ -140,7 +140,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
cmCon = new AAFConHttp(env.access(),aaf_url_cm);
artifactsDF = env.newDataFactory(Artifacts.class);
certInfoDF = env.newDataFactory(CertInfo.class);
-
+
/////////////////////////
// Screens
@@ -158,7 +158,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
Page roleDetail = new Display(this, GET, new RoleDetail(this, start, myRoles)).page();
new Display(this, POST, new RoleDetailAction(this,start,myRoles,roleDetail));
new Display(this, GET, new RoleHistory(this,start,myRoles,roleDetail));
-
+
// MyNameSpace
final Page myNamespaces = new Display(this, GET, new NssShow(this, start)).page();
Page nsDetail = new Display(this, GET, new NsDetail(this, start, myNamespaces)).page();
@@ -168,48 +168,48 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
Page artiShow = new Display(this, GET, new CMArtifactShow(this, start, myNamespaces, nsDetail, crdDetail)).page();
Page artiCForm = new Display(this, GET, new CMArtiChangeForm(this, start, myNamespaces, nsDetail, crdDetail,artiShow)).page();
new Display(this, POST, new CMArtiChangeAction(this, start,artiShow,artiCForm));
-
+
// Password Change Screens
final Page pwc = new Display(this, GET, new PassChangeForm(this, start,crdDetail)).page();
new Display(this, POST, new PassChangeAction(this, start, pwc));
-
+
// Password Delete Screen
new Display(this, GET, new PassDeleteAction(this, start,crdDetail));
// Validation Change Screens
final Page validate = new Display(this, GET, new ApprovalForm(this, start)).page();
new Display(this, POST, new ApprovalAction(this, start, validate));
-
+
// Onboard, Detailed Edit Screens
final Page onb = new Display(this, GET, new NsInfoForm(this, start)).page();
new Display(this, POST, new NsInfoAction(this, start, onb));
// Web Command Screens
/* final Page webCommand =*/ new Display(this, GET, new WebCommand(this, start)).page();
-
+
// API Docs
final Page apidocs = new Display(this, GET, new ApiDocs(this, start)).page();
new Display(this, GET, new ApiExample(this,start, apidocs)).page();
-
+
// Permission Grant Page
final Page permGrant = new Display(this, GET, new PermGrantForm(this, start)).page();
new Display(this, POST, new PermGrantAction(this, start, permGrant)).page();
-
+
// Login Landing if no credentials detected
final Page loginLanding = new Display(this, GET, new LoginLanding(this, start)).page();
new Display(this, POST, new LoginLandingAction(this, start, loginLanding));
-
+
// User Role Request Extend and Remove
new Display(this, GET, new UserRoleExtend(this, start,myRoles)).page();
new Display(this, GET, new UserRoleRemove(this, start,myRoles)).page();
-
+
// See my Pending Requests
final Page requestsShow = new Display(this, GET, new PendingRequestsShow(this, start)).page();
new Display(this, GET, new RequestDetail(this, start, requestsShow));
-
+
// Command line Mechanism
route(env, PUT, "/gui/cui", new CUI(this),"text/plain;charset=utf-8","*/*");
-
+
route(env, GET, "/gui/clear", new HttpCode<AuthzTrans, Void>(null, "Clear"){
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
@@ -226,8 +226,8 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
resp.sendRedirect("/gui/home");
}
}, "text/plain;charset=utf-8","*/*");
-
- ///////////////////////
+
+ ///////////////////////
// WebContent Handler
///////////////////////
CachingFileAccess<AuthzTrans> cfa = new CachingFileAccess<AuthzTrans>(env);
@@ -237,11 +237,11 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
aafCon = aafCon();
lur = aafCon.newLur();
}
-
+
public<T> RosettaDF<T> getDF(Class<T> cls) throws APIException {
return Cmd.getDF(env,cls);
}
-
+
public void writeError(AuthzTrans trans, Future<?> fp, HTMLGen hgen, int indent) {
if (hgen!=null) {
String msg = aafCon.readableErrMsg(fp);
@@ -256,7 +256,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E
public<RET> RET cmClientAsUser(TaggedPrincipal p,Retryable<RET> retryable) throws APIException, LocatorException, CadiException {
return cmCon.hman().best(new HTransferSS(p,app, aafCon.securityInfo()), retryable);
}
-
+
@Override
public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
try {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java
index 621257b2..f056f4a7 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,7 +43,7 @@ public class BreadCrumbs extends NamedCode {
super(false,"breadcrumbs");
breadcrumbs = pages;
}
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
// BreadCrumbs
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/ContentCode.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/ContentCode.java
index 175236df..3619e43d 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/ContentCode.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/ContentCode.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Controls.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Controls.java
index 76cb18ac..3bec5405 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Controls.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Controls.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,7 +31,7 @@ public class Controls extends NamedCode {
public Controls() {
super(false,"controls");
}
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
hgen.incr("form","method=post")
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java
index 24262e8f..74b5acc6 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,14 +45,14 @@ public class Display {
/*
* We handle all the "Form POST" calls here with a naming convention that allows us to create arrays from strings.
- *
- * On the HTTP side, elements concatenate their name with their Index number (if multiple). In this code,
- * we turn such names into arrays with same index number. Then, we place them in the Transaction "Properties" so that
+ *
+ * On the HTTP side, elements concatenate their name with their Index number (if multiple). In this code,
+ * we turn such names into arrays with same index number. Then, we place them in the Transaction "Properties" so that
* it can be transferred to subclasses easily.
- */
+ */
if (meth.equals(HttpMethods.POST)) {
// Here, we'll expect FORM URL Encoded Data, which we need to get from the body
- gui.route(gui.env, meth, page.url(),
+ gui.route(gui.env, meth, page.url(),
new HttpCode<AuthzTrans,AAF_GUI>(gui,page.name()) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
@@ -90,8 +90,8 @@ public class Display {
} else {
// Transfer whether Page shouldn't be cached to local Final var.
final boolean no_cache = page.no_cache;
-
- gui.route(gui.env, meth, page.url(),
+
+ gui.route(gui.env, meth, page.url(),
new HttpCode<AuthzTrans,AAF_GUI>(gui,page.name()) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
@@ -105,7 +105,7 @@ public class Display {
} else { // multi value
String[] array = new String[30];
String field=fields[i].substring(0, idx);
-
+
for (Enumeration<String> mm = req.getParameterNames();mm.hasMoreElements();) {
String key = mm.nextElement();
if (key.startsWith(field)) {
@@ -127,7 +127,7 @@ public class Display {
}
page.replay(context,trans,resp.getOutputStream(),"general");
}
-
+
/**
* When the field is "as_user", make sure permission is granted
*/
@@ -146,8 +146,8 @@ public class Display {
}
}
-
- public Page page() {
+
+ public Page page() {
return get;
}
} \ No newline at end of file
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java
index 40aef8fb..caa58601 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,18 +30,18 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
public class Form extends NamedCode {
private String preamble;
private NamedCode content;
-
+
public Form(boolean no_cache, NamedCode content) {
super(no_cache,content);
this.content = content;
preamble=null;
}
-
+
public Form preamble(String preamble) {
this.preamble = preamble;
return this;
}
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
@@ -49,9 +49,9 @@ public class Form extends NamedCode {
hgen.incr("p","class=preamble").text(preamble).end();
}
hgen.incr("form","method=post");
-
+
content.code(cache, hgen);
-
+
hgen.tagOnly("input", "type=submit", "value=Submit")
.tagOnly("input", "type=reset", "value=Reset")
.end();
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java
index 435197c8..22069c55 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,16 +25,16 @@ public abstract class NamedCode implements ContentCode {
private final boolean no_cache;
private String name;
private String[] idattrs;
-
+
/*
- * Mark whether this code should not be cached, and any attributes
+ * Mark whether this code should not be cached, and any attributes
*/
public NamedCode(final boolean no_cache, final String name) {
this.name = name;
idattrs = new String[] {name};
this.no_cache = no_cache;
}
-
+
public NamedCode(boolean no_cache, NamedCode content) {
this.no_cache = no_cache;
name=content.name;
@@ -48,7 +48,7 @@ public abstract class NamedCode implements ContentCode {
public String[] idattrs() {
return idattrs;
}
-
+
public void addAttr(boolean first, String attr) {
String[] temp = new String[idattrs.length+1];
if (first) {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java
index deed77c0..9240ce4c 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java
@@ -7,9 +7,9 @@
* * 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.
@@ -40,7 +40,7 @@ import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.principal.TaggedPrincipal;
public class OrgLookupFilter implements Filter {
-
+
@Override
public void init(FilterConfig arg0) throws ServletException {
}
@@ -69,7 +69,7 @@ public class OrgLookupFilter implements Filter {
}
fc.doFilter(req, resp);
}
-
+
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java
index 02654696..1d797aad 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java
@@ -7,9 +7,9 @@
* 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.
@@ -63,8 +63,8 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
import org.onap.aaf.misc.xgen.html.Imports;
/**
- * A Base "Mobile First" Page
- *
+ * A Base "Mobile First" Page
+ *
* @author Jonathan
*
*/
@@ -92,7 +92,7 @@ public class Page extends HTMLCacheGen {
// Note: Only access is synchronized in "getPerm"
private final static Map<String,Map<String,Permission>> perms = new HashMap<>();
-
+
/*
* Relative path, Menu Name, Full Path
*/
@@ -113,15 +113,15 @@ public class Page extends HTMLCacheGen {
public String name() {
return bcName;
}
-
+
public String url() {
return bcUrl;
}
-
+
public String[] fields() {
return fields;
}
-
+
public Page(AuthzEnv env, String name, String url, Enum<?>[] en, final NamedCode ...content) throws APIException, IOException {
super(CacheGen.PRETTY, new PageCode(env, 1, content));
fields = new String[en.length];
@@ -135,7 +135,7 @@ public class Page extends HTMLCacheGen {
// Mark which fields must be "no_cache"
boolean no_cacheTemp=false;
for (NamedCode nc : content) {
- if (nc.no_cache()) {
+ if (nc.no_cache()) {
no_cacheTemp=true;
break;
}
@@ -145,7 +145,7 @@ public class Page extends HTMLCacheGen {
public Page(AuthzEnv env, String name, String url, String [] fields, final NamedCode ... content) throws APIException,IOException {
this(env,name,url,1,fields,content);
}
-
+
public Page(AuthzEnv env, String name, String url, int backdots, String [] fields, final NamedCode ... content) throws APIException,IOException {
super(CacheGen.PRETTY, new PageCode(env, backdots, content));
if (fields==null) {
@@ -158,19 +158,19 @@ public class Page extends HTMLCacheGen {
// Mark which fields must be "no_cache"
boolean no_cacheTemp=false;
for (NamedCode nc : content) {
- if (nc.no_cache()) {
+ if (nc.no_cache()) {
no_cacheTemp=true;
break;
}
}
no_cache=no_cacheTemp;
}
-
-
+
+
private static class PageCode implements Code<HTMLGen> {
private static final String AAF_GUI_THEME = "aaf.gui.theme";
private static final String AAF_GUI_TITLE = "aaf_gui_title";
-
+
private final ContentCode[] content;
private final Slot browserSlot;
private final int backdots;
@@ -210,7 +210,7 @@ public class Page extends HTMLCacheGen {
props = new Properties();
themeProps.put(t.getName(), props);
}
-
+
try {
FileInputStream fis = new FileInputStream(f);
try {
@@ -233,7 +233,7 @@ public class Page extends HTMLCacheGen {
}
return themes.get(theme);
}
-
+
protected Imports getImports(Env env, String theme, int backdots, BROWSER browser) {
List<String> ls = getThemeFiles(env,theme);
Imports imp = new Imports(backdots);
@@ -258,10 +258,10 @@ public class Page extends HTMLCacheGen {
}
return imp;
}
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
- // Note: I found that App Storage saves everything about the page, or not. Thus, if you declare the page uncacheable, none of the
+ // Note: I found that App Storage saves everything about the page, or not. Thus, if you declare the page uncacheable, none of the
// Artifacts, like JPGs are stored, which makes this feature useless for Server driven elements
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI,AuthzTrans>() {
@Override
@@ -277,14 +277,14 @@ public class Page extends HTMLCacheGen {
});
hgen.html();
final String title = env.getProperty(AAF_GUI_TITLE,"Authentication/Authorization Framework");
- final String defaultTheme = env.get(sTheme,"onap");
-
+ final String defaultTheme = env.get(sTheme,"onap");
+
Mark head = hgen.head();
hgen.leaf(TITLE).text(title).end();
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI,AuthzTrans>() {
@Override
public void code(AAF_GUI state, AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
- BROWSER browser = browser(trans,browserSlot);
+ BROWSER browser = browser(trans,browserSlot);
String theme = null;
Cookie[] cookies = trans.hreq().getCookies();
if(cookies!=null) {
@@ -298,7 +298,7 @@ public class Page extends HTMLCacheGen {
}
}
}
-
+
if(theme==null) {
for(String t : themes.keySet()) {
if(!t.equals(defaultTheme) && trans.fish(new AAFPermission(null,trans.user()+":id", AAF_GUI_THEME, t))) {
@@ -311,7 +311,7 @@ public class Page extends HTMLCacheGen {
}
List<String> ls = getThemeFiles(trans, theme);
if(ls==null) {
- throw new APIException("Theme " + theme + " does not exist.");
+ throw new APIException("Theme " + theme + " does not exist.");
}
Cookie cookie = new Cookie(AAF_GUI_THEME,theme);
cookie.setMaxAge(604_800); // one week
@@ -329,11 +329,11 @@ public class Page extends HTMLCacheGen {
break;
default:
}
-
+
}
});
hgen.end(head);
-
+
Mark body = hgen.body();
Mark header = hgen.header();
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI,AuthzTrans>() {
@@ -345,7 +345,7 @@ public class Page extends HTMLCacheGen {
String env = trans.getProperty(Config.AAF_ENV,"N/A");
xgen.leaf(H1).text(title + " on " + env).end();
xgen.leaf("p","id=version").text("AAF Version: " + state.deployedVersion).end();
-
+
// Obtain User Info, and print
TaggedPrincipal p = trans.getUserPrincipal();
String user,secured;
@@ -361,11 +361,11 @@ public class Page extends HTMLCacheGen {
.text("<sup>")
.text(secured)
.text("</sup>").end();
-
+
switch(browser(trans,browserSlot)) {
case ieOld:
case ie:
- xgen.incr("h5").text("This app is Mobile First HTML5. Internet Explorer "
+ xgen.incr("h5").text("This app is Mobile First HTML5. Internet Explorer "
+ " does not support all HTML5 standards. Old, non TSS-Standard versions may not function correctly.").br()
.text(" For best results, use a highly compliant HTML5 browser like Firefox.")
.end();
@@ -374,9 +374,9 @@ public class Page extends HTMLCacheGen {
}
}
});
-
+
hgen.hr();
-
+
int cIdx;
ContentCode nc;
// If BreadCrumbs, put here
@@ -389,7 +389,7 @@ public class Page extends HTMLCacheGen {
} else {
cIdx = 0;
}
-
+
hgen.end(header);
hgen.divID("pageContent");
@@ -402,9 +402,9 @@ public class Page extends HTMLCacheGen {
hgen.end(ctnt);
}
- hgen.end(inner);
+ hgen.end(inner);
+
-
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI,AuthzTrans>() {
@Override
public void code(AAF_GUI state, AuthzTrans trans,Cache<HTMLGen> cache, HTMLGen xgen) throws APIException, IOException {
@@ -415,7 +415,7 @@ public class Page extends HTMLCacheGen {
} else {
props = themeProps==null?null:themeProps.get(theme);
}
-
+
if(props!=null && "TRUE".equalsIgnoreCase(props.getProperty("enable_nav_btn"))) {
xgen.leaf("button", "id=navBtn").end();
}
@@ -434,7 +434,7 @@ public class Page extends HTMLCacheGen {
} else {
props = themeProps==null?null:themeProps.get(theme);
}
-
+
if(props!=null) {
if("TRUE".equalsIgnoreCase(props.getProperty("main_menu_in_nav"))) {
xgen.incr("h2").text("Navigation").end();
@@ -516,15 +516,15 @@ public class Page extends HTMLCacheGen {
hgen.end();
}
hgen.end();
-
+
hgen.hr();
-
+
hgen.end(nav);
// Footer - Using older Footer to work with decrepit IE versions
Mark footer = hgen.divID("footer");
hgen.textCR(1, env.getProperty(AAF_GUI.AAF_GUI_COPYRIGHT))
.end(footer);
-
+
hgen.end(body);
hgen.endAll();
}
@@ -533,27 +533,27 @@ public class Page extends HTMLCacheGen {
public static String getBrowserType() {
return BROWSER_TYPE;
}
-
+
/**
* It's IE if int >=0
- *
+ *
* Use int found in "ieVersion"
- *
+ *
* Official IE 7
- * Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322;
+ * Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322;
* .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
* Official IE 8
- * Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2;
+ * Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2;
* .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; ATT)
- *
+ *
* IE 11 Compatibility
- * Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727;
+ * Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727;
* .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; InfoPath.3; HVD; ATT)
- *
+ *
* IE 11 (not Compatiblity)
- * Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727;
+ * Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727;
* .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; InfoPath.3; HVD; ATT)
- *
+ *
* @param trans
* @return
*/
@@ -561,7 +561,7 @@ public class Page extends HTMLCacheGen {
BROWSER br = trans.get(slot, null);
if (br==null) {
String agent = trans.agent();
- int msie;
+ int msie;
if (agent.contains("iPhone") /* other phones? */) {
br=BROWSER.iPhone;
} else if ((msie = agent.indexOf("MSIE"))>=0) {
@@ -581,7 +581,7 @@ public class Page extends HTMLCacheGen {
}
return br;
}
-
+
/*
* Get, rather than create each time, permissions for validations
*/
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java
index 7462de80..ba1e1e3b 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,7 +39,7 @@ public abstract class SlotCode<TRANS extends TransStore> extends NamedCode {
public<T> T get(TRANS trans,Enum<?> en, T dflt) {
return get(trans,en.ordinal(),dflt);
}
-
+
public<T> T get(TRANS trans,int idx, T dflt) {
if (idx>slots.length) {
return dflt;
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java
index 6451c4e7..bcef6de9 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java
@@ -7,9 +7,9 @@
* 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.
@@ -53,7 +53,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
this(title,trans,data,name, attrs);
this.other = other;
}
-
+
public Table(String title, TRANS trans, Data<S,TRANS> data, String name, String ... attrs) {
super(true,name);
// prefix=postfix=null;
@@ -73,7 +73,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
this.title = title;
// Derive an ID from title (from no spaces, etc), and prepend to IDAttributes (Protected from NamedCode)
addAttr(true,title(trans).replaceAll("\\s",""));
-
+
other = null;
}
@@ -87,12 +87,12 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
});
Mark table = new Mark();
Mark tr = new Mark();
-
+
hgen.incr(table,TABLE);
if (title==null) {
cache.dynamic(hgen, new DynamicCode<HTMLGen,S,TRANS>() {
@Override
- public void code(S state, TRANS trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
+ public void code(S state, TRANS trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
hgen.leaf("caption", "class=title").text(title(trans)).end();
}
});
@@ -104,16 +104,16 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
hgen.leaf("th").text(column).end();
}
hgen.end(tr);
-
+
// Load Rows Dynamically
cache.dynamic(hgen, rows);
// End Table
- hgen.end(table);
-
+ hgen.end(table);
+
if (other!=null) {
other.code(cache,hgen);
}
-
+
// Print Message from Row Gathering, if available
cache.dynamic(hgen, new DynamicCode<HTMLGen,S,TRANS>() {
@Override
@@ -122,7 +122,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
if ((msg = trans.get(EMPTY_TABLE_SLOT, null))!=null) {
hgen.incr("style").text("#inner tr,caption,input,p.preamble {display: none;}#inner p.notfound {margin: 0px 0px 0px 20px}").end();
hgen.incr(HTMLGen.P,"class=notfound").text(msg).end().br();
- } else if ((msg=trans.get(ROW_MSG_SLOT,null))!=null) {
+ } else if ((msg=trans.get(ROW_MSG_SLOT,null))!=null) {
hgen.p(msg).br();
}
}
@@ -146,7 +146,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
cells = new AbsCell[0][0];
msg = "No Data Found";
}
-
+
public Cells(ArrayList<AbsCell[]> arrayCells, String msg) {
cells = new AbsCell[arrayCells.size()][];
arrayCells.toArray(cells);
@@ -154,9 +154,9 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
}
public AbsCell[][] cells;
public String msg;
-
+
}
-
+
public interface Data<S extends State<Env>, TRANS extends Trans> {
// Note: Trans is not first to avoid Method Name Collision
public void prefix(S state, TRANS trans, final Cache<HTMLGen> cache, final HTMLGen hgen);
@@ -168,17 +168,17 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
private class Rows extends DynamicCode<HTMLGen,S,TRANS> {
private Data<S,TRANS> data;
private int alt;
-
+
public Rows(Data<S,TRANS> data, int alt) {
this.data = data;
this.alt = alt;
}
-
+
@Override
public void code(final S state, final TRANS trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
Mark tr = new Mark();
Mark td = new Mark();
-
+
int alt = this.alt;
Cells cells = data.get(trans,state);
if (cells.cells.length>0) {
@@ -220,7 +220,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named
// prefix = dynamicCode;
// return this;
// }
-//
+//
// public Table<S,TRANS> setPostfix(DynamicCode<HTMLGen, AuthGUI, AuthzTrans> dynamicCode) {
// postfix = dynamicCode;
// return this;
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java
index cf3a6715..bec41ac8 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java
@@ -34,7 +34,7 @@ public class XFrameFilter implements Filter {
enum TYPE {none,self};
// Note: Content-Security Params need to be worked out for GUI before activating.
private final String xframe;//,csp;
-
+
public XFrameFilter(TYPE type) {
switch(type) {
case self:
@@ -46,10 +46,10 @@ public class XFrameFilter implements Filter {
xframe="DENY";
// csp="default-src 'none'";
break;
-
+
}
}
-
+
@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain fc) throws IOException, ServletException {
if (resp instanceof HttpServletResponse) {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java
index 39e4d0b6..b171695e 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java
@@ -59,11 +59,11 @@ public class ApiDocs extends Page {
private static final String fields[] = {};
private static final String ERROR_LINK = "<a href=\"./example/"
+ "YXBwbGljYXRpb24vRXJyb3IranNvbg=="
-// + Symm.base64noSplit().encode("application/Error+json")
+// + Symm.base64noSplit().encode("application/Error+json")
+ "\">JSON</a> "
+ "<a href=\"./example/"
+ "YXBwbGljYXRpb24vRXJyb3IreG1s"
-// + Symm.base64noSplit().encode("application/Error+xml")
+// + Symm.base64noSplit().encode("application/Error+xml")
+ "\">XML</a> ";
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java
index 7da77607..9d28d1dc 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,7 +40,7 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
/**
* Detail Page for Permissions
- *
+ *
* @author Jonathan
*
*/
@@ -54,7 +54,7 @@ public class ApiExample extends Page {
new Model(NAME)
);
}
-
+
private static class Model extends NamedCode {
private static final String WITH_OPTIONAL_PARAMETERS = "\n\n////////////\n Data with Optional Parameters \n////////////\n\n";
@@ -86,8 +86,8 @@ public class ApiExample extends Page {
} else {
fs2=null;
}
-
-
+
+
if (fp.get(5000)) {
xgen.incr(HTMLGen.H1).text("Sample Code").end()
.incr(HTMLGen.H5).text(typecode).end();
@@ -123,11 +123,11 @@ public class ApiExample extends Page {
tt.done();
}
}
-
+
});
xgen.end(inner);
}
}
-}
+}
\ No newline at end of file
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java
index 8c90b491..18499ac8 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,9 +50,9 @@ public class ApprovalAction extends Page {
new NamedCode(true,"content") {
final Slot sAppr = gui.env.slot(ApprovalForm.NAME+'.'+ApprovalForm.FIELDS[0]);
final Slot sUser = gui.env.slot(ApprovalForm.NAME+'.'+ApprovalForm.FIELDS[1]);
-
+
@Override
- public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
+ public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI, AuthzTrans>() {
@Override
public void code(final AAF_GUI gui, final AuthzTrans trans,final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
@@ -62,7 +62,7 @@ public class ApprovalAction extends Page {
if (user != null) {
lastPage += "?user="+user;
}
-
+
if (appr==null) {
hgen.p("No Approvals have been selected.");
} else {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java
index cb868b16..a5337369 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java
@@ -7,9 +7,9 @@
* 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.
@@ -67,8 +67,8 @@ public class ApprovalForm extends Page {
static final String NAME="Approvals";
static final String HREF = "/gui/approve";
static final String[] FIELDS = new String[] {"line[]","user","delegate_of","as_user"};
-
-
+
+
public ApprovalForm(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, FIELDS,
@@ -106,38 +106,38 @@ public class ApprovalForm extends Page {
}
});
}
-
+
/**
* Implement the Table Content for Approvals
- *
+ *
* @author Jonathan
*
*/
private static class Model extends TableData<AAF_GUI,AuthzTrans> {
//TODO come up with a generic way to do ILM Info (people page)
// private static final String TODO_ILM_INFO = "TODO: ILM Info";
-
-
+
+
private static final String[] headers = new String[] {"Identity","Request","Approve","Deny"};
private Slot sUser;
private Slot sAsDelegate;
private Slot sAsUser;
-
+
public Model(AuthzEnv env) {
sUser = env.slot(NAME+".user");
sAsDelegate = env.slot(NAME+".delegate_of");
sAsUser = env.slot(NAME + ".as_user");
}
-
+
@Override
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final String userParam = trans.get(sUser, null);
-
+
final String asDelegate = trans.get(sAsDelegate, null);
final String approver;
if(asDelegate==null) {
@@ -145,7 +145,7 @@ public class ApprovalForm extends Page {
} else {
approver = asDelegate;
}
-
+
ArrayList<AbsCell[]> rv = new ArrayList<>();
String msg = null;
TimeTaken tt = trans.start("AAF Get Approvals for Approver",Env.REMOTE);
@@ -158,7 +158,7 @@ public class ApprovalForm extends Page {
Future<Approvals> fa = client.read("/authz/approval/approver/"+approver,gui.getDF(Approvals.class));
int numLeft = 0;
if (fa.get(AAF_GUI.TIMEOUT)) {
-
+
if (fa.value!=null) {
for (Approval appr : fa.value.getApprovals()) {
if ("pending".equals(appr.getStatus())) {
@@ -170,10 +170,10 @@ public class ApprovalForm extends Page {
}
}
}
-
+
String prevApprover = null;
int overallIndex = 0;
-
+
for (Approval appr : pendingApprovals) {
String currApprover = appr.getApprover();
if (!currApprover.equals(prevApprover)) {
@@ -186,7 +186,7 @@ public class ApprovalForm extends Page {
return numLeft;
}
});
-
+
if (!pendingApprovals.isEmpty()) {
// Only add select all links if we have approvals
AbsCell[] selectAllRow = new AbsCell[] {
@@ -197,14 +197,14 @@ public class ApprovalForm extends Page {
};
rv.add(selectAllRow);
}
-
+
int line=-1;
-
+
while (!beginIndicesPerApprover.isEmpty()) {
int beginIndex = beginIndicesPerApprover.remove(0);
int endIndex = (beginIndicesPerApprover.isEmpty()?pendingApprovals.size():beginIndicesPerApprover.get(0));
List<Approval> currApproverList = pendingApprovals.subList(beginIndex, endIndex);
-
+
Identity iapprover = trans.org().getIdentity(trans,currApproverList.get(0).getApprover());
if(iapprover==null) {
rv.add(new AbsCell[] {
@@ -213,25 +213,25 @@ public class ApprovalForm extends Page {
});
} else {
if (!iapprover.fullID().equals(trans.user())) {
-
+
AbsCell[] approverHeader;
// if (domainOfUser.equals(domainOfApprover)) {
- // approverHeader = new AbsCell[] {
+ // approverHeader = new AbsCell[] {
// new TextAndRefCell("Approvals Delegated to Me by ", currApproverFull,
- // TODO_ILM_INFO + currApproverShort,
+ // TODO_ILM_INFO + currApproverShort,
// true,
// new String[] {"colspan=4", "class=head"})
// };
// } else {
- approverHeader = new AbsCell[] {
- new TextCell("Approvals Delegated to Me by " + iapprover.fullName()
+ approverHeader = new AbsCell[] {
+ new TextCell("Approvals Delegated to Me by " + iapprover.fullName()
+ '(' + iapprover.id() + ')',
new String[] {"colspan=4", "class=head"})
};
// }
rv.add(approverHeader);
}
-
+
// Sort by User Requesting
Collections.sort(currApproverList, new Comparator<Approval>() {
@Override
@@ -239,16 +239,16 @@ public class ApprovalForm extends Page {
return a1.getUser().compareTo(a2.getUser());
}
});
-
+
String prevUser = null;
boolean userOK=true;
for (Approval appr : currApproverList) {
if (++line<MAX_LINE) { // limit number displayed at one time.
AbsCell userCell;
String user = appr.getUser();
-
+
if (user.equals(prevUser)) {
- userCell = AbsCell.Null;
+ userCell = AbsCell.Null;
} else if (user.endsWith(trans.org().getRealm())){
userOK=true;
String title;
@@ -266,7 +266,7 @@ public class ApprovalForm extends Page {
if (managedBy==null) {
title ="Identity: " + au.type();
} else {
- title="Sponsor: " + managedBy.fullName();
+ title="Sponsor: " + managedBy.fullName();
}
userCell = new TextToolTipCell(au.fullID(),title);
}
@@ -280,7 +280,7 @@ public class ApprovalForm extends Page {
// TODO_ILM_INFO+user.substring(0, user.length()-domainOfApprover.length()),
// true,
// title);
-
+
} else {
userCell = new TextCell(user);
}
@@ -302,7 +302,7 @@ public class ApprovalForm extends Page {
}
if (rv.isEmpty()) {
if (numLeft>0) {
- msg = "No Approvals to process at this time for user " + userParam +". You have "
+ msg = "No Approvals to process at this time for user " + userParam +". You have "
+ numLeft + " other approvals to process.";
} else {
msg = "No Approvals to process at this time";
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java
index c6821199..8f3fe958 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -67,7 +67,7 @@ public class CMArtiChangeAction extends Page {
final Slot sOther = gui.env.slot(CMArtiChangeForm.NAME+'.'+CMArtiChangeForm.fields[9]);
final Slot sType = gui.env.slot(CMArtiChangeForm.NAME+'.'+CMArtiChangeForm.fields[10]);
final Slot sSans = gui.env.slot(CMArtiChangeForm.NAME+'.'+CMArtiChangeForm.fields[11]);
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI, AuthzTrans>() {
@@ -83,7 +83,7 @@ public class CMArtiChangeAction extends Page {
arti.getSans().add(s);
}
}
-
+
// These checks to not apply to deletions
if(!CMArtiChangeForm.DELETE.equals(trans.get(sCmd, ""))) {
// Disallow IP entries, except by special Permission
@@ -105,9 +105,9 @@ public class CMArtiChangeAction extends Page {
return;
}
}
-
+
}
-
+
arti.setMechid((String)trans.get(sID,null));
arti.setMachine(machine);
arti.setNs((String)trans.get(sNS,null));
@@ -128,11 +128,11 @@ public class CMArtiChangeAction extends Page {
hgen.p("Data Entry Failure: Please enter a valid ID, including domain.");
// VALIDATE OTHERS?
} else { // everything else is checked by Server
-
+
try {
final Artifacts artifacts = new Artifacts();
artifacts.getArtifact().add(arti);
- final Holder<Boolean> ok = new Holder<Boolean>(false);
+ final Holder<Boolean> ok = new Holder<Boolean>(false);
final Holder<Boolean> deleted = new Holder<Boolean>(false);
Future<?> f = gui.cmClientAsUser(trans.getUserPrincipal(), new Retryable<Future<?>>() {
@Override
@@ -221,7 +221,7 @@ public class CMArtiChangeAction extends Page {
hgen.p("Unknown Error");
e.printStackTrace();
}
-
+
}
hgen.br();
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java
index ee55fdbc..9df54107 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,18 +55,18 @@ import certman.v1_0.Artifacts.Artifact;
public class CMArtiChangeForm extends Page {
private static final String COPY_ARTIFACT = "copyArtifact";
private static final String DELETE_ARTIFACT = "deleteArtifact";
-
+
// Package on purpose
static final String HREF = "/gui/artichange";
static final String NAME = "ArtifactChange";
static final String fields[] = {"id","machine","ns","directory","ca","osuser","renewal","notify","cmd","others","types[]","sans"};
-
+
static final String types[] = {"pkcs12","jks","file","script"};
static final String UPDATE = "Update";
static final String CREATE = "Create";
static final String COPY = "Copy";
static final String DELETE = "Delete";
-
+
public CMArtiChangeForm(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, fields,
new BreadCrumbs(breadcrumbs),
@@ -74,7 +74,7 @@ public class CMArtiChangeForm extends Page {
private final Slot sID = gui.env.slot(CMArtiChangeForm.NAME+'.'+CMArtiChangeForm.fields[0]);
private final Slot sMach = gui.env.slot(CMArtiChangeForm.NAME+'.'+CMArtiChangeForm.fields[1]);
private final Slot sNS = gui.env.slot(CMArtiChangeForm.NAME+'.'+CMArtiChangeForm.fields[2]);
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
Mark js = new Mark();
@@ -121,7 +121,7 @@ public class CMArtiChangeForm extends Page {
hgen.leaf(HTMLGen.TITLE).text("Certificate Artifact Form").end();
Mark form = new Mark();
hgen.incr(form, "form","action="+HREF,"method=post");
-
+
cache.dynamic(hgen, new DynamicCode<HTMLGen, AAF_GUI, AuthzTrans>() {
@Override
public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
@@ -199,7 +199,7 @@ public class CMArtiChangeForm extends Page {
}
sb.append(s);
}
-
+
hgen.text("IPs allowed, separated by commas.").end()
.input(fields[11], "SANs", false, "value="+(sb==null?"":sb.toString()),"style=width:130%;");
// }
@@ -215,7 +215,7 @@ public class CMArtiChangeForm extends Page {
for (int i=0;i<types.length;++i) {
hgen.leaf("input","type=checkbox","name=types."+i,arti.getType().contains(types[i])?"checked":"").text(types[i]).end().br();
}
-
+
Mark tr = new Mark();
hgen.incr(tr,HTMLGen.TR).incr(HTMLGen.TD,"id=trcopy")
.leaf("input","id=cbcopy","type=checkbox","onclick="+COPY_ARTIFACT+"()").text("Copy Artifact").end(2)
@@ -228,10 +228,10 @@ public class CMArtiChangeForm extends Page {
.leaf("input","id=cbdelete","type=checkbox","onclick="+DELETE_ARTIFACT+"()",delete?"style:display:none;":"").text("Delete Artifact").end(2)
.end(tr);
hgen.end(table);
-
+
hgen.tagOnly("input","id="+fields[8],"name="+fields[8],"value="+submitText,"style=display:none;");
hgen.tagOnly("input","id=theButton","type=submit", "orig="+submitText,"value="+submitText);
-
+
} catch (CadiException | LocatorException | OrganizationException e) {
throw new APIException(e);
}
@@ -241,6 +241,6 @@ public class CMArtiChangeForm extends Page {
hgen.end(form);
}
});
-
+
}
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java
index 85797cb5..2362951b 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java
@@ -7,9 +7,9 @@
* 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.
@@ -63,7 +63,7 @@ import certman.v1_0.Artifacts.Artifact;
import certman.v1_0.CertInfo;
public class CMArtifactShow extends Page {
-
+
public static final String HREF = "/gui/cmarti";
public static final String NAME = "ArtifactsShow";
private static ArtiTable arti;
@@ -72,14 +72,14 @@ public class CMArtifactShow extends Page {
public CMArtifactShow(final AAF_GUI gui, Page ... breadcrumbs) throws APIException, IOException {
- super(gui.env, NAME, HREF, Params.values() ,
+ super(gui.env, NAME, HREF, Params.values() ,
new BreadCrumbs(breadcrumbs),
arti = new ArtiTable(gui.env)
);
// Setting so we can get access to HTMLGen clone and Slots
arti.set(this,slotCode);
}
-
+
private static class ArtiTable extends Table<AAF_GUI, AuthzTrans> {
private static Model model;
private SlotCode<AuthzTrans> sc;
@@ -108,13 +108,13 @@ public class CMArtifactShow extends Page {
}
},"class=std");
}
-
+
public void set(CMArtifactShow cmArtifactShow, SlotCode<AuthzTrans> sc) {
this.sc = sc;
model.set(cmArtifactShow,sc);
}
-
+
@Override
protected String title(AuthzTrans trans) {
StringBuilder sb = new StringBuilder("X509 Certificates");
@@ -132,7 +132,7 @@ public class CMArtifactShow extends Page {
}
/**
* Implement the table content for Cred Detail
- *
+ *
* @author Jeremiah
*
*/
@@ -151,7 +151,7 @@ public class CMArtifactShow extends Page {
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
String str = sc.get(trans,Params.id, null);
@@ -167,7 +167,7 @@ public class CMArtifactShow extends Page {
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<CertInfo> fuCI = client.read("/cert/id/"+id,gui.certInfoDF);
Future<Artifacts> fuArt = client.read("/cert/artifacts?mechid="+id, gui.artifactsDF);
-
+
X509Certificate[] lc;
if (fuCI.get(AAFcli.timeout())) {
TimeTaken tt1 = trans.start("x509Certificate", Env.SUB);
@@ -214,7 +214,7 @@ public class CMArtifactShow extends Page {
}
rv.add(new AbsCell[] {
- new TextCell(arti.getMachine(),"style=width:20%;"),
+ new TextCell(arti.getMachine(),"style=width:20%;"),
new TextCell(arti.getDir(),"style=width:25%;"),
new TextCell(arti.getCa(),"style=width:2%;text-align:center;"),
new TextCell(renew==null?
@@ -247,5 +247,5 @@ public class CMArtifactShow extends Page {
}
}
-
+
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java
index 70d86933..07aa99a6 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java
@@ -7,9 +7,9 @@
* 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.
@@ -67,7 +67,7 @@ import certman.v1_0.Artifacts;
import certman.v1_0.Artifacts.Artifact;
public class CredDetail extends Page {
-
+
public static final String HREF = "/gui/creddetail";
public static final String NAME = "CredDetail";
private static Model model;
@@ -76,7 +76,7 @@ public class CredDetail extends Page {
public CredDetail(final AAF_GUI gui, Page ... breadcrumbs) throws APIException, IOException {
- super(gui.env, NAME, HREF, Params.values(),
+ super(gui.env, NAME, HREF, Params.values(),
new BreadCrumbs(breadcrumbs),
new Table<AAF_GUI,AuthzTrans>("Cred Details",gui.env.newTransNoAvg(),model = new Model(),
slotCode = new SlotCode<AuthzTrans>(false,gui.env,NAME,Params.values()) {
@@ -109,7 +109,7 @@ public class CredDetail extends Page {
});
}
},"class=std")
-
+
);
// Setting so we can get access to HTMLGen clone
model.set(this,slotCode);
@@ -119,7 +119,7 @@ public class CredDetail extends Page {
/**
* Implement the table content for Cred Detail
- *
+ *
* @author Jeremiah
*
*/
@@ -136,7 +136,7 @@ public class CredDetail extends Page {
cd = credDetail;
sc = slotCode;
}
-
+
@Override
public void prefix(AAF_GUI state, AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) {
}
@@ -150,7 +150,7 @@ public class CredDetail extends Page {
}
final ArrayList<AbsCell[]> rv = new ArrayList<>();
final TimeTaken tt = trans.start("AAF Cred Details",Env.REMOTE);
- List<Artifact> la;
+ List<Artifact> la;
try {
la = gui.cmClientAsUser(trans.getUserPrincipal(), new Retryable<List<Artifact>>() {
@Override
@@ -177,11 +177,11 @@ public class CredDetail extends Page {
if (fu.get(AAFcli.timeout())) {
// Organize User entries
Map<String,List<Map<Integer,List<User>>>> users = new HashMap<>();
-
+
List<Map<Integer,List<User>>> lmu=null;
Map<Integer, List<User>> mu = null;
List<User> lu = null;
-
+
for (User u : fu.value.getUser()) {
if (u.getType() == 200) {
lns.remove(u.getId());
@@ -196,11 +196,11 @@ public class CredDetail extends Page {
mu = xmu;
}
}
-
+
if (mu==null) {
lmu.add(mu=new HashMap<>());
}
-
+
lu = mu.get(u.getType());
if (lu==null) {
mu.put(u.getType(),lu = new ArrayList<>());
@@ -215,7 +215,7 @@ public class CredDetail extends Page {
HTMLGen hgen = cd.clone(buttons);
hgen.leaf("button","onclick=divVisibility('"+key+"');","class=button").text("Expand").end();
hgen.leaf(HTMLGen.A,"class=button","class=greenbutton","href="+CredHistory.HREF+"?user="+ulm.getKey()).text("History").end();
-
+
StringWriter creds = new StringWriter();
hgen = cd.clone(creds);
Mark div = hgen.divID(key,ulm.getKey().equals(id)?"":"style=display:none;");
@@ -226,7 +226,7 @@ public class CredDetail extends Page {
Mark uRow = new Mark();
String cls;
boolean first = true;
-
+
for ( Entry<Integer, List<User>> es : miu.entrySet()) {
Collections.sort(es.getValue(),new Comparator<User>() {
@Override
@@ -256,8 +256,8 @@ public class CredDetail extends Page {
if (first) {
hgen.leaf(HTMLGen.TD,cls="class=detailFirst",STYLE_WIDTH_10);
switch(es.getKey()) {
- case 1:
- case 2: hgen.text("Password");
+ case 1:
+ case 2: hgen.text("Password");
break;
case 10: hgen.text("Certificate"); break;
}
@@ -266,7 +266,7 @@ public class CredDetail extends Page {
}
hgen.end();
hgen.incr(HTMLGen.TD,cls,STYLE_WIDTH_20);
-
+
hgen.leaf(HTMLGen.A,
"class=button",
"href="+PassDeleteAction.HREF+
@@ -284,7 +284,7 @@ public class CredDetail extends Page {
hgen.end().leaf(HTMLGen.TD,cls,STYLE_WIDTH_70)
.text(Chrono.niceDateStamp(u.getExpires()))
.end();
-
+
hgen.end(uRow);
}
}
@@ -305,15 +305,15 @@ public class CredDetail extends Page {
.end(uRow);
}
-
+
}
hgen.end(utable);
}
-
+
hgen.end(div);
rv.add(new AbsCell[] {
- new TextCell(ulm.getKey(),STYLE_WIDTH_15),
+ new TextCell(ulm.getKey(),STYLE_WIDTH_15),
new TextCell(buttons.toString(),STYLE_WIDTH_5),
new TextCell(creds.toString(),STYLE_WIDTH_70)
});
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredHistory.java
index 7e3962ec..af26a430 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredHistory.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredHistory.java
@@ -7,9 +7,9 @@
* 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.
@@ -61,7 +61,7 @@ public class CredHistory extends Page {
static final String HREF = "/gui/credHistory";
static final String FIELDS[] = {"user","dates"};
-
+
public CredHistory(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, FIELDS,
new BreadCrumbs(breadcrumbs),
@@ -74,24 +74,24 @@ public class CredHistory extends Page {
@Override
public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
String obUser = trans.get(user, null);
-
+
// Use Javascript to make the table title more descriptive
hgen.js()
.text("var caption = document.querySelector(\".title\");")
- .text("caption.innerHTML='History for User [ " + obUser + " ]';")
+ .text("caption.innerHTML='History for User [ " + obUser + " ]';")
.done();
-
+
// Use Javascript to change Link Target to our last visited Detail page
String lastPage = CredDetail.HREF + "?role=" + obUser;
hgen.js()
- .text("alterLink('roledetail', '"+lastPage + "');")
+ .text("alterLink('roledetail', '"+lastPage + "');")
.done();
-
+
hgen.br();
hgen.leaf("a", "href=#advanced_search","onclick=divVisibility('advanced_search');","class=greenbutton").text("Advanced Search").end()
.divID("advanced_search", "style=display:none");
hgen.incr("table");
-
+
addDateRow(hgen,"Start Date");
addDateRow(hgen,"End Date");
hgen.incr("tr").incr("td");
@@ -106,9 +106,9 @@ public class CredHistory extends Page {
}
);
-
+
}
-
+
private static void addDateRow(HTMLGen hgen, String s) {
hgen
.incr("tr")
@@ -129,16 +129,16 @@ public class CredHistory extends Page {
.end()
.incr("td")
.tagOnly("input","type=number","id=year"+s.substring(0, s.indexOf(' ')),"required",
- "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900",
+ "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900",
"max="+Calendar.getInstance().get(Calendar.YEAR),
"placeholder=Year").end()
.end();
}
-
-
+
+
/**
* Implement the Table Content for History
- *
+ *
* @author Jonathan
*
*/
@@ -146,25 +146,25 @@ public class CredHistory extends Page {
private static final String[] headers = new String[] {"Date","User","Memo"};
private Slot user;
private Slot dates;
-
+
public Model(AuthzEnv env) {
user = env.slot(NAME+".user");
dates = env.slot(NAME+".dates");
}
-
+
@Override
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final String oName = trans.get(user,null);
final String oDates = trans.get(dates,null);
-
+
Cells rv = Cells.EMPTY;
if (oName!=null) {
-
+
try {
rv = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Cells>() {
@Override
@@ -181,14 +181,14 @@ public class CredHistory extends Page {
tt.done();
tt = trans.start("Load History Data", Env.SUB);
List<Item> histItems = fh.value.getItem();
-
+
java.util.Collections.sort(histItems, new Comparator<Item>() {
@Override
public int compare(Item o1, Item o2) {
return o2.getTimestamp().compare(o1.getTimestamp());
}
});
-
+
for (Item i : histItems) {
String user = i.getUser();
AbsCell userCell = new TextCell(user);
@@ -209,7 +209,7 @@ public class CredHistory extends Page {
}
} finally {
tt.done();
- }
+ }
return new Cells(rv,msg);
}
});
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/Home.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/Home.java
index 3553da2b..7ac17ef5 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/Home.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/Home.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
public class Home extends Page {
public static final String HREF = "/gui/home";
-
+
public Home(final AAF_GUI gui) throws APIException, IOException {
super(gui.env,"Home",HREF, NO_FIELDS, new NamedCode(false,"content") {
@Override
@@ -63,5 +63,5 @@ public class Home extends Page {
}
});
}
-
+
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java
index 3fd69aca..aa10289c 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,16 +42,16 @@ public class LoginLanding extends Page {
static final String NAME = "Login";
static final String fields[] = {"id","password","environment"};
static final String envs[] = {"DEV","TEST","PROD"};
-
+
public LoginLanding(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env, NAME,HREF, fields, new NamedCode(true, "content") {
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
hgen.leaf("p").text("No login credentials are found in your current session. " +
"Choose your preferred login option to continue.").end();
-
+
Mark loginPaths = hgen.divID("Pages");
-
+
cache.dynamic(hgen, new DynamicCode<HTMLGen, AAF_GUI, AuthzTrans>() {
@Override
public void code(AAF_GUI authGUI, AuthzTrans trans, Cache<HTMLGen> cache, HTMLGen xgen) throws APIException, IOException {
@@ -74,13 +74,13 @@ public class LoginLanding extends Page {
// .incr("p", "id=tguard","style=display:none").text("this will redirect to tGuard login").end()
// hgen.leaf("a", "href=#","onclick=divVisibility('basicauth');").text("AAF Basic Auth").end();
hgen.end(loginPaths);
-
+
// hgen.incr("form","method=post","style=display:none","id=basicauth","gui/home?Authentication=BasicAuth");
// Mark table = new Mark(TABLE);
// hgen.incr(table);
// cache.dynamic(hgen, new DynamicCode<HTMLGen, AuthGUI, AuthzTrans>() {
// @Override
-// public void code(final AuthGUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen)
+// public void code(final AuthGUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen)
// throws APIException, IOException {
// hgen
// .input(fields[0],"Username",true)
@@ -97,9 +97,9 @@ public class LoginLanding extends Page {
// for (String env : envs) {
// hgen.incr("option", "value="+env).text(env).end();
// }
-// hgen
-// .end(selectRow)
-
+// hgen
+// .end(selectRow)
+
// hgen.end();
// }
// });
@@ -107,7 +107,7 @@ public class LoginLanding extends Page {
// hgen.tagOnly("input", "type=submit", "value=Submit")
// .tagOnly("input", "type=reset", "value=Reset")
// .end();
-
+
}
});
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLandingAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLandingAction.java
index f20caebb..0c5979ec 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLandingAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLandingAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,7 +41,7 @@ public class LoginLandingAction extends Page {
new NamedCode(true,"content") {
final Slot sID = gui.env.slot(LoginLanding.NAME+'.'+LoginLanding.fields[0]);
// final Slot sPassword = gui.env.slot(LoginLanding.NAME+'.'+LoginLanding.fields[1]);
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI, AuthzTrans>() {
@@ -52,11 +52,11 @@ public class LoginLandingAction extends Page {
hgen.p("User: "+username);
hgen.p("Pass: ********");
-
+
// TODO: clarification from JG
// put in request header?
// then pass through authn/basicAuth call?
-
+
}
});
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java
index 6b1c6120..38e7e2a0 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java
@@ -7,9 +7,9 @@
* 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.
@@ -58,7 +58,7 @@ import aaf.v2_0.Role;
import aaf.v2_0.Roles;
public class NsDetail extends Page {
-
+
public static final String HREF = "/gui/nsdetail";
public static final String NAME = "NsDetail";
public static enum NS_FIELD { OWNERS, ADMINS, ROLES, PERMISSIONS, CREDS};
@@ -69,7 +69,7 @@ public class NsDetail extends Page {
public NsDetail(final AAF_GUI gui, Page ... breadcrumbs) throws APIException, IOException {
- super(gui.env, NAME, HREF, new String[] {"ns"},
+ super(gui.env, NAME, HREF, new String[] {"ns"},
new BreadCrumbs(breadcrumbs),
new Table<AAF_GUI,AuthzTrans>("Namespace Details",gui.env.newTransNoAvg(),model=new Model(),"class=detail")
);
@@ -85,7 +85,7 @@ public class NsDetail extends Page {
/**
* Implement the table content for Namespace Detail
- *
+ *
* @author Jeremiah
*
*/
@@ -123,11 +123,11 @@ public class NsDetail extends Page {
tt.done();
try {
// TimeTaken tt = trans.start("Load Data", Env.SUB);
-
+
for (Ns n : fn.value.getNs()) {
String desc = (n.getDescription()!=null?n.getDescription():BLANK);
rv.add(new AbsCell[]{new TextCell("Description:"),new TextCell(desc)});
-
+
addField(trans, nsName, rv, n.getAdmin(), NS_FIELD.ADMINS);
addField(trans, nsName, rv, n.getResponsible(), NS_FIELD.OWNERS);
@@ -138,10 +138,10 @@ public class NsDetail extends Page {
new TextCell("Credentials"),
new TextCell(sw.toString())
});
-
-
+
+
Future<Roles> fr = client.read(
- "/authz/roles/ns/"+nsName,
+ "/authz/roles/ns/"+nsName,
gui.getDF(Roles.class)
);
List<String> roles = new ArrayList<>();
@@ -151,14 +151,14 @@ public class NsDetail extends Page {
}
}
addField(trans, nsName, rv, roles, NS_FIELD.ROLES);
-
-
+
+
Future<Perms> fp = client.read(
- "/authz/perms/ns/"+nsName,
+ "/authz/perms/ns/"+nsName,
gui.getDF(Perms.class)
);
List<String> perms = new ArrayList<>();
-
+
if (fp.get(AAFcli.timeout())) {
for (Perm p : fp.value.getPerm()) {
perms.add(p.getType() + "|" + p.getInstance() + "|" + p.getAction());
@@ -166,7 +166,7 @@ public class NsDetail extends Page {
}
addField(trans, nsName, rv, perms, NS_FIELD.PERMISSIONS);
}
- String historyLink = NsHistory.HREF
+ String historyLink = NsHistory.HREF
+ "?name=" + nsName;
rv.add(new AbsCell[] {new RefCell("See History",historyLink,false,"class=greenbutton")});
} finally {
@@ -197,7 +197,7 @@ public class NsDetail extends Page {
String user = values.get(i);
AbsCell userCell = (new TextCell(user));
rv.add(new AbsCell[] {
- label,
+ label,
userCell
});
}
@@ -217,14 +217,14 @@ public class NsDetail extends Page {
AbsCell label = (i==0?new TextCell(sentenceCase(field)+":","style=width:20%"):AbsCell.Null);
String perm = values.get(i);
String[] fields = perm.split("\\|");
- String grantLink = locate_url
+ String grantLink = locate_url
+ PermGrantForm.HREF
+ "?type=" + fields[0].trim()
+ "&amp;instance=" + fields[1].trim()
+ "&amp;action=" + fields[2].trim();
-
+
rv.add(new AbsCell[] {
- label,
+ label,
new TextCell(perm,"style=width:60%;"),
new RefCell("Grant", grantLink,false,"class=button","style=width:20%;")
});
@@ -239,6 +239,6 @@ public class NsDetail extends Page {
String sField = field.toString();
return sField.substring(0, 1).toUpperCase() + sField.substring(1).toLowerCase();
}
-
+
}
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java
index dc9119bf..6994a2c8 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java
@@ -7,9 +7,9 @@
* 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.
@@ -58,9 +58,9 @@ public class NsHistory extends Page {
static final String NAME="NsHistory";
static final String HREF = "/gui/nsHistory";
static final String FIELDS[] = {"name","dates"};
- static enum Month { JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY,
+ static enum Month { JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY,
AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER };
-
+
public NsHistory(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, FIELDS,
new BreadCrumbs(breadcrumbs),
@@ -73,24 +73,24 @@ public class NsHistory extends Page {
@Override
public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
String obName = trans.get(name, null);
-
+
// Use Javascript to make the table title more descriptive
hgen.js()
.text("var caption = document.querySelector(\".title\");")
- .text("caption.innerHTML='History for Namespace [ " + obName + " ]';")
+ .text("caption.innerHTML='History for Namespace [ " + obName + " ]';")
.done();
-
+
// Use Javascript to change Link Target to our last visited Detail page
String lastPage = NsDetail.HREF + "?name=" + obName;
hgen.js()
- .text("alterLink('nsdetail', '"+lastPage + "');")
+ .text("alterLink('nsdetail', '"+lastPage + "');")
.done();
-
+
hgen.br();
hgen.leaf("a","href=#advanced_search","onclick=divVisibility('advanced_search');","class=greenbutton").text("Advanced Search").end()
.divID("advanced_search", "style=display:none");
hgen.incr("table");
-
+
addDateRow(hgen,"Start Date");
addDateRow(hgen,"End Date");
hgen.incr("tr").incr("td");
@@ -99,7 +99,7 @@ public class NsHistory extends Page {
hgen.end().end();
hgen.end();
hgen.end();
-
+
}
});
}
@@ -128,18 +128,18 @@ public class NsHistory extends Page {
.end()
.incr("td")
.tagOnly("input","type=number","id=year"+s.substring(0, s.indexOf(' ')),"required",
- "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900",
+ "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900",
"max="+Calendar.getInstance().get(Calendar.YEAR),
"placeholder=Year").end()
.end();
}
-
-
-
+
+
+
/**
* Implement the Table Content for History
- *
+ *
* @author Jeremiah
*
*/
@@ -147,26 +147,26 @@ public class NsHistory extends Page {
private static final String[] headers = new String[] {"Date","User","Memo"};
private Slot name;
private Slot dates;
-
+
public Model(AuthzEnv env) {
name = env.slot(NAME+".name");
dates = env.slot(NAME+".dates");
}
-
+
@Override
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final String oName = trans.get(name,null);
final String oDates = trans.get(dates,null);
-
+
if (oName==null) {
return Cells.EMPTY;
}
-
+
final ArrayList<AbsCell[]> rv = new ArrayList<>();
String msg = null;
final TimeTaken tt = trans.start("AAF Get History for Namespace ["+oName+"]",Env.REMOTE);
@@ -183,18 +183,18 @@ public class NsHistory extends Page {
TimeTaken tt2 = trans.start("Load History Data", Env.SUB);
try {
List<Item> histItems = fh.value.getItem();
-
+
java.util.Collections.sort(histItems, new Comparator<Item>() {
@Override
public int compare(Item o1, Item o2) {
return o2.getTimestamp().compare(o1.getTimestamp());
}
});
-
+
for (Item i : histItems) {
String user = i.getUser();
AbsCell userCell = new TextCell(user);
-
+
String memo = i.getMemo().replace("<script>", "&lt;script&gt;").replace("</script>", "&lt;/script&gt;");
rv.add(new AbsCell[] {
new TextCell(i.getTimestamp().toGregorianCalendar().getTime().toString()),
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java
index cb942c6c..c93d1562 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,7 +55,7 @@ public class NsInfoAction extends Page {
final Slot sPassword = gui.env.slot(PassChangeForm.NAME+'.'+PassChangeForm.fields[2]);
final Slot sPassword2 = gui.env.slot(PassChangeForm.NAME+'.'+PassChangeForm.fields[3]);
final Slot startDate = gui.env.slot(PassChangeForm.NAME+'.'+PassChangeForm.fields[4]);
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI, AuthzTrans>() {
@@ -65,10 +65,10 @@ public class NsInfoAction extends Page {
String currPass = trans.get(sCurrPass,null);
final String password = trans.get(sPassword,null);
String password2 = trans.get(sPassword2,null);
-
+
// Run Validations
boolean fail = true;
-
+
if (id==null || id.indexOf('@')<=0) {
hgen.p("Data Entry Failure: Please enter a valid ID, including domain.");
} else if (password == null || password2 == null || currPass == null) {
@@ -114,13 +114,13 @@ public class NsInfoAction extends Page {
throw new CadiException(e);
}
}
-
+
fcr = client.create(
"/authn/cred",
gui.getDF(CredRequest.class),
cred
);
-
+
if (fcr.get(5000)) {
// Do Remote Call
hgen.p("New Password has been added.");
@@ -148,7 +148,7 @@ public class NsInfoAction extends Page {
if (fail) {
hgen.incr("a",true,"href="+PassChangeForm.HREF+"?id="+id).text("Try again").end();
} else {
- hgen.incr("a",true,"href="+Home.HREF).text("Home").end();
+ hgen.incr("a",true,"href="+Home.HREF).text("Home").end();
}
}
});
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java
index 2306a1a5..cdd97558 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,7 +55,7 @@ public class NsInfoForm extends Page {
static final String HREF = "/gui/onboard";
static final String NAME = "Onboarding";
static final String fields[] = {"ns","description","mots","owners","admins"};
-
+
public NsInfoForm(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, fields,
new BreadCrumbs(breadcrumbs),
@@ -79,7 +79,7 @@ public class NsInfoForm extends Page {
public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
final String incomingID= trans.get(sID, "");
final String[] info = new String[fields.length];
- final Object own_adm[] = new Object[2];
+ final Object own_adm[] = new Object[2];
for (int i=0;i<info.length;++i) {
info[i]="";
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java
index 6f090a49..3c3c0ed3 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,13 +55,13 @@ public class NssShow extends Page {
public NssShow(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env, "MyNamespaces",HREF, NO_FIELDS,
- new BreadCrumbs(breadcrumbs),
- new Table<AAF_GUI,AuthzTrans>("Namespaces I administer",gui.env.newTransNoAvg(),new Model(true,"Administrator",gui.env),
+ new BreadCrumbs(breadcrumbs),
+ new Table<AAF_GUI,AuthzTrans>("Namespaces I administer",gui.env.newTransNoAvg(),new Model(true,"Administrator",gui.env),
"class=std", "style=display: inline-block; width: 45%; margin: 10px;"),
new Table<AAF_GUI,AuthzTrans>("Namespaces I own",gui.env.newTransNoAvg(),new Model(false,"Owner",gui.env),
"class=std", "style=display: inline-block; width: 45%; margin: 10px;"));
}
-
+
private static class Model extends TableData<AAF_GUI,AuthzTrans> {
private String[] headers;
private String privilege = null;
@@ -80,7 +80,7 @@ public class NssShow extends Page {
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
ArrayList<AbsCell[]> rv = new ArrayList<>();
@@ -104,7 +104,7 @@ public class NssShow extends Page {
}
});
trans.put(sNssByUser,nss);
- }
+ }
} finally {
tt.done();
}
@@ -120,7 +120,7 @@ public class NssShow extends Page {
tt.done();
}
}
-
+
if (nss!=null) {
for (Ns n : nss) {
if ((isAdmin && !n.getAdmin().isEmpty())
@@ -137,6 +137,6 @@ public class NssShow extends Page {
return new Cells(rv,null);
}
}
-
+
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java
index 10af074a..4fbce006 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -65,7 +65,7 @@ public class PassChangeAction extends Page {
final Slot sPassword2 = gui.env.slot(PassChangeForm.NAME+'.'+PassChangeForm.fields[3]);
final Slot startDate = gui.env.slot(PassChangeForm.NAME+'.'+PassChangeForm.fields[4]);
final Slot sNS = gui.env.slot(PassChangeForm.NAME+'.'+PassChangeForm.fields[5]);
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI, AuthzTrans>() {
@@ -76,10 +76,10 @@ public class PassChangeAction extends Page {
final String password = trans.get(sPassword,null);
final String password2 = trans.get(sPassword2,null);
final String ns = trans.get(sNS, null);
-
+
// Run Validations
boolean fail = true;
-
+
if (id==null || id.indexOf('@')<=0) {
hgen.p("Data Entry Failure: Please enter a valid ID, including domain.");
} else if (password == null || password2 == null) {
@@ -121,7 +121,7 @@ public class PassChangeAction extends Page {
}
return true; // no existing, no expired password
} else {
- if (fc.code()==404) { // not found...
+ if (fc.code()==404) { // not found...
return true;
} else {
trans.error().log(gui.aafCon.readableErrMsg(fc));
@@ -169,7 +169,7 @@ public class PassChangeAction extends Page {
throw new CadiException(e);
}
}
-
+
Future<CredRequest> fcr = gui.clientAsUser(trans.getUserPrincipal()).create("/authn/cred",gui.getDF(CredRequest.class),cred);
if (fcr.get(AAFcli.timeout())) {
// Do Remote Call
@@ -182,16 +182,16 @@ public class PassChangeAction extends Page {
} finally {
tt.done();
}
- }
+ }
return fail;
}
-
+
});
} catch (Exception e) {
hgen.p("Unknown Error");
e.printStackTrace();
}
-
+
}
hgen.br();
if (fail) {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java
index 499c02dd..5b98d018 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,15 +56,15 @@ public class PassChangeForm extends Page {
static final String HREF = "/gui/passwd";
static final String NAME = "PassChange";
static final String fields[] = {"id","current","password","password2","startDate","ns"};
-
+
public PassChangeForm(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, fields,
new BreadCrumbs(breadcrumbs),
- new NamedCode(true,NAME) {
+ new NamedCode(true,NAME) {
private final Slot sID = gui.env.slot(PassChangeForm.NAME+'.'+PassChangeForm.fields[0]);
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
-
+
// p tags not closing right using .p() - causes issues in IE8 password form - so using leaf for the moment
hgen.incr(HTMLGen.H4,true,"style=margin: 0em 0em .4em 0em")
.text("You are <i>adding</i> a New Password in the AAF System.")
@@ -72,7 +72,7 @@ public class PassChangeForm extends Page {
Mark form = new Mark();
hgen.incr(form,"form","method=post");
-
+
Mark table = new Mark(TABLE);
hgen.incr(table);
@@ -96,7 +96,7 @@ public class PassChangeForm extends Page {
} else {
// Owners/or the IDs themselves are allowed to reset password without previous one
skipCurrent=skipCurrent(trans, user);
-
+
if (!skipCurrent) {
final String id = incomingID;
try {
@@ -113,7 +113,7 @@ public class PassChangeForm extends Page {
}
return true; // no existing, no expired password
} else {
- if (fc.code()==404) { // not found...
+ if (fc.code()==404) { // not found...
return true;
} else {
trans.error().log(gui.aafCon.readableErrMsg(fc));
@@ -127,13 +127,13 @@ public class PassChangeForm extends Page {
}
}
}
- }
+ }
} catch (OrganizationException e) {
hgen.incr(HTMLGen.H4,"style=color:red;").text("Error: ")
.text(e.getMessage()).end();
}
}
-
+
hgen.input(fields[0],"ID*",true,"value="+incomingID,(incomingID.length()==0?"":"readonly"));
if (!skipCurrent) {
hgen.input(fields[1],"Current Password*",true,"type=password");
@@ -159,7 +159,7 @@ public class PassChangeForm extends Page {
"This allows you to migrate services to this new password until the old ones expire.").br().br()
.p("Note: You must be an Admin of the Namespace where the MechID is defined.").br()
;
-
+
Mark div = hgen.divID("passwordRules");
cache.dynamic(hgen, new DynamicCode<HTMLGen, AAF_GUI, AuthzTrans>() {
@Override
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java
index f66e8bcb..76aef6e2 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,7 +46,7 @@ public class PassDeleteAction extends Page {
public static final String NAME = "PassDeleteAction";
public static final String HREF = "/gui/passdelete";
private static enum Params{id,date,ns,type};
-
+
public PassDeleteAction(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF,Params.values(),
new BreadCrumbs(breadcrumbs),
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java
index 585a75ae..b528b24b 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java
@@ -7,9 +7,9 @@
* 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.
@@ -62,10 +62,10 @@ public class PendingRequestsShow extends Page {
public static final String NAME = "MyRequests";
private static final String[] FIELDS = new String[] {"as_user"}; // as_user Checked in Display
private static final String AS_USER=NAME+".as_user";
-
+
public PendingRequestsShow(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env, NAME,HREF, FIELDS,
- new BreadCrumbs(breadcrumbs),
+ new BreadCrumbs(breadcrumbs),
new TopOfPage(gui.env,true, "expedite"),
new Table<AAF_GUI,AuthzTrans>("Pending Requests",gui.env.newTransNoAvg(),new Model(gui.env), "class=std")
);
@@ -98,7 +98,7 @@ public class PendingRequestsShow extends Page {
.leaf("a","href=#expedite_directions","onclick=divVisibility('expedite_directions');")
.text("Click Here").end()
.divID("expedite_directions", "style=display:none");
-
+
hgen
.incr(HTMLGen.OL)
.incr(HTMLGen.LI)
@@ -120,7 +120,7 @@ public class PendingRequestsShow extends Page {
/**
* Implement the Table Content for Requests by User
- *
+ *
* @author Jeremiah
*
*/
@@ -137,7 +137,7 @@ public class PendingRequestsShow extends Page {
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final ArrayList<AbsCell[]> rv = new ArrayList<>();
@@ -163,12 +163,12 @@ public class PendingRequestsShow extends Page {
return id1.timestamp()<=id2.timestamp()?1:-1;
}
});
-
+
String prevTicket = null;
for (Approval a : approvals) {
String approver = a.getApprover();
// String approverShort = approver.substring(0,approver.indexOf('@'));
-
+
AbsCell tsCell = null;
String ticket = a.getTicket();
if (ticket==null || ticket.equals(prevTicket)) {
@@ -180,7 +180,7 @@ public class PendingRequestsShow extends Page {
RequestDetail.HREF + "?ticket=" + ticket,false);
prevTicket = ticket;
}
-
+
AbsCell approverCell = new TextCell(approver);
AbsCell[] sa = new AbsCell[] {
tsCell,
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java
index 4a5a940a..00bec4cd 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java
@@ -7,9 +7,9 @@
* 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.
@@ -53,7 +53,7 @@ import aaf.v2_0.Perms;
/**
* Detail Page for Permissions
- *
+ *
* @author Jonathan
*
*/
@@ -71,7 +71,7 @@ public class PermDetail extends Page {
/**
* Implement the table content for Permissions Detail
- *
+ *
* @author Jonathan
*
*/
@@ -91,7 +91,7 @@ public class PermDetail extends Page {
v.permTypeWithUser(trans.user(),pType)
.permInstance(pInstance)
.permAction(pAction);
-
+
if (v.err()) {
trans.warn().printf("Error in PermDetail Request: %s", v.errs());
return Cells.EMPTY;
@@ -107,7 +107,7 @@ public class PermDetail extends Page {
TimeTaken tt = trans.start("AAF Perm Details",Env.REMOTE);
try {
Future<Perms> fp= client.read("/authz/perms/"+pType + '/' + pInstance + '/' + pAction,gui.getDF(Perms.class));
-
+
if (fp.get(AAF_GUI.TIMEOUT)) {
tt.done();
tt = trans.start("Load Data", Env.SUB);
@@ -132,9 +132,9 @@ public class PermDetail extends Page {
}
}
}
- String historyLink = PermHistory.HREF
+ String historyLink = PermHistory.HREF
+ "?type=" + pType + "&instance=" + pInstance + "&action=" + pAction;
-
+
rv.add(new AbsCell[] {new RefCell("See History",historyLink,false,"class=greenbutton")});
} else {
rv.add(new AbsCell[] {new TextCell(
@@ -156,5 +156,5 @@ public class PermDetail extends Page {
return new Cells(rv,null);
}
}
-}
+}
\ No newline at end of file
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java
index 9d53c535..4512e473 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,8 +45,8 @@ import aaf.v2_0.Pkey;
import aaf.v2_0.RolePermRequest;
public class PermGrantAction extends Page {
-
-
+
+
public PermGrantAction(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,PermGrantForm.NAME, PermGrantForm.HREF, PermGrantForm.fields,
new BreadCrumbs(breadcrumbs),
@@ -55,7 +55,7 @@ public class PermGrantAction extends Page {
final Slot sInstance = gui.env.slot(PermGrantForm.NAME+'.'+PermGrantForm.fields[1]);
final Slot sAction = gui.env.slot(PermGrantForm.NAME+'.'+PermGrantForm.fields[2]);
final Slot sRole = gui.env.slot(PermGrantForm.NAME+'.'+PermGrantForm.fields[3]);
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI, AuthzTrans>() {
@@ -66,16 +66,16 @@ public class PermGrantAction extends Page {
String instance = trans.get(sInstance,null);
String action = trans.get(sAction,null);
String role = trans.get(sRole,null);
-
- String lastPage = PermGrantForm.HREF
+
+ String lastPage = PermGrantForm.HREF
+ "?type=" + type + "&instance=" + instance + "&action=" + action;
-
+
// Run Validations
boolean fail = true;
-
+
TimeTaken tt = trans.start("AAF Grant Permission to Role",Env.REMOTE);
try {
-
+
final RolePermRequest grantReq = new RolePermRequest();
Pkey pkey = new Pkey();
pkey.setType(type);
@@ -83,7 +83,7 @@ public class PermGrantAction extends Page {
pkey.setAction(action);
grantReq.setPerm(pkey);
grantReq.setRole(role);
-
+
fail = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Boolean>() {
@Override
public Boolean code(Rcli<?> client) throws CadiException, ConnectException, APIException {
@@ -114,7 +114,7 @@ public class PermGrantAction extends Page {
} finally {
tt.done();
}
-
+
hgen.br();
hgen.incr("a",true,"href="+lastPage);
if (fail) {
@@ -124,7 +124,7 @@ public class PermGrantAction extends Page {
}
hgen.end();
hgen.js()
- .text("alterLink('permgrant', '"+lastPage + "');")
+ .text("alterLink('permgrant', '"+lastPage + "');")
.done();
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java
index 71958060..ac9cdf1e 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java
@@ -7,9 +7,9 @@
* 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.
@@ -53,7 +53,7 @@ public class PermGrantForm extends Page {
static final String HREF = "/gui/permgrant";
static final String NAME = "Permission Grant";
static final String fields[] = {"type","instance","action","role"};
-
+
public PermGrantForm(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, fields,
new BreadCrumbs(breadcrumbs),
@@ -72,7 +72,7 @@ public class PermGrantForm extends Page {
cache.dynamic(hgen, new DynamicCode<HTMLGen, AAF_GUI, AuthzTrans>() {
@Override
public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
-
+
Mark copyRoleJS = new Mark();
hgen.js(copyRoleJS);
hgen.text("function copyRole(role) {");
@@ -81,7 +81,7 @@ public class PermGrantForm extends Page {
hgen.text("txtRole.value=role;");
hgen.text("}");
hgen.end(copyRoleJS);
-
+
String typeValue = trans.get(type, "");
String instanceValue = trans.get(instance, "");
String actionValue = trans.get(action, "");
@@ -91,7 +91,7 @@ public class PermGrantForm extends Page {
.input(fields[0],"Perm Type",true,"value="+typeValue,"disabled")
.input(fields[1],"Perm Instance",true,"value="+instanceValue,"disabled")
.input(fields[2],"Perm Action",true,"value="+actionValue,"disabled");
-
+
// select & options are not an input type, so we must create table row & cell tags
Mark selectRow = new Mark();
hgen
@@ -106,7 +106,7 @@ public class PermGrantForm extends Page {
hgen.incr("option", "value="+role).text(role).end();
}
hgen
- .incr("option", "value=").text("Other").end()
+ .incr("option", "value=").text("Other").end()
.end(selectRow);
if (roleValue==null) {
hgen.input(fields[3],"Role", true, "placeholder=or type a role here");
@@ -123,7 +123,7 @@ public class PermGrantForm extends Page {
}
});
}
-
+
private static List<String> getMyRoles(final AAF_GUI gui, final AuthzTrans trans) {
final List<String> myRoles = new ArrayList<>();
try {
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java
index 4c3bd32e..4885827d 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java
@@ -7,9 +7,9 @@
* 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.
@@ -60,7 +60,7 @@ public class PermHistory extends Page {
static final String NAME="PermHistory";
static final String HREF = "/gui/permHistory";
static final String FIELDS[] = {"type","instance","action","dates"};
-
+
public PermHistory(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, FIELDS,
new BreadCrumbs(breadcrumbs),
@@ -77,26 +77,26 @@ public class PermHistory extends Page {
String type = trans.get(sType, null);
String instance = trans.get(sInstance,null);
String action = trans.get(sAction,null);
-
+
// Use Javascript to make the table title more descriptive
hgen.js()
.text("var caption = document.querySelector(\".title\");")
- .text("caption.innerHTML='History for Permission [ " + type + " ]';")
+ .text("caption.innerHTML='History for Permission [ " + type + " ]';")
.done();
-
+
// Use Javascript to change Link Target to our last visited Detail page
String lastPage = PermDetail.HREF + "?type=" + type
+ "&instance=" + instance
+ "&action=" + action;
hgen.js()
- .text("alterLink('permdetail', '"+lastPage + "');")
+ .text("alterLink('permdetail', '"+lastPage + "');")
.done();
-
+
hgen.br();
hgen.leaf("a", "href=#advanced_search", "onclick=divVisibility('advanced_search');","class=greenbutton").text("Advanced Search").end()
.divID("advanced_search", "style=display:none");
hgen.incr("table");
-
+
addDateRow(hgen,"Start Date");
addDateRow(hgen,"End Date");
hgen.incr("tr").incr("td");
@@ -113,9 +113,9 @@ public class PermHistory extends Page {
}
);
-
+
}
-
+
private static void addDateRow(HTMLGen hgen, String s) {
hgen
.incr("tr")
@@ -136,15 +136,15 @@ public class PermHistory extends Page {
.end()
.incr("td")
.tagOnly("input","type=number","id=year"+s.substring(0, s.indexOf(' ')),"required",
- "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900",
+ "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900",
"max="+Calendar.getInstance().get(Calendar.YEAR),
"placeholder=Year").end()
.end();
}
-
+
/**
* Implement the Table Content for History
- *
+ *
* @author Jeremiah
*
*/
@@ -152,26 +152,26 @@ public class PermHistory extends Page {
private static final String[] headers = new String[] {"Date","User","Memo"};
private Slot sType;
private Slot sDates;
-
+
public Model(AuthzEnv env) {
sType = env.slot(NAME+".type");
sDates = env.slot(NAME+".dates");
}
-
+
@Override
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final String oName = trans.get(sType,null);
final String oDates = trans.get(sDates,null);
-
+
if (oName==null) {
return Cells.EMPTY;
}
-
+
final ArrayList<AbsCell[]> rv = new ArrayList<>();
String msg = null;
try {
@@ -187,20 +187,20 @@ public class PermHistory extends Page {
"/authz/hist/perm/"+oName,
gui.getDF(History.class)
);
-
-
+
+
if (fh.get(AAF_GUI.TIMEOUT)) {
tt.done();
tt = trans.start("Load History Data", Env.SUB);
List<Item> histItems = fh.value.getItem();
-
+
java.util.Collections.sort(histItems, new Comparator<Item>() {
@Override
public int compare(Item o1, Item o2) {
return o2.getTimestamp().compare(o1.getTimestamp());
}
});
-
+
for (Item i : histItems) {
String user = i.getUser();
AbsCell userCell = new TextCell(user);
@@ -211,7 +211,7 @@ public class PermHistory extends Page {
new TextCell(memo)
});
}
-
+
} else {
if (fh.code()==403) {
rv.add(new AbsCell[] {new TextCell("You may not view History of Permission [" + oName + "]", "colspan = 3", "class=center")});
@@ -226,7 +226,7 @@ public class PermHistory extends Page {
return null;
}
});
-
+
} catch (Exception e) {
trans.error().log(e);
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java
index 7dff0815..ad2c5b02 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,22 +48,22 @@ import aaf.v2_0.Perms;
/**
* Page content for My Permissions
- *
+ *
* @author Jonathan
*
*/
public class PermsShow extends Page {
public static final String HREF = "/gui/myperms";
-
+
public PermsShow(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env, "MyPerms",HREF, NO_FIELDS,
- new BreadCrumbs(breadcrumbs),
+ new BreadCrumbs(breadcrumbs),
new Table<AAF_GUI,AuthzTrans>("Permissions",gui.env.newTransNoAvg(),new Model(), "class=std"));
}
/**
* Implement the Table Content for Permissions by User
- *
+ *
* @author Jonathan
*
*/
@@ -74,7 +74,7 @@ public class PermsShow extends Page {
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final ArrayList<AbsCell[]> rv = new ArrayList<>();
@@ -87,7 +87,7 @@ public class PermsShow extends Page {
if (fp.get(5000)) {
TimeTaken ttld = trans.start("Load Data", Env.SUB);
try {
- if (fp.value!=null) {
+ if (fp.value!=null) {
for (Perm p : fp.value.getPerm()) {
AbsCell[] sa = new AbsCell[] {
new RefCell(p.getType(),PermDetail.HREF
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java
index 09b583bf..b6a6a016 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java
@@ -7,9 +7,9 @@
* 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.
@@ -68,7 +68,7 @@ public class RequestDetail extends Page {
/**
* Implement the table content for Request Detail
- *
+ *
* @author Jeremiah
*
*/
@@ -92,10 +92,10 @@ public class RequestDetail extends Page {
ArrayList<AbsCell[]> rv = new ArrayList<>();
try {
Future<Approvals> fa = client.read(
- "/authz/approval/ticket/"+ticket,
+ "/authz/approval/ticket/"+ticket,
gui.getDF(Approvals.class)
);
-
+
if (fa.get(AAF_GUI.TIMEOUT)) {
Approval app = fa.value.getApprovals().get(0);
if(app==null) {
@@ -118,39 +118,39 @@ public class RequestDetail extends Page {
if (first) {
DateFormat createdDF = new SimpleDateFormat(DATE_TIME_FORMAT);
UUID id = UUID.fromString(approval.getId());
-
+
rv.add(new AbsCell[]{new TextCell("Ticket ID:"),new TextCell(approval.getTicket(),"colspan=3")});
rv.add(new AbsCell[]{new TextCell("Memo:"),new TextCell(approval.getMemo(),"colspan=3")});
- rv.add(new AbsCell[]{new TextCell("Requested On:"),
+ rv.add(new AbsCell[]{new TextCell("Requested On:"),
new TextCell(createdDF.format((id.timestamp() - NUM_100NS_INTERVALS_SINCE_UUID_EPOCH)/10000),"colspan=3")
});
rv.add(new AbsCell[]{new TextCell("Operation:"),new TextCell(decodeOp(approval.getOperation()),"colspan=3")});
String user = approval.getUser();
rv.add(new AbsCell[]{new TextCell("User:"),new TextCell(user,"colspan=3")});
-
+
// headers for listing each approver
rv.add(new AbsCell[]{new TextCell(" ","colspan=4","class=blank_line")});
rv.add(new AbsCell[]{AbsCell.Null,
- new TextCell("Approver","class=bold"),
- new TextCell("Type","class=bold"),
+ new TextCell("Approver","class=bold"),
+ new TextCell("Type","class=bold"),
new TextCell("Status","class=bold")});
approverLine[0] = new TextCell("Approvals:");
-
+
first = false;
} else {
approverLine[0] = AbsCell.Null;
}
-
+
approverLine[1] = new TextCell(approval.getApprover());
String type = approval.getType();
if ("owner".equalsIgnoreCase(type)) {
type = "resource owner";
}
-
+
approverLine[2] = new TextCell(type);
approverLine[3] = new TextCell(approval.getStatus());
rv.add(approverLine);
-
+
}
} else {
rv.add(new AbsCell[] {new TextCell("*** Data Unavailable ***")});
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java
index dcf0f928..7b01e8f2 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java
@@ -7,9 +7,9 @@
* 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.
@@ -63,7 +63,7 @@ import aaf.v2_0.UserRoles;
/**
* Detail Page for Permissions
- *
+ *
* @author Jonathan
*
*/
@@ -82,7 +82,7 @@ public class RoleDetail extends Page {
/**
* Implement the table content for Permissions Detail
- *
+ *
* @author Jonathan
*
*/
@@ -116,8 +116,8 @@ public class RoleDetail extends Page {
return;
}
-
- try {
+
+ try {
gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Boolean>() {
@Override
public Boolean code(Rcli<?> client) throws CadiException, ConnectException, APIException {
@@ -134,7 +134,7 @@ public class RoleDetail extends Page {
trans.put(sMayWrite,mayWrite);
Boolean mayApprove = trans.fish(new AAFPermission(role.getNs(),ACCESS,":role:"+role.getName(),"approve"));
trans.put(sMayApprove, mayApprove);
-
+
if (mayWrite || mayApprove) {
Mark js = new Mark();
Mark fn = new Mark();
@@ -153,7 +153,7 @@ public class RoleDetail extends Page {
"dcb.checked= (d.orig != d.value)"
).end(fn)
.end(js);
-
+
Mark mark = new Mark();
hgen.incr(mark,"form","method=post");
trans.put(sMark, mark);
@@ -163,7 +163,7 @@ public class RoleDetail extends Page {
trans.error().printf("Error calling AAF for Roles in GUI, Role Detail %d: %s",fr.code(),fr.body());
return false;
}
-
+
if (fur.get(AAF_GUI.TIMEOUT)) {
trans.put(sUserRole, fur.value.getUserRole());
} else {
@@ -187,7 +187,7 @@ public class RoleDetail extends Page {
final String pRole = trans.get(sRoleName, null);
final Role role = trans.get(sRole,null);
ArrayList<AbsCell[]> rv = new ArrayList<>();
-
+
if (role!=null) {
boolean mayWrite = trans.get(sMayWrite, false);
boolean mayApprove = trans.get(sMayApprove, false);
@@ -241,11 +241,11 @@ public class RoleDetail extends Page {
}
}
}
-
+
if (mayApprove) {
rv.add(AbsCell.HLINE);
- //
+ //
rv.add(new AbsCell[] {
new TextCell("Users in Role:","width=25%"),
new TextCell("Delete","width=10%"),
@@ -256,7 +256,7 @@ public class RoleDetail extends Page {
if (userroles!=null) {
for (UserRole ur : userroles) {
String tag = "userrole";
-
+
rv.add(new AbsCell[] {
AbsCell.Null,
new CheckBoxCell(tag+".delete", ur.getUser()),
@@ -267,8 +267,8 @@ public class RoleDetail extends Page {
}
}
}
-
- // History
+
+ // History
rv.add(new AbsCell[] {
new RefCell("See History",RoleHistory.HREF + "?role=" + pRole,false,"class=greenbutton")
});
@@ -299,5 +299,5 @@ public class RoleDetail extends Page {
}
}
-}
+}
\ No newline at end of file
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java
index fb64cd6e..74526361 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java
@@ -7,9 +7,9 @@
* 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.
@@ -59,7 +59,7 @@ public class RoleDetailAction extends Page {
new BreadCrumbs(breadcrumbs),
new NamedCode(true,"content") {
final Slot sReq = gui.env.slot(AAF_GUI.HTTP_SERVLET_REQUEST);
-
+
@Override
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI, AuthzTrans>() {
@@ -68,7 +68,7 @@ public class RoleDetailAction extends Page {
final HttpServletRequest req = trans.get(sReq, null);
final String role = getSingleParam(req,"role");
if (role==null) {
- hgen.text("Parameter 'role' is required").end();
+ hgen.text("Parameter 'role' is required").end();
} else {
// Run Validations
// boolean fail;
@@ -81,7 +81,7 @@ public class RoleDetailAction extends Page {
Map<String, String[]> pm = (Map<String, String[]>)req.getParameterMap();
for (final Entry<String, String[]> es : pm.entrySet()) {
for (final String v : es.getValue()) {
- TimeTaken tt = null;
+ TimeTaken tt = null;
try {
switch(es.getKey()) {
case "desc": // Check box set
@@ -92,7 +92,7 @@ public class RoleDetailAction extends Page {
RoleRequest rr = new RoleRequest();
rr.setName(role);
rr.setDescription(desc);
- ltf.add(new TypedFuture(ActionType.desc, text,
+ ltf.add(new TypedFuture(ActionType.desc, text,
client.update("/authz/role",
gui.getDF(RoleRequest.class),rr
)));
@@ -111,7 +111,7 @@ public class RoleDetailAction extends Page {
rpr.setPerm(perm);
rpr.setRole(role);
ltf.add(new TypedFuture(ActionType.ungrant,text,
- client.delete("/authz/role/" + role + "/perm",
+ client.delete("/authz/role/" + role + "/perm",
gui.getDF(RolePermRequest.class),rpr
)));
} else {
@@ -142,7 +142,7 @@ public class RoleDetailAction extends Page {
}
}
}
-
+
if (ltf.isEmpty()) {
hgen.p("No Changes");
} else {
@@ -150,7 +150,7 @@ public class RoleDetailAction extends Page {
if (tf.future.get(5000)) {
hgen.p("<font color=\"green\"><i>Success</i>:</font> " + tf.text);
} else {
- // Note: if handling of special Error codes is required, use
+ // Note: if handling of special Error codes is required, use
// switch(tf.type) {
// }
hgen.p(tf.text);
@@ -172,13 +172,13 @@ public class RoleDetailAction extends Page {
}
});
}
-
+
enum ActionType {desc, ungrant, deleteUR, extendUR};
private static class TypedFuture {
// public final ActionType type;
public final Future<?> future;
public final String text;
-
+
public TypedFuture(ActionType type, String text, Future<?> future) {
// this.type = type;
this.future = future;
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java
index a9f0eeb0..ce308354 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java
@@ -7,9 +7,9 @@
* 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.
@@ -61,7 +61,7 @@ public class RoleHistory extends Page {
static final String HREF = "/gui/roleHistory";
static final String FIELDS[] = {"role","dates"};
-
+
public RoleHistory(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env,NAME,HREF, FIELDS,
new BreadCrumbs(breadcrumbs),
@@ -74,24 +74,24 @@ public class RoleHistory extends Page {
@Override
public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
String obRole = trans.get(role, null);
-
+
// Use Javascript to make the table title more descriptive
hgen.js()
.text("var caption = document.querySelector(\".title\");")
- .text("caption.innerHTML='History for Role [ " + obRole + " ]';")
+ .text("caption.innerHTML='History for Role [ " + obRole + " ]';")
.done();
-
+
// Use Javascript to change Link Target to our last visited Detail page
String lastPage = RoleDetail.HREF + "?role=" + obRole;
hgen.js()
- .text("alterLink('roledetail', '"+lastPage + "');")
+ .text("alterLink('roledetail', '"+lastPage + "');")
.done();
-
+
hgen.br();
hgen.leaf("a", "href=#advanced_search","onclick=divVisibility('advanced_search');","class=greenbutton").text("Advanced Search").end()
.divID("advanced_search", "style=display:none");
hgen.incr("table");
-
+
addDateRow(hgen,"Start Date");
addDateRow(hgen,"End Date");
hgen.incr("tr").incr("td");
@@ -106,9 +106,9 @@ public class RoleHistory extends Page {
}
);
-
+
}
-
+
private static void addDateRow(HTMLGen hgen, String s) {
hgen
.incr("tr")
@@ -129,16 +129,16 @@ public class RoleHistory extends Page {
.end()
.incr("td")
.tagOnly("input","type=number","id=year"+s.substring(0, s.indexOf(' ')),"required",
- "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900",
+ "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900",
"max="+Calendar.getInstance().get(Calendar.YEAR),
"placeholder=Year").end()
.end();
}
-
-
+
+
/**
* Implement the Table Content for History
- *
+ *
* @author Jeremiah
*
*/
@@ -146,25 +146,25 @@ public class RoleHistory extends Page {
private static final String[] headers = new String[] {"Date","User","Memo"};
private Slot role;
private Slot dates;
-
+
public Model(AuthzEnv env) {
role = env.slot(NAME+".role");
dates = env.slot(NAME+".dates");
}
-
+
@Override
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
final String oName = trans.get(role,null);
final String oDates = trans.get(dates,null);
-
+
Cells rv = Cells.EMPTY;
if (oName!=null) {
-
+
try {
rv = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Cells>() {
@Override
@@ -181,14 +181,14 @@ public class RoleHistory extends Page {
tt.done();
tt = trans.start("Load History Data", Env.SUB);
List<Item> histItems = fh.value.getItem();
-
+
java.util.Collections.sort(histItems, new Comparator<Item>() {
@Override
public int compare(Item o1, Item o2) {
return o2.getTimestamp().compare(o1.getTimestamp());
}
});
-
+
for (Item i : histItems) {
String user = i.getUser();
AbsCell userCell = new TextCell(user);
@@ -209,7 +209,7 @@ public class RoleHistory extends Page {
}
} finally {
tt.done();
- }
+ }
return new Cells(rv,msg);
}
});
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java
index 414c4161..ea1cfabf 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java
@@ -7,9 +7,9 @@
* 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.
@@ -51,23 +51,23 @@ import aaf.v2_0.UserRoles;
/**
* Page content for My Roles
- *
+ *
* @author Jonathan
*
*/
public class RolesShow extends Page {
public static final String HREF = "/gui/myroles";
private static final String DATE_TIME_FORMAT = "yyyy-MM-dd";
-
+
public RolesShow(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env, "MyRoles",HREF, NO_FIELDS,
- new BreadCrumbs(breadcrumbs),
+ new BreadCrumbs(breadcrumbs),
new Table<AAF_GUI,AuthzTrans>("Roles",gui.env.newTransNoAvg(),new Model(), "class=std"));
}
/**
* Implement the Table Content for Permissions by User
- *
+ *
* @author Jonathan
*
*/
@@ -81,7 +81,7 @@ public class RolesShow extends Page {
public String[] headers() {
return headers;
}
-
+
@Override
public Cells get(final AuthzTrans trans, final AAF_GUI gui) {
Cells rv = Cells.EMPTY;
@@ -107,7 +107,7 @@ public class RolesShow extends Page {
UserRoleRemove.HREF+USER +trans.user()+ROLE+u.getRole(),
false,
new String[]{CLASS_EXPIRED})
-
+
};
rv.add(sa);
} else {
@@ -124,7 +124,7 @@ public class RolesShow extends Page {
rv.add(sa);
}
}
-
+
} finally {
tt.done();
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java
index ed4c19d9..10a82267 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,11 +54,11 @@ public class UserRoleExtend extends Page {
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
final Slot sUser = gui.env.slot(NAME+".user");
final Slot sRole = gui.env.slot(NAME+".role");
-
-
+
+
cache.dynamic(hgen, new DynamicCode<HTMLGen, AAF_GUI, AuthzTrans>() {
@Override
- public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
+ public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
final String user = trans.get(sUser, "");
final String role = trans.get(sRole, "");
@@ -87,12 +87,12 @@ public class UserRoleExtend extends Page {
} finally {
tt.done();
}
-
-
+
+
}
});
}
-
+
});
}
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java
index 11126f89..75611b3f 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,11 +54,11 @@ public class UserRoleRemove extends Page {
public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
final Slot sUser = gui.env.slot(NAME+".user");
final Slot sRole = gui.env.slot(NAME+".role");
-
-
+
+
cache.dynamic(hgen, new DynamicCode<HTMLGen, AAF_GUI, AuthzTrans>() {
@Override
- public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
+ public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException {
final String user = trans.get(sUser, "");
final String role = trans.get(sRole, "");
@@ -69,7 +69,7 @@ public class UserRoleRemove extends Page {
public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
Future<Void> fv = client.delete(
"/authz/userRole/"+user+"/"+role+"?request=true",Void.class);
-
+
if (fv.get(5000)) {
// not sure if we'll ever hit this
hgen.p("User ["+ user+"] Removed from Role [" +role+"]");
@@ -91,7 +91,7 @@ public class UserRoleRemove extends Page {
}
});
}
-
+
});
}
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/WebCommand.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/WebCommand.java
index 73f4981c..3c30e807 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/WebCommand.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/WebCommand.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,7 +38,7 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
public class WebCommand extends Page {
public static final String HREF = "/gui/cui";
-
+
public WebCommand(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException {
super(gui.env, "Web Command Client",HREF, NO_FIELDS,
new BreadCrumbs(breadcrumbs),
@@ -54,21 +54,21 @@ public class WebCommand extends Page {
.end()
.text(". Type 'help' below for a list of AAF commands")
.end()
-
+
.divID("console_and_options");
- hgen.divID("console_area");
+ hgen.divID("console_area");
hgen.end(); //console_area
-
+
hgen.divID("options_link", "class=closed");
cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI,AuthzTrans>() {
@Override
public void code(AAF_GUI state, AuthzTrans trans, Cache<HTMLGen> cache, HTMLGen xgen)
throws APIException, IOException {
String image_root = "src=../../"+state.env.get(sThemeWebPath).toString() + '/' + state.env.get(sTheme) + "/images/icons";
- hgen.img(image_root + "/options_down.png", "onclick=handleDivHiding('options',this);",
- "id=options_img", "alt=Options", "title=Options")
+ hgen.img(image_root + "/options_down.png", "onclick=handleDivHiding('options',this);",
+ "id=options_img", "alt=Options", "title=Options")
.end(); //options_link
-
+
hgen.divID("options");
switch(browser(trans,trans.env().slot(getBrowserType()))) {
@@ -82,29 +82,29 @@ public class WebCommand extends Page {
}
// xgen.img("src=../../"+gui.theme+"/AAF_email.png", "onclick=emailLog();",
// "alt=Email log to me", "title=Email log to me");
- xgen.img(image_root+"/AAF_font_size.png", "onclick=handleDivHiding('text_slider',this);",
+ xgen.img(image_root+"/AAF_font_size.png", "onclick=handleDivHiding('text_slider',this);",
"id=fontsize_img", "alt=Change text size", "title=Change text size");
- xgen.img(image_root+"/AAF_details.png", "onclick=selectOption(this,0);",
+ xgen.img(image_root+"/AAF_details.png", "onclick=selectOption(this,0);",
"id=details_img", "alt=Turn on/off details mode", "title=Turn on/off details mode");
xgen.img(image_root+"/AAF_maximize.png", "onclick=maximizeConsole(this);",
"id=maximize_img", "alt=Maximize Console Window", "title=Maximize Console Window");
- }
+ }
});
hgen.divID("text_slider");
hgen.tagOnly("input", "type=button", "class=change_font", "onclick=buttonChangeFontSize('dec')", "value=-")
- .tagOnly("input", "id=text_size_slider", "type=range", "min=75", "max=200", "value=100",
+ .tagOnly("input", "id=text_size_slider", "type=range", "min=75", "max=200", "value=100",
"oninput=changeFontSize(this.value)", "onchange=changeFontSize(this.value)", "title=Change Text Size")
- .tagOnly("input", "type=button", "class=change_font", "onclick=buttonChangeFontSize('inc')", "value=+")
+ .tagOnly("input", "type=button", "class=change_font", "onclick=buttonChangeFontSize('inc')", "value=+")
.end(); //text_slider
hgen.end(); //options
hgen.end(); //console_and_options
-
+
hgen.divID("input_area");
- hgen.tagOnly("input", "type=text", "id=command_field",
+ hgen.tagOnly("input", "type=text", "id=command_field",
"autocomplete=off", "autocorrect=off", "autocapitalize=off", "spellcheck=false",
"onkeypress=keyPressed()", "placeholder=Type your AAFCLI commands here", "autofocus")
- .tagOnly("input", "id=submit", "type=button", "value=Submit",
+ .tagOnly("input", "id=submit", "type=button", "value=Submit",
"onclick=http('put','../../gui/cui',getCommand(),callCUI);")
.end();
@@ -112,10 +112,10 @@ public class WebCommand extends Page {
hgen.js(callCUI);
hgen.text("function callCUI(resp) {")
.text("moveCommandToDiv();")
- .text("printResponse(resp);")
+ .text("printResponse(resp);")
.text("}");
- hgen.end(callCUI);
-
+ hgen.end(callCUI);
+
}
});
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/AbsCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/AbsCell.java
index e461cf54..102d674e 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/AbsCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/AbsCell.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,13 +35,13 @@ public abstract class AbsCell {
* @param hgen
*/
public abstract void write(HTMLGen hgen);
-
+
public final static AbsCell Null = new AbsCell() {
@Override
public void write(final HTMLGen hgen) {
}
};
-
+
public String[] attrs() {
return NONE;
}
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/ButtonCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/ButtonCell.java
index 2443eb98..79c7483a 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/ButtonCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/ButtonCell.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,7 +25,7 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
public class ButtonCell extends AbsCell {
private String[] attrs;
-
+
public ButtonCell(String value, String ... attributes) {
attrs = new String[2+attributes.length];
attrs[0]="type=button";
@@ -37,7 +37,7 @@ public class ButtonCell extends AbsCell {
hgen.incr("input",true,attrs).end();
}
-
+
@Override
public String[] attrs() {
return AbsCell.CENTER;
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/CheckBoxCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/CheckBoxCell.java
index 91abfa42..b34efd05 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/CheckBoxCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/CheckBoxCell.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,7 +27,7 @@ public class CheckBoxCell extends AbsCell {
public enum ALIGN{ left, right, center };
private String[] attrs;
private ALIGN align;
-
+
public CheckBoxCell(String name, ALIGN align, String value, String ... attributes) {
this.align = align;
attrs = new String[3 + attributes.length];
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RadioCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RadioCell.java
index 9f21fac8..bccce8f9 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RadioCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RadioCell.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,7 +25,7 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
public class RadioCell extends AbsCell {
private String[] attrs;
-
+
public RadioCell(String name, String radioClass, String value, String ... attributes) {
attrs = new String[4 + attributes.length];
attrs[0]="type=radio";
@@ -35,7 +35,7 @@ public class RadioCell extends AbsCell {
System.arraycopy(attributes, 0, attrs, 4, attributes.length);
}
-
+
@Override
public void write(HTMLGen hgen) {
hgen.tagOnly("input",attrs);
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java
index 759d87f4..7058a243 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
public class RefCell extends AbsCell {
public final String name;
public final String[] str;
-
+
public RefCell(String name, String href, boolean newWindow, String... attributes) {
this.name = name;
if (newWindow) {
@@ -46,7 +46,7 @@ public class RefCell extends AbsCell {
System.arraycopy(attributes, 0, str, 1, attributes.length);
}
-
+
@Override
public void write(HTMLGen hgen) {
hgen.leaf(A,str).text(name);
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TableData.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TableData.java
index d202ffa0..df0ad967 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TableData.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TableData.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,7 +29,7 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
import org.onap.aaf.misc.xgen.html.State;
public abstract class TableData<S extends State<Env>, TRANS extends Trans> implements Table.Data<S,TRANS>{
- public static final String[] headers = new String[0];
+ public static final String[] headers = new String[0];
/* (non-Javadoc)
* @see org.onap.aaf.auth.gui.Table.Data#prefix(org.onap.aaf.misc.xgen.html.State, com.att.inno.env.Trans, org.onap.aaf.misc.xgen.Cache, org.onap.aaf.misc.xgen.html.HTMLGen)
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextAndRefCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextAndRefCell.java
index aefb3a46..ac65d741 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextAndRefCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextAndRefCell.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,7 +28,7 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
public class TextAndRefCell extends RefCell {
private String text;
-
+
public TextAndRefCell(String text, String name, String href, boolean newWindow, String[] attributes) {
super(name, href, newWindow, attributes);
this.text = text;
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextCell.java
index 5d2a7262..2fdd914a 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextCell.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,17 +31,17 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
public class TextCell extends AbsCell {
public final String name;
private String[] attrs;
-
+
public TextCell(String name, String... attributes) {
attrs = attributes;
this.name = name;
}
-
+
@Override
public void write(HTMLGen hgen) {
hgen.text(name);
}
-
+
@Override
public String[] attrs() {
return attrs;
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextInputCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextInputCell.java
index c55759ea..655ae8db 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextInputCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextInputCell.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,7 +31,7 @@ import org.onap.aaf.misc.xgen.html.HTMLGen;
public class TextInputCell extends AbsCell {
private static final String[] NULL_ATTRS=new String[0];
private String[] attrs;
-
+
public TextInputCell(String name, String textClass, String value, String ... attributes) {
attrs = new String[5 + attributes.length];
attrs[0]="type=text";
@@ -41,12 +41,12 @@ public class TextInputCell extends AbsCell {
attrs[4]="style=font-size:100%;";
System.arraycopy(attributes, 0, attrs, 5, attributes.length);
}
-
+
@Override
public void write(HTMLGen hgen) {
hgen.tagOnly("input",attrs);
}
-
+
@Override
public String[] attrs() {
return NULL_ATTRS;
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextToolTipCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextToolTipCell.java
index 5eaa69d1..8f047d85 100644
--- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextToolTipCell.java
+++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/TextToolTipCell.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,18 +32,18 @@ public class TextToolTipCell extends AbsCell {
public final String name;
private final String[] attrs;
private final String tooltip;
-
+
public TextToolTipCell(String name, String tooltip, String... attributes) {
attrs = attributes;
this.name = name;
this.tooltip = "<abbr title=\"" + tooltip + "\">";
}
-
+
@Override
public void write(HTMLGen hgen) {
hgen.text(tooltip + name + "</abbr>");
}
-
+
@Override
public String[] attrs() {
return attrs;
diff --git a/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_FormTest.java b/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_FormTest.java
index fa95bc25..8181d1d2 100644
--- a/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_FormTest.java
+++ b/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_FormTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_TableTest.java b/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_TableTest.java
index ec39916b..b655d003 100644
--- a/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_TableTest.java
+++ b/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/JU_TableTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/table/JU_UICellTest.java b/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/table/JU_UICellTest.java
index 3cf6b723..067b62d6 100644
--- a/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/table/JU_UICellTest.java
+++ b/auth/auth-gui/src/test/java/org/onap/aaf/auth/gui/table/JU_UICellTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
index cd9965cf..e5366ac6 100644
--- a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
+++ b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,19 +52,19 @@ public class AAF_Hello extends AbsService<AuthzEnv,AuthzTrans> {
public Map<String, Dated> cacheUser;
public AAFAuthn<?> aafAuthn;
public AAFLurPerm aafLurPerm;
-
+
/**
* Construct AuthzAPI with all the Context Supporting Routes that Authz needs
- *
+ *
* @param env
- * @param si
- * @param dm
- * @param decryptor
- * @throws APIException
+ * @param si
+ * @param dm
+ * @param decryptor
+ * @throws APIException
*/
public AAF_Hello(final AuthzEnv env) throws Exception {
super(env.access(), env);
-
+
aafLurPerm = aafCon().newLur();
// Note: If you need both Authn and Authz construct the following:
aafAuthn = aafCon().newAuthn(aafLurPerm);
@@ -73,29 +73,29 @@ public class AAF_Hello extends AbsService<AuthzEnv,AuthzTrans> {
if (aaf_env==null) {
throw new APIException("aaf_env needs to be set");
}
-
+
// Initialize Facade for all uses
AuthzTrans trans = env.newTrans();
StringBuilder sb = new StringBuilder();
trans.auditTrail(2, sb);
trans.init().log(sb);
-
+
API_Hello.init(this);
}
-
+
/**
* Setup XML and JSON implementations for each supported Version type
- *
+ *
* We do this by taking the Code passed in and creating clones of these with the appropriate Facades and properties
* to do Versions and Content switches
- *
+ *
*/
public void route(HttpMethods meth, String path, API api, HttpCode<AuthzTrans, AAF_Hello> code){
String version = "1.0";
// Get Correct API Class from Mapper
route(env,meth,path,code,"text/plain;version="+version,"*/*");
}
-
+
@Override
public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
try {
diff --git a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java
index 814dff27..4ffb1787 100644
--- a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java
+++ b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/API_Hello.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,10 +48,10 @@ public class API_Hello {
// Hide Public Constructor
private API_Hello() {}
-
+
/**
* Normal Init level APIs
- *
+ *
* @param oauthHello
* @param facade
* @throws Exception
@@ -60,7 +60,7 @@ public class API_Hello {
////////
// Simple "GET" API
///////
-
+
oauthHello.route(HttpMethods.GET,"/hello/:perm*",API.TOKEN,new HttpCode<AuthzTrans, AAF_Hello>(oauthHello,"Hello OAuth"){
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
@@ -86,10 +86,10 @@ public class API_Hello {
os.print(')');
}
os.println();
-
+
trans.info().printf("Said 'Hello' to %s, Authentication type: %s",trans.getUserPrincipal().getName(),trans.getUserPrincipal().getClass().getSimpleName());
}
- });
+ });
////////////////
// REST APIs
@@ -115,7 +115,7 @@ public class API_Hello {
resp.setStatus(406);
}
}
- },APPLICATION_JSON);
+ },APPLICATION_JSON);
////////////////
@@ -147,8 +147,8 @@ public class API_Hello {
os.println(sb.toString());
trans.info().printf("Said 'RESTful Hello' to %s, Authentication type: %s",trans.getUserPrincipal().getName(),trans.getUserPrincipal().getClass().getSimpleName());
}
- },APPLICATION_JSON);
-
+ },APPLICATION_JSON);
+
////////////////
// UPDATE/PUT
////////////////
@@ -170,7 +170,7 @@ public class API_Hello {
resp.setStatus(406);
}
}
- },APPLICATION_JSON);
+ },APPLICATION_JSON);
////////////////
@@ -182,7 +182,7 @@ public class API_Hello {
trans.info().printf("Delete requested on %s\n", pathParam(req, ":id"));
resp.setStatus(200 /* OK */);
}
- },APPLICATION_JSON);
+ },APPLICATION_JSON);
}
}
diff --git a/auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java b/auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java
index e85431d3..2ed4efb1 100644
--- a/auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java
+++ b/auth/auth-hello/src/test/java/org/onap/aaf/auth/hello/test/HelloTester.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,7 +52,7 @@ public class HelloTester {
SecurityInfoC<HttpURLConnection> si = SecurityInfoC.instance(access, HttpURLConnection.class);
AAFLocator loc = new AAFLocator(si,new URI(uriPrefix+"/locate/"+Define.ROOT_NS()+".hello:1.0"));
AAFConHttp aafcon = new AAFConHttp(access,loc,si);
-
+
//
String pathinfo = "/hello";
final int iterations = Integer.parseInt(access.getProperty("iterations","5"));
@@ -68,7 +68,7 @@ public class HelloTester {
System.err.println("Ooops, missed one: " + fs.code() + ": " + fs.body());
}
return null;
-
+
}
});
Thread.sleep(500L);
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
index 0ad14c84..ff538269 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
@@ -7,9 +7,9 @@
* 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.
@@ -81,19 +81,19 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
public final ConfigDAO configDAO;
private Locator<URI> dal;
-
+
/**
* Construct AuthzAPI with all the Context Supporting Routes that Authz needs
- *
+ *
* @param env
- * @param si
- * @param dm
- * @param decryptor
- * @throws APIException
+ * @param si
+ * @param dm
+ * @param decryptor
+ * @throws APIException
*/
public AAF_Locate(final AuthzEnv env) throws Exception {
super(env.access(), env);
-
+
expireIn = Long.parseLong(env.getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF));
// Initialize Facade for all uses
@@ -129,7 +129,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
API_AAFAccess.init(this,facade);
API_Find.init(this, facade);
API_Proxy.init(this, facade);
-
+
////////////////////////////////////////////////////////////////////////
// Management APIs
////////////////////////////////////////////////////////////////////////
@@ -143,21 +143,21 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
// Default Function
////////////////////////////////////////////////////////////////////////
API_AAFAccess.initDefault(this,facade);
-
+
}
-
+
/**
* Setup XML and JSON implementations for each supported Version type
- *
+ *
* We do this by taking the Code passed in and creating clones of these with the appropriate Facades and properties
* to do Versions and Content switches
- *
+ *
*/
public void route(HttpMethods meth, String path, API api, LocateCode code) throws Exception {
String version = "1.0";
// Get Correct API Class from Mapper
- Class<?> respCls = facade.mapper().getClass(api);
+ Class<?> respCls = facade.mapper().getClass(api);
if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
// setup Application API HTML ContentTypes for JSON and Route
String application = applicationJSON(respCls, version);
@@ -166,10 +166,10 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
// setup Application API HTML ContentTypes for XML and Route
application = applicationXML(respCls, version);
route(env,meth,path,code.clone(facade_1_1_XML,false),application,"text/xml;version="+version);
-
+
// Add other Supported APIs here as created
}
-
+
public void routeAll(HttpMethods meth, String path, API api, LocateCode code){
route(env,meth,path,code,""); // this will always match
}
@@ -210,7 +210,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
try {
return new Filter[] {
- new AuthzTransFilter(env, aafCon(),
+ new AuthzTransFilter(env, aafCon(),
new AAFTrustChecker((Env)env)
,additionalTafLurs
)};
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java
index 30258d80..80dffc27 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java
index 214c9d80..a2fd5c24 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,7 @@ public abstract class LocateCode extends HttpCode<AuthzTrans, LocateFacade> impl
super(facade, description, roles);
this.useJSON = useJSON;
}
-
+
public <D extends LocateCode> D clone(LocateFacade facade, boolean useJSON) throws Exception {
@SuppressWarnings("unchecked")
D d = (D)clone();
@@ -40,5 +40,5 @@ public abstract class LocateCode extends HttpCode<AuthzTrans, LocateFacade> impl
d.context = facade;
return d;
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java
index b5ab4351..36a987e5 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,22 +55,22 @@ import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.TimeTaken;
public class API_AAFAccess {
-// private static String service, version, envContext;
+// private static String service, version, envContext;
private static final String GET_PERMS_BY_USER = "Get Perms by User";
private static final String USER_HAS_PERM ="User Has Perm";
// private static final String USER_IN_ROLE ="User Has Role";
-
+
/**
* Normal Init level APIs
- *
+ *
* @param gwAPI
* @param facade
* @throws Exception
*/
public static void init(final AAF_Locate gwAPI, LocateFacade facade) throws Exception {
-
-
+
+
gwAPI.route(HttpMethods.GET,"/authz/perms/user/:user",API.VOID,new LocateCode(facade,GET_PERMS_BY_USER, true) {
@Override
public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
@@ -90,7 +90,7 @@ public class API_AAFAccess {
} finally {
tt2.done();
}
-
+
if (d==null || d.data.isEmpty()) {
tt2 = trans.start("AAF Service Call",Env.REMOTE);
try {
@@ -136,7 +136,7 @@ public class API_AAFAccess {
/**
* Query User Has Perm is DEPRECATED
- *
+ *
* Need to move towards NS declaration... is this even being used?
* @deprecated
*/
@@ -169,8 +169,8 @@ public class API_AAFAccess {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
- gwAPI.getGUILocator(),
+ redirect(trans, req, resp, context,
+ gwAPI.getGUILocator(),
"gui/"+pathParam(req,":path"));
} catch (LocatorException e) {
context.error(trans, resp, Result.ERR_BadData, e.getMessage());
@@ -184,8 +184,8 @@ public class API_AAFAccess {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
- gwAPI.getGUILocator(),
+ redirect(trans, req, resp, context,
+ gwAPI.getGUILocator(),
pathParam(req,":path"));
} catch (LocatorException e) {
context.error(trans, resp, Result.ERR_BadData, e.getMessage());
@@ -195,7 +195,7 @@ public class API_AAFAccess {
}
});
}
-
+
public static void initDefault(final AAF_Locate gwAPI, LocateFacade facade) throws Exception {
/**
@@ -205,7 +205,7 @@ public class API_AAFAccess {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
+ redirect(trans, req, resp, context,
gwAPI.getGUILocator(),
"login");
} catch (LocatorException e) {
@@ -216,7 +216,7 @@ public class API_AAFAccess {
}
});
-
+
/**
* Default URL
*/
@@ -224,17 +224,17 @@ public class API_AAFAccess {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
- gwAPI.getGUILocator(),
+ redirect(trans, req, resp, context,
+ gwAPI.getGUILocator(),
"gui/home");
} catch (Exception e) {
context.error(trans, resp, Result.ERR_General, e.getMessage());
}
}
});
-
+
/**
- * Configuration
+ * Configuration
*/
gwAPI.route(HttpMethods.GET,"/configure/:id/:type",API.CONFIG,new LocateCode(facade,"Deliver Configuration Properties to AAF", true) {
@Override
@@ -261,7 +261,7 @@ public class API_AAFAccess {
if (loc.hasItems()) {
Item item = loc.best();
URI uri = loc.get(item);
- StringBuilder redirectURL = new StringBuilder(uri.toString());
+ StringBuilder redirectURL = new StringBuilder(uri.toString());
redirectURL.append('/');
redirectURL.append(path);
String str = req.getQueryString();
@@ -282,7 +282,7 @@ public class API_AAFAccess {
private static class User {
public final int code;
public final String resp;
-
+
public User(int code, String resp) {
this.code = code;
this.resp = resp;
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java
index 1e60e796..90cfa68d 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,7 +44,7 @@ import org.onap.aaf.cadi.Symm;
public class API_Api {
/**
* Normal Init level APIs
- *
+ *
* @param gwAPI
* @param facade
* @throws Exception
@@ -76,7 +76,7 @@ public class API_Api {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String pathInfo = req.getPathInfo();
int question = pathInfo.lastIndexOf('?');
-
+
pathInfo = pathInfo.substring(13, question<0?pathInfo.length():question);// IMPORTANT, this is size of "/api/example/"
String nameOrContextType=Symm.base64noSplit.decode(pathInfo);
// String param = req.getParameter("optional");
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java
index 88fcc079..08236aa3 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,14 +39,14 @@ import org.onap.aaf.misc.env.util.Split;
/**
* API Apis.. using Redirect for mechanism
- *
+ *
* @author Jonathan
*
*/
public class API_Find {
/**
* Normal Init level APIs
- *
+ *
* @param gwAPI
* @param facade
* @throws Exception
@@ -55,7 +55,7 @@ public class API_Find {
////////
// Overall APIs
///////
-
+
final LocateCode locationInfo = new LocateCode(facade,"Location Information", true) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
@@ -75,7 +75,7 @@ public class API_Find {
service=Define.varReplace(service);
Result<Void> r = context.getEndpoints(trans,resp,
req.getPathInfo(), // use as Key
- service,version,other
+ service,version,other
);
switch(r.status) {
case OK:
@@ -90,8 +90,8 @@ public class API_Find {
gwAPI.route(HttpMethods.GET,"/locate/:service/:version",API.ENDPOINTS,locationInfo);
gwAPI.route(HttpMethods.GET,"/locate/:service/:version/:other",API.ENDPOINTS,locationInfo);
gwAPI.route(HttpMethods.GET,"/locate/:service",API.ENDPOINTS,locationInfo);
-
-
+
+
gwAPI.route(HttpMethods.GET,"/download/agent", API.VOID, new LocateCode(facade,"Redirect to latest Agent",false) {
@Override
public void handle(AuthzTrans arg0, HttpServletRequest arg1, HttpServletResponse arg2) throws Exception {
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java
index 85860316..962b9859 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,7 +46,7 @@ import org.onap.aaf.misc.env.TimeTaken;
/**
* API Apis.. using Redirect for mechanism
- *
+ *
* @author Jonathan
*
*/
@@ -54,13 +54,13 @@ public class API_Proxy {
/**
* Normal Init level APIs
- *
+ *
* @param gwAPI
* @param facade
* @throws Exception
*/
public static void init(final AAF_Locate gwAPI, LocateFacade facade) throws Exception {
-
+
String aafurl = gwAPI.access.getProperty(Config.AAF_URL,null);
if (aafurl!=null) {
////////
@@ -68,7 +68,7 @@ public class API_Proxy {
// But DO NOT transfer BasicAuth case... wastes resources.
///////
final BasicAuthCode bac = new BasicAuthCode(gwAPI.aafAuthn,facade);
-
+
gwAPI.routeAll(HttpMethods.GET,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy GET", true) {
@Override
public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
@@ -85,7 +85,7 @@ public class API_Proxy {
return null;
}
});
-
+
} catch (CadiException | APIException e) {
trans.error().log(e);
} finally {
@@ -94,7 +94,7 @@ public class API_Proxy {
}
}
});
-
+
gwAPI.routeAll(HttpMethods.POST,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy POST", true) {
@Override
public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
@@ -115,7 +115,7 @@ public class API_Proxy {
}
}
});
-
+
gwAPI.routeAll(HttpMethods.PUT,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy PUT", true) {
@Override
public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
@@ -136,7 +136,7 @@ public class API_Proxy {
}
}
});
-
+
gwAPI.routeAll(HttpMethods.DELETE,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy DELETE", true) {
@Override
public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java
index 4a2afa58..18d4f350 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,14 +30,14 @@ import org.onap.aaf.auth.rserv.RServlet;
/**
- *
+ *
* @author Jonathan
*
*/
public interface LocateFacade {
///////////////////// STANDARD ELEMENTS //////////////////
- /**
+ /**
* @param trans
* @param response
* @param result
@@ -45,7 +45,7 @@ public interface LocateFacade {
void error(AuthzTrans trans, HttpServletResponse response, Result<?> result);
/**
- *
+ *
* @param trans
* @param response
* @param status
@@ -54,7 +54,7 @@ public interface LocateFacade {
/**
- *
+ *
* @param trans
* @param resp
* @param rservlet
@@ -63,7 +63,7 @@ public interface LocateFacade {
public Result<Void> getAPI(AuthzTrans trans, HttpServletResponse resp, RServlet<AuthzTrans> rservlet);
/**
- *
+ *
* @param trans
* @param resp
* @param typeCode
@@ -73,20 +73,20 @@ public interface LocateFacade {
public abstract Result<Void> getAPIExample(AuthzTrans trans, HttpServletResponse resp, String typeCode, boolean optional);
/**
- *
+ *
* @param trans
* @param resp
* @param service
* @param version
* @param other
- * @param string
+ * @param string
* @return
*/
- public abstract Result<Void> getEndpoints(AuthzTrans trans, HttpServletResponse resp, String key,
+ public abstract Result<Void> getEndpoints(AuthzTrans trans, HttpServletResponse resp, String key,
String service, String version, String other);
/**
- *
+ *
* @param trans
* @param req
* @param resp
@@ -95,7 +95,7 @@ public interface LocateFacade {
public abstract Result<Void> putMgmtEndpoints(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
/**
- *
+ *
* @param trans
* @param req
* @param resp
@@ -104,7 +104,7 @@ public interface LocateFacade {
public abstract Result<Void> removeMgmtEndpoints(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
/**
- *
+ *
* @param trans
* @param req
* @param resp
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java
index 0bb9fbdb..e2d7cf96 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,7 +43,7 @@ public class LocateFacadeFactory {
InRequest,
Out,
Error>(trans,locate,new Mapper_1_1()),
- type);
+ type);
}
}
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java
index fc73047c..67107088 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -65,7 +65,7 @@ import locate_local.v1_0.Api;
/**
* AuthzFacade
- *
+ *
* This Service Facade encapsulates the essence of the API Service can do, and provides
* a single created object for elements such as RosettaDF.
*
@@ -76,14 +76,14 @@ import locate_local.v1_0.Api;
* a) In the future, we may support multiple Response Formats, aka JSON or XML, based on User Request.
* 4) Log Service info, warnings and exceptions as necessary
* 5) When asked by the API layer, this will create and write Error content to the OutputStream
- *
- * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
+ *
+ * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
* clearly coordinated with the API Documentation
- *
+ *
* @author Jonathan
*
*/
-public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURATION,ERROR> extends FacadeImpl implements LocateFacade
+public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURATION,ERROR> extends FacadeImpl implements LocateFacade
{
private LocateService<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURATION,ERROR> service;
@@ -105,14 +105,14 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
(mepDF = env.newDataFactory(mapper().getClass(API.MGMT_ENDPOINTS))).in(dataType).out(dataType);
(confDF = env.newDataFactory(mapper().getClass(API.CONFIG))).in(dataType).out(dataType);
}
-
+
public Mapper<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURATION,ERROR> mapper() {
return service.mapper();
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#error(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, int)
- *
+ *
* Note: Conforms to AT&T TSS RESTful Error Structure
*/
@Override
@@ -128,7 +128,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
}
error(trans, response, result.status,msg,detail);
}
-
+
@Override
public void error(AuthzTrans trans, HttpServletResponse response, int status, String msg, String ... _detail) {
String[] detail = _detail;
@@ -153,7 +153,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
detail[0] = "Forbidden";
response.setStatus(/*httpstatus=*/403);
break;
-
+
case 404:
case ERR_NotFound:
msgId = "SVC1404";
@@ -167,21 +167,21 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
detail[0] = "Not Acceptable";
response.setStatus(/*httpstatus=*/406);
break;
-
+
case 409:
case ERR_ConflictAlreadyExists:
msgId = "SVC1409";
detail[0] = "Conflict Already Exists";
response.setStatus(/*httpstatus=*/409);
break;
-
+
case 501:
case ERR_NotImplemented:
msgId = "SVC1501";
- detail[0] = "Not Implemented";
+ detail[0] = "Not Implemented";
response.setStatus(/*httpstatus=*/501);
break;
-
+
default:
msgId = "SVC1500";
detail[0] = "General Service Error";
@@ -194,7 +194,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
StringBuilder holder = new StringBuilder();
ERROR em = mapper().errorFromMessage(holder,msgId,msg,detail);
trans.checkpoint(
- "ErrResp [" +
+ "ErrResp [" +
msgId +
"] " +
holder.toString(),
@@ -204,12 +204,12 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
em = mapper().errorFromMessage(holder, msgId, "Server had an issue processing this request");
}
errDF.newData(trans).load(em).to(response.getOutputStream());
-
+
} catch (Exception e) {
trans.error().log(e,"unable to send response for",msg);
}
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getAPI(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse)
*/
@@ -256,7 +256,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
tt.done();
}
}
-
+
public final static String API_EXAMPLE = "apiExample";
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getAPIExample(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String)
@@ -265,7 +265,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
public Result<Void> getAPIExample(AuthzTrans trans, HttpServletResponse resp, String nameOrContentType, boolean optional) {
TimeTaken tt = trans.start(API_EXAMPLE, Env.SUB);
try {
- String content =Examples.print(apiDF.getEnv(), nameOrContentType, optional);
+ String content =Examples.print(apiDF.getEnv(), nameOrContentType, optional);
resp.getOutputStream().print(content);
setContentType(resp,content.contains("<?xml")?TYPE.XML:TYPE.JSON);
return Result.ok();
@@ -296,7 +296,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
output = epsCache.get(key);
if ("{}".equals(output) && emptyCheck<temp) {
output = null;
- emptyCheck = temp+5000; // 5 second check
+ emptyCheck = temp+5000; // 5 second check
}
}
}
@@ -341,7 +341,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
}
Result<Void> rp = service.putMgmtEndPoints(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
synchronized(LOCK) {
cacheClear = 0L;
}
@@ -377,7 +377,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
}
Result<Void> rp = service.removeMgmtEndPoints(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
synchronized(LOCK) {
cacheClear = 0L;
}
@@ -401,7 +401,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
try {
Result<CONFIGURATION> rp = service.getConfig(trans, id, type);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,mepDF.getOutType());
confDF.newData(trans).load(rp.value).to(resp.getOutputStream());
return Result.ok();
@@ -413,7 +413,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
return Result.err(e);
} finally {
tt.done();
- }
+ }
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java
index 8f45058f..3a1f9b83 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java
index e2cd4bce..60c6d1f1 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java
index aca71363..75652897 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,7 +38,7 @@ import locate_local.v1_0.InRequest;
import locate_local.v1_0.Out;
public class Mapper_1_1 implements Mapper<InRequest,Out,Endpoints,MgmtEndpoints,Configuration,Error> {
-
+
@Override
public Class<?> getClass(API api) {
switch(api) {
@@ -91,7 +91,7 @@ public class Mapper_1_1 implements Mapper<InRequest,Out,Endpoints,MgmtEndpoints,
}
int major=-1, minor=-1, patch=-1, pkg=-1;
if (version!=null) {
- try {
+ try {
String[] v = Split.split('.',version);
if (v.length>0) {major = Integer.parseInt(v[0]);}
if (v.length>1) {minor = Integer.parseInt(v[1]);}
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java
index 47f3b984..9a6858a3 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java
index 1ace384e..0e12ebb9 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,20 +40,20 @@ import locate.v1_0.MgmtEndpoints;
import locate.v1_1.Configuration;
import locate.v1_1.Configuration.Props;
-public class LocateServiceImpl<IN,OUT,ERROR>
+public class LocateServiceImpl<IN,OUT,ERROR>
implements LocateService<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> {
private Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper;
protected LocateDAO locateDAO;
private ConfigDAO configDAO;
private boolean permToRegister;
-
+
public LocateServiceImpl(AuthzTrans trans, AAF_Locate locate, Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper){
this.mapper = mapper;
this.locateDAO = locate.locateDAO;
this.configDAO = locate.configDAO;
permToRegister = false; //TODO Setup a Configuration for this
}
-
+
public Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper() {return mapper;}
@Override
@@ -73,14 +73,14 @@ public class LocateServiceImpl<IN,OUT,ERROR>
int count = 0;
StringBuilder denied = null;
for (MgmtEndpoint me : meps.getMgmtEndpoint()) {
- if (permToRegister) {
+ if (permToRegister) {
int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName()
- AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
+ AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
if (!trans.fish(p)) {
if(denied==null) {
denied = new StringBuilder("May not register service(s):");
}
-
+
denied.append("\n\t");
denied.append(p.getKey());
denied.append(')');
@@ -111,14 +111,14 @@ public class LocateServiceImpl<IN,OUT,ERROR>
int count = 0;
StringBuilder denied = null;
for (MgmtEndpoint me : meps.getMgmtEndpoint()) {
- if (permToRegister) {
+ if (permToRegister) {
int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName()
- AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
+ AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
if (!trans.fish(p)) {
if(denied==null) {
denied = new StringBuilder("May not deregister service(s):");
}
-
+
denied.append("\n\t");
denied.append(p.getKey());
denied.append(')');
@@ -140,7 +140,7 @@ public class LocateServiceImpl<IN,OUT,ERROR>
///// ADDED v1_1
/* (non-Javadoc)
* @see org.onap.aaf.auth.locate.service.LocateService#getConfig(org.onap.aaf.auth.env.AuthzTrans, java.lang.String, java.lang.String)
- *
+ *
* Note: "id" is put in, in case we need to filter, or direct data change in the future by Permission
*/
@Override
@@ -149,7 +149,7 @@ public class LocateServiceImpl<IN,OUT,ERROR>
Configuration c = new Configuration();
c.setName(type);
Props p;
-
+
if (dr.isOKhasData()) {
for (ConfigDAO.Data data : dr.value) {
p = new Props();
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
index 747211e1..b6ae54eb 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,9 +32,9 @@ import locate.v1_0.MgmtEndpoints;
/**
* Validator
* Consistently apply content rules for content (incoming)
- *
- * Note: We restrict content for usability in URLs (because RESTful service), and avoid
- * issues with Regular Expressions, and other enabling technologies.
+ *
+ * Note: We restrict content for usability in URLs (because RESTful service), and avoid
+ * issues with Regular Expressions, and other enabling technologies.
* @author Jonathan
*
*/
@@ -73,7 +73,7 @@ public class LocateValidator extends Validator {
}
return this;
}
-
+
public LocateValidator endpoints(Endpoints e, boolean emptyNotOK) {
if (e==null) {
msg("Endpoints Data is null.");
@@ -130,7 +130,7 @@ public class LocateValidator extends Validator {
nullOrBlank("Special Port Name",sp.getName());
nullOrBlank("Special Port Protocol",sp.getProtocol());
intRange("Special Port",sp.getPort(),0,1000000);
-
+
for (String s : sp.getProtocolVersions()) {
nullOrBlank("Special Port Protocol Version", s);
}
diff --git a/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java b/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java
index dd9ac7fc..c3b964bc 100644
--- a/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java
+++ b/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
index b4c9f97b..6f04ed5f 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java
@@ -7,9 +7,9 @@
* 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.
@@ -72,36 +72,36 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
private final OAuthService service;
private OAFacade1_0 facade1_0;
private final Question question;
- private TokenPermLoader tpLoader;
+ private TokenPermLoader tpLoader;
private final Cluster cluster;
-
+
/**
* Construct AuthzAPI with all the Context Supporting Routes that Authz needs
- *
+ *
* @param env
- * @param si
- * @param dm
- * @param decryptor
- * @throws APIException
+ * @param si
+ * @param dm
+ * @param decryptor
+ * @throws APIException
*/
public AAF_OAuth(final AuthzEnv env) throws Exception {
super(env.access(),env);
-
+
String aaf_env = env.getProperty(Config.AAF_ENV);
if (aaf_env==null) {
throw new APIException("aaf_env needs to be set");
}
-
+
// Initialize Facade for all uses
AuthzTrans trans = env.newTrans();
cluster = org.onap.aaf.auth.dao.CassAccess.cluster(env,null);
-
+
aafLurPerm = aafCon().newLur();
// Note: If you need both Authn and Authz construct the following:
aafAuthn = aafCon().newAuthn(aafLurPerm);
// Start Background Processing
- // Question question =
+ // Question question =
question = new Question(trans, cluster, CassAccess.KEYSPACE);
question.startTimers(env);
@@ -114,21 +114,21 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
StringBuilder sb = new StringBuilder();
trans.auditTrail(2, sb);
trans.init().log(sb);
-
+
API_Token.init(this, facade1_0);
}
-
+
/**
* Setup XML and JSON implementations for each supported Version type
- *
+ *
* We do this by taking the Code passed in and creating clones of these with the appropriate Facades and properties
* to do Versions and Content switches
- *
+ *
*/
public void route(HttpMethods meth, String path, API api, HttpCode<AuthzTrans, OAFacade<Introspect>> code) throws Exception {
String version = "1.0";
// Get Correct API Class from Mapper
- Class<?> respCls = facade1_0.mapper().getClass(api);
+ Class<?> respCls = facade1_0.mapper().getClass(api);
if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
// setup Application API HTML ContentTypes for JSON and Route
String application = applicationJSON(respCls, version);
@@ -138,7 +138,7 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
route(env,meth,path,code,application,"application/json;version="+version,"*/*");
}
}
-
+
@Override
public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
try {
@@ -150,7 +150,7 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
if (additionalTafLurs.length>0) {
System.arraycopy(additionalTafLurs, 0, atl, 2, additionalTafLurs.length);
}
-
+
return new Filter[] {
new AuthzTransFilter(env,aafCon(),
new AAFTrustChecker((Env)env),
@@ -160,7 +160,7 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
throw new CadiException("Invalid Property information", e);
}
}
-
+
@SuppressWarnings("unchecked")
@Override
public Registrant<AuthzEnv>[] registrants(final int port) throws CadiException {
@@ -181,7 +181,7 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> {
}
super.destroy();
}
-
+
// For use in CADI ONLY
public TokenMgr.TokenPermLoader tpLoader() {
return tpLoader;
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java
index 3d863824..45a70e9e 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/DirectOAuthTAF.java
@@ -7,9 +7,9 @@
* 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.
@@ -80,7 +80,7 @@ public class DirectOAuthTAF implements HttpTaf {
String[] split = Split.split(',', alt_url);
int timeout = split.length>1?Integer.parseInt(split[1]):3000;
altIntrospectClient = tcf.newClient(split[0], timeout);
- altIntrospectClient.client_creds(access.getProperty(Config.AAF_ALT_CLIENT_ID,null),
+ altIntrospectClient.client_creds(access.getProperty(Config.AAF_ALT_CLIENT_ID,null),
access.getProperty(Config.AAF_ALT_CLIENT_SECRET,null));
} catch (GeneralSecurityException | IOException | LocatorException e) {
throw new CadiException(e);
@@ -125,7 +125,7 @@ public class DirectOAuthTAF implements HttpTaf {
password=s;
}
break;
- case "token":
+ case "token":
if (token!=null) { // Defined as both Bearer and Form Encoded - Error
return new OAuth2HttpTafResp(access, null, "Token Info found as both Bearer Token and Form Info", RESP.FAIL, resp, true);
}
@@ -136,12 +136,12 @@ public class DirectOAuthTAF implements HttpTaf {
// Ignore others
}
}
-
+
if (client_id==null || client_secret==null) {
return new OAuth2HttpTafResp(access, null, "client_id and client_secret required", RESP.TRY_ANOTHER_TAF, resp, false);
}
-
- if (token==null) { // No Token to work with, use only Client_ID and Client_Secret
+
+ if (token==null) { // No Token to work with, use only Client_ID and Client_Secret
AuthzTrans trans = (AuthzTrans)req.getAttribute(TransFilter.TRANS_TAG);
if (directUserPass.validate(client_id, Type.PASSWORD, client_secret.getBytes(), trans)) {
@@ -166,8 +166,8 @@ public class DirectOAuthTAF implements HttpTaf {
return new OAuth2HttpTafResp(access,null,"OAuth client_id " + client_id + " not authenticated ",RESP.FAIL,resp,true);
}
}
- }
-
+ }
+
// OK, have only a Token to validate
if (token!=null) {
AuthzTrans trans = (AuthzTrans)req.getAttribute(TransFilter.TRANS_TAG);
@@ -205,7 +205,7 @@ public class DirectOAuthTAF implements HttpTaf {
public ServiceTPL(AuthzTrans atrans) {
trans = atrans;
}
-
+
@Override
public org.onap.aaf.cadi.client.Result<TokenPerm> load(String accessToken, byte[] cred) throws APIException, CadiException, LocatorException {
Result<Introspect> ri = oaFacade.mappedIntrospect(trans, accessToken);
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OACode.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OACode.java
index a0381c3e..082c0fb2 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OACode.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OACode.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ public abstract class OACode extends HttpCode<AuthzTrans, OAFacade<Introspect>>
super(facade, description, roles);
this.useJSON = useJSON;
}
-
+
public <D extends OACode> D clone(OAFacade<Introspect> facade, boolean useJSON) throws Exception {
@SuppressWarnings("unchecked")
D d = (D)clone();
@@ -41,5 +41,5 @@ public abstract class OACode extends HttpCode<AuthzTrans, OAFacade<Introspect>>
d.context = facade;
return d;
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java
index 9777f564..a3242ec8 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2Filter.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,8 +46,8 @@ public class OAuth2Filter implements Filter {
HttpServletRequest hreq = (HttpServletRequest)request;
Principal p = hreq.getUserPrincipal();
if (request.getContentType().equals("application/x-www-form-urlencoded")) {
-
- } else if (p instanceof BearerPrincipal) {
+
+ } else if (p instanceof BearerPrincipal) {
for (String authz : Split.splitTrim(';', hreq.getHeader("Authorization"))) {
if (authz.startsWith("Bearer ")) {
((BearerPrincipal)p).setBearer(authz.substring(7));
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2FormHttpTafResp.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2FormHttpTafResp.java
index f63daf89..2d76248e 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2FormHttpTafResp.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/OAuth2FormHttpTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,23 +36,23 @@ public class OAuth2FormHttpTafResp extends AbsTafResp implements TafResp {
private HttpServletResponse httpResp;
private RESP status;
private final boolean wasFailed;
-
+
public OAuth2FormHttpTafResp(Access access, OAuth2FormPrincipal principal, String desc, RESP status, HttpServletResponse resp, boolean wasFailed) {
super(access,tafName,principal, desc);
httpResp = resp;
- this.status = status;
+ this.status = status;
this.wasFailed = wasFailed;
}
public OAuth2FormHttpTafResp(Access access, TrustPrincipal principal, String desc, RESP status,HttpServletResponse resp) {
super(access,tafName,principal, desc);
httpResp = resp;
- this.status = status;
+ this.status = status;
wasFailed = true; // if Trust Principal added, must be good
}
public RESP authenticate() throws IOException {
- httpResp.setStatus(401); // Unauthorized
+ httpResp.setStatus(401); // Unauthorized
return RESP.HTTP_REDIRECT_INVOKED;
}
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java
index 0ed4fbed..4babaf6b 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/api/API_Token.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,10 +42,10 @@ import aafoauth.v2_0.Introspect;
public class API_Token {
// Hide Public Constructor
private API_Token() {}
-
+
/**
* Normal Init level APIs
- *
+ *
* @param authzAPI
* @param facade
* @throws Exception
@@ -65,7 +65,7 @@ public class API_Token {
}
}
});
-
+
authzAPI.route(HttpMethods.POST,"/introspect",API.INTROSPECT,new OACode(facade,"AAF Token Information", true) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java
index 6aec5feb..3127ba18 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java
index 36f08b15..db401c78 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospectImpl.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectOAFacadeImpl.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectOAFacadeImpl.java
index f71f7c15..a2a5b230 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectOAFacadeImpl.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectOAFacadeImpl.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade.java
index 23011d27..15ae4b1a 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,14 +30,14 @@ import org.onap.aaf.auth.oauth.service.OAuthService;
/**
- *
+ *
* @author Jonathan
*
*/
public interface OAFacade<INTROSPECT> {
///////////////////// STANDARD ELEMENTS //////////////////
- /**
+ /**
* @param trans
* @param response
* @param result
@@ -45,7 +45,7 @@ public interface OAFacade<INTROSPECT> {
public void error(AuthzTrans trans, HttpServletResponse response, Result<?> result);
/**
- *
+ *
* @param trans
* @param response
* @param status
@@ -57,7 +57,7 @@ public interface OAFacade<INTROSPECT> {
public Result<Void> introspect(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
public OAuthService service();
-
+
///////////////////// STANDARD ELEMENTS //////////////////
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade1_0.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade1_0.java
index b0776d94..451ffbe0 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade1_0.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacade1_0.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,9 +37,9 @@ import aafoauth.v2_0.TokenRequest;
*
*/
public class OAFacade1_0 extends OAFacadeImpl<TokenRequest,Token,Introspect,Error> {
- public OAFacade1_0(AAF_OAuth api,
+ public OAFacade1_0(AAF_OAuth api,
OAuthService service,
- Mapper<TokenRequest,Token,Introspect,Error> mapper,
+ Mapper<TokenRequest,Token,Introspect,Error> mapper,
Data.TYPE type) throws APIException {
super(api, service, mapper, type);
}
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeFactory.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeFactory.java
index 11b7217e..0de4ae20 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeFactory.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,9 +38,9 @@ public class OAFacadeFactory {
certman,
service,
new Mapper1_0(),
- type);
+ type);
}
-
+
public static DirectIntrospect<Introspect> directV1_0(OAuthService service) {
return new DirectIntrospectImpl<Introspect>(service, new MapperIntrospect1_0());
}
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java
index 63306641..221508e9 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/OAFacadeImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -61,7 +61,7 @@ import aaf.v2_0.Perms;
/**
* AuthzFacade
- *
+ *
* This Service Facade encapsulates the essence of the API Service can do, and provides
* a single created object for elements such as RosettaDF.
*
@@ -72,14 +72,14 @@ import aaf.v2_0.Perms;
* a) In the future, we may support multiple Response Formats, aka JSON or XML, based on User Request.
* 4) Log Service info, warnings and exceptions as necessary
* 5) When asked by the API layer, this will create and write Error content to the OutputStream
- *
- * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
+ *
+ * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
* clearly coordinated with the API Documentation
- *
+ *
* @author Jonathan
*
*/
-public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
+public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
extends DirectIntrospectImpl<INTROSPECT> implements OAFacade<INTROSPECT> {
private static final String INVALID_INPUT = "Invalid Input";
private final RosettaDF<TOKEN> tokenDF;
@@ -88,9 +88,9 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
private final RosettaDF<ERROR> errDF;
public final RosettaDF<Perms> permsDF;
private final Mapper<TOKEN_REQ, TOKEN, INTROSPECT, ERROR> mapper;
-
+
public OAFacadeImpl(AAF_OAuth api,
- OAuthService service,
+ OAuthService service,
Mapper<TOKEN_REQ,TOKEN,INTROSPECT,ERROR> mapper,
Data.TYPE dataType) throws APIException {
super(service, mapper);
@@ -102,13 +102,13 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
(permsDF = env.newDataFactory(Perms.class)).in(dataType).out(dataType);
(errDF = env.newDataFactory(mapper.getClass(API.ERROR))).in(dataType).out(dataType);
}
-
+
///////////////////////////
// Tokens
///////////////////////////
public static final String CREATE_TOKEN = "createToken";
public static final String INTROSPECT = "introspect";
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.oauth.facade.OAFacade#getToken(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, org.onap.aaf.auth.oauth.service.OAuthAPI)
*/
@@ -145,7 +145,7 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
rp = Result.err(rs);
}
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<TOKEN> data = tokenDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -186,10 +186,10 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
setContentType(resp,tokenDF.getOutType());
return Result.ok();
} else if (p instanceof OAuth2FormPrincipal) {
- token = req.getParameter("token");
+ token = req.getParameter("token");
}
}
-
+
if (token==null) {
token = req.getParameter("access_token");
if (token==null || token.isEmpty()) {
@@ -207,7 +207,7 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
Result<INTROSPECT> rti = mappedIntrospect(trans,token);
switch(rti.status) {
- case OK:
+ case OK:
RosettaData<INTROSPECT> data = introspectDF.newData(trans).load(rti.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -226,11 +226,11 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
tt.done();
}
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#error(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, int)
- *
+ *
* Note: Conforms to AT&T TSS RESTful Error Structure
*/
@Override
@@ -239,7 +239,7 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
result.details==null?"":result.details.trim(),
result.variables==null?Result.EMPTY_VARS:result.variables);
}
-
+
@Override
public void error(AuthzTrans trans, HttpServletResponse response, int status, final String _msg, final Object ... _detail) {
String msgId;
@@ -261,7 +261,7 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
prefix = "Forbidden";
response.setStatus(/*httpstatus=*/403);
break;
-
+
case 404:
case ERR_NotFound:
msgId = "SVC1404";
@@ -275,21 +275,21 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
prefix = "Not Acceptable";
response.setStatus(/*httpstatus=*/406);
break;
-
+
case 409:
case ERR_ConflictAlreadyExists:
msgId = "SVC1409";
prefix = "Conflict Already Exists";
response.setStatus(/*httpstatus=*/409);
break;
-
+
case 501:
case ERR_NotImplemented:
msgId = "SVC1501";
- prefix = "Not Implemented";
+ prefix = "Not Implemented";
response.setStatus(/*httpstatus=*/501);
break;
-
+
default:
msgId = "SVC1500";
@@ -303,7 +303,7 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
StringBuilder holder = new StringBuilder();
ERROR em = mapper.errorFromMessage(holder, msgId,prefix + ": " + _msg,_detail);
trans.checkpoint(
- "ErrResp [" +
+ "ErrResp [" +
msgId +
"] " +
holder.toString(),
@@ -313,16 +313,16 @@ public abstract class OAFacadeImpl<TOKEN_REQ,TOKEN,INTROSPECT,ERROR>
em = mapper.errorFromMessage(holder, msgId, "Server had an issue processing this request");
}
errDF.newData(trans).load(em).to(response.getOutputStream());
-
+
} catch (Exception e) {
trans.error().log(e,"unable to send response for",_msg);
}
}
-
+
public Mapper<TOKEN_REQ,TOKEN,INTROSPECT,ERROR> mapper() {
return mapper;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.oauth.facade.OAFacade#service()
*/
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper.java
index d741469c..95f0217b 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,16 +31,16 @@ import org.onap.aaf.cadi.client.Holder;
import org.onap.aaf.cadi.oauth.OAuth2Principal;
public interface Mapper<TOKEN_REQ,TOKEN,INTROSPECT,ERROR> extends MapperIntrospect<INTROSPECT>
-{
+{
public enum API{TOKEN_REQ, TOKEN,INTROSPECT, ERROR,VOID};
-
+
public Class<?> getClass(API api);
public<A> A newInstance(API api);
public ERROR errorFromMessage(StringBuilder holder, String msgID, String text, Object ... detail);
public TOKEN_REQ tokenReqFromParams(HttpServletRequest req);
public OCreds credsFromReq(TOKEN_REQ tokReq);
-
+
public OAuthTokenDAO.Data clientTokenReq(TOKEN_REQ tokReq, Holder<GRANT_TYPE> hgt);
public Result<TOKEN> tokenFromData(Result<OAuthTokenDAO.Data> rs);
public INTROSPECT fromPrincipal(OAuth2Principal p);
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java
index d4852c1a..ddc306c4 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/Mapper1_0.java
@@ -7,9 +7,9 @@
* 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.
@@ -49,7 +49,7 @@ public class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
@Override
public Class<?> getClass(API api) {
switch(api) {
- case TOKEN_REQ: return TokenRequest.class;
+ case TOKEN_REQ: return TokenRequest.class;
case TOKEN: return Token.class;
case INTROSPECT: return Introspect.class;
case ERROR: return Error.class;
@@ -134,12 +134,12 @@ public class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
}
break;
- }
+ }
}
return data?tr:null;
}
-
-
+
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.oauth.mapper.Mapper#credsFromReq(javax.servlet.http.HttpServletRequest)
@@ -156,19 +156,19 @@ public class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
@Override
public Data clientTokenReq(TokenRequest tokReq, Holder<GRANT_TYPE> hgt) {
OAuthTokenDAO.Data tdd = new OAuthTokenDAO.Data();
- tdd.client_id = tokReq.getClientId();
+ tdd.client_id = tokReq.getClientId();
tdd.user = tokReq.getUsername();
if (tokReq.getRefreshToken()!=null) {
tdd.refresh=tokReq.getRefreshToken();
}
-
+
for (GRANT_TYPE ttt : GRANT_TYPE.values()) {
if (ttt.name().equals(tokReq.getGrantType())) {
hgt.set(ttt);
break;
}
}
-
+
switch(hgt.get()) {
case client_credentials:
case password:
@@ -179,14 +179,14 @@ public class Mapper1_0 extends MapperIntrospect1_0 implements Mapper<TokenReques
tdd.type = CLIENT_TYPE.unknown.ordinal();
break;
}
- String scopes=tokReq.getScope();
+ String scopes=tokReq.getScope();
if (scopes!=null) {
Set<String> ss = tdd.scopes(true);
for (String s: Split.split(' ', tokReq.getScope())) {
ss.add(s);
}
}
-
+
tdd.state = tokReq.getState();
return tdd;
}
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect.java
index 27f40ecf..58bd417a 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java
index 33df05fa..05b99c32 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/mapper/MapperIntrospect1_0.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,7 +56,7 @@ public class MapperIntrospect1_0 implements MapperIntrospect<Introspect> {
}
return Result.err(rs);
}
-
+
protected static String getScopes(Set<String> scopes) {
StringBuilder sb = new StringBuilder();
boolean start = true;
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoader.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoader.java
index 51120870..0126c2e2 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoader.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoader.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java
index e3179aea..f163f21c 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/JSONPermLoaderFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -89,7 +89,7 @@ public class JSONPermLoaderFactory {
if (pd.notOK()) {
return Result.err(pd);
}
- // Since we know it is
+ // Since we know it is
StringBuilder sb = new StringBuilder("{\"perm\":[");
boolean first = true;
for (PermDAO.Data d : pd.value) {
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java
index 1e4b6cbb..4e1dd5b9 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,13 +54,13 @@ import org.onap.aaf.misc.env.APIException;
import aafoauth.v2_0.Introspect;
public class OAuthService {
-
+
private static final int TOK_EXP = 60*60*1000; // 1 hour, millis.
public enum TOKEN_TYPE {unknown,bearer,refresh}
public enum GRANT_TYPE {unknown,password,client_credentials,refresh_token};
public enum CLIENT_TYPE {unknown,confidential};
-
+
// Additional Expires
private final DAO<AuthzTrans, ?>[] daos;
public final OAuthTokenDAO tokenDAO;
@@ -87,7 +87,7 @@ public class OAuthService {
String[] split = Split.split(',', alt_url);
int timeout = split.length>1?Integer.parseInt(split[1]):3000;
altIntrospectClient = tcf.newClient(split[0], timeout);
- altIntrospectClient.client_creds(access.getProperty(Config.AAF_ALT_CLIENT_ID,null),
+ altIntrospectClient.client_creds(access.getProperty(Config.AAF_ALT_CLIENT_ID,null),
access.getProperty(Config.AAF_ALT_CLIENT_SECRET,null));
altDomain = '@'+access.getProperty(Config.AAF_ALT_OAUTH2_DOMAIN,null);
} else {
@@ -97,7 +97,7 @@ public class OAuthService {
} catch (GeneralSecurityException | CadiException | LocatorException e) {
throw new APIException("Could not construct TokenClientFactory",e);
}
-
+
}
public Result<Void> validate(AuthzTrans trans, OCreds creds) {
@@ -119,7 +119,7 @@ public class OAuthService {
return Result.err(Result.ERR_BadData, "Unknown Grant Type");
}
}
-
+
private Result<Data> createBearerToken(AuthzTrans trans, OAuthTokenDAO.Data odd) {
if (odd.user==null) {
odd.user = trans.user();
@@ -131,7 +131,7 @@ public class OAuthService {
odd.expires = new Date(exp=(System.currentTimeMillis()+TOK_EXP));
odd.exp_sec = exp/1000;
odd.req_ip = trans.ip();
-
+
try {
Result<Data> rd = loadToken(trans, odd);
if (rd.notOK()) {
@@ -142,7 +142,7 @@ public class OAuthService {
}
return tokenDAO.create(trans, odd);
}
-
+
private Result<Data> loadToken(AuthzTrans trans, Data odd) throws APIException, CadiException {
Result<String> rs = permLoader.loadJSONPerms(trans,odd.user,odd.scopes(false));
if (rs.isOK()) {
@@ -156,8 +156,8 @@ public class OAuthService {
return Result.err(Result.ERR_Backend,"Error accessing AAF Info: %s",rs.errorString());
}
}
-
-
+
+
private Result<Data> refreshBearerToken(AuthzTrans trans, Data odd) {
Result<List<Data>> rld = tokenDAO.readByUser(trans, trans.user());
@@ -189,7 +189,7 @@ public class OAuthService {
break;
}
}
-
+
if (token==null) {
trans.audit().printf("Duplicate Refresh Token (%s) attempted for %s. Possible Replay Attack",odd.refresh.toString(),trans.user());
return Result.err(Result.ERR_Security,"Invalid Refresh Token");
diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OCreds.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OCreds.java
index af15d4c2..0e10b1b5 100644
--- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OCreds.java
+++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OCreds.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_DirectOAuthTAF.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_DirectOAuthTAF.java
index 61608a17..3e7b0357 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_DirectOAuthTAF.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_DirectOAuthTAF.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OACodeTest.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OACodeTest.java
index 22958736..b4769038 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OACodeTest.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OACodeTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FilterTest.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FilterTest.java
index 13ba4e70..0b58aeca 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FilterTest.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FilterTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FormHttpTafRespTest.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FormHttpTafRespTest.java
index 461716e1..17494795 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FormHttpTafRespTest.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/JU_OAuth2FormHttpTafRespTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_DirectOAFacadeImplTest.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_DirectOAFacadeImplTest.java
index 6e6722f9..44a2803f 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_DirectOAFacadeImplTest.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_DirectOAFacadeImplTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_OAFacadeFactory.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_OAFacadeFactory.java
index 8a75bc41..c6bb61ef 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_OAFacadeFactory.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/facade/JU_OAFacadeFactory.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_Mapper1_0Test.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_Mapper1_0Test.java
index f10129c0..8bee2a5b 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_Mapper1_0Test.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_Mapper1_0Test.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_MapperIntrospect1_0Test.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_MapperIntrospect1_0Test.java
index f8992e22..d67ad9b2 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_MapperIntrospect1_0Test.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/mapper/JU_MapperIntrospect1_0Test.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_JSONPermLoaderFactoryTest.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_JSONPermLoaderFactoryTest.java
index 786b4282..810a9344 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_JSONPermLoaderFactoryTest.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_JSONPermLoaderFactoryTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_OCredsTest.java b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_OCredsTest.java
index b2f45be3..4e306805 100644
--- a/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_OCredsTest.java
+++ b/auth/auth-oauth/src/test/java/org/onap/aaf/auth/oauth/service/JU_OCredsTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
index bdba4696..ba4df19b 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AAF_Service.java
@@ -7,9 +7,9 @@
* 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.
@@ -79,13 +79,13 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
private DirectAAFUserPass directAAFUserPass;
private final Cluster cluster;
//private final OAuthService oauthService;
-
+
/**
* Construct AuthzAPI with all the Context Supporting Routes that Authz needs
- *
+ *
* @param env
- * @param decryptor
- * @throws APIException
+ * @param decryptor
+ * @throws APIException
*/
public AAF_Service( final AuthzEnv env) throws Exception {
super(env.access(), env);
@@ -99,12 +99,12 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
// Start Background Processing
question = new Question(trans, cluster, CassAccess.KEYSPACE);
question.startTimers(env);
-
+
DirectCertIdentity.set(question.certDAO());
// Have AAFLocator object Create DirectLocators for Location needs
AbsAAFLocator.setCreator(new DirectLocatorCreator(env, question.locateDAO));
-
+
// Initialize Organizations... otherwise, first pass may miss
int org_size = ORGANIZATION.length();
for (String n : env.existingStaticSlotNames()) {
@@ -112,16 +112,16 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
OrganizationFactory.obtain(env, n.substring(org_size));
}
}
-
+
// For direct Introspection needs.
//oauthService = new OAuthService(trans, question);
-
+
facade = AuthzFacadeFactory.v2_0(env,trans,Data.TYPE.JSON,question);
facade_XML = AuthzFacadeFactory.v2_0(env,trans,Data.TYPE.XML,question);
directAAFUserPass = new DirectAAFUserPass(trans.env(),question);
-
+
// Print results and cleanup
StringBuilder sb = new StringBuilder();
trans.auditTrail(0, sb);
@@ -157,9 +157,9 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
// init functions
API_Mgmt.init(this, facade);
API_Api.init(this, facade);
-
+
}
-
+
@Override
public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
final String domain = FQI.reverseDomain(access.getProperty(Config.AAF_ROOT_NS,Config.AAF_ROOT_NS_DEF));
@@ -173,7 +173,7 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
if (additionalTafLurs.length>0) {
System.arraycopy(additionalTafLurs, 0, atl, 2, additionalTafLurs.length);
}
-
+
return new Filter[] {
new AuthzTransFilter(env,aafCon(),
new AAFTrustChecker((Env)env),
@@ -193,8 +193,8 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
new DirectRegistrar(access,question.locateDAO, actualPort)
};
}
-
- @Override
+
+ @Override
public void postStartup(final String hostname, final int port) throws APIException {
try {
CacheInfoDAO.startUpdate(env, aafCon().hman(), aafCon().securityInfo().defSS,hostname,port);
@@ -213,16 +213,16 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
super.destroy();
}
-
+
/**
* Setup XML and JSON implementations for each supported Version type
- *
+ *
* We do this by taking the Code passed in and creating clones of these with the appropriate Facades and properties
* to do Versions and Content switches
- *
+ *
*/
public void route(HttpMethods meth, String path, API api, Code code) throws Exception {
- Class<?> respCls = facade.mapper().getClass(api);
+ Class<?> respCls = facade.mapper().getClass(api);
if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
String application = applicationJSON(respCls, Config.AAF_DEFAULT_API_VERSION);
@@ -238,7 +238,7 @@ public class AAF_Service extends AbsService<AuthzEnv,AuthzTrans> {
try {
Log4JLogIt logIt = new Log4JLogIt(args, "authz");
PropAccess propAccess = new PropAccess(logIt,args);
-
+
try {
new JettyServiceStarter<AuthzEnv,AuthzTrans>(
new AAF_Service(new AuthzEnv(propAccess)),true)
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java
index 3b010821..2431e0eb 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -99,8 +99,8 @@ import org.onap.aaf.misc.env.util.Split;
import aaf.v2_0.CredRequest;
/**
- * AuthzCassServiceImpl implements AuthzCassService for
- *
+ * AuthzCassServiceImpl implements AuthzCassService for
+ *
* @author Jonathan
*
* @param <NSS>
@@ -116,12 +116,12 @@ import aaf.v2_0.CredRequest;
*/
public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS>
implements AuthzService <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> {
-
+
private static final String TWO_SPACE = " ";
private Mapper <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> mapper;
@Override
public Mapper <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> mapper() {return mapper;}
-
+
private static final String ASTERIX = "*";
private static final String CACHE = "cache";
private static final String ROOT_NS = Define.ROOT_NS();
@@ -129,28 +129,28 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private final Question ques;
private final Function func;
-
+
public AuthzCassServiceImpl(AuthzTrans trans, Mapper<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> mapper,Question question) {
this.ques = question;
func = new Function(trans, question);
this.mapper = mapper;
-
+
}
/***********************************
- * NAMESPACE
+ * NAMESPACE
***********************************/
/**
* createNS
- * @throws DAOException
+ * @throws DAOException
* @see org.onap.aaf.auth.service.AuthzService#createNS(org.onap.aaf.auth.env.test.AuthzTrans, java.lang.String, java.lang.String)
*/
- @ApiDoc(
- method = POST,
+ @ApiDoc(
+ method = POST,
path = "/authz/ns",
params = {},
expectedCode = 201,
- errorCodes = { 403,404,406,409 },
+ errorCodes = { 403,404,406,409 },
text = { "Namespace consists of: ",
"<ul><li>name - What you want to call this Namespace</li>",
"<li>responsible(s) - Person(s) who receive Notifications and approves Requests ",
@@ -168,7 +168,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> createNS(final AuthzTrans trans, REQUEST from, NsType type) {
final Result<Namespace> rnamespace = mapper.ns(trans, from);
final ServiceValidator v = new ServiceValidator();
- if (v.ns(rnamespace).err()) {
+ if (v.ns(rnamespace).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
final Namespace namespace = rnamespace.value;
@@ -176,13 +176,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (parentNs.notOK()) {
return Result.err(parentNs);
}
-
+
// Note: Data validate occurs in func.createNS
if (namespace.name.lastIndexOf('.')<0) { // Root Namespace... Function will check if allowed
return func.createNS(trans, namespace, false);
}
-
- Result<FutureDAO.Data> fd = mapper.future(trans, NsDAO.TABLE,from,namespace,true,
+
+ Result<FutureDAO.Data> fd = mapper.future(trans, NsDAO.TABLE,from,namespace,true,
new Mapper.Memo() {
@Override
public String get() {
@@ -204,7 +204,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<String> rfc = func.createFuture(trans, fd.value, namespace.name, trans.user(),parentNs.value, FUTURE_OP.C);
if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "NS [%s] is saved for future processing",namespace.name);
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
@@ -213,16 +213,16 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(fd);
}
}
-
+
@ApiDoc(
- method = POST,
+ method = POST,
path = "/authz/ns/:ns/admin/:id",
params = { "ns|string|true",
- "id|string|true"
+ "id|string|true"
},
expectedCode = 201,
- errorCodes = { 403,404,406,409 },
- text = { "Add an Identity :id to the list of Admins for the Namespace :ns",
+ errorCodes = { 403,404,406,409 },
+ text = { "Add an Identity :id to the list of Admins for the Namespace :ns",
"Note: :id must be fully qualified (i.e. ab1234@people.osaaf.org)" }
)
@Override
@@ -231,13 +231,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
@ApiDoc(
- method = DELETE,
+ method = DELETE,
path = "/authz/ns/:ns/admin/:id",
params = { "ns|string|true",
- "id|string|true"
+ "id|string|true"
},
expectedCode = 200,
- errorCodes = { 403,404 },
+ errorCodes = { 403,404 },
text = { "Remove an Identity :id from the list of Admins for the Namespace :ns",
"Note: :id must be fully qualified (i.e. ab1234@people.osaaf.org)" }
)
@@ -247,13 +247,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
@ApiDoc(
- method = POST,
+ method = POST,
path = "/authz/ns/:ns/responsible/:id",
params = { "ns|string|true",
- "id|string|true"
+ "id|string|true"
},
expectedCode = 201,
- errorCodes = { 403,404,406,409 },
+ errorCodes = { 403,404,406,409 },
text = { "Add an Identity :id to the list of Responsibles for the Namespace :ns",
"Note: :id must be fully qualified (i.e. ab1234@people.osaaf.org)" }
)
@@ -263,13 +263,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
@ApiDoc(
- method = DELETE,
+ method = DELETE,
path = "/authz/ns/:ns/responsible/:id",
params = { "ns|string|true",
- "id|string|true"
+ "id|string|true"
},
expectedCode = 200,
- errorCodes = { 403,404 },
+ errorCodes = { 403,404 },
text = { "Remove an Identity :id to the list of Responsibles for the Namespace :ns",
"Note: :id must be fully qualified (i.e. ab1234@people.osaaf.org)",
"Note: A namespace must have at least 1 responsible party"
@@ -284,14 +284,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
* @see org.onap.aaf.auth.service.AuthzService#applyModel(org.onap.aaf.auth.env.test.AuthzTrans, java.lang.Object)
*/
@ApiDoc(
- method = POST,
+ method = POST,
path = "/authz/ns/:ns/attrib/:key/:value",
params = { "ns|string|true",
"key|string|true",
"value|string|true"},
expectedCode = 201,
- errorCodes = { 403,404,406,409 },
- text = {
+ errorCodes = { 403,404,406,409 },
+ text = {
"Create an attribute in the Namespace",
"You must be given direct permission for key by AAF"
}
@@ -319,9 +319,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (nsd.attrib.get(key)!=null) {
return Result.err(Status.ERR_ConflictAlreadyExists, "NS Property %s:%s exists", ns, key);
}
-
+
// Check if User may put
- if (!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
+ if (!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
":"+trans.org().getDomain()+".*:"+key, Access.write.name())) {
return Result.err(Status.ERR_Denied, "%s may not create NS Attrib [%s:%s]", trans.user(),ns, key);
}
@@ -335,14 +335,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@ApiDoc(
- method = GET,
+ method = GET,
path = "/authz/ns/attrib/:key",
params = { "key|string|true" },
expectedCode = 200,
- errorCodes = { 403,404 },
- text = {
+ errorCodes = { 403,404 },
+ text = {
"Read Attributes for Namespace"
}
)
@@ -355,7 +355,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
// May Read
- if (!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
+ if (!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
":"+trans.org().getDomain()+".*:"+key, Question.READ)) {
return Result.err(Status.ERR_Denied,"%s may not read NS by Attrib '%s'",trans.user(),key);
}
@@ -369,13 +369,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@ApiDoc(
- method = PUT,
+ method = PUT,
path = "/authz/ns/:ns/attrib/:key/:value",
params = { "ns|string|true",
"key|string|true"},
expectedCode = 200,
- errorCodes = { 403,404 },
- text = {
+ errorCodes = { 403,404 },
+ text = {
"Update Value on an existing attribute in the Namespace",
"You must be given direct permission for key by AAF"
}
@@ -403,9 +403,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (nsd.attrib.get(key)==null) {
return Result.err(Status.ERR_NotFound, "NS Property %s:%s exists", ns, key);
}
-
+
// Check if User may put
- if (!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
+ if (!ques.isGranted(trans, trans.user(), ROOT_NS, Question.ATTRIB,
":"+trans.org().getDomain()+".*:"+key, Access.write.name())) {
return Result.err(Status.ERR_Denied, "%s may not create NS Attrib [%s:%s]", trans.user(),ns, key);
}
@@ -414,20 +414,20 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
nsd.attrib.put(key, value);
ques.nsDAO().invalidate(trans, nsd);
return ques.nsDAO().update(trans,nsd);
-
+
} finally {
tt.done();
}
}
@ApiDoc(
- method = DELETE,
+ method = DELETE,
path = "/authz/ns/:ns/attrib/:key",
params = { "ns|string|true",
"key|string|true"},
expectedCode = 200,
- errorCodes = { 403,404 },
- text = {
+ errorCodes = { 403,404 },
+ text = {
"Delete an attribute in the Namespace",
"You must be given direct permission for key by AAF"
}
@@ -454,7 +454,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (nsd.attrib.get(key)==null) {
return Result.err(Status.ERR_NotFound, "NS Property [%s:%s] does not exist", ns, key);
}
-
+
// Check if User may del
if (!ques.isGranted(trans, trans.user(), ROOT_NS, "attrib", ":" + ROOT_COMPANY + ".*:"+key, Access.write.name())) {
return Result.err(Status.ERR_Denied, "%s may not delete NS Attrib [%s:%s]", trans.user(),ns, key);
@@ -471,12 +471,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
@ApiDoc(
- method = GET,
+ method = GET,
path = "/authz/nss/:id",
params = { "id|string|true" },
expectedCode = 200,
- errorCodes = { 404,406 },
- text = {
+ errorCodes = { 404,406 },
+ text = {
"Lists the Owner(s), Admin(s), Description, and Attributes of Namespace :id",
}
)
@@ -486,7 +486,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("NS", ns).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
Result<List<NsDAO.Data>> rlnd = ques.nsDAO().read(trans, ns);
if (rlnd.isOK()) {
if (rlnd.isEmpty()) {
@@ -494,10 +494,10 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), rlnd.value.get(0), Access.read);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
-
-
+
+
Namespace namespace = new Namespace(rnd.value);
Result<List<String>> rd = func.getOwners(trans, namespace.name, includeExpired);
if (rd.isOK()) {
@@ -507,7 +507,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rd.isOK()) {
namespace.admin = rd.value;
}
-
+
NSS nss = mapper.newInstance(API.NSS);
return mapper.nss(trans, namespace, nss);
} else {
@@ -516,13 +516,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
@ApiDoc(
- method = GET,
+ method = GET,
path = "/authz/nss/admin/:id",
params = { "id|string|true" },
expectedCode = 200,
- errorCodes = { 403,404 },
- text = { "Lists all Namespaces where Identity :id is an Admin",
- "Note: :id must be fully qualified (i.e. ab1234@people.osaaf.org)"
+ errorCodes = { 403,404 },
+ text = { "Lists all Namespaces where Identity :id is an Admin",
+ "Note: :id must be fully qualified (i.e. ab1234@people.osaaf.org)"
}
)
@Override
@@ -531,13 +531,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData, v.errs());
}
-
+
Result<Collection<Namespace>> rn = loadNamepace(trans, user, ".admin", full);
if (rn.notOK()) {
return Result.err(rn);
}
if (rn.isEmpty()) {
- return Result.err(Status.ERR_NotFound, "[%s] is not an admin for any namespaces",user);
+ return Result.err(Status.ERR_NotFound, "[%s] is not an admin for any namespaces",user);
}
NSS nss = mapper.newInstance(API.NSS);
// Note: "loadNamespace" already validates view of Namespace
@@ -545,13 +545,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
@ApiDoc(
- method = GET,
+ method = GET,
path = "/authz/nss/either/:id",
params = { "id|string|true" },
expectedCode = 200,
- errorCodes = { 403,404 },
- text = { "Lists all Namespaces where Identity :id is either an Admin or an Owner",
- "Note: :id must be fully qualified (i.e. ab1234@people.osaaf.org)"
+ errorCodes = { 403,404 },
+ text = { "Lists all Namespaces where Identity :id is either an Admin or an Owner",
+ "Note: :id must be fully qualified (i.e. ab1234@people.osaaf.org)"
}
)
@Override
@@ -560,13 +560,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData, v.errs());
}
-
+
Result<Collection<Namespace>> rn = loadNamepace(trans, user, null, full);
if (rn.notOK()) {
return Result.err(rn);
}
if (rn.isEmpty()) {
- return Result.err(Status.ERR_NotFound, "[%s] is not an admin or owner for any namespaces",user);
+ return Result.err(Status.ERR_NotFound, "[%s] is not an admin or owner for any namespaces",user);
}
NSS nss = mapper.newInstance(API.NSS);
// Note: "loadNamespace" already validates view of Namespace
@@ -595,7 +595,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rls.isOK()) {
namespace.admin=rls.value;
}
-
+
rls = func.getOwners(trans, namespace.name, false);
if (rls.isOK()) {
namespace.owner=rls.value;
@@ -619,7 +619,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
if (endsWith==null || urdd.role.endsWith(endsWith)) {
lm.put(namespace.name,namespace);
- } else {
+ } else {
other.put(namespace.name,namespace);
}
}
@@ -636,12 +636,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
@ApiDoc(
- method = GET,
+ method = GET,
path = "/authz/nss/responsible/:id",
params = { "id|string|true" },
expectedCode = 200,
- errorCodes = { 403,404 },
- text = { "Lists all Namespaces where Identity :id is a Responsible Party",
+ errorCodes = { 403,404 },
+ text = { "Lists all Namespaces where Identity :id is a Responsible Party",
"Note: :id must be fully qualified (i.e. ab1234@people.osaaf.org)"
}
)
@@ -656,20 +656,20 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(rn);
}
if (rn.isEmpty()) {
- return Result.err(Status.ERR_NotFound, "[%s] is not an owner for any namespaces",user);
+ return Result.err(Status.ERR_NotFound, "[%s] is not an owner for any namespaces",user);
}
NSS nss = mapper.newInstance(API.NSS);
// Note: "loadNamespace" prevalidates
return mapper.nss(trans, rn.value, nss);
}
-
+
@ApiDoc(
- method = GET,
+ method = GET,
path = "/authz/nss/children/:id",
params = { "id|string|true" },
expectedCode = 200,
- errorCodes = { 403,404 },
- text = { "Lists all Child Namespaces of Namespace :id",
+ errorCodes = { 403,404 },
+ text = { "Lists all Child Namespaces of Namespace :id",
"Note: This is not a cached read"
}
)
@@ -679,14 +679,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("NS", parent).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
Result<NsDAO.Data> rnd = ques.deriveNs(trans, parent);
if (rnd.notOK()) {
return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
Set<Namespace> lm = new HashSet<>();
@@ -701,7 +701,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rls.isOK()) {
namespace.admin=rls.value;
}
-
+
rls = func.getOwners(trans, namespace.name, false);
if (rls.isOK()) {
namespace.owner=rls.value;
@@ -718,11 +718,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@ApiDoc(
- method = PUT,
+ method = PUT,
path = "/authz/ns",
params = {},
expectedCode = 200,
- errorCodes = { 403,404,406 },
+ errorCodes = { 403,404,406 },
text = { "Replace the Current Description of a Namespace with a new one"
}
)
@@ -739,11 +739,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Namespace namespace = nsd.value;
Result<List<NsDAO.Data>> rlnd = ques.nsDAO().read(trans, namespace.name);
-
+
if (rlnd.notOKorIsEmpty()) {
return Result.err(Status.ERR_NotFound, "Namespace [%s] does not exist",namespace.name);
}
-
+
if (ques.mayUser(trans, trans.user(), rlnd.value.get(0), Access.write).notOK()) {
return Result.err(Status.ERR_Denied, "You do not have approval to change %s",namespace.name);
}
@@ -755,18 +755,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(rdr);
}
}
-
+
/**
* deleteNS
- * @throws DAOException
+ * @throws DAOException
* @see org.onap.aaf.auth.service.AuthzService#deleteNS(org.onap.aaf.auth.env.test.AuthzTrans, java.lang.String, java.lang.String)
*/
@ApiDoc(
- method = DELETE,
+ method = DELETE,
path = "/authz/ns/:ns",
params = { "ns|string|true" },
expectedCode = 200,
- errorCodes = { 403,404,424 },
+ errorCodes = { 403,404,424 },
text = { "Delete the Namespace :ns. Namespaces cannot normally be deleted when there ",
"are still credentials associated with them, but they can be deleted by setting ",
"the \"force\" property. To do this: Add 'force=true' as a query parameter",
@@ -783,19 +783,19 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
/***********************************
- * PERM
+ * PERM
***********************************/
/*
* (non-Javadoc)
* @see org.onap.aaf.auth.service.AuthzService#createOrUpdatePerm(org.onap.aaf.auth.env.test.AuthzTrans, java.lang.Object, boolean, java.lang.String, java.lang.String, java.lang.String, java.util.List, java.util.List)
*/
- @ApiDoc(
- method = POST,
+ @ApiDoc(
+ method = POST,
path = "/authz/perm",
params = {},
expectedCode = 201,
- errorCodes = {403,404,406,409},
+ errorCodes = {403,404,406,409},
text = { "Permission consists of:",
"<ul><li>type - a Namespace qualified identifier specifying what kind of resource "
+ "is being protected</li>",
@@ -806,7 +806,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
)
@Override
- public Result<Void> createPerm(final AuthzTrans trans,REQUEST rreq) {
+ public Result<Void> createPerm(final AuthzTrans trans,REQUEST rreq) {
final Result<PermDAO.Data> newPd = mapper.perm(trans, rreq);
final ServiceValidator v = new ServiceValidator();
@@ -824,7 +824,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(rlpdd);
}
if(!rlpdd.isEmpty()) {
- return Result.err(Result.ERR_ConflictAlreadyExists,"Permission already exists");
+ return Result.err(Result.ERR_ConflictAlreadyExists,"Permission already exists");
}
RoleDAO.Data rdd = new RoleDAO.Data();
@@ -836,7 +836,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if(rpdd.notOK()) {
return Result.err(rpdd);
}
-
+
CachedRoleDAO roleDAO = ques.roleDAO();
Result<List<RoleDAO.Data>> rlrdd = roleDAO.read(trans, rdd);
if(rlrdd.notOK()) {
@@ -846,14 +846,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
rdd = rlrdd.value.get(0);
}
}
-
+
String eperm = pdd.encode();
rdd.perms(true).add(eperm);
Result<Void> rv = roleDAO.update(trans, rdd);
if(rv.notOK()) {
return rv;
}
-
+
CachedUserRoleDAO urDAO = ques.userRoleDAO();
UserRoleDAO.Data urdd = new UserRoleDAO.Data();
urdd.user = trans.user();
@@ -883,14 +883,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Status.ERR_ConflictAlreadyExists,
"Permission Type exists as a Namespace");
}
-
+
Result<FutureDAO.Data> fd = mapper.future(trans, PermDAO.TABLE, rreq, newPd.value,false,
new Mapper.Memo() {
@Override
public String get() {
- return "Create Permission [" +
- newPd.value.fullType() + '|' +
- newPd.value.instance + '|' +
+ return "Create Permission [" +
+ newPd.value.fullType() + '|' +
+ newPd.value.instance + '|' +
newPd.value.action + ']';
}
},
@@ -904,14 +904,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return nsd;
}
});
-
+
Result<List<NsDAO.Data>> nsr = ques.nsDAO().read(trans, newPd.value.ns);
if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
switch(fd.status) {
case OK:
- Result<String> rfc = func.createFuture(trans,fd.value,
+ Result<String> rfc = func.createFuture(trans,fd.value,
newPd.value.fullType() + '|' + newPd.value.instance + '|' + newPd.value.action,
trans.user(),
nsr.value.get(0),
@@ -933,12 +933,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
- @ApiDoc(
- method = GET,
+ @ApiDoc(
+ method = GET,
path = "/authz/perms/:type",
params = {"type|string|true"},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "List All Permissions that match the :type element of the key" }
)
@Override
@@ -956,7 +956,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// We don't have instance & action for mayUserView... do we want to loop through all returned here as well as in mapper?
// Result<NsDAO.Data> r;
// if ((r = ques.mayUserViewPerm(trans, trans.user(), permType)).notOK())return Result.err(r);
-
+
PERMS perms = mapper.newInstance(API.PERMS);
if (!rlpd.isEmpty()) {
// Note: Mapper will restrict what can be viewed
@@ -964,15 +964,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
return Result.ok(perms);
}
-
- @ApiDoc(
- method = GET,
+
+ @ApiDoc(
+ method = GET,
path = "/authz/perms/:type/:instance/:action",
params = {"type|string|true",
"instance|string|true",
"action|string|true"},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "List Permissions that match key; :type, :instance and :action" }
)
@Override
@@ -983,7 +983,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
|| v.nullOrBlank("PermAction", action).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
Result<List<PermDAO.Data>> rlpd = ques.getPermsByName(trans, type, instance, action);
if (rlpd.notOK()) {
return Result.err(rlpd);
@@ -997,12 +997,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.ok(perms);
}
- @ApiDoc(
- method = GET,
+ @ApiDoc(
+ method = GET,
path = "/authz/perms/user/:user",
params = {"user|string|true"},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "List All Permissions that match user :user",
"<p>'user' must be expressed as full identity (ex: id@full.domain.com)</p>"}
)
@@ -1018,25 +1018,25 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rlpd.notOK()) {
return Result.err(rlpd);
}
-
+
PERMS perms = mapper.newInstance(API.PERMS);
-
+
if (rlpd.isEmpty()) {
return Result.ok(perms);
}
// Note: Mapper will restrict what can be viewed
// if user is the same as that which is looked up, no filtering is required
- return mapper.perms(trans, rlpd.value,
- perms,
+ return mapper.perms(trans, rlpd.value,
+ perms,
!user.equals(trans.user()));
}
- @ApiDoc(
- method = GET,
+ @ApiDoc(
+ method = GET,
path = "/authz/perms/user/:user/scope/:scope",
params = {"user|string|true","scope|string|true"},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "List All Permissions that match user :user, filtered by NS (Scope)",
"<p>'user' must be expressed as full identity (ex: id@full.domain.com)</p>",
"<p>'scope' must be expressed as NSs separated by ':'</p>"
@@ -1053,26 +1053,26 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rlpd.notOK()) {
return Result.err(rlpd);
}
-
+
PERMS perms = mapper.newInstance(API.PERMS);
-
+
if (rlpd.isEmpty()) {
return Result.ok(perms);
}
// Note: Mapper will restrict what can be viewed
// if user is the same as that which is looked up, no filtering is required
- return mapper.perms(trans, rlpd.value,
- perms,
+ return mapper.perms(trans, rlpd.value,
+ perms,
scopes,
!user.equals(trans.user()));
}
- @ApiDoc(
- method = POST,
+ @ApiDoc(
+ method = POST,
path = "/authz/perms/user/:user",
params = {"user|string|true"},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "List All Permissions that match user :user",
"<p>'user' must be expressed as full identity (ex: id@full.domain.com)</p>",
"",
@@ -1100,15 +1100,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
//////////////
PermLookup pl = PermLookup.get(trans,ques,user);
Result<List<PermDAO.Data>> rlpd = pl.getPerms(trans.requested(force));
if (rlpd.notOK()) {
return Result.err(rlpd);
}
-
- /*//TODO
+
+ /*//TODO
1) See if allowed to query
2) See if User is allowed
*/
@@ -1150,25 +1150,25 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
out.add(pdd);
}
}
- }
-
+ }
+
perms = mapper.newInstance(API.PERMS);
if (rlpd.isEmpty()) {
return Result.ok(perms);
}
// Note: Mapper will restrict what can be viewed
// if user is the same as that which is looked up, no filtering is required
- return mapper.perms(trans, rlpd.value,
- perms,
+ return mapper.perms(trans, rlpd.value,
+ perms,
!user.equals(trans.user()));
}
-
- @ApiDoc(
- method = GET,
+
+ @ApiDoc(
+ method = GET,
path = "/authz/perms/role/:role",
params = {"role|string|true"},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "List All Permissions that are granted to :role" }
)
@Override
@@ -1198,12 +1198,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.ok(perms);
}
- @ApiDoc(
- method = GET,
+ @ApiDoc(
+ method = GET,
path = "/authz/perms/ns/:ns",
params = {"ns|string|true"},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "List All Permissions that are in Namespace :ns" }
)
@Override
@@ -1220,9 +1220,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
-
+
Result<List<PermDAO.Data>> rlpd = ques.permDAO().readNS(trans, ns);
if (rlpd.notOK()) {
return Result.err(rlpd);
@@ -1235,15 +1235,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
return Result.ok(perms);
}
-
- @ApiDoc(
- method = PUT,
+
+ @ApiDoc(
+ method = PUT,
path = "/authz/perm/:type/:instance/:action",
params = {"type|string|true",
"instance|string|true",
"action|string|true"},
expectedCode = 200,
- errorCodes = { 404,406, 409 },
+ errorCodes = { 404,406, 409 },
text = { "Rename the Permission referenced by :type :instance :action, and "
+ "rename (copy/delete) to the Permission described in PermRequest" }
)
@@ -1259,54 +1259,54 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Status.ERR_Denied, "You do not have approval to change Permission [%s.%s|%s|%s]",
newPd.value.ns,newPd.value.type,newPd.value.instance,newPd.value.action);
}
-
+
Result<NsSplit> nss = ques.deriveNsSplit(trans, origType);
- Result<List<PermDAO.Data>> origRlpd = ques.permDAO().read(trans, nss.value.ns, nss.value.name, origInstance, origAction);
-
+ Result<List<PermDAO.Data>> origRlpd = ques.permDAO().read(trans, nss.value.ns, nss.value.name, origInstance, origAction);
+
if (origRlpd.notOKorIsEmpty()) {
- return Result.err(Status.ERR_PermissionNotFound,
+ return Result.err(Status.ERR_PermissionNotFound,
"Permission [%s|%s|%s] does not exist",
origType,origInstance,origAction);
}
-
+
PermDAO.Data origPd = origRlpd.value.get(0);
if (!origPd.ns.equals(newPd.value.ns)) {
return Result.err(Status.ERR_Denied, "Cannot change namespace with rename command. " +
"<new type> must start with [" + origPd.ns + "]");
}
-
- if ( origPd.type.equals(newPd.value.type) &&
- origPd.action.equals(newPd.value.action) &&
+
+ if ( origPd.type.equals(newPd.value.type) &&
+ origPd.action.equals(newPd.value.action) &&
origPd.instance.equals(newPd.value.instance) ) {
return Result.err(Status.ERR_ConflictAlreadyExists, "New Permission must be different than original permission");
}
-
+
Set<String> origRoles = origPd.roles(false);
if (!origRoles.isEmpty()) {
Set<String> roles = newPd.value.roles(true);
for (String role : origPd.roles) {
- roles.add(role);
+ roles.add(role);
}
- }
-
+ }
+
newPd.value.description = origPd.description;
-
+
Result<Void> rv = null;
-
+
rv = func.createPerm(trans, newPd.value, false);
if (rv.isOK()) {
rv = func.deletePerm(trans, origPd, true, false);
}
return rv;
}
-
- @ApiDoc(
- method = PUT,
+
+ @ApiDoc(
+ method = PUT,
path = "/authz/perm",
params = {},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "Add Description Data to Perm" }
)
@Override
@@ -1344,7 +1344,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
-
+
@ApiDoc(
method = PUT,
path = "/authz/role/perm",
@@ -1372,18 +1372,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
// Read full set to get CURRENT values
- Result<List<PermDAO.Data>> rcurr = ques.permDAO().read(trans,
- updt.value.ns,
- updt.value.type,
- updt.value.instance,
+ Result<List<PermDAO.Data>> rcurr = ques.permDAO().read(trans,
+ updt.value.ns,
+ updt.value.type,
+ updt.value.instance,
updt.value.action);
-
+
if (rcurr.notOKorIsEmpty()) {
- return Result.err(Status.ERR_PermissionNotFound,
+ return Result.err(Status.ERR_PermissionNotFound,
"Permission [%s.%s|%s|%s] does not exist",
updt.value.ns,updt.value.type,updt.value.instance,updt.value.action);
}
-
+
// Create a set of Update Roles, which are in Internal Format
Set<String> updtRoles = new HashSet<>();
Result<NsSplit> nss;
@@ -1397,11 +1397,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Void> rv = null;
-
+
for (PermDAO.Data curr : rcurr.value) {
Set<String> currRoles = curr.roles(false);
- // must add roles to this perm, and add this perm to each role
- // in the update, but not in the current
+ // must add roles to this perm, and add this perm to each role
+ // in the update, but not in the current
for (String role : updtRoles) {
if (!currRoles.contains(role)) {
Result<RoleDAO.Data> key = RoleDAO.Data.decode(trans, ques, role);
@@ -1437,17 +1437,17 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
}
- }
- }
- return rv==null?Result.ok():rv;
+ }
+ }
+ return rv==null?Result.ok():rv;
}
-
- @ApiDoc(
+
+ @ApiDoc(
method = DELETE,
path = "/authz/perm",
params = {},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "Delete the Permission referenced by PermKey.",
"You cannot normally delete a permission which is still granted to roles,",
"however the \"force\" property allows you to do just that. To do this: Add",
@@ -1469,7 +1469,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Status.ERR_PermissionNotFound, "Permission [%s.%s|%s|%s] does not exist",
perm.ns,perm.type,perm.instance,perm.action );
}
-
+
Result<FutureDAO.Data> fd = mapper.future(trans,PermDAO.TABLE,from,perm,false,
new Mapper.Memo() {
@Override
@@ -1487,36 +1487,36 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return nsd;
}
});
-
+
switch(fd.status) {
case OK:
Result<List<NsDAO.Data>> nsr = ques.nsDAO().read(trans, perm.ns);
if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
-
- Result<String> rfc = func.createFuture(trans, fd.value,
+
+ Result<String> rfc = func.createFuture(trans, fd.value,
perm.encode(), trans.user(),nsr.value.get(0),FUTURE_OP.D);
if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Perm Deletion [%s] is saved for future processing",perm.encode());
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
return func.deletePerm(trans,perm,trans.requested(force), false);
default:
return Result.err(fd);
- }
- }
-
- @ApiDoc(
+ }
+ }
+
+ @ApiDoc(
method = DELETE,
path = "/authz/perm/:name/:type/:action",
params = {"type|string|true",
"instance|string|true",
"action|string|true"},
expectedCode = 200,
- errorCodes = { 404,406 },
+ errorCodes = { 404,406 },
text = { "Delete the Permission referenced by :type :instance :action",
"You cannot normally delete a permission which is still granted to roles,",
"however the \"force\" property allows you to do just that. To do this: Add",
@@ -1532,7 +1532,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
Result<PermDAO.Data> pd = ques.permFrom(trans, type, instance, action);
if (pd.isOK()) {
return func.deletePerm(trans, pd.value, trans.requested(force), false);
@@ -1542,7 +1542,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
/***********************************
- * ROLE
+ * ROLE
***********************************/
@ApiDoc(
method = POST,
@@ -1586,8 +1586,8 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
new Mapper.Memo() {
@Override
public String get() {
- return "Create Role [" +
- rd.value.fullName() +
+ return "Create Role [" +
+ rd.value.fullName() +
']';
}
},
@@ -1601,7 +1601,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return nsd;
}
});
-
+
Result<List<NsDAO.Data>> nsr = ques.nsDAO().read(trans, rd.value.ns);
if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
@@ -1609,13 +1609,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(fd.status) {
case OK:
- Result<String> rfc = func.createFuture(trans, fd.value,
+ Result<String> rfc = func.createFuture(trans, fd.value,
role.encode(), trans.user(),nsr.value.get(0),FUTURE_OP.C);
if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Role [%s.%s] is saved for future processing",
rd.value.ns,
rd.value.name);
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
@@ -1636,7 +1636,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@ApiDoc(
method = GET,
path = "/authz/roles/:role",
- params = {"role|string|true"},
+ params = {"role|string|true"},
expectedCode = 200,
errorCodes = {404,406},
text = { "List Roles that match :role",
@@ -1649,7 +1649,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("Role", role).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
// Determine if User can ask this question
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, ques, role);
if (rrdd.isOKhasData()) {
@@ -1660,7 +1660,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} else {
return Result.err(rrdd);
}
-
+
// Look up data
int query = role.indexOf('?');
Result<List<RoleDAO.Data>> rlrd = ques.getRolesByName(trans, query<0?role:role.substring(0, query));
@@ -1722,7 +1722,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
params = {"ns|string|true"},
expectedCode = 200,
errorCodes = {404,406},
- text = { "List all Roles for the Namespace :ns",
+ text = { "List all Roles for the Namespace :ns",
"Note: You must have permission to see any given role"
}
)
@@ -1733,15 +1733,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("NS", ns).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
// check if user is allowed to view NS
- Result<NsDAO.Data> rnsd = ques.deriveNs(trans, ns);
+ Result<NsDAO.Data> rnsd = ques.deriveNs(trans, ns);
if (rnsd.notOK()) {
- return Result.err(rnsd);
+ return Result.err(rnsd);
}
rnsd = ques.mayUser(trans, trans.user(), rnsd.value, Access.read);
if (rnsd.notOK()) {
- return Result.err(rnsd);
+ return Result.err(rnsd);
}
TimeTaken tt = trans.start("MAP Roles by NS to Roles", Env.SUB);
@@ -1773,7 +1773,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
params = {"name|string|true"},
expectedCode = 200,
errorCodes = {404,406},
- text = { "List all Roles for only the Name of Role (without Namespace)",
+ text = { "List all Roles for only the Name of Role (without Namespace)",
"Note: You must have permission to see any given role"
}
)
@@ -1783,7 +1783,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("Name", name).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
// User Mapper to make sure user is allowed to view NS
TimeTaken tt = trans.start("MAP Roles by Name to Roles", Env.SUB);
@@ -1834,7 +1834,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
TimeTaken tt = trans.start("Map Perm Roles Roles", Env.SUB);
try {
ROLES roles = mapper.newInstance(API.ROLES);
@@ -1846,7 +1846,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if ((res=ques.mayUser(trans, trans.user(), pdd, Question.Access.read)).notOK()) {
return Result.err(res);
}
-
+
Result<List<PermDAO.Data>> pdlr = ques.permDAO().read(trans, pdd);
if (pdlr.isOK())for (PermDAO.Data pd : pdlr.value) {
Result<List<RoleDAO.Data>> rlrd;
@@ -1910,7 +1910,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
-
+
@ApiDoc(
method = POST,
path = "/authz/role/perm",
@@ -1918,7 +1918,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
expectedCode = 201,
errorCodes = {403,404,406,409},
text = { "Grant a Permission to a Role",
- "Permission consists of:",
+ "Permission consists of:",
"<ul><li>type - a Namespace qualified identifier specifying what kind of resource "
+ "is being protected</li>",
"<li>instance - a key, possibly multi-dimensional, that identifies a specific "
@@ -1942,7 +1942,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rrd.notOKorIsEmpty()) {
return Result.err(rrd);
}
-
+
// Validate Role and Perm values
final ServiceValidator v = new ServiceValidator();
if (v.perm(rpd.value)
@@ -1955,9 +1955,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rlrd.notOKorIsEmpty()) {
return Result.err(Status.ERR_RoleNotFound, "Role [%s] does not exist", rrd.value.fullName());
}
-
+
// Check Status of Data in DB (does it exist)
- Result<List<PermDAO.Data>> rlpd = ques.permDAO().read(trans, rpd.value.ns,
+ Result<List<PermDAO.Data>> rlpd = ques.permDAO().read(trans, rpd.value.ns,
rpd.value.type, rpd.value.instance, rpd.value.action);
PermDAO.Data createPerm = null; // if not null, create first
if (rlpd.notOKorIsEmpty()) { // Permission doesn't exist
@@ -1966,7 +1966,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
createPerm = rpd.value;
createPerm.roles.clear();
} else {
- return Result.err(Status.ERR_PermissionNotFound,"Permission [%s.%s|%s|%s] does not exist",
+ return Result.err(Status.ERR_PermissionNotFound,"Permission [%s.%s|%s|%s] does not exist",
rpd.value.ns,rpd.value.type,rpd.value.instance,rpd.value.action);
}
} else {
@@ -1979,7 +1979,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
-
+
Result<FutureDAO.Data> fd = mapper.future(trans, PermDAO.TABLE, rreq, rpd.value,true, // Allow grants to create Approvals
new Mapper.Memo() {
@Override
@@ -2007,7 +2007,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
switch(fd.status) {
case OK:
- Result<String> rfc = func.createFuture(trans,fd.value,
+ Result<String> rfc = func.createFuture(trans,fd.value,
rpd.value.fullPerm(),
trans.user(),
nsr.value.get(0),
@@ -2018,7 +2018,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
rpd.value.type,
rpd.value.instance,
rpd.value.action);
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
@@ -2033,7 +2033,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
default:
return Result.err(fd);
}
-
+
}
/**
@@ -2071,17 +2071,17 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return delPermFromRole(trans, updt.value,rrd.value, rreq);
}
-
- private Result<Void> delPermFromRole(final AuthzTrans trans, PermDAO.Data pdd, RoleDAO.Data rdd, REQUEST rreq) {
- Result<List<PermDAO.Data>> rlpd = ques.permDAO().read(trans, pdd.ns, pdd.type,
+
+ private Result<Void> delPermFromRole(final AuthzTrans trans, PermDAO.Data pdd, RoleDAO.Data rdd, REQUEST rreq) {
+ Result<List<PermDAO.Data>> rlpd = ques.permDAO().read(trans, pdd.ns, pdd.type,
pdd.instance, pdd.action);
-
+
if (rlpd.notOKorIsEmpty()) {
- return Result.err(Status.ERR_PermissionNotFound,
+ return Result.err(Status.ERR_PermissionNotFound,
"Permission [%s.%s|%s|%s] does not exist",
pdd.ns,pdd.type,pdd.instance,pdd.action);
}
-
+
Result<FutureDAO.Data> fd = mapper.future(trans, PermDAO.TABLE, rreq, pdd,true, // allow ungrants requests
new Mapper.Memo() {
@Override
@@ -2106,7 +2106,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
switch(fd.status) {
case OK:
- Result<String> rfc = func.createFuture(trans,fd.value,
+ Result<String> rfc = func.createFuture(trans,fd.value,
pdd.fullPerm(),
trans.user(),
nsr.value.get(0),
@@ -2127,7 +2127,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(fd);
}
}
-
+
/*
@ApiDoc(
method = DELETE,
@@ -2148,7 +2148,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rpns.notOKorIsEmpty()) {
return Result.err(rpns);
}
-
+
final Validator v = new ServiceValidator();
if (v.role(role)
.permType(rpns.value.name,rpns.value.parent)
@@ -2157,26 +2157,26 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
Result<Data> rrns = ques.deriveNs(trans, role);
if (rrns.notOKorIsEmpty()) {
return Result.err(rrns);
}
-
+
final Result<List<RoleDAO.Data>> rrd = ques.roleDAO().read(trans, rrns.value.parent, rrns.value.name);
if (rrd.notOKorIsEmpty()) {
return Result.err(rrd);
}
-
+
final Result<List<PermDAO.Data>> rpd = ques.permDAO().read(trans, rpns.value.parent, rpns.value.name, instance, action);
if (rpd.notOKorIsEmpty()) {
return Result.err(rpd);
}
-
+
return delPermFromRole(trans,rpd.value.get(0), rrd.value.get(0), mapper.ungrantRequest(trans, role, type, instance, action));
}
-
+
@ApiDoc(
method = DELETE,
path = "/authz/role/:role",
@@ -2191,7 +2191,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,ques,role);
if (rrdd.isOKhasData()) {
final ServiceValidator v = new ServiceValidator();
- if (v.nullOrBlank(rrdd.value).err()) {
+ if (v.nullOrBlank(rrdd.value).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
return func.deleteRole(trans, rrdd.value, false, false);
@@ -2241,21 +2241,21 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return nsd;
}
});
-
+
switch(fd.status) {
case OK:
Result<List<NsDAO.Data>> nsr = ques.nsDAO().read(trans, rd.value.ns);
if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
-
- Result<String> rfc = func.createFuture(trans, fd.value,
+
+ Result<String> rfc = func.createFuture(trans, fd.value,
role.encode(), trans.user(),nsr.value.get(0),FUTURE_OP.D);
if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Role Deletion [%s.%s] is saved for future processing",
rd.value.ns,
rd.value.name);
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
@@ -2267,14 +2267,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
/***********************************
- * CRED
+ * CRED
***********************************/
private class MayCreateCred implements MayChange {
private Result<NsDAO.Data> nsd;
private AuthzTrans trans;
private CredDAO.Data cred;
private Executor exec;
-
+
public MayCreateCred(AuthzTrans trans, CredDAO.Data cred, Executor exec) {
this.trans = trans;
this.cred = cred;
@@ -2291,7 +2291,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
// Check Org Policy
if (trans.org().validate(trans,Policy.CREATE_MECHID, exec, cred.id)==null) {
- return Result.ok();
+ return Result.ok();
} else {
Result<?> rmc = ques.mayUser(trans, trans.user(), nsd.value, Access.write);
if (rmc.isOKhasData()) {
@@ -2365,13 +2365,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
private final long DAY_IN_MILLIS = 24*3600*1000L;
-
- @ApiDoc(
- method = POST,
+
+ @ApiDoc(
+ method = POST,
path = "/authn/cred",
params = {},
expectedCode = 201,
- errorCodes = {403,404,406,409},
+ errorCodes = {403,404,406,409},
text = { "A credential consists of:",
"<ul><li>id - the ID to create within AAF. The domain is in reverse",
"order of Namespace (i.e. Users of Namespace com.att.myapp would be",
@@ -2385,18 +2385,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> createUserCred(final AuthzTrans trans, REQUEST from) {
final String cmdDescription = ("Create User Credential");
TimeTaken tt = trans.start(cmdDescription, Env.SUB);
-
+
try {
Result<CredDAO.Data> rcred = mapper.cred(trans, from, true);
if (rcred.isOKhasData()) {
rcred = ques.userCredSetup(trans, rcred.value);
-
+
final ServiceValidator v = new ServiceValidator();
-
- if (v.cred(trans, trans.org(),rcred,true).err()) { // Note: Creates have stricter Validations
+
+ if (v.cred(trans, trans.org(),rcred,true).err()) { // Note: Creates have stricter Validations
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
// 2016-4 Jonathan, New Behavior - If MechID is not registered with Org, deny creation
Identity mechID = null;
@@ -2406,7 +2406,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} catch (Exception e1) {
trans.error().log(e1,rcred.value.id,"cannot be validated at this time");
}
- if (mechID==null || !mechID.isFound()) {
+ if (mechID==null || !mechID.isFound()) {
return Result.err(Status.ERR_Policy,"MechIDs must be registered with %s before provisioning in AAF",org.getName());
}
@@ -2414,11 +2414,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (nsr.notOKorIsEmpty()) {
return Result.err(Status.ERR_NsNotFound,"Cannot provision %s on non-existent Namespace %s",mechID.id(),rcred.value.ns);
}
-
+
boolean firstID = false;
MayChange mc;
-
+
CassExecutor exec = new CassExecutor(trans, func);
Result<List<CredDAO.Data>> rlcd = ques.credDAO().readID(trans, rcred.value.id);
if (rlcd.isOKhasData()) {
@@ -2430,21 +2430,21 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// May not use the same password in the list
// Note: ASPR specifies character differences, but we don't actually store the
// password to validate char differences.
-
+
// byte[] rawCred = rcred.value.type==CredDAO.RAW?null:; return Result.err(Status.ERR_ConflictAlreadyExists, "Credential with same Expiration Date exists");
if(rcred.value.type==CredDAO.FQI ) {
if(curr.type==CredDAO.FQI) {
return Result.err(Status.ERR_ConflictAlreadyExists, "Credential with same Expiration Date exists");
}
} else {
-
+
rb = ques.userCredCheck(trans, curr, rcred.value.cred!=null?rcred.value.cred.array():null);
if (rb.notOK()) {
return Result.err(rb);
} else if (rb.value){
return Result.err(Status.ERR_Policy, "Credential content cannot be reused.");
- } else if(Chrono.dateOnlyStamp(curr.expires).equals(Chrono.dateOnlyStamp(rcred.value.expires))
- && curr.type==rcred.value.type
+ } else if(Chrono.dateOnlyStamp(curr.expires).equals(Chrono.dateOnlyStamp(rcred.value.expires))
+ && curr.type==rcred.value.type
) {
// Allow if expiring differential is greater than 1 day (for TEMP)
// Unless expiring in 1 day
@@ -2453,7 +2453,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
}
- }
+ }
} else {
try {
// 2016-04-12 Jonathan If Caller is the Sponsor and is also an Owner of NS, allow without special Perm
@@ -2469,32 +2469,32 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
String reason;
// We can say "ID does not exist" here
if ((reason=org.validate(trans, Policy.CREATE_MECHID, exec, theMechID,trans.user(),otherMechIDs.toString()))!=null) {
- return Result.err(Status.ERR_Denied, reason);
+ return Result.err(Status.ERR_Denied, reason);
}
firstID=true;
} catch (Exception e) {
return Result.err(e);
}
}
-
+
mc = new MayCreateCred(trans, rcred.value, exec);
-
+
final CredDAO.Data cdd = rcred.value;
Result<FutureDAO.Data> fd = mapper.future(trans,CredDAO.TABLE,from, rcred.value,false, // may want to enable in future.
new Mapper.Memo() {
@Override
public String get() {
- return cmdDescription + " [" +
- cdd.id + '|'
- + cdd.type + '|'
+ return cmdDescription + " [" +
+ cdd.id + '|'
+ + cdd.type + '|'
+ cdd.expires + ']';
}
},
mc);
-
+
switch(fd.status) {
case OK:
- Result<String> rfc = func.createFuture(trans, fd.value,
+ Result<String> rfc = func.createFuture(trans, fd.value,
rcred.value.id + '|' + rcred.value.type.toString() + '|' + rcred.value.expires,
trans.user(), nsr.value.get(0), FUTURE_OP.C);
if (rfc.isOK()) {
@@ -2502,7 +2502,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
rcred.value.id,
Integer.toString(rcred.value.type),
rcred.value.expires.toString());
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
@@ -2512,11 +2512,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if(!ques.isOwner(trans,trans.user(),cdd.ns)) {
// Admins are not allowed to set first Cred, but Org has already
// said entity MAY create, typically by Permission
- // We can't know which reason they are allowed here, so we
- // have to assume that any with Special Permission would not be
+ // We can't know which reason they are allowed here, so we
+ // have to assume that any with Special Permission would not be
// an Admin.
if(ques.isAdmin(trans, trans.user(), cdd.ns)) {
- return Result.err(Result.ERR_Denied,
+ return Result.err(Result.ERR_Denied,
"Only Owners may create first passwords in their Namespace. Admins may modify after one exists" );
} else {
// Allow IDs that AREN'T part of NS with Org Onboarding Permission (see Org object) to create Temp Passwords.
@@ -2527,7 +2527,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} catch (Exception e) {
trans.error().log(e, "While setting expiration to TempPassword");
}
-
+
Result<?>udr = ques.credDAO().create(trans, rcred.value);
if (udr.isOK()) {
return Result.ok();
@@ -2545,12 +2545,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
- @ApiDoc(
- method = GET,
+ @ApiDoc(
+ method = GET,
path = "/authn/creds/ns/:ns",
params = {"ns|string|true"},
expectedCode = 200,
- errorCodes = {403,404,406},
+ errorCodes = {403,404,406},
text = { "Return all IDs in Namespace :ns"
}
)
@@ -2560,42 +2560,42 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.ns(ns).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
// check if user is allowed to view NS
Result<NsDAO.Data> rnd = ques.deriveNs(trans,ns);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
-
+
TimeTaken tt = trans.start("MAP Creds by NS to Creds", Env.SUB);
- try {
+ try {
USERS users = mapper.newInstance(API.USERS);
Result<List<CredDAO.Data>> rlcd = ques.credDAO().readNS(trans, ns);
-
+
if (rlcd.isOK()) {
if (!rlcd.isEmpty()) {
return mapper.cred(rlcd.value, users);
}
- return Result.ok(users);
+ return Result.ok(users);
} else {
return Result.err(rlcd);
}
} finally {
tt.done();
}
-
+
}
- @ApiDoc(
- method = GET,
+ @ApiDoc(
+ method = GET,
path = "/authn/creds/id/:ns",
params = {"id|string|true"},
expectedCode = 200,
- errorCodes = {403,404,406},
+ errorCodes = {403,404,406},
text = { "Return all IDs in for ID"
,"(because IDs are multiple, due to multiple Expiration Dates)"
}
@@ -2606,59 +2606,59 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("ID",id).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
String ns = Question.domain2ns(id);
// check if user is allowed to view NS
Result<NsDAO.Data> rnd = ques.deriveNs(trans,ns);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
-
+
TimeTaken tt = trans.start("MAP Creds by ID to Creds", Env.SUB);
- try {
+ try {
USERS users = mapper.newInstance(API.USERS);
Result<List<CredDAO.Data>> rlcd = ques.credDAO().readID(trans, id);
-
+
if (rlcd.isOK()) {
if (!rlcd.isEmpty()) {
return mapper.cred(rlcd.value, users);
}
- return Result.ok(users);
+ return Result.ok(users);
} else {
return Result.err(rlcd);
}
} finally {
tt.done();
}
-
+
}
- @ApiDoc(
- method = GET,
+ @ApiDoc(
+ method = GET,
path = "/authn/certs/id/:id",
params = {"id|string|true"},
expectedCode = 200,
- errorCodes = {403,404,406},
+ errorCodes = {403,404,406},
text = { "Return Cert Info for ID"
}
)
@Override
public Result<CERTS> getCertInfoByID(AuthzTrans trans, HttpServletRequest req, String id) {
TimeTaken tt = trans.start("Get Cert Info by ID", Env.SUB);
- try {
+ try {
CERTS certs = mapper.newInstance(API.CERTS);
Result<List<CertDAO.Data>> rlcd = ques.certDAO().readID(trans, id);
-
+
if (rlcd.isOK()) {
if (!rlcd.isEmpty()) {
return mapper.cert(rlcd.value, certs);
}
- return Result.ok(certs);
- } else {
+ return Result.ok(certs);
+ } else {
return Result.err(rlcd);
}
} finally {
@@ -2667,12 +2667,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
- @ApiDoc(
- method = PUT,
+ @ApiDoc(
+ method = PUT,
path = "/authn/cred",
params = {},
expectedCode = 200,
- errorCodes = {300,403,404,406},
+ errorCodes = {300,403,404,406},
text = { "Reset a Credential Password. If multiple credentials exist for this",
"ID, you will need to specify which entry you are resetting in the",
"CredRequest object"
@@ -2686,54 +2686,54 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<CredDAO.Data> rcred = mapper.cred(trans, from, true);
if (rcred.isOKhasData()) {
rcred = ques.userCredSetup(trans, rcred.value);
-
+
final ServiceValidator v = new ServiceValidator();
-
- if (v.cred(trans, trans.org(),rcred,false).err()) {// Note: Creates have stricter Validations
+
+ if (v.cred(trans, trans.org(),rcred,false).err()) {// Note: Creates have stricter Validations
return Result.err(Status.ERR_BadData,v.errs());
}
Result<List<CredDAO.Data>> rlcd = ques.credDAO().readID(trans, rcred.value.id);
if (rlcd.notOKorIsEmpty()) {
return Result.err(Status.ERR_UserNotFound, "Credential does not exist");
- }
-
+ }
+
MayChange mc = new MayChangeCred(trans, rcred.value,MayChangeCred.RESET);
- Result<?> rmc = mc.mayChange();
+ Result<?> rmc = mc.mayChange();
if (rmc.notOK()) {
return Result.err(rmc);
}
-
+
List<CredDAO.Data> lcdd = filterList(rlcd.value,CredDAO.BASIC_AUTH, CredDAO.BASIC_AUTH_SHA256);
-
+
Result<Integer> ri = selectEntryIfMultiple((CredRequest)from, lcdd, MayChangeCred.RESET);
if (ri.notOK()) {
return Result.err(ri);
}
int entry = ri.value;
-
-
+
+
final CredDAO.Data cred = rcred.value;
-
+
Result<FutureDAO.Data> fd = mapper.future(trans,CredDAO.TABLE,from, rcred.value,false,
new Mapper.Memo() {
@Override
public String get() {
- return cmdDescription + " [" +
- cred.id + '|'
- + cred.type + '|'
+ return cmdDescription + " [" +
+ cred.id + '|'
+ + cred.type + '|'
+ cred.expires + ']';
}
},
mc);
-
+
Result<List<NsDAO.Data>> nsr = ques.nsDAO().read(trans, rcred.value.ns);
if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
-
+
switch(fd.status) {
case OK:
- Result<String> rfc = func.createFuture(trans, fd.value,
+ Result<String> rfc = func.createFuture(trans, fd.value,
rcred.value.id + '|' + rcred.value.type.toString() + '|' + rcred.value.expires,
trans.user(), nsr.value.get(0), FUTURE_OP.U);
if (rfc.isOK()) {
@@ -2741,7 +2741,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
rcred.value.id,
Integer.toString(rcred.value.type),
rcred.value.expires.toString());
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
@@ -2754,15 +2754,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} else {
exp = Expiration.TempPassword;
}
-
+
Organization org = trans.org();
CredDAO.Data current = rlcd.value.get(entry);
// If user resets password in same day, we will have a primary key conflict, so subtract 1 day
- if (current.expires.equals(rcred.value.expires)
+ if (current.expires.equals(rcred.value.expires)
&& rlcd.value.get(entry).type==rcred.value.type) {
GregorianCalendar gc = org.expiration(null, exp,rcred.value.id);
gc = Chrono.firstMomentOfDay(gc);
- gc.set(GregorianCalendar.HOUR_OF_DAY, org.startOfDay());
+ gc.set(GregorianCalendar.HOUR_OF_DAY, org.startOfDay());
rcred.value.expires = new Date(gc.getTimeInMillis() - DAY_IN_MILLIS);
} else {
rcred.value.expires = org.expiration(null,exp).getTime();
@@ -2775,7 +2775,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (udr.isOK()) {
return Result.ok();
}
-
+
return Result.err(udr);
default:
return Result.err(fd);
@@ -2788,12 +2788,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
- @ApiDoc(
- method = PUT,
+ @ApiDoc(
+ method = PUT,
path = "/authn/cred/:days",
params = {"days|string|true"},
expectedCode = 200,
- errorCodes = {300,403,404,406},
+ errorCodes = {300,403,404,406},
text = { "Extend a Credential Expiration Date. The intention of this API is",
"to avoid an outage in PROD due to a Credential expiring before it",
"can be configured correctly. Measures are being put in place ",
@@ -2807,12 +2807,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<CredDAO.Data> cred = mapper.cred(trans, from, false);
Organization org = trans.org();
final ServiceValidator v = new ServiceValidator();
- if (v.notOK(cred).err() ||
+ if (v.notOK(cred).err() ||
v.nullOrBlank(cred.value.id, "Invalid ID").err() ||
v.user(org,cred.value.id).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
try {
String reason;
if ((reason=org.validate(trans, Policy.MAY_EXTEND_CRED_EXPIRES, new CassExecutor(trans,func)))!=null) {
@@ -2823,13 +2823,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
trans.error().log(e, msg="Could not contact Organization for User Validation");
return Result.err(Status.ERR_Denied, msg);
}
-
+
// Get the list of Cred Entries
Result<List<CredDAO.Data>> rlcd = ques.credDAO().readID(trans, cred.value.id);
if (rlcd.notOKorIsEmpty()) {
return Result.err(Status.ERR_UserNotFound, "Credential does not exist");
}
-
+
// Only Passwords can be extended
List<CredDAO.Data> lcdd = filterList(rlcd.value,CredDAO.BASIC_AUTH, CredDAO.BASIC_AUTH_SHA256);
@@ -2854,7 +2854,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if(cd.expires.before(found.expires)) {
return Result.err(Result.ERR_BadData,String.format("Credential's expiration date is more than %s days in the future",days));
}
-
+
cred = ques.credDAO().create(trans, cd);
if (cred.isOK()) {
return Result.ok();
@@ -2863,14 +2863,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} finally {
tt.done();
}
- }
+ }
- @ApiDoc(
- method = DELETE,
+ @ApiDoc(
+ method = DELETE,
path = "/authn/cred",
params = {},
expectedCode = 200,
- errorCodes = {300,403,404,406},
+ errorCodes = {300,403,404,406},
text = { "Delete a Credential. If multiple credentials exist for this",
"ID, you will need to specify which entry you are deleting in the",
"CredRequest object."
@@ -2885,11 +2885,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
MayChange mc = new MayChangeCred(trans,cred.value,MayChangeCred.DELETE);
- Result<?> rmc = mc.mayChange();
+ Result<?> rmc = mc.mayChange();
if (rmc.notOK()) {
return Result.err(rmc);
}
-
+
boolean doForce = trans.requested(force);
Result<List<CredDAO.Data>> rlcd = ques.credDAO().readID(trans, cred.value.id);
if (rlcd.notOKorIsEmpty()) {
@@ -2903,7 +2903,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Status.ERR_UserNotFound, "Credential does not exist");
}
boolean isLastCred = rlcd.value.size()==1;
-
+
int entry;
CredRequest cr = (CredRequest)from;
if(isLastCred) {
@@ -2921,7 +2921,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
++fentry;
if(cdd.type == CredDAO.FQI) {
entry = fentry;
- break;
+ break;
}
}
} else {
@@ -2972,26 +2972,26 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
}
-
+
Result<FutureDAO.Data> fd = mapper.future(trans,CredDAO.TABLE,from,cred.value,false,
() -> "Delete Credential [" +
cred.value.id +
']',
mc);
-
+
Result<List<NsDAO.Data>> nsr = ques.nsDAO().read(trans, cred.value.ns);
if (nsr.notOKorIsEmpty()) {
return Result.err(nsr);
}
-
+
switch(fd.status) {
case OK:
Result<String> rfc = func.createFuture(trans, fd.value, cred.value.id,
trans.user(), nsr.value.get(0), FUTURE_OP.D);
-
+
if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Credential Delete [%s] is saved for future processing",cred.value.id);
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
@@ -3031,7 +3031,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
default:
return Result.err(fd);
}
-
+
}
/*
@@ -3105,21 +3105,21 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private String[] buildVariables(List<CredDAO.Data> value) {
String [] vars = new String[value.size()];
CredDAO.Data cdd;
-
+
for (int i = 0; i < value.size(); i++) {
cdd = value.get(i);
vars[i] = cdd.id + TWO_SPACE + Define.getCredType(cdd.type) + TWO_SPACE + Chrono.niceUTCStamp(cdd.expires) + TWO_SPACE + cdd.tag;
}
return vars;
}
-
+
private String selectCredFromList(List<CredDAO.Data> value, String action) {
StringBuilder errMessage = new StringBuilder();
String userPrompt = MayChangeCred.DELETE.equals(action)?
"Select which cred to delete (set force=true to delete all):":
"Select which cred to " + action + ':';
int numSpaces = value.get(0).id.length() - "Id".length();
-
+
errMessage.append(userPrompt + '\n');
errMessage.append(" ID");
for (int i = 0; i < numSpaces; i++) {
@@ -3135,7 +3135,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
errMessage.append("Run same command again with chosen entry as last parameter");
}
return errMessage.toString();
-
+
}
@Override
@@ -3162,12 +3162,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
- @ApiDoc(
- method = POST,
+ @ApiDoc(
+ method = POST,
path = "/authn/validate",
params = {},
expectedCode = 200,
- errorCodes = { 403 },
+ errorCodes = { 403 },
text = { "Validate a Credential given a Credential Structure. This is a more comprehensive validation, can "
+ "do more than BasicAuth as Credential types exp" }
)
@@ -3192,13 +3192,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Status.ERR_Denied,"Bad Basic Auth");
}
-@ApiDoc(
- method = GET,
+@ApiDoc(
+ method = GET,
path = "/authn/basicAuth",
params = {},
expectedCode = 200,
- errorCodes = { 403 },
- text = { "!!!! DEPRECATED without X509 Authentication STOP USING THIS API BY DECEMBER 2017, or use Certificates !!!!\n"
+ errorCodes = { 403 },
+ text = { "!!!! DEPRECATED without X509 Authentication STOP USING THIS API BY DECEMBER 2017, or use Certificates !!!!\n"
+ "Use /authn/validate instead\n"
+ "Note: Validate a Password using BasicAuth Base64 encoded Header. This HTTP/S call is intended as a fast"
+ " User/Password lookup for Security Frameworks, and responds 200 if it passes BasicAuth "
@@ -3209,14 +3209,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
/***********************************
- * USER-ROLE
+ * USER-ROLE
***********************************/
- @ApiDoc(
- method = POST,
+ @ApiDoc(
+ method = POST,
path = "/authz/userRole",
params = {},
expectedCode = 201,
- errorCodes = {403,404,406,409},
+ errorCodes = {403,404,406,409},
text = { "Create a UserRole relationship (add User to Role)",
"A UserRole is an object Representation of membership of a Role for limited time.",
"If a shorter amount of time for Role ownership is required, use the 'End' field.",
@@ -3233,7 +3233,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(urr);
}
final UserRoleDAO.Data userRole = urr.value;
-
+
final ServiceValidator v = new ServiceValidator();
if (v.user_role(trans.user(),userRole).err() ||
v.user(trans.org(), userRole.user).err()) {
@@ -3241,7 +3241,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
-
+
// Check if user can change first
Result<FutureDAO.Data> fd = mapper.future(trans,UserRoleDAO.TABLE,from,urr.value,true, // may request Approvals
() -> "Add User [" + userRole.user + "] to Role [" +
@@ -3261,7 +3261,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return nsd;
}
});
-
+
NsDAO.Data ndd;
if(userRole.role.startsWith(userRole.user)) {
userRole.ns=userRole.user;
@@ -3277,14 +3277,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
switch(fd.status) {
case OK:
- Result<String> rfc = func.createFuture(trans, fd.value, userRole.user+'|'+userRole.ns + '.' + userRole.rname,
+ Result<String> rfc = func.createFuture(trans, fd.value, userRole.user+'|'+userRole.ns + '.' + userRole.rname,
userRole.user, ndd, FUTURE_OP.C);
if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "UserRole [%s - %s.%s] is saved for future processing",
userRole.user,
userRole.ns,
userRole.rname);
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
@@ -3296,7 +3296,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
/**
* getUserRolesByRole
*/
@@ -3315,7 +3315,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("Role",role).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
Result<RoleDAO.Data> rrdd;
rrdd = RoleDAO.Data.decode(trans,ques,role);
if (rrdd.notOK()) {
@@ -3326,11 +3326,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (ns.notOK()) {
return Result.err(ns);
}
-
- // boolean filter = true;
+
+ // boolean filter = true;
// if (ns.value.isAdmin(trans.user()) || ns.value.isResponsible(trans.user()))
// filter = false;
-
+
// Get list of roles per user, then add to Roles as we go
HashSet<UserRoleDAO.Data> userSet = new HashSet<>();
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO().readByRole(trans, role);
@@ -3339,7 +3339,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
userSet.add(data);
}
}
-
+
@SuppressWarnings("unchecked")
USERROLES users = (USERROLES) mapper.newInstance(API.USER_ROLES);
// Checked for permission
@@ -3364,18 +3364,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.nullOrBlank("User",user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
// Get list of roles per user, then add to Roles as we go
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO().readByUser(trans, user);
- if (rlurd.notOK()) {
+ if (rlurd.notOK()) {
return Result.err(rlurd);
}
-
+
/* Check for
- * 1) is User
+ * 1) is User
* 2) is User's Supervisor
* 3) Has special global access =read permission
- *
+ *
* If none of the 3, then filter results to NSs in which Calling User has Ns.access * read
*/
boolean mustFilter;
@@ -3401,11 +3401,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
mustFilter = true;
}
}
-
+
List<UserRoleDAO.Data> content;
if (mustFilter) {
content = new ArrayList<>(rlurd.value.size()); // avoid multi-memory redos
-
+
for (UserRoleDAO.Data data : rlurd.value) {
ndd.name=data.ns;
Result<Data> mur = ques.mayUser(trans, callingUser, ndd, Access.read);
@@ -3413,7 +3413,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
content.add(data);
}
}
-
+
} else {
content = rlurd.value;
}
@@ -3426,9 +3426,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.ok(users);
}
-
-
-
+
+
+
@ApiDoc(
method = GET,
path = "/authz/userRole/extend/:user/:role",
@@ -3450,18 +3450,18 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,ques,role);
if (rrdd.notOK()) {
return Result.err(rrdd);
}
-
+
Result<NsDAO.Data> rcr = ques.mayUser(trans, trans.user(), rrdd.value, Access.write);
boolean mayNotChange;
if ((mayNotChange = rcr.notOK()) && !trans.requested(future)) {
return Result.err(rcr);
}
-
+
Result<List<UserRoleDAO.Data>> rr = ques.userRoleDAO().read(trans, user,role);
if (rr.notOK()) {
return Result.err(rr);
@@ -3481,7 +3481,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(e);
}
- Result<String> rfc = func.createFuture(trans, fto,
+ Result<String> rfc = func.createFuture(trans, fto,
userRole.user+'|'+userRole.role, userRole.user, rcr.value, FUTURE_OP.U);
if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "UserRole [%s - %s] is saved for future processing",
@@ -3497,14 +3497,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Result.ERR_NotFound,"This user and role doesn't exist");
}
- @ApiDoc(
- method = DELETE,
+ @ApiDoc(
+ method = DELETE,
path = "/authz/userRole/:user/:role",
params = { "user|string|true",
"role|string|true"
},
expectedCode = 200,
- errorCodes = {403,404,406},
+ errorCodes = {403,404,406},
text = { "Remove Role :role from User :user."
}
)
@@ -3521,7 +3521,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rrdd.notOK()) {
return Result.err(rrdd);
}
-
+
RoleDAO.Data rdd = rrdd.value;
Result<NsDAO.Data> rns = ques.mayUser(trans, trans.user(), rdd, Access.write);
@@ -3529,7 +3529,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rns.isOKhasData() && Question.OWNER.equals(rdd.name) && ques.countOwner(trans,rdd.ns)<=1) {
return Result.err(Status.ERR_Denied,"You may not delete the last Owner of " + rdd.ns );
}
-
+
if (mayNotChange=rns.notOK()) {
if (!trans.requested(future)) {
return Result.err(rns);
@@ -3551,13 +3551,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
fto.start = now.getTime();
fto.expires = trans.org().expiration(now, Expiration.Future).getTime();
- Result<String> rfc = func.createFuture(trans, fto,
+ Result<String> rfc = func.createFuture(trans, fto,
userRole.user+'|'+userRole.role, userRole.user, rns.value, FUTURE_OP.D);
if (rfc.isOK()) {
- return Result.err(Status.ACC_Future, "UserRole [%s - %s] is saved for future processing",
+ return Result.err(Status.ACC_Future, "UserRole [%s - %s] is saved for future processing",
userRole.user,
userRole.role);
- } else {
+ } else {
return Result.err(rfc);
}
} else {
@@ -3565,13 +3565,13 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
- @ApiDoc(
- method = GET,
+ @ApiDoc(
+ method = GET,
path = "/authz/userRole/:user/:role",
params = {"user|string|true",
"role|string|true"},
expectedCode = 200,
- errorCodes = {403,404,406},
+ errorCodes = {403,404,406},
text = { "Returns the User (with Expiration date from listed User/Role) if it exists"
}
)
@@ -3584,7 +3584,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Result<NsDAO.Data> ns = ques.deriveNs(trans, role);
// if (ns.notOK()) return Result.err(ns);
-//
+//
// Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), ns.value, Access.write);
// May calling user see by virtue of the Role
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, ques, role);
@@ -3593,9 +3593,9 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), rrdd.value,Access.read);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
-
+
HashSet<UserRoleDAO.Data> userSet = new HashSet<>();
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO().readUserInRole(trans, user, role);
if (rlurd.isOK()) {
@@ -3603,20 +3603,20 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
userSet.add(data);
}
}
-
+
@SuppressWarnings("unchecked")
USERS users = (USERS) mapper.newInstance(API.USERS);
mapper.users(trans, userSet, users);
return Result.ok(users);
}
- @ApiDoc(
- method = GET,
+ @ApiDoc(
+ method = GET,
path = "/authz/users/role/:role",
params = {"user|string|true",
"role|string|true"},
expectedCode = 200,
- errorCodes = {403,404,406},
+ errorCodes = {403,404,406},
text = { "Returns the User (with Expiration date from listed User/Role) if it exists"
}
)
@@ -3629,14 +3629,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
// Result<NsDAO.Data> ns = ques.deriveNs(trans, role);
// if (ns.notOK()) return Result.err(ns);
-//
+//
// Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), ns.value, Access.write);
// May calling user see by virtue of the Role
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, ques, role);
if (rrdd.notOK()) {
return Result.err(rrdd);
}
-
+
boolean contactOnly = false;
// Allow the request of any valid user to find the contact of the NS (Owner)
Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), rrdd.value,Access.read);
@@ -3647,10 +3647,10 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(rnd);
}
}
-
+
HashSet<UserRoleDAO.Data> userSet = new HashSet<>();
Result<List<UserRoleDAO.Data>> rlurd = ques.userRoleDAO().readByRole(trans, role);
- if (rlurd.isOK()) {
+ if (rlurd.isOK()) {
for (UserRoleDAO.Data data : rlurd.value) {
if (contactOnly) { //scrub data
// Can't change actual object, or will mess up the cache.
@@ -3665,7 +3665,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
}
-
+
@SuppressWarnings("unchecked")
USERS users = (USERS) mapper.newInstance(API.USERS);
mapper.users(trans, userSet, users);
@@ -3692,7 +3692,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
final Validator v = new ServiceValidator();
if (v.nullOrBlank("Type",type)
.nullOrBlank("Instance",instance)
- .nullOrBlank("Action",action)
+ .nullOrBlank("Action",action)
.err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -3701,25 +3701,25 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (nss.notOK()) {
return Result.err(nss);
}
-
+
Result<List<NsDAO.Data>> nsd = ques.nsDAO().read(trans, nss.value.ns);
if (nsd.notOK()) {
return Result.err(nsd);
}
-
+
boolean allInstance = ASTERIX.equals(instance);
boolean allAction = ASTERIX.equals(action);
- // Get list of roles per Permission,
+ // Get list of roles per Permission,
// Then loop through Roles to get Users
// Note: Use Sets to avoid processing or responding with Duplicates
Set<String> roleUsed = new HashSet<>();
Set<UserRoleDAO.Data> userSet = new HashSet<>();
-
+
if (!nss.isEmpty()) {
Result<List<PermDAO.Data>> rlp = ques.permDAO().readByType(trans, nss.value.ns, nss.value.name);
if (rlp.isOKhasData()) {
for (PermDAO.Data pd : rlp.value) {
- if ((allInstance || pd.instance.equals(instance)) &&
+ if ((allInstance || pd.instance.equals(instance)) &&
(allAction || pd.action.equals(action))) {
if (ques.mayUser(trans, trans.user(),pd,Access.read).isOK()) {
for (String role : pd.roles) {
@@ -3745,10 +3745,10 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
/***********************************
- * HISTORY
- ***********************************/
+ * HISTORY
+ ***********************************/
@Override
- public Result<HISTORY> getHistoryByUser(final AuthzTrans trans, String user, final int[] yyyymm, final int sort) {
+ public Result<HISTORY> getHistoryByUser(final AuthzTrans trans, String user, final int[] yyyymm, final int sort) {
final Validator v = new ServiceValidator();
if (v.nullOrBlank("User",user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
@@ -3797,12 +3797,12 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rrdd.notOK()) {
return Result.err(rrdd);
}
-
+
Result<NsDAO.Data> rnd = ques.mayUser(trans, trans.user(), rrdd.value, Access.read);
if (rnd.notOK()) {
return Result.err(rnd);
}
- Result<List<HistoryDAO.Data>> resp = ques.historyDAO().readBySubject(trans, role, "role", yyyymm);
+ Result<List<HistoryDAO.Data>> resp = ques.historyDAO().readBySubject(trans, role, "role", yyyymm);
if (resp.notOK()) {
return Result.err(resp);
}
@@ -3828,11 +3828,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
resp = ques.historyDAO().readBySubject(trans, type, "perm", yyyymm);
}
-
+
if (resp.notOK()) {
return Result.err(resp);
}
@@ -3842,7 +3842,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<HISTORY> getHistoryByNS(AuthzTrans trans, String ns, int[] yyyymm, final int sort) {
final Validator v = new ServiceValidator();
- if (v.nullOrBlank("NS",ns).err()) {
+ if (v.nullOrBlank("NS",ns).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -3852,7 +3852,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
rnd = ques.mayUser(trans, trans.user(), rnd.value, Access.read);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
Result<List<HistoryDAO.Data>> resp = ques.historyDAO().readBySubject(trans, ns, "ns", yyyymm);
@@ -3868,7 +3868,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
ndd.name = FQI.reverseDomain(subject);
Result<Data> rnd = ques.mayUser(trans, trans.user(), ndd, Access.read);
if (rnd.notOK()) {
- return Result.err(rnd);
+ return Result.err(rnd);
}
Result<List<HistoryDAO.Data>> resp = ques.historyDAO().readBySubject(trans, subject, target, yyyymm);
@@ -3879,7 +3879,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
/***********************************
- * DELEGATE
+ * DELEGATE
***********************************/
@Override
public Result<Void> createDelegate(final AuthzTrans trans, REQUEST base) {
@@ -3895,23 +3895,23 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private Result<Void> createOrUpdateDelegate(final AuthzTrans trans, REQUEST base, final Access access) {
final Result<DelegateDAO.Data> rd = mapper.delegate(trans, base);
final ServiceValidator v = new ServiceValidator();
- if (v.delegate(trans.org(),rd).err()) {
+ if (v.delegate(trans.org(),rd).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
final DelegateDAO.Data dd = rd.value;
-
+
Result<List<DelegateDAO.Data>> ddr = ques.delegateDAO().read(trans, dd);
if (access==Access.create && ddr.isOKhasData()) {
return Result.err(Status.ERR_ConflictAlreadyExists, "[%s] already delegates to [%s]", dd.user, ddr.value.get(0).delegate);
- } else if (access!=Access.create && ddr.notOKorIsEmpty()) {
+ } else if (access!=Access.create && ddr.notOKorIsEmpty()) {
return Result.err(Status.ERR_NotFound, "[%s] does not have a Delegate Record to [%s].",dd.user,access.name());
}
Result<Void> rv = ques.mayUser(trans, dd, access);
if (rv.notOK()) {
return rv;
}
-
+
Result<FutureDAO.Data> fd = mapper.future(trans,DelegateDAO.TABLE,base, dd, false,
() -> {
StringBuilder sb = new StringBuilder();
@@ -3928,15 +3928,15 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
() -> {
return Result.ok(); // Validate in code above
});
-
+
switch(fd.status) {
case OK:
- Result<String> rfc = func.createFuture(trans, fd.value,
+ Result<String> rfc = func.createFuture(trans, fd.value,
dd.user, trans.user(),null, access==Access.create?FUTURE_OP.C:FUTURE_OP.U);
- if (rfc.isOK()) {
+ if (rfc.isOK()) {
return Result.err(Status.ACC_Future, "Delegate for [%s]",
dd.user);
- } else {
+ } else {
return Result.err(rfc);
}
case Status.ACC_Now:
@@ -3962,7 +3962,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (v.notOK(rd).nullOrBlank("User", rd.value.user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
Result<List<DelegateDAO.Data>> ddl;
if ((ddl=ques.delegateDAO().read(trans, rd.value)).notOKorIsEmpty()) {
return Result.err(Status.ERR_DelegateNotFound,"Cannot delete non-existent Delegate");
@@ -3972,7 +3972,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rv.notOK()) {
return rv;
}
-
+
return ques.delegateDAO().delete(trans, dd, false);
}
@@ -3993,10 +3993,10 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rv.notOK()) {
return rv;
}
-
+
return ques.delegateDAO().delete(trans, dd, false);
}
-
+
@Override
public Result<DELGS> getDelegatesByUser(AuthzTrans trans, String user) {
final Validator v = new ServiceValidator();
@@ -4011,7 +4011,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (rv.notOK()) {
return Result.err(rv);
}
-
+
TimeTaken tt = trans.start("Get delegates for a user", Env.SUB);
Result<List<DelegateDAO.Data>> dbDelgs = ques.delegateDAO().read(trans, user);
@@ -4023,7 +4023,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
} finally {
tt.done();
- }
+ }
}
@Override
@@ -4051,11 +4051,11 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
} finally {
tt.done();
- }
+ }
}
/***********************************
- * APPROVAL
+ * APPROVAL
***********************************/
private static final String APPR_FMT = "actor=%s, action=%s, operation=\"%s\", requestor=%s, delegator=%s";
@Override
@@ -4070,7 +4070,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
int numProcessed = 0;
String user = trans.user();
-
+
Result<List<ApprovalDAO.Data>> curr;
Lookup<List<ApprovalDAO.Data>> apprByTicket=null;
for (ApprovalDAO.Data updt : rlad.value) {
@@ -4093,14 +4093,14 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Map<String, Result<List<DelegateDAO.Data>>> delegateCache = new HashMap<>();
Map<UUID, FutureDAO.Data> futureCache = new HashMap<>();
FutureDAO.Data hasDeleted = new FutureDAO.Data();
-
+
for (ApprovalDAO.Data cd : curr.value) {
if ("pending".equals(cd.status)) {
// Check for right record. Need ID, or (Ticket&Trans.User==Appr)
// If Default ID
boolean delegatedAction = ques.isDelegated(trans, user, cd.approver, delegateCache);
String delegator = cd.approver;
- if (updt.id!=null ||
+ if (updt.id!=null ||
(updt.ticket!=null && user.equals(cd.approver)) ||
(updt.ticket!=null && delegatedAction)) {
if (updt.ticket.equals(cd.ticket)) {
@@ -4178,7 +4178,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(Status.ERR_ActionNotCompleted,numProcessed + " out of " + numApprs + " completed");
}
-
+
private static class Changed {
private boolean hasChanged = false;
@@ -4202,7 +4202,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<APPROVALS> getApprovalsByUser(AuthzTrans trans, String user) {
final Validator v = new ServiceValidator();
- if (v.nullOrBlank("User", user).err()) {
+ if (v.nullOrBlank("User", user).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
@@ -4217,7 +4217,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<APPROVALS> getApprovalsByTicket(AuthzTrans trans, String ticket) {
final Validator v = new ServiceValidator();
- if (v.nullOrBlank("Ticket", ticket).err()) {
+ if (v.nullOrBlank("Ticket", ticket).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
UUID uuid;
@@ -4226,7 +4226,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} catch (IllegalArgumentException e) {
return Result.err(Status.ERR_BadData,e.getMessage());
}
-
+
Result<List<ApprovalDAO.Data>> rapd = ques.approvalDAO().readByTicket(trans, uuid);
if (rapd.isOK()) {
return mapper.approvals(rapd.value);
@@ -4234,23 +4234,23 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(rapd);
}
}
-
+
@Override
public Result<APPROVALS> getApprovalsByApprover(AuthzTrans trans, String approver) {
final Validator v = new ServiceValidator();
if (v.nullOrBlank("Approver", approver).err()) {
return Result.err(Status.ERR_BadData,v.errs());
}
-
+
List<ApprovalDAO.Data> listRapds = new ArrayList<>();
-
+
Result<List<ApprovalDAO.Data>> myRapd = ques.approvalDAO().readByApprover(trans, approver);
if (myRapd.notOK()) {
return Result.err(myRapd);
}
-
+
listRapds.addAll(myRapd.value);
-
+
Result<List<DelegateDAO.Data>> delegatedFor = ques.delegateDAO().readByDelegate(trans, approver);
if (delegatedFor.isOK()) {
for (DelegateDAO.Data dd : delegatedFor.value) {
@@ -4258,7 +4258,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
String delegator = dd.user;
Result<List<ApprovalDAO.Data>> rapd = ques.approvalDAO().readByApprover(trans, delegator);
if (rapd.isOK()) {
- for (ApprovalDAO.Data d : rapd.value) {
+ for (ApprovalDAO.Data d : rapd.value) {
if (!d.user.equals(trans.user())) {
listRapds.add(d);
}
@@ -4267,10 +4267,10 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
}
-
+
return mapper.approvals(listRapds);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.service.AuthzService#clearCache(org.onap.aaf.auth.env.test.AuthzTrans, java.lang.String)
*/
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzService.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzService.java
index f9f23f46..4a756f26 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzService.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzService.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,31 +33,31 @@ import org.onap.aaf.auth.service.mapper.Mapper;
public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> {
public Mapper<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> mapper();
-
+
/***********************************
- * NAMESPACE
+ * NAMESPACE
***********************************/
/**
- *
+ *
* @param trans
* @param user
* @param ns
* @return
- * @throws DAOException
- * @throws
+ * @throws DAOException
+ * @throws
*/
public Result<Void> createNS(AuthzTrans trans, REQUEST request, NsType type);
/**
- *
+ *
* @param trans
* @param ns
* @return
*/
public Result<Void> addAdminNS(AuthzTrans trans, String ns, String id);
-
+
/**
- *
+ *
* @param trans
* @param ns
* @return
@@ -65,7 +65,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> delAdminNS(AuthzTrans trans, String ns, String id);
/**
- *
+ *
* @param trans
* @param ns
* @param id
@@ -74,7 +74,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> addResponsibleNS(AuthzTrans trans, String ns, String id);
/**
- *
+ *
* @param trans
* @param ns
* @param id
@@ -83,7 +83,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> delResponsibleNS(AuthzTrans trans, String ns, String id);
/**
- *
+ *
* @param trans
* @param ns
* @param key
@@ -93,7 +93,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> createNsAttrib(AuthzTrans trans, String ns, String key, String value);
/**
- *
+ *
* @param trans
* @param ns
* @param key
@@ -103,7 +103,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<?> updateNsAttrib(AuthzTrans trans, String ns, String key, String value);
/**
- *
+ *
* @param trans
* @param ns
* @param key
@@ -112,7 +112,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> deleteNsAttrib(AuthzTrans trans, String ns, String key);
/**
- *
+ *
* @param trans
* @param ns
* @param key
@@ -122,23 +122,23 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
/**
- *
+ *
* @param trans
* @param ns
* @return
*/
public Result<NSS> getNSbyName(AuthzTrans trans, String ns, boolean full);
-
+
/**
- *
+ *
* @param trans
* @param user
* @return
*/
public Result<NSS> getNSbyAdmin(AuthzTrans trans, String user, boolean full);
-
+
/**
- *
+ *
* @param trans
* @param user
* @return
@@ -146,7 +146,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<NSS> getNSbyResponsible(AuthzTrans trans, String user, boolean full);
/**
- *
+ *
* @param trans
* @param user
* @return
@@ -154,7 +154,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<NSS> getNSbyEither(AuthzTrans trans, String user, boolean full);
/**
- *
+ *
* @param trans
* @param parent
* @return
@@ -162,15 +162,15 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<NSS> getNSsChildren(AuthzTrans trans, String parent);
/**
- *
+ *
* @param trans
* @param req
* @return
*/
public Result<Void> updateNsDescription(AuthzTrans trans, REQUEST req);
-
+
/**
- *
+ *
* @param trans
* @param ns
* @param user
@@ -180,29 +180,29 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> deleteNS(AuthzTrans trans, String ns);
/***********************************
- * PERM
+ * PERM
***********************************/
/**
- *
+ *
* @param trans
* @param rreq
* @return
- * @throws DAOException
+ * @throws DAOException
* @throws MappingException
*/
public Result<Void> createPerm(AuthzTrans trans, REQUEST rreq);
-
+
/**
- *
+ *
* @param trans
* @param childPerm
* @return
- * @throws DAOException
+ * @throws DAOException
*/
public Result<PERMS> getPermsByType(AuthzTrans trans, String perm);
-
+
/**
- *
+ *
* @param trans
* @param type
* @param instance
@@ -216,14 +216,14 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
* Gets all the permissions for a user across all the roles it is assigned to
* @param userName
* @return
- * @throws Exception
+ * @throws Exception
* @throws Exception
*/
public Result<PERMS> getPermsByUser(AuthzTrans trans, String userName);
/**
* Gets all the permissions for a user across all the roles it is assigned to, filtered by NS (Scope)
- *
+ *
* @param trans
* @param user
* @param scopes
@@ -234,30 +234,30 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
/**
* Gets all the permissions for a user across all the roles it is assigned to
- *
+ *
* Add AAF Perms representing the "MayUser" calls if
* 1) Allowed
* 2) User has equivalent permission
- *
+ *
* @param userName
* @return
- * @throws Exception
+ * @throws Exception
* @throws Exception
*/
public Result<PERMS> getPermsByUser(AuthzTrans trans, PERMS perms, String userName);
/**
- *
+ *
* Gets all the permissions for a user across all the roles it is assigned to
- *
+ *
* @param roleName
* @return
* @throws Exception
*/
public Result<PERMS> getPermsByRole(AuthzTrans trans, String roleName);
-
+
/**
- *
+ *
* @param trans
* @param ns
* @return
@@ -266,7 +266,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
/**
* rename permission
- *
+ *
* @param trans
* @param rreq
* @param isRename
@@ -276,25 +276,25 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
* @return
*/
public Result<Void> renamePerm(AuthzTrans trans, REQUEST rreq, String origType, String origInstance, String origAction);
-
+
/**
- *
+ *
* @param trans
* @param req
* @return
*/
public Result<Void> updatePermDescription(AuthzTrans trans, REQUEST req);
-
+
/**
- *
+ *
* @param trans
* @param from
* @return
*/
public Result<Void> resetPermRoles(AuthzTrans trans, REQUEST from);
-
+
/**
- *
+ *
* @param trans
* @param from
* @return
@@ -303,7 +303,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> deletePerm(AuthzTrans trans, REQUEST from);
/**
- *
+ *
* @param trans
* @param user
* @param perm
@@ -315,22 +315,22 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
Result<Void> deletePerm(AuthzTrans trans, String perm, String type, String action);
/***********************************
- * ROLE
+ * ROLE
***********************************/
/**
- *
+ *
* @param trans
* @param user
* @param role
* @param approvers
* @return
- * @throws DAOException
+ * @throws DAOException
* @throws Exception
*/
public Result<Void> createRole(AuthzTrans trans, REQUEST req);
/**
- *
+ *
* @param trans
* @param role
* @return
@@ -338,16 +338,16 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<ROLES> getRolesByName(AuthzTrans trans, String role);
/**
- *
+ *
* @param trans
* @param user
* @return
- * @throws DAOException
+ * @throws DAOException
*/
public Result<ROLES> getRolesByUser(AuthzTrans trans, String user);
/**
- *
+ *
* @param trans
* @param user
* @return
@@ -355,7 +355,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<ROLES> getRolesByNS(AuthzTrans trans, String user);
/**
- *
+ *
* @param trans
* @param name
* @return
@@ -363,7 +363,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<ROLES> getRolesByNameOnly(AuthzTrans trans, String name);
/**
- *
+ *
* @param trans
* @param type
* @param instance
@@ -373,25 +373,25 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<ROLES> getRolesByPerm(AuthzTrans trans, String type, String instance, String action);
/**
- *
+ *
* @param trans
* @param req
* @return
*/
public Result<Void> updateRoleDescription(AuthzTrans trans, REQUEST req);
-
+
/**
- *
+ *
* @param trans
* @param rreq
* @return
* @throws DAOException
*/
public Result<Void> addPermToRole(AuthzTrans trans, REQUEST rreq);
-
-
+
+
/**
- *
+ *
* @param trans
* @param rreq
* @return
@@ -411,18 +411,18 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> delPermFromRole(AuthzTrans trans, String role, String type, String instance, String action);
/**
- *
+ *
* @param trans
* @param user
* @param role
* @return
- * @throws DAOException
- * @throws MappingException
+ * @throws DAOException
+ * @throws MappingException
*/
public Result<Void> deleteRole(AuthzTrans trans, String role);
/**
- *
+ *
* @param trans
* @param req
* @return
@@ -430,11 +430,11 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> deleteRole(AuthzTrans trans, REQUEST req);
/***********************************
- * CRED
+ * CRED
***********************************/
/**
- *
+ *
* @param trans
* @param from
* @return
@@ -442,7 +442,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
Result<Void> createUserCred(AuthzTrans trans, REQUEST from);
/**
- *
+ *
* @param trans
* @param from
* @return
@@ -450,7 +450,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
Result<Void> resetUserCred(AuthzTrans trans, REQUEST from);
/**
- *
+ *
* @param trans
* @param from
* @param days
@@ -459,15 +459,15 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
Result<Void> extendUserCred(AuthzTrans trans, REQUEST from, String days);
/**
- *
+ *
* @param trans
* @param ns
* @return
*/
public Result<USERS> getCredsByNS(AuthzTrans trans, String ns);
-
+
/**
- *
+ *
* @param trans
* @param id
* @return
@@ -475,7 +475,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<USERS> getCredsByID(AuthzTrans trans, String id);
/**
- *
+ *
* @param trans
* @param req
* @param id
@@ -484,15 +484,15 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<CERTS> getCertInfoByID(AuthzTrans trans, HttpServletRequest req, String id);
/**
- *
+ *
* @param trans
* @param credReq
* @return
*/
public Result<Void> deleteUserCred(AuthzTrans trans, REQUEST credReq);
-
+
/**
- *
+ *
* @param trans
* @param user
* @return
@@ -501,15 +501,15 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Date> doesCredentialMatch(AuthzTrans trans, REQUEST credReq);
/**
- *
+ *
* @param trans
* @param basicAuth
* @return
*/
public Result<Date> validateBasicAuth(AuthzTrans trans, String basicAuth);
-
+
/**
- *
+ *
* @param trans
* @param role
* @return
@@ -517,7 +517,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<USERS> getUsersByRole(AuthzTrans trans, String role);
/**
- *
+ *
* @param trans
* @param role
* @return
@@ -525,7 +525,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<USERS> getUserInRole(AuthzTrans trans, String user, String role);
/**
- *
+ *
* @param trans
* @param type
* @param instance
@@ -533,15 +533,15 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
* @return
*/
public Result<USERS> getUsersByPermission(AuthzTrans trans,String type, String instance, String action);
-
-
+
+
/***********************************
- * USER-ROLE
+ * USER-ROLE
***********************************/
/**
- *
+ *
* @param trans
* @param user
* @param request
@@ -551,7 +551,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> createUserRole(AuthzTrans trans, REQUEST request);
/**
- *
+ *
* @param trans
* @param role
* @return
@@ -559,7 +559,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<USERROLES> getUserRolesByRole(AuthzTrans trans, String role);
/**
- *
+ *
* @param trans
* @param role
* @return
@@ -570,9 +570,9 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
* Note: Removed "resetRolesForUsers" because it was too dangerous, and
* removed "resetUsersForRoles" because it was being misused.
*/
-
+
/**
- *
+ *
* @param trans
* @param user
* @param role
@@ -582,23 +582,23 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
String role);
/**
- *
+ *
* @param trans
* @param user
* @param usr
* @param role
* @return
- * @throws DAOException
+ * @throws DAOException
*/
public Result<Void> deleteUserRole(AuthzTrans trans, String usr, String role);
/***********************************
- * HISTORY
- ***********************************/
+ * HISTORY
+ ***********************************/
/**
- *
+ *
* @param trans
* @param user
* @param yyyymm
@@ -607,7 +607,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<HISTORY> getHistoryByUser(AuthzTrans trans, String user, int[] yyyymm, int sort);
/**
- *
+ *
* @param trans
* @param subj
* @param yyyymm
@@ -617,7 +617,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<HISTORY> getHistoryByRole(AuthzTrans trans, String subj, int[] yyyymm, int sort);
/**
- *
+ *
* @param trans
* @param subj
* @param yyyymm
@@ -627,7 +627,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<HISTORY> getHistoryByPerm(AuthzTrans trans, String subj, int[] yyyymm, int sort);
/**
- *
+ *
* @param trans
* @param subj
* @param yyyymm
@@ -637,7 +637,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<HISTORY> getHistoryByNS(AuthzTrans trans, String subj, int[] yyyymm, int sort);
/**
- *
+ *
* @param trans
* @param target
* @param yyyymm
@@ -647,28 +647,28 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<HISTORY> getHistoryBySubject(AuthzTrans trans, String subject, String target, int[] yyyymm, int sort);
/***********************************
- * DELEGATE
+ * DELEGATE
***********************************/
/**
- *
+ *
* @param trans
* @param delegates
* @return
* @throws Exception
*/
public Result<Void> createDelegate(AuthzTrans trans, REQUEST reqDelegate);
-
+
/**
- *
+ *
* @param trans
* @param delegates
* @return
* @throws Exception
*/
public Result<Void> updateDelegate(AuthzTrans trans, REQUEST reqDelegate);
-
+
/**
- *
+ *
* @param trans
* @param userName
* @param delegate
@@ -676,9 +676,9 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
* @throws Exception
*/
public Result<Void> deleteDelegate(AuthzTrans trans, REQUEST reqDelegate);
-
+
/**
- *
+ *
* @param trans
* @param userName
* @return
@@ -686,17 +686,17 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> deleteDelegate(AuthzTrans trans, String userName);
/**
- *
+ *
* @param trans
* @param user
* @return
* @throws Exception
*/
public Result<DELGS> getDelegatesByUser(AuthzTrans trans, String user);
-
+
/**
- *
+ *
* @param trans
* @param delegate
* @return
@@ -704,10 +704,10 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<DELGS> getDelegatesByDelegate(AuthzTrans trans, String delegate);
/***********************************
- * APPROVAL
+ * APPROVAL
***********************************/
/**
- *
+ *
* @param trans
* @param user
* @param approver
@@ -717,7 +717,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> updateApproval(AuthzTrans trans, APPROVALS approvals);
/**
- *
+ *
* @param trans
* @param user
* @return
@@ -725,7 +725,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<APPROVALS> getApprovalsByUser(AuthzTrans trans, String user);
/**
- *
+ *
* @param trans
* @param ticket
* @return
@@ -733,7 +733,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<APPROVALS> getApprovalsByTicket(AuthzTrans trans, String ticket);
/**
- *
+ *
* @param trans
* @param approver
* @return
@@ -741,7 +741,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<APPROVALS> getApprovalsByApprover(AuthzTrans trans, String approver);
/**
- *
+ *
* @param trans
* @param cname
* @return
@@ -749,7 +749,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> cacheClear(AuthzTrans trans, String cname);
/**
- *
+ *
* @param trans
* @param cname
* @param segment
@@ -758,7 +758,7 @@ public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERT
public Result<Void> cacheClear(AuthzTrans trans, String cname, int[] segment);
/**
- *
+ *
* @param trans
*/
public void dbReset(AuthzTrans trans);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/Code.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/Code.java
index ac799f4e..e2cf5e5a 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/Code.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/Code.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,7 @@ public abstract class Code extends HttpCode<AuthzTrans, AuthzFacade> implements
super(facade, description, roles);
this.useJSON = useJSON;
}
-
+
public <D extends Code> D clone(AuthzFacade facade, boolean useJSON) throws Exception {
@SuppressWarnings("unchecked")
D d = (D)clone();
@@ -40,5 +40,5 @@ public abstract class Code extends HttpCode<AuthzTrans, AuthzFacade> implements
d.context = facade;
return d;
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/MayChange.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/MayChange.java
index a1ceb75a..7279a14e 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/MayChange.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/MayChange.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ package org.onap.aaf.auth.service;
import org.onap.aaf.auth.layer.Result;
/**
- * There are several ways to determine if
+ * There are several ways to determine if
* @author Jonathan
*
*/
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java
index 70d131a5..4410d7b7 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Api.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,10 +42,10 @@ import org.onap.aaf.cadi.Symm;
public class API_Api {
// Hide Public Constructor
private API_Api() {}
-
+
/**
* Normal Init level APIs
- *
+ *
* @param authzAPI
* @param facade
* @throws Exception
@@ -74,7 +74,7 @@ public class API_Api {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String pathInfo = req.getPathInfo();
int question = pathInfo.lastIndexOf('?');
-
+
pathInfo = pathInfo.substring(13, question<0?pathInfo.length():question);// IMPORTANT, this is size of "/api/example/"
String nameOrContextType=Symm.base64noSplit.decode(pathInfo);
Result<Void> r = context.getAPIExample(trans,resp,nameOrContextType,
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java
index 7c74be1b..77c460ce 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Approval.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,7 +38,7 @@ import org.onap.aaf.auth.service.mapper.Mapper.API;
public class API_Approval {
// Hide Public Constructor
private API_Approval() {}
-
+
public static void init(AAF_Service authzAPI, AuthzFacade facade) throws Exception {
/**
@@ -50,11 +50,11 @@ public class API_Approval {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.getApprovalsByUser(trans, resp, pathParam(req,"user"));
if (r.isOK()) {
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
/**
@@ -68,8 +68,8 @@ public class API_Approval {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
/**
@@ -83,8 +83,8 @@ public class API_Approval {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
@@ -99,8 +99,8 @@ public class API_Approval {
resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
}
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java
index fbc1baa2..c23471a0 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Creds.java
@@ -7,9 +7,9 @@
* 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.
@@ -61,25 +61,25 @@ public class API_Creds {
// needed to validate Creds even when already Authenticated x509
/**
* TIME SENSITIVE APIs
- *
+ *
* These will be first in the list
- *
+ *
* @param env
* @param authzAPI
* @param facade
- * @param directAAFUserPass
+ * @param directAAFUserPass
* @throws Exception
*/
public static void timeSensitiveInit(Env env, AAF_Service authzAPI, AuthzFacade facade, final DirectAAFUserPass directAAFUserPass) throws Exception {
/**
* Basic Auth, quick Validation
- *
+ *
* Responds OK or NotAuthorized
*/
authzAPI.route(env, HttpMethods.GET, "/authn/basicAuth", new Code(facade,"Is given BasicAuth valid?",true) {
@Override
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
@@ -92,7 +92,7 @@ public class API_Creds {
// have to check Basic Auth here, because it might be CSP.
String authz = req.getHeader("Authorization");
if (authz.startsWith("Basic ")) {
- BasicHttpTaf bht = ((X509Principal)p).getBasicHttpTaf();
+ BasicHttpTaf bht = ((X509Principal)p).getBasicHttpTaf();
if (bht!=null) {
BasicPrincipal bp = new BasicPrincipal(authz,"");
CredVal cv = bht.getCredVal(bp.getDomain());
@@ -109,8 +109,8 @@ public class API_Creds {
TimeTaken tt = trans.start("Direct Validation", Env.REMOTE);
try {
if (directAAFUserPass.validate(
- decoded.substring(0,colon),
- CredVal.Type.PASSWORD ,
+ decoded.substring(0,colon),
+ CredVal.Type.PASSWORD ,
decoded.substring(colon+1).getBytes(),trans)) {
resp.setStatus(HttpStatus.OK_200);
} else {
@@ -133,58 +133,58 @@ public class API_Creds {
}
}
},"text/plain","*/*","*");
-
- /**
+
+ /**
* returns whether a given Credential is valid
*/
authzAPI.route(POST, "/authn/validate", API.CRED_REQ, new Code(facade,"Is given Credential valid?",true) {
@Override
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
// will be a valid Entity. Do we need to add permission
- //if(trans.fish("ns","password","request")) or the like
+ //if(trans.fish("ns","password","request")) or the like
Result<Date> r = context.doesCredentialMatch(trans, req, resp);
if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
} else {
// For Security, we don't give any info out on why failed, other than forbidden
// Can't do "401", because that is on the call itself
- // 403 Implies you MAY NOT Ask.
+ // 403 Implies you MAY NOT Ask.
resp.setStatus(HttpStatus.NOT_ACCEPTABLE_406);
}
}
- });
+ });
- /**
+ /**
* returns whether a given Credential is valid
*/
authzAPI.route(GET, "/authn/cert/id/:id", API.CERTS, new Code(facade,"Get Cert Info by ID",true) {
@Override
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getCertInfoByID(trans, req, resp, pathParam(req,":id") );
if (r.isOK()) {
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
} else {
// For Security, we don't give any info out on why failed, other than forbidden
resp.setStatus(HttpStatus.FORBIDDEN_403);
}
}
- });
+ });
}
-
+
/**
* Normal Init level APIs
- *
+ *
* @param authzAPI
* @param facade
* @throws Exception
@@ -195,7 +195,7 @@ public class API_Creds {
*/
authzAPI.route(POST,"/authn/cred",API.CRED_REQ,new Code(facade,"Add a New ID/Credential", true) {
@Override
- public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
+ public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
Result<Void> r = context.createUserCred(trans, req);
if (r.isOK()) {
resp.setStatus(HttpStatus.CREATED_201);
@@ -204,40 +204,40 @@ public class API_Creds {
}
}
});
-
- /**
+
+ /**
* gets all credentials by Namespace
*/
authzAPI.route(GET, "/authn/creds/ns/:ns", API.USERS, new Code(facade,"Get Creds for a Namespace",true) {
@Override
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getCredsByNS(trans, resp, pathParam(req, "ns"));
if (r.isOK()) {
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
}
}
});
-
- /**
+
+ /**
* gets all credentials by ID
*/
authzAPI.route(GET, "/authn/creds/id/:id", API.USERS, new Code(facade,"Get Creds by ID",true) {
@Override
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getCredsByID(trans, resp, pathParam(req, "id"));
if (r.isOK()) {
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
} else {
context.error(trans,resp,r);
}
@@ -252,7 +252,7 @@ public class API_Creds {
authzAPI.route(PUT,"/authn/cred",API.CRED_REQ,new Code(facade,"Update an ID/Credential", true) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.changeUserCred(trans, req);
if (r.isOK()) {
resp.setStatus(HttpStatus.OK_200);
@@ -266,7 +266,7 @@ public class API_Creds {
* Extend ID/Credential
* This behavior will accelerate getting out of P1 outages due to ignoring renewal requests, or
* other expiration issues.
- *
+ *
* Scenario is that people who are solving Password problems at night, are not necessarily those who
* know what the passwords are supposed to be. Also, changing Password, without changing Configurations
* using that password only exacerbates the P1 Issue.
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Delegate.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Delegate.java
index ec1824b1..6ad62f28 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Delegate.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Delegate.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,14 +50,14 @@ public class API_Delegate {
Result<Void> r = context.createDelegate(trans, req, resp);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ resp.setStatus(HttpStatus.CREATED_201);
break;
default:
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
-
+
/**
* Update a delegate
*/
@@ -68,14 +68,14 @@ public class API_Delegate {
Result<Void> r = context.updateDelegate(trans, req, resp);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
-
+
/**
* DELETE delegates for a user
*/
@@ -86,14 +86,14 @@ public class API_Delegate {
Result<Void> r = context.deleteDelegate(trans, req, resp);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
-
+
/**
* DELETE a delegate
*/
@@ -104,14 +104,14 @@ public class API_Delegate {
Result<Void> r = context.deleteDelegate(trans, pathParam(req, "user_name"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
-
+
/**
* Read who is delegating for User
*/
@@ -122,12 +122,12 @@ public class API_Delegate {
Result<Void> r = context.getDelegatesByUser(trans, pathParam(req, "user"), resp);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
/**
@@ -140,12 +140,12 @@ public class API_Delegate {
Result<Void> r = context.getDelegatesByDelegate(trans, pathParam(req, "delegate"), resp);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
- }
- }
+ }
+ }
});
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java
index ce730cec..341719c3 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,20 +44,20 @@ import org.onap.aaf.auth.service.mapper.Mapper.API;
/**
* Pull certain types of History Info
- *
- * Specify yyyymm as
+ *
+ * Specify yyyymm as
* single - 201504
* commas 201503,201504
* ranges 201501-201504
* combinations 201301,201401,201501-201504
- *
+ *
* @author Jonathan
*
*/
public class API_History {
/**
* Normal Init level APIs
- *
+ *
* @param authzAPI
* @param facade
* @throws Exception
@@ -82,7 +82,7 @@ public class API_History {
Result<Void> r = context.getHistoryByUser(trans, resp, pathParam(req,":user"),years,descend);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -105,11 +105,11 @@ public class API_History {
context.error(trans, resp, Result.err(Status.ERR_BadData, e.getMessage()));
return;
}
-
+
Result<Void> r = context.getHistoryByNS(trans, resp, pathParam(req,":ns"),years,descend);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -136,7 +136,7 @@ public class API_History {
Result<Void> r = context.getHistoryByRole(trans, resp, pathParam(req,":role"),years,descend);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -159,20 +159,20 @@ public class API_History {
context.error(trans, resp, Result.err(Status.ERR_BadData, e.getMessage()));
return;
}
-
+
Result<Void> r = context.getHistoryByPerm(trans, resp, pathParam(req,":type"),years,descend);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
});
-
+
/**
- * Get History by Subject
+ * Get History by Subject
*/
authzAPI.route(GET,"/authz/hist/subject/:type/:subject",API.HISTORY,new Code(facade,"Get History by Perm Type", true) {
@Override
@@ -186,11 +186,11 @@ public class API_History {
context.error(trans, resp, Result.err(Status.ERR_BadData, e.getMessage()));
return;
}
-
+
Result<Void> r = context.getHistoryBySubject(trans, resp, pathParam(req,":type"), pathParam(req,":subject"),years,descend);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -205,9 +205,9 @@ public class API_History {
if ("true".equalsIgnoreCase(req.getParameter("asc")))return 1;
return 0;
}
-
+
// Get Common "yyyymm" parameter, or none
-
+
private static int[] getYears(HttpServletRequest req) throws NumberFormatException {
// Sonar says threading issues.
SimpleDateFormat FMT = new SimpleDateFormat("yyyyMM");
@@ -237,8 +237,8 @@ public class API_History {
GregorianCalendar gc = new GregorianCalendar();
gc.set(GregorianCalendar.MONTH, Integer.parseInt(range[1].substring(4,6))-1);
gc.set(GregorianCalendar.YEAR, Integer.parseInt(range[1].substring(0,4)));
- int end = getNum(FMT.format(gc.getTime()));
-
+ int end = getNum(FMT.format(gc.getTime()));
+
gc.set(GregorianCalendar.MONTH, Integer.parseInt(range[0].substring(4,6))-1);
gc.set(GregorianCalendar.YEAR, Integer.parseInt(range[0].substring(0,4)));
for (int i=getNum(FMT.format(gc.getTime()));i<=end;gc.add(GregorianCalendar.MONTH, 1),i=getNum(FMT.format(gc.getTime()))) {
@@ -258,7 +258,7 @@ public class API_History {
}
return ym;
}
-
+
private static int getNum(String n) {
if (n==null || n.length()!=6) throw new NumberFormatException(n + " is not in YYYYMM format");
return Integer.parseInt(n);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java
index d99e1ada..d79ab589 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Mgmt.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,7 +56,7 @@ public class API_Mgmt {
/**
* Normal Init level APIs
- *
+ *
* @param authzAPI
* @param facade
* @throws Exception
@@ -73,14 +73,14 @@ public class API_Mgmt {
switch(r.status) {
case OK:
trans.checkpoint(SUCCESS,Trans.ALWAYS);
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
});
-
+
/**
* Clear Cache
*/
@@ -94,7 +94,7 @@ public class API_Mgmt {
case OK:
trans.audit().log("Cache " + area + " has been cleared by "+trans.user());
trans.checkpoint(SUCCESS,Trans.ALWAYS);
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -127,7 +127,7 @@ public class API_Mgmt {
});
/**
- * Deny an IP
+ * Deny an IP
*/
authzAPI.route(POST, "/mgmt/deny/ip/:ip", API.VOID, new Code(facade,"Deny IP",true) {
@Override
@@ -140,17 +140,17 @@ public class API_Mgmt {
resp.setStatus(HttpStatus.CREATED_201);
} else {
- context.error(trans,resp,Result.err(Status.ERR_ConflictAlreadyExists,
+ context.error(trans,resp,Result.err(Status.ERR_ConflictAlreadyExists,
ip + " is already being denied"));
}
} else {
trans.audit().log(trans.user(),"has attempted to deny",ip,"without authorization");
- context.error(trans,resp,Result.err(Status.ERR_Denied,
+ context.error(trans,resp,Result.err(Status.ERR_Denied,
trans.getUserPrincipal().getName() + " is not allowed to set IP Denial"));
}
}
});
-
+
/**
* Stop Denying an IP
*/
@@ -164,19 +164,19 @@ public class API_Mgmt {
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.OK_200);
} else {
- context.error(trans,resp,Result.err(Status.ERR_NotFound,
+ context.error(trans,resp,Result.err(Status.ERR_NotFound,
ip + " is not on the denial list"));
}
} else {
trans.audit().log(trans.user(),"has attempted to remove",ip," from being denied without authorization");
- context.error(trans,resp,Result.err(Status.ERR_Denied,
+ context.error(trans,resp,Result.err(Status.ERR_Denied,
trans.getUserPrincipal().getName() + " is not allowed to remove IP Denial"));
}
}
});
/**
- * Deny an ID
+ * Deny an ID
*/
authzAPI.route(POST, "/mgmt/deny/id/:id", API.VOID, new Code(facade,"Deny ID",true) {
@Override
@@ -188,17 +188,17 @@ public class API_Mgmt {
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.CREATED_201);
} else {
- context.error(trans,resp,Result.err(Status.ERR_ConflictAlreadyExists,
+ context.error(trans,resp,Result.err(Status.ERR_ConflictAlreadyExists,
id + " is already being denied"));
}
} else {
trans.audit().log(trans.user(),"has attempted to deny",id,"without authorization");
- context.error(trans,resp,Result.err(Status.ERR_Denied,
+ context.error(trans,resp,Result.err(Status.ERR_Denied,
trans.getUserPrincipal().getName() + " is not allowed to set ID Denial"));
}
}
});
-
+
/**
* Stop Denying an ID
*/
@@ -212,19 +212,19 @@ public class API_Mgmt {
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.OK_200);
} else {
- context.error(trans,resp,Result.err(Status.ERR_NotFound,
+ context.error(trans,resp,Result.err(Status.ERR_NotFound,
id + " is not on the denial list"));
}
} else {
trans.audit().log(trans.user(),"has attempted to remove",id," from being denied without authorization");
- context.error(trans,resp,Result.err(Status.ERR_Denied,
+ context.error(trans,resp,Result.err(Status.ERR_Denied,
trans.getUserPrincipal().getName() + " is not allowed to remove ID Denial"));
}
}
});
/**
- * Deny an ID
+ * Deny an ID
*/
authzAPI.route(POST, "/mgmt/log/id/:id", API.VOID, new Code(facade,"Special Log ID",true) {
@Override
@@ -236,17 +236,17 @@ public class API_Mgmt {
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.CREATED_201);
} else {
- context.error(trans,resp,Result.err(Status.ERR_ConflictAlreadyExists,
+ context.error(trans,resp,Result.err(Status.ERR_ConflictAlreadyExists,
id + " is already being special Logged"));
}
} else {
trans.audit().log(trans.user(),"has attempted to special Log",id,"without authorization");
- context.error(trans,resp,Result.err(Status.ERR_Denied,
+ context.error(trans,resp,Result.err(Status.ERR_Denied,
trans.getUserPrincipal().getName() + " is not allowed to set ID special Logging"));
}
}
});
-
+
/**
* Stop Denying an ID
*/
@@ -260,12 +260,12 @@ public class API_Mgmt {
trans.checkpoint(SUCCESS,Trans.ALWAYS);
resp.setStatus(HttpStatus.OK_200);
} else {
- context.error(trans,resp,Result.err(Status.ERR_NotFound,
+ context.error(trans,resp,Result.err(Status.ERR_NotFound,
id + " is not on the special Logging list"));
}
} else {
trans.audit().log(trans.user(),"has attempted to remove",id," from being special Logged without authorization");
- context.error(trans,resp,Result.err(Status.ERR_Denied,
+ context.error(trans,resp,Result.err(Status.ERR_Denied,
trans.getUserPrincipal().getName() + " is not allowed to remove ID special Logging"));
}
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Multi.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Multi.java
index 45bc9d0f..0f73a03a 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Multi.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Multi.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,20 +39,20 @@ import org.onap.aaf.auth.service.mapper.Mapper.API;
public class API_Multi {
public static void init(AAF_Service authzAPI, AuthzFacade facade) throws Exception {
-
+
authzAPI.route(POST,"/authz/multi",API.VOID, new Code(facade,"Multiple Request API",true) {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.addResponsibilityForNS(trans, resp, pathParam(req,":ns"), pathParam(req,":id"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ resp.setStatus(HttpStatus.CREATED_201);
break;
case Status.ACC_Future:
- resp.setStatus(HttpStatus.ACCEPTED_202);
+ resp.setStatus(HttpStatus.ACCEPTED_202);
break;
default:
context.error(trans,resp,r);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_NS.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_NS.java
index b06e3651..420beed5 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_NS.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_NS.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,24 +47,24 @@ public class API_NS {
public static void init(AAF_Service authzAPI, AuthzFacade facade) throws Exception {
/**
* puts a new Namespace in Authz DB
- *
+ *
* TESTCASES: TC_NS1, TC_NSdelete1
*/
authzAPI.route(POST,"/authz/ns",API.NS_REQ, new Code(facade,"Create a Namespace",true) {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
NsType nst = NsType.fromString(req.getParameter("type"));
Result<Void> r = context.requestNS(trans, req, resp,nst);
-
+
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ resp.setStatus(HttpStatus.CREATED_201);
break;
case Status.ACC_Future:
- resp.setStatus(HttpStatus.ACCEPTED_202);
+ resp.setStatus(HttpStatus.ACCEPTED_202);
break;
default:
context.error(trans,resp,r);
@@ -72,22 +72,22 @@ public class API_NS {
}
}
);
-
+
/**
* removes a Namespace from Authz DB
- *
+ *
* TESTCASES: TC_NS1, TC_NSdelete1
*/
authzAPI.route(DELETE,"/authz/ns/:ns",API.VOID, new Code(facade,"Delete a Namespace",true) {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.deleteNS(trans, req, resp, pathParam(req,":ns"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -98,22 +98,22 @@ public class API_NS {
/**
* Add an Admin in NS in Authz DB
- *
+ *
* TESTCASES: TC_NS1
*/
authzAPI.route(POST,"/authz/ns/:ns/admin/:id",API.VOID, new Code(facade,"Add an Admin to a Namespace",true) {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.addAdminToNS(trans, resp, pathParam(req,":ns"), pathParam(req,":id"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ resp.setStatus(HttpStatus.CREATED_201);
break;
case Status.ACC_Future:
- resp.setStatus(HttpStatus.ACCEPTED_202);
+ resp.setStatus(HttpStatus.ACCEPTED_202);
break;
default:
context.error(trans,resp,r);
@@ -121,22 +121,22 @@ public class API_NS {
}
}
);
-
+
/**
* Removes an Admin from Namespace in Authz DB
- *
+ *
* TESTCASES: TC_NS1
*/
authzAPI.route(DELETE,"/authz/ns/:ns/admin/:id",API.VOID, new Code(facade,"Remove an Admin from a Namespace",true) {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.delAdminFromNS(trans, resp, pathParam(req,":ns"), pathParam(req,":id"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -147,22 +147,22 @@ public class API_NS {
/**
* Add an Admin in NS in Authz DB
- *
+ *
* TESTCASES: TC_NS1
*/
authzAPI.route(POST,"/authz/ns/:ns/responsible/:id",API.VOID, new Code(facade,"Add a Responsible Identity to a Namespace",true) {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.addResponsibilityForNS(trans, resp, pathParam(req,":ns"), pathParam(req,":id"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ resp.setStatus(HttpStatus.CREATED_201);
break;
case Status.ACC_Future:
- resp.setStatus(HttpStatus.ACCEPTED_202);
+ resp.setStatus(HttpStatus.ACCEPTED_202);
break;
default:
context.error(trans,resp,r);
@@ -173,39 +173,39 @@ public class API_NS {
/**
- *
+ *
*/
authzAPI.route(GET,"/authz/nss/:id",API.NSS, new Code(facade,"Return Information about Namespaces", true) {
@Override
public void handle(
- AuthzTrans trans,
- HttpServletRequest req,
+ AuthzTrans trans,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.getNSsByName(trans, resp, pathParam(req,":id"),TRUE.equals(req.getParameter(FULL)));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
}
- );
-
+ );
+
/**
* Get all Namespaces where user is an admin
*/
authzAPI.route(GET,"/authz/nss/admin/:user",API.NSS, new Code(facade,"Return Namespaces where User is an Admin", true) {
@Override
public void handle(
- AuthzTrans trans,
- HttpServletRequest req,
+ AuthzTrans trans,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.getNSsByAdmin(trans, resp, pathParam(req,":user"),TRUE.equals(req.getParameter(FULL)));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -213,20 +213,20 @@ public class API_NS {
}
}
);
-
+
/**
* Get all Namespaces where user is a responsible party
*/
authzAPI.route(GET,"/authz/nss/responsible/:user",API.NSS, new Code(facade,"Return Namespaces where User is Responsible", true) {
@Override
public void handle(
- AuthzTrans trans,
- HttpServletRequest req,
+ AuthzTrans trans,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.getNSsByResponsible(trans, resp, pathParam(req,":user"),TRUE.equals(req.getParameter(FULL)));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -241,13 +241,13 @@ public class API_NS {
authzAPI.route(GET,"/authz/nss/either/:user",API.NSS, new Code(facade,"Return Namespaces where User Admin or Owner", true) {
@Override
public void handle(
- AuthzTrans trans,
- HttpServletRequest req,
+ AuthzTrans trans,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.getNSsByEither(trans, resp, pathParam(req,":user"),TRUE.equals(req.getParameter(FULL)));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -262,13 +262,13 @@ public class API_NS {
authzAPI.route(GET,"/authz/nss/children/:id",API.NSS, new Code(facade,"Return Child Namespaces", true) {
@Override
public void handle(
- AuthzTrans trans,
- HttpServletRequest req,
+ AuthzTrans trans,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.getNSsChildren(trans, resp, pathParam(req,":id"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -283,36 +283,36 @@ public class API_NS {
authzAPI.route(PUT,"/authz/ns",API.NS_REQ,new Code(facade,"Set a Description for a Namespace",true) {
@Override
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.updateNsDescription(trans, req, resp);
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
- });
-
+ });
+
/**
* Removes an Owner from Namespace in Authz DB
- *
+ *
* TESTCASES: TC_NS1
*/
authzAPI.route(DELETE,"/authz/ns/:ns/responsible/:id",API.VOID, new Code(facade,"Remove a Responsible Identity from Namespace",true) {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.delResponsibilityForNS(trans, resp, pathParam(req,":ns"), pathParam(req,":id"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -324,13 +324,13 @@ public class API_NS {
authzAPI.route(POST,"/authz/ns/:ns/attrib/:key/:value",API.VOID, new Code(facade,"Add an Attribute from a Namespace",true) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
- Result<Void> r = context.createAttribForNS(trans, resp,
- pathParam(req,":ns"),
+ Result<Void> r = context.createAttribForNS(trans, resp,
+ pathParam(req,":ns"),
pathParam(req,":key"),
pathParam(req,":value"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ resp.setStatus(HttpStatus.CREATED_201);
break;
default:
context.error(trans,resp,r);
@@ -345,7 +345,7 @@ public class API_NS {
Result<Void> r = context.readNsByAttrib(trans, resp, pathParam(req,":key"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -357,13 +357,13 @@ public class API_NS {
authzAPI.route(PUT,"/authz/ns/:ns/attrib/:key/:value",API.VOID, new Code(facade,"update an Attribute from a Namespace",true) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
- Result<Void> r = context.updAttribForNS(trans, resp,
- pathParam(req,":ns"),
+ Result<Void> r = context.updAttribForNS(trans, resp,
+ pathParam(req,":ns"),
pathParam(req,":key"),
pathParam(req,":value"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -371,16 +371,16 @@ public class API_NS {
}
}
);
-
+
authzAPI.route(DELETE,"/authz/ns/:ns/attrib/:key",API.VOID, new Code(facade,"delete an Attribute from a Namespace",true) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
- Result<Void> r = context.delAttribForNS(trans, resp,
- pathParam(req,":ns"),
+ Result<Void> r = context.delAttribForNS(trans, resp,
+ pathParam(req,":ns"),
pathParam(req,":key"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -390,6 +390,6 @@ public class API_NS {
);
}
-
-
+
+
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java
index 04654d47..d65304ca 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Perms.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,15 +44,15 @@ import org.onap.aaf.misc.env.util.Split;
public class API_Perms {
public static void timeSensitiveInit(AAF_Service authzAPI, AuthzFacade facade) throws Exception {
- /**
+ /**
* gets all permissions by user name
*/
authzAPI.route(GET, "/authz/perms/user/:user", API.PERMS, new Code(facade,"Get Permissions by User",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
String scopes = req.getParameter("scopes");
Result<Void> r;
if (scopes==null) {
@@ -61,8 +61,8 @@ public class API_Perms {
r = context.getPermsByUserScope(trans, resp, pathParam(req, "user"),Split.split(':', scopes));
}
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -70,20 +70,20 @@ public class API_Perms {
}
});
-
- /**
+
+ /**
* gets all permissions by user name
*/
authzAPI.route(POST, "/authz/perms/user/:user", API.PERMS, new Code(facade,"Get Permissions by User, Query AAF Perms",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getPermsByUserWithAAFQuery(trans, req, resp, pathParam(req, "user"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -101,14 +101,14 @@ public class API_Perms {
*/
authzAPI.route(POST,"/authz/perm",API.PERM_REQ,new Code(facade,"Create a Permission",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.createPerm(trans, req, resp);
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ case OK:
+ resp.setStatus(HttpStatus.CREATED_201);
break;
default:
context.error(trans,resp,r);
@@ -116,22 +116,22 @@ public class API_Perms {
}
});
- /**
+ /**
* get details of Permission
*/
authzAPI.route(GET, "/authz/perms/:type/:instance/:action", API.PERMS, new Code(facade,"Get Permissions by Key",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
- Result<Void> r = context.getPermsByName(trans, resp,
+
+ Result<Void> r = context.getPermsByName(trans, resp,
pathParam(req, "type"),
URLDecoder.decode(pathParam(req, "instance"),Config.UTF_8),
pathParam(req, "action"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -139,20 +139,20 @@ public class API_Perms {
}
});
-
- /**
+
+ /**
* get children of Permission
*/
authzAPI.route(GET, "/authz/perms/:type", API.PERMS, new Code(facade,"Get Permissions by Type",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getPermsByType(trans, resp, pathParam(req, "type"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -161,20 +161,20 @@ public class API_Perms {
});
-
+
/**
* gets all permissions by role name
*/
authzAPI.route(GET,"/authz/perms/role/:role",API.PERMS,new Code(facade,"Get Permissions by Role",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getPermsForRole(trans, resp, pathParam(req, "role"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -187,78 +187,78 @@ public class API_Perms {
*/
authzAPI.route(GET,"/authz/perms/ns/:ns",API.PERMS,new Code(facade,"Get PermsByNS",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getPermsByNS(trans, resp, pathParam(req, "ns"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
});
-
+
/**
* Set a perm's description
*/
authzAPI.route(PUT,"/authz/perm",API.PERM_REQ,new Code(facade,"Set Description for Permission",true) {
@Override
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.updatePermDescription(trans, req, resp);
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
- });
-
+ });
+
/**
* Update a permission with a rename
*/
authzAPI.route(PUT,"/authz/perm/:type/:instance/:action",API.PERM_REQ,new Code(facade,"Update a Permission",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
- Result<Void> r = context.renamePerm(trans, req, resp,
- pathParam(req, "type"),
- URLDecoder.decode(pathParam(req, "instance"),Config.UTF_8),
+
+ Result<Void> r = context.renamePerm(trans, req, resp,
+ pathParam(req, "type"),
+ URLDecoder.decode(pathParam(req, "instance"),Config.UTF_8),
pathParam(req, "action"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
- });
-
+ });
+
/**
* Delete a Permission
*/
authzAPI.route(DELETE,"/authz/perm",API.PERM_REQ,new Code(facade,"Delete a Permission",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.deletePerm(trans,req, resp);
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -266,25 +266,25 @@ public class API_Perms {
}
});
-
-
+
+
/**
* Delete a Permission
*/
authzAPI.route(DELETE,"/authz/perm/:name/:type/:action",API.PERM_KEY,new Code(facade,"Delete a Permission",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.deletePerm(trans, resp,
pathParam(req, ":name"),
pathParam(req, ":type"),
pathParam(req, ":action"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Roles.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Roles.java
index 6088dd36..038e6fb8 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Roles.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_Roles.java
@@ -7,9 +7,9 @@
* 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.
@@ -51,16 +51,16 @@ public class API_Roles {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.createRole(trans, req, resp);
-
+
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ resp.setStatus(HttpStatus.CREATED_201);
break;
case Status.ACC_Future:
- resp.setStatus(HttpStatus.ACCEPTED_202);
+ resp.setStatus(HttpStatus.ACCEPTED_202);
break;
default:
context.error(trans,resp,r);
@@ -69,19 +69,19 @@ public class API_Roles {
}
);
- /**
+ /**
* get Role by name
*/
authzAPI.route(GET, "/authz/roles/:role", API.ROLES, new Code(facade,"GetRolesByFullName",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getRolesByName(trans, resp, pathParam(req, "role"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -91,19 +91,19 @@ public class API_Roles {
});
- /**
+ /**
* gets all Roles by user name
*/
authzAPI.route(GET, "/authz/roles/user/:name", API.ROLES, new Code(facade,"GetRolesByUser",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getRolesByUser(trans, resp, pathParam(req, "name"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -112,19 +112,19 @@ public class API_Roles {
});
- /**
+ /**
* gets all Roles by Namespace
*/
authzAPI.route(GET, "/authz/roles/ns/:ns", API.ROLES, new Code(facade,"GetRolesByNS",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.getRolesByNS(trans, resp, pathParam(req, "ns"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -132,25 +132,25 @@ public class API_Roles {
}
});
- /**
+ /**
* gets all Roles by Name without the Namespace
*/
authzAPI.route(GET, "/authz/roles/name/:name", API.ROLES, new Code(facade,"GetRolesByNameOnly",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.getRolesByNameOnly(trans, resp, pathParam(req, ":name"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
});
-
+
/**
* Deletes a Role from Authz DB by Object
*/
@@ -158,24 +158,24 @@ public class API_Roles {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.deleteRole(trans, req, resp);
-
+
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
-
+
}
);
-
-
+
+
/**
* Deletes a Role from Authz DB by Key
*/
@@ -183,22 +183,22 @@ public class API_Roles {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.deleteRole(trans, resp, pathParam(req,":role"));
-
+
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
-
+
}
);
-
+
/**
* Add a Permission to a Role (Grant)
@@ -207,14 +207,14 @@ public class API_Roles {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.addPermToRole(trans, req, resp);
-
+
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ resp.setStatus(HttpStatus.CREATED_201);
break;
default:
context.error(trans,resp,r);
@@ -222,72 +222,72 @@ public class API_Roles {
}
}
);
-
+
/**
* Get all Roles by Permission
*/
authzAPI.route(GET,"/authz/roles/perm/:type/:instance/:action",API.ROLES,new Code(facade,"GetRolesByPerm",true) {
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
- Result<Void> r = context.getRolesByPerm(trans, resp,
+
+ Result<Void> r = context.getRolesByPerm(trans, resp,
pathParam(req, "type"),
URLDecoder.decode(pathParam(req, "instance"),Config.UTF_8),
pathParam(req, "action"));
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
});
-
+
/**
* Set a role's description
*/
authzAPI.route(PUT,"/authz/role",API.ROLE_REQ,new Code(facade,"Set Description for role",true) {
@Override
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.updateRoleDescription(trans, req, resp);
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
- });
-
+ });
+
/**
* Set a permission's roles to roles given
*/
authzAPI.route(PUT,"/authz/role/perm",API.ROLE_PERM_REQ,new Code(facade,"Set a Permission's Roles",true) {
@Override
public void handle(
- AuthzTrans trans,
+ AuthzTrans trans,
HttpServletRequest req,
HttpServletResponse resp) throws Exception {
-
+
Result<Void> r = context.resetPermRoles(trans, req, resp);
switch(r.status) {
- case OK:
- resp.setStatus(HttpStatus.OK_200);
+ case OK:
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
- });
-
+ });
+
/**
* Delete a Permission from a Role
* With multiple perms
@@ -296,13 +296,13 @@ public class API_Roles {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
Result<Void> r = context.delPermFromRole(trans, req, resp);
-
+
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -318,17 +318,17 @@ public class API_Roles {
@Override
public void handle(
AuthzTrans trans,
- HttpServletRequest req,
+ HttpServletRequest req,
HttpServletResponse resp) throws Exception {
- Result<Void> r = context.delPermFromRole(trans, resp,
+ Result<Void> r = context.delPermFromRole(trans, resp,
pathParam(req,":role"),
pathParam(req,":type"),
pathParam(req,":instance"),
pathParam(req,":action"));
-
+
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_User.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_User.java
index d5ce00c3..526766eb 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_User.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_User.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,7 +46,7 @@ import org.onap.aaf.cadi.config.Config;
public class API_User {
/**
* Normal Init level APIs
- *
+ *
* @param authzAPI
* @param facade
* @throws Exception
@@ -58,8 +58,8 @@ public class API_User {
authzAPI.route(GET,"/authz/users/perm/:type/:instance/:action",API.USERS,new Code(facade,"Get Users By Permission", true) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
-// trans.checkpoint(pathParam(req,"type") + " "
-// + pathParam(req,"instance") + " "
+// trans.checkpoint(pathParam(req,"type") + " "
+// + pathParam(req,"instance") + " "
// + pathParam(req,"action"));
//
Result<Void> r = context.getUsersByPermission(trans, resp,
@@ -68,7 +68,7 @@ public class API_User {
pathParam(req, ":action"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -86,14 +86,14 @@ public class API_User {
Result<Void> r = context.getUsersByRole(trans, resp, pathParam(req, ":role"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
});
-
+
/**
* Get User Role if exists
* @deprecated
@@ -104,7 +104,7 @@ public class API_User {
Result<Void> r = context.getUserInRole(trans, resp, pathParam(req,":user"),pathParam(req,":role"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -121,16 +121,16 @@ public class API_User {
Result<Void> r = context.getUserInRole(trans, resp, pathParam(req,":user"),pathParam(req,":role"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
});
-
+
}
-
+
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_UserRole.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_UserRole.java
index 15d2302f..f4bea1d9 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_UserRole.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_UserRole.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,7 +46,7 @@ import org.onap.aaf.auth.service.mapper.Mapper.API;
public class API_UserRole {
/**
* Normal Init level APIs
- *
+ *
* @param authzAPI
* @param facade
* @throws Exception
@@ -61,15 +61,15 @@ public class API_UserRole {
Result<Void> r = context.requestUserRole(trans, req, resp);
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.CREATED_201);
+ resp.setStatus(HttpStatus.CREATED_201);
break;
default:
context.error(trans,resp,r);
}
}
});
-
-
+
+
/**
* Get UserRoles by Role
*/
@@ -79,14 +79,14 @@ public class API_UserRole {
Result<Void> r = context.getUserRolesByRole(trans, resp, pathParam(req,":role"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
}
});
-
+
/**
* Get UserRoles by User
*/
@@ -96,7 +96,7 @@ public class API_UserRole {
Result<Void> r = context.getUserRolesByUser(trans, resp, pathParam(req,":user"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
@@ -117,8 +117,8 @@ public class API_UserRole {
context.error(trans,resp,removeAPI);
}
});
-
-
+
+
/**
* Update users attached to role in path
*/
@@ -132,8 +132,8 @@ public class API_UserRole {
/*
* END REMOVE Dangerous API
*/
-
-
+
+
/**
* Extend Expiration Date (according to Organizational rules)
*/
@@ -143,17 +143,17 @@ public class API_UserRole {
Result<Void> r = context.extendUserRoleExpiration(trans,resp,pathParam(req,":user"),pathParam(req,":role"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
}
-
+
}
-
+
});
-
-
+
+
/**
* Create a new ID/Credential
*/
@@ -163,7 +163,7 @@ public class API_UserRole {
Result<Void> r = context.deleteUserRole(trans, resp, pathParam(req,":user"),pathParam(req,":role"));
switch(r.status) {
case OK:
- resp.setStatus(HttpStatus.OK_200);
+ resp.setStatus(HttpStatus.OK_200);
break;
default:
context.error(trans,resp,r);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade.java
index f9ea39d6..4630ba81 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,12 +35,12 @@ import org.onap.aaf.auth.rserv.RServlet;
* AuthzFacade
* This layer is responsible for covering the Incoming Messages, be they XML, JSON or just entries on the URL,
* and converting them to data that can be called on the Service Layer.
- *
+ *
* Upon response, this layer, because it knew the incoming Data Formats (i.e. XML/JSON), the HTTP call types
* are set on "ContentType" on Response.
- *
+ *
* Finally, we wrap the call in Time Stamps with explanation of what is happing for Audit trails.
- *
+ *
* @author Jonathan
*
*/
@@ -52,13 +52,13 @@ public interface AuthzFacade {
* Namespaces
*/
public abstract Result<Void> requestNS(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, NsType type);
-
+
public abstract Result<Void> getNSsByName(AuthzTrans trans, HttpServletResponse resp, String ns, boolean full);
-
+
public abstract Result<Void> getNSsByAdmin(AuthzTrans trans, HttpServletResponse resp, String user, boolean full);
-
+
public abstract Result<Void> getNSsByResponsible(AuthzTrans trans, HttpServletResponse resp, String user, boolean full);
-
+
public abstract Result<Void> getNSsByEither(AuthzTrans trans, HttpServletResponse resp, String user, boolean full);
public abstract Result<Void> getNSsChildren(AuthzTrans trans, HttpServletResponse resp, String pathParam);
@@ -70,7 +70,7 @@ public interface AuthzFacade {
public abstract Result<Void> addResponsibilityForNS(AuthzTrans trans, HttpServletResponse resp, String ns, String id);
public abstract Result<Void> delResponsibilityForNS(AuthzTrans trans, HttpServletResponse resp, String ns, String id);
-
+
public abstract Result<Void> updateNsDescription(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
public abstract Result<Void> deleteNS(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, String ns);
@@ -87,40 +87,40 @@ public interface AuthzFacade {
/*
* Permissions
*/
- public abstract Result<Void> createPerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
- public abstract Result<Void> getPermsByName(AuthzTrans trans, HttpServletResponse resp,
+ public abstract Result<Void> createPerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
+
+ public abstract Result<Void> getPermsByName(AuthzTrans trans, HttpServletResponse resp,
String type, String instance, String action);
public abstract Result<Void> getPermsByUser(AuthzTrans trans, HttpServletResponse response, String user);
public abstract Result<Void> getPermsByUserScope(AuthzTrans trans, HttpServletResponse resp, String user, String[] scopes);
-
+
public abstract Result<Void> getPermsByUserWithAAFQuery(AuthzTrans trans, HttpServletRequest request, HttpServletResponse response, String user);
-
+
public abstract Result<Void> getPermsByType(AuthzTrans trans, HttpServletResponse resp, String type);
public abstract Result<Void> getPermsForRole(AuthzTrans trans, HttpServletResponse response, String roleName);
public abstract Result<Void> getPermsByNS(AuthzTrans trans, HttpServletResponse response, String ns);
-
+
public abstract Result<Void> renamePerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp,
String type, String instance, String action);
-
+
public abstract Result<Void> updatePermDescription(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
+
public abstract Result<Void> resetPermRoles(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
public abstract Result<Void> deletePerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
- public abstract Result<Void> deletePerm(AuthzTrans trans, HttpServletResponse resp,
+ public abstract Result<Void> deletePerm(AuthzTrans trans, HttpServletResponse resp,
String perm, String type, String action);
/*
* Roles
*/
public abstract Result<Void> createRole(AuthzTrans trans, HttpServletRequest req, HttpServletResponse response);
-
+
public abstract Result<Void> getRolesByName(AuthzTrans trans,HttpServletResponse resp, String name);
public abstract Result<Void> getRolesByNS(AuthzTrans trans, HttpServletResponse resp, String ns);
@@ -132,12 +132,12 @@ public interface AuthzFacade {
public abstract Result<Void> getRolesByPerm(AuthzTrans trans, HttpServletResponse resp, String type, String instance, String action);
public abstract Result<Void> updateRoleDescription(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
+
public abstract Result<Void> addPermToRole(AuthzTrans trans,HttpServletRequest req, HttpServletResponse resp);
-
+
public abstract Result<Void> delPermFromRole(AuthzTrans trans,HttpServletRequest req, HttpServletResponse resp);
- public abstract Result<Void> delPermFromRole(AuthzTrans trans, HttpServletResponse resp,
+ public abstract Result<Void> delPermFromRole(AuthzTrans trans, HttpServletResponse resp,
String role, String type, String instance, String action);
public abstract Result<Void> deleteRole(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
@@ -147,10 +147,10 @@ public interface AuthzFacade {
/*
* Users
*/
-
+
public abstract Result<Void> getUsersByRole(AuthzTrans trans, HttpServletResponse resp, String role);
-
- public abstract Result<Void> getUsersByPermission(AuthzTrans trans, HttpServletResponse resp,
+
+ public abstract Result<Void> getUsersByPermission(AuthzTrans trans, HttpServletResponse resp,
String type, String instance, String action);
@@ -159,13 +159,13 @@ public interface AuthzFacade {
* Delegates
*/
public abstract Result<Void> createDelegate(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
+
public abstract Result<Void> updateDelegate(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
+
public abstract Result<Void> deleteDelegate(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
+
public abstract Result<Void> deleteDelegate(AuthzTrans trans, String user);
-
+
public abstract Result<Void> getDelegatesByUser(AuthzTrans trans, String userName, HttpServletResponse resp);
public abstract Result<Void> getDelegatesByDelegate(AuthzTrans trans, String userName, HttpServletResponse resp);
@@ -202,11 +202,11 @@ public interface AuthzFacade {
* UserRole
*/
public abstract Result<Void> requestUserRole(AuthzTrans trans,HttpServletRequest req, HttpServletResponse resp);
-
+
public abstract Result<Void> getUserInRole(AuthzTrans trans, HttpServletResponse resp, String user, String role);
-
+
public abstract Result<Void> getUserRolesByRole(AuthzTrans trans, HttpServletResponse resp, String role);
-
+
public abstract Result<Void> getUserRolesByUser(AuthzTrans trans, HttpServletResponse resp, String user);
public abstract Result<Void> deleteUserRole(AuthzTrans trans, HttpServletResponse resp, String user, String role);
@@ -214,19 +214,19 @@ public interface AuthzFacade {
/*
* resetUsersForRoles and resetRolesForUsers is too dangerous and not helpful.
*/
-
+
public abstract Result<Void> extendUserRoleExpiration(AuthzTrans trans, HttpServletResponse resp, String user,
String role);
/*
- * Approval
+ * Approval
*/
public abstract Result<Void> updateApproval(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
-
+
public abstract Result<Void> getApprovalsByUser(AuthzTrans trans, HttpServletResponse resp, String user);
-
+
public abstract Result<Void> getApprovalsByTicket(AuthzTrans trans, HttpServletResponse resp, String ticket);
-
+
public abstract Result<Void> getApprovalsByApprover(AuthzTrans trans, HttpServletResponse resp, String approver);
@@ -234,7 +234,7 @@ public interface AuthzFacade {
* History
*/
public abstract Result<Void> getHistoryByUser(AuthzTrans trans, HttpServletResponse resp, String user, int[] yyyymm, final int sort);
-
+
public abstract Result<Void> getHistoryByRole(AuthzTrans trans, HttpServletResponse resp, String role, int[] yyyymm, final int sort);
public abstract Result<Void> getHistoryByPerm(AuthzTrans trans, HttpServletResponse resp, String perm, int[] yyyymm, final int sort);
@@ -244,12 +244,12 @@ public interface AuthzFacade {
public abstract Result<Void> getHistoryBySubject(AuthzTrans trans, HttpServletResponse resp, String type, String subject, int[] yyyymm, int sort);
/*
- * Cache
+ * Cache
*/
public abstract Result<Void> cacheClear(AuthzTrans trans, String pathParam);
public abstract Result<Void> cacheClear(AuthzTrans trans, String string,String segments);
-
+
public abstract void dbReset(AuthzTrans trans);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeFactory.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeFactory.java
index 1d7f31e5..0554a025 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeFactory.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,6 +50,6 @@ public class AuthzFacadeFactory {
(trans,new Mapper_2_0(question),question),
type);
}
-
+
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java
index 10138d2c..60b76ea2 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacadeImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -80,7 +80,7 @@ import aaf.v2_0.Api;
/**
* AuthzFacade
- *
+ *
* This Service Facade encapsulates the essence of the API Service can do, and provides
* a single created object for elements such as RosettaDF.
*
@@ -91,14 +91,14 @@ import aaf.v2_0.Api;
* a) In the future, we may support multiple Response Formats, aka JSON or XML, based on User Request.
* 4) Log Service info, warnings and exceptions as necessary
* 5) When asked by the API layer, this will create and write Error content to the OutputStream
- *
- * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
+ *
+ * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
* clearly coordinated with the API Documentation
- *
+ *
* @author Pavani & Jonathan
*
*/
-public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> extends FacadeImpl implements AuthzFacade
+public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> extends FacadeImpl implements AuthzFacade
{
private static final String FORBIDDEN = "Forbidden";
private static final String NOT_FOUND = "Not Found";
@@ -155,14 +155,14 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
(errDF = env.newDataFactory(service.mapper().getClass(API.ERROR))).in(dataType).out(dataType);
(apiDF = env.newDataFactory(Api.class)).in(dataType).out(dataType);
}
-
+
public Mapper<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> mapper() {
return service.mapper();
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#error(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, int)
- *
+ *
* Note: Conforms to AT&T TSS RESTful Error Structure
*/
@Override
@@ -186,7 +186,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
dlist.toArray(detail);
}
//int httpstatus;
-
+
switch(result.status) {
case ERR_ActionNotCompleted:
msgId = "SVC1202";
@@ -216,7 +216,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
detail[0] = msg;
response.setStatus(/*httpstatus=*/403);
break;
-
+
case ERR_NsNotFound:
msgId = "SVC2404";
detail[0] = NOT_FOUND;
@@ -263,25 +263,25 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
detail[0] = NOT_ACCEPTABLE;
response.setStatus(/*httpstatus=*/406);
break;
-
+
case ERR_ConflictAlreadyExists:
msgId = "SVC1409";
detail[0] = "Conflict Already Exists";
response.setStatus(/*httpstatus=*/409);
break;
-
+
case ERR_DependencyExists:
msgId = "SVC1424";
detail[0] = "Failed Dependency";
response.setStatus(/*httpstatus=*/424);
break;
-
+
case ERR_NotImplemented:
msgId = "SVC1501";
- detail[0] = "Not Implemented";
+ detail[0] = "Not Implemented";
response.setStatus(/*httpstatus=*/501);
break;
-
+
case Status.ACC_Future:
msgId = "SVC1202";
detail[0] = "Accepted for Future, pending Approvals";
@@ -292,14 +292,14 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
detail[0] = "Choice Needed";
response.setStatus(/*httpstatus=*/300);
break;
- case ERR_Backend:
+ case ERR_Backend:
msgId = "SVC2500";
detail[0] = GENERAL_SERVICE_ERROR;
response.setStatus(/*httpstatus=*/500);
hidemsg = true;
break;
- default:
+ default:
msgId = "SVC1500";
detail[0] = GENERAL_SERVICE_ERROR;
response.setStatus(/*httpstatus=*/500);
@@ -311,7 +311,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
StringBuilder holder = new StringBuilder();
ERR em = service.mapper().errorFromMessage(holder,msgId,msg,detail);
trans.checkpoint(
- "ErrResp [" +
+ "ErrResp [" +
msgId +
"] " +
holder.toString(),
@@ -325,7 +325,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
trans.error().log(e,"unable to send response for",msg);
}
}
-
+
///////////////////////////
// Namespace
///////////////////////////
@@ -341,7 +341,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public static final String GET_NS_CHILDREN = "getNamespaceChildren";
public static final String UPDATE_NS_DESC = "updateNamespaceDescription";
public static final String DELETE_NS = "deleteNamespace";
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#createNS(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
@@ -361,10 +361,10 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
trans.error().log("Invalid Input",IN,CREATE_NS);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
-
+
Result<Void> rp = service.createNS(trans,request,type);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,nsRequestDF.getOutType());
return Result.ok();
default:
@@ -387,7 +387,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<Void> rp = service.addAdminNS(trans,ns,id);
switch(rp.status) {
- case OK:
+ case OK:
//TODO Perms??
setContentType(resp,nsRequestDF.getOutType());
resp.getOutputStream().println();
@@ -412,7 +412,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<Void> rp = service.delAdminNS(trans, ns, id);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,nsRequestDF.getOutType());
return Result.ok();
default:
@@ -435,7 +435,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<Void> rp = service.addResponsibleNS(trans,ns,id);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,nsRequestDF.getOutType());
resp.getOutputStream().println();
return Result.ok();
@@ -459,7 +459,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<Void> rp = service.delResponsibleNS(trans, ns, id);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,nsRequestDF.getOutType());
resp.getOutputStream().println();
return Result.ok();
@@ -483,7 +483,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<NSS> rp = service.getNSbyName(trans, ns, full );
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -501,7 +501,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
// TODO: uncomment when on cassandra 2.1.2 for MyNamespace GUI page
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getNSsByAdmin(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String)
@@ -512,7 +512,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<NSS> rp = service.getNSbyAdmin(trans, user, full);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -530,7 +530,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
// TODO: uncomment when on cassandra 2.1.2 for MyNamespace GUI page
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getNSsByResponsible(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String)
@@ -541,7 +541,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<NSS> rp = service.getNSbyResponsible(trans, user, full);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -569,9 +569,9 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
TimeTaken tt = trans.start(GET_NS_BY_EITHER + ' ' + user, Env.SUB|Env.ALWAYS);
try {
Result<NSS> rp = service.getNSbyEither(trans, user, full);
-
+
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -600,7 +600,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<NSS> rp = service.getNSsChildren(trans, parent);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<NSS> data = nssDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -637,7 +637,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Void> rp = service.updateNsDescription(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,nsRequestDF.getOutType());
return Result.ok();
default:
@@ -650,7 +650,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
/*
* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#requestNS(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
@@ -661,7 +661,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<Void> rp = service.deleteNS(trans,ns);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,nsRequestDF.getOutType());
return Result.ok();
default:
@@ -679,7 +679,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private final static String NS_UPDATE_ATTRIB = "nsUpdateAttrib";
private final static String READ_NS_BY_ATTRIB = "readNsByAttrib";
private final static String NS_DELETE_ATTRIB = "nsDeleteAttrib";
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#createAttribForNS(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String, java.lang.String)
*/
@@ -689,7 +689,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<?> rp = service.createNsAttrib(trans,ns,key,value);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp, keysDF.getOutType());
resp.getOutputStream().println();
return Result.ok();
@@ -713,7 +713,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<KEYS> rp = service.readNsByAttrib(trans, key);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<KEYS> data = keysDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -741,7 +741,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<?> rp = service.updateNsAttrib(trans,ns,key,value);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp, keysDF.getOutType());
resp.getOutputStream().println();
return Result.ok();
@@ -766,7 +766,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<?> rp = service.deleteNsAttrib(trans,ns,key);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp, keysDF.getOutType());
resp.getOutputStream().println();
return Result.ok();
@@ -796,14 +796,14 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public static final String UPDATE_PERM_DESC = "updatePermissionDescription";
public static final String SET_PERMISSION_ROLES_TO = "setPermissionRolesTo";
public static final String DELETE_PERMISSION = "deletePermission";
-
+
/*
* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#createOrUpdatePerm(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public Result<Void> createPerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) {
- TimeTaken tt = trans.start( CREATE_PERMISSION, Env.SUB|Env.ALWAYS);
+ TimeTaken tt = trans.start( CREATE_PERMISSION, Env.SUB|Env.ALWAYS);
try {
REQUEST rreq;
try {
@@ -811,15 +811,15 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
- rreq = data.asObject();
+ rreq = data.asObject();
} catch (APIException e) {
trans.error().log("Invalid Input",IN,CREATE_PERMISSION);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
-
+
Result<Void> rp = service.createPerm(trans,rreq);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -832,7 +832,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getChildPerms(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String)
*/
@@ -840,7 +840,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> getPermsByType(AuthzTrans trans, HttpServletResponse resp, String perm) {
TimeTaken tt = trans.start(GET_PERMS_BY_TYPE + ' ' + perm, Env.SUB|Env.ALWAYS);
try {
-
+
Result<PERMS> rp = service.getPermsByType(trans, perm);
switch(rp.status) {
case OK:
@@ -862,15 +862,15 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
- public Result<Void> getPermsByName(AuthzTrans trans, HttpServletResponse resp,
+ public Result<Void> getPermsByName(AuthzTrans trans, HttpServletResponse resp,
String type, String instance, String action) {
-
+
TimeTaken tt = trans.start(GET_PERMS_BY_NAME + ' ' + type
+ '|' + instance + '|' + action, Env.SUB|Env.ALWAYS);
try {
-
+
Result<PERMS> rp = service.getPermsByName(trans, type, instance, action);
switch(rp.status) {
case OK:
@@ -902,7 +902,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<PERMS> rp = service.getPermsByUser(trans, user);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -921,7 +921,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getPermissionByUser(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String)
*/
@@ -931,7 +931,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<PERMS> rp = service.getPermsByUserScope(trans, user, scopes);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -952,7 +952,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getPermissionByUser(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String)
*/
@@ -966,7 +966,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
- perms = data.asObject();
+ perms = data.asObject();
} catch (APIException e) {
trans.error().log("Invalid Input",IN,GET_PERMISSIONS_BY_USER_WITH_QUERY);
return Result.err(Status.ERR_BadData,"Invalid Input");
@@ -974,7 +974,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<PERMS> rp = service.getPermsByUser(trans, perms, user);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<PERMS> data = permsDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -994,7 +994,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getPermissionsForRole(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String)
*/
@@ -1023,7 +1023,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
public Result<Void> getPermsByNS(AuthzTrans trans,HttpServletResponse resp,String ns) {
TimeTaken tt = trans.start(GET_PERMISSIONS_BY_NS + ' ' + ns, Env.SUB|Env.ALWAYS);
@@ -1058,7 +1058,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> renamePerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp,
String origType, String origInstance, String origAction) {
String cmdDescription = UPDATE_PERMISSION;
- TimeTaken tt = trans.start( cmdDescription + ' ' + origType + ' ' + origInstance + ' ' + origAction, Env.SUB|Env.ALWAYS);
+ TimeTaken tt = trans.start( cmdDescription + ' ' + origType + ' ' + origInstance + ' ' + origAction, Env.SUB|Env.ALWAYS);
try {
REQUEST rreq;
try {
@@ -1066,15 +1066,15 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
- rreq = data.asObject();
+ rreq = data.asObject();
} catch (APIException e) {
trans.error().log("Invalid Input",IN,cmdDescription);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
-
+
Result<Void> rp = service.renamePerm(trans,rreq, origType, origInstance, origAction);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -1087,7 +1087,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
public Result<Void> updatePermDescription(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) {
TimeTaken tt = trans.start(UPDATE_PERM_DESC, Env.SUB|Env.ALWAYS);
@@ -1106,7 +1106,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Void> rp = service.updatePermDescription(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permRequestDF.getOutType());
return Result.ok();
default:
@@ -1119,8 +1119,8 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
-
+
+
@Override
public Result<Void> resetPermRoles(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) {
TimeTaken tt = trans.start(SET_PERMISSION_ROLES_TO, Env.SUB|Env.ALWAYS);
@@ -1136,11 +1136,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
trans.error().log("Invalid Input",IN, SET_PERMISSION_ROLES_TO);
return Result.err(Status.ERR_BadData,"Invalid Input");
}
-
+
Result<Void> rp = service.resetPermRoles(trans, rreq);
-
+
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -1153,7 +1153,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
public Result<Void> deletePerm(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) {
TimeTaken tt = trans.start(DELETE_PERMISSION, Env.SUB|Env.ALWAYS);
@@ -1173,7 +1173,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<Void> rp = service.deletePerm(trans,rreq);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -1193,7 +1193,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<Void> rp = service.deletePerm(trans,type,instance,action);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -1213,7 +1213,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public static final String GET_ROLES_BY_NAME_ONLY = "getRolesByNameOnly";
public static final String GET_ROLES_BY_NAME = "getRolesByName";
public static final String GET_ROLES_BY_PERM = "getRolesByPerm";
- public static final String UPDATE_ROLE_DESC = "updateRoleDescription";
+ public static final String UPDATE_ROLE_DESC = "updateRoleDescription";
public static final String ADD_PERM_TO_ROLE = "addPermissionToRole";
public static final String DELETE_PERM_FROM_ROLE = "deletePermissionFromRole";
public static final String UPDATE_MGTPERM_ROLE = "updateMgtPermRole";
@@ -1238,7 +1238,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Void> rp = service.createRole(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,roleRequestDF.getOutType());
return Result.ok();
default:
@@ -1261,7 +1261,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<ROLES> rp = service.getRolesByName(trans, role);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -1290,7 +1290,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<ROLES> rp = service.getRolesByUser(trans, user);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -1319,7 +1319,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<ROLES> rp = service.getRolesByNS(trans, ns);
switch(rp.status) {
- case OK:
+ case OK:
if (!rp.isEmpty()) {
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
@@ -1353,7 +1353,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<ROLES> rp = service.getRolesByNameOnly(trans, nameOnly);
switch(rp.status) {
- case OK:
+ case OK:
if (!rp.isEmpty()) {
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
@@ -1386,7 +1386,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<ROLES> rp = service.getRolesByPerm(trans, type,instance,action);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<ROLES> data = roleDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -1428,7 +1428,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Void> rp = service.updateRoleDescription(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,roleRequestDF.getOutType());
return Result.ok();
default:
@@ -1460,7 +1460,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Void> rp = service.addPermToRole(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
resp.getOutputStream().println();
return Result.ok();
@@ -1493,7 +1493,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Void> rp = service.delPermFromRole(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
resp.getOutputStream().println();
return Result.ok();
@@ -1518,7 +1518,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<Void> rp = service.delPermFromRole(trans, role, type, instance, action);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
resp.getOutputStream().println();
return Result.ok();
@@ -1539,7 +1539,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<Void> rp = service.deleteRole(trans, role);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -1571,7 +1571,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
Result<Void> rp = service.deleteRole(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -1599,7 +1599,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
/**
* Create Credential
- *
+ *
*/
public Result<Void> createUserCred(AuthzTrans trans, HttpServletRequest req) {
TimeTaken tt = trans.start(CREATE_CRED, Env.SUB|Env.ALWAYS);
@@ -1668,11 +1668,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> getCredsByNS(AuthzTrans trans, HttpServletResponse resp, String ns) {
TimeTaken tt = trans.start(GET_CREDS_BY_NS + ' ' + ns, Env.SUB|Env.ALWAYS);
-
+
try {
Result<USERS> ru = service.getCredsByNS(trans,ns);
switch(ru.status) {
- case OK:
+ case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
if (Question.willSpecialLog(trans,trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -1689,21 +1689,21 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} finally {
tt.done();
}
-
+
}
-
-
+
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getCredsByID(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String)
*/
@Override
public Result<Void> getCredsByID(AuthzTrans trans, HttpServletResponse resp, String id) {
TimeTaken tt = trans.start(GET_CREDS_BY_ID + ' ' + id, Env.SUB|Env.ALWAYS);
-
+
try {
Result<USERS> ru = service.getCredsByID(trans,id);
switch(ru.status) {
- case OK:
+ case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -1720,7 +1720,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} finally {
tt.done();
}
-
+
}
@Override
@@ -1741,10 +1741,10 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(e);
} finally {
tt.done();
- }
+ }
}
-
-
+
+
@Override
public Result<Date> doesCredentialMatch(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) {
TimeTaken tt = trans.start(DOES_CRED_MATCH, Env.SUB|Env.ALWAYS);
@@ -1763,7 +1763,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
return Result.err(e);
} finally {
tt.done();
- }
+ }
}
@@ -1792,11 +1792,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
@Override
public Result<Void> getCertInfoByID(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp, String id) {
TimeTaken tt = trans.start(GET_CERT_BY_ID, Env.SUB|Env.ALWAYS);
- try {
+ try {
Result<CERTS> rci = service.getCertInfoByID(trans,req,id);
-
+
switch(rci.status) {
- case OK:
+ case OK:
if (Question.willSpecialLog(trans, trans.user())) {
RosettaData<CERTS> data = certsDF.newData(trans).load(rci.value);
Question.logEncryptTrace(trans,data.asString());
@@ -1822,11 +1822,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public static final String DELETE_DELEGATE = "deleteDelegate";
public static final String GET_DELEGATE_USER = "getDelegatesByUser";
public static final String GET_DELEGATE_DELG = "getDelegatesByDelegate";
-
+
@Override
public Result<Void> createDelegate(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) {
TimeTaken tt = trans.start(CREATE_DELEGATE, Env.SUB|Env.ALWAYS);
- try {
+ try {
Data<REQUEST> data = delgRequestDF.newData().load(req.getInputStream());
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -1840,11 +1840,11 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
public Result<Void> updateDelegate(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) {
TimeTaken tt = trans.start(UPDATE_DELEGATE, Env.SUB|Env.ALWAYS);
- try {
+ try {
Data<REQUEST> data = delgRequestDF.newData().load(req.getInputStream());
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -1858,7 +1858,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
public Result<Void> deleteDelegate(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) {
TimeTaken tt = trans.start(DELETE_DELEGATE, Env.SUB|Env.ALWAYS);
@@ -1876,7 +1876,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
public Result<Void> deleteDelegate(AuthzTrans trans, String userName) {
TimeTaken tt = trans.start(DELETE_DELEGATE + ' ' + userName, Env.SUB|Env.ALWAYS);
@@ -1889,15 +1889,15 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
public Result<Void> getDelegatesByUser(AuthzTrans trans, String user, HttpServletResponse resp) {
TimeTaken tt = trans.start(GET_DELEGATE_USER, Env.SUB|Env.ALWAYS);
try {
Result<DELGS> rd = service.getDelegatesByUser(trans, user);
-
+
switch(rd.status) {
- case OK:
+ case OK:
RosettaData<DELGS> data = delgDF.newData(trans).load(rd.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -1922,7 +1922,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<DELGS> rd = service.getDelegatesByDelegate(trans, delegate);
switch(rd.status) {
- case OK:
+ case OK:
RosettaData<DELGS> data = delgDF.newData(trans).load(rd.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -1964,10 +1964,10 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
} catch (APIException e) {
return Result.err(Status.ERR_BadData,"Invalid Input");
}
-
+
Result<Void> rp = service.createUserRole(trans,request);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -1980,14 +1980,14 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
public Result<Void> getUserInRole(AuthzTrans trans, HttpServletResponse resp, String user, String role) {
TimeTaken tt = trans.start(GET_USERROLES + ' ' + user + '|' + role, Env.SUB|Env.ALWAYS);
try {
Result<USERS> ru = service.getUserInRole(trans,user,role);
switch(ru.status) {
- case OK:
+ case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2015,7 +2015,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<USERROLES> ru = service.getUserRolesByUser(trans,user);
switch(ru.status) {
- case OK:
+ case OK:
RosettaData<USERROLES> data = userrolesDF.newData(trans).load(ru.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2036,14 +2036,14 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
-
+
@Override
public Result<Void> getUserRolesByRole(AuthzTrans trans, HttpServletResponse resp, String role) {
TimeTaken tt = trans.start(GET_USERROLES_BY_ROLE + ' ' + role, Env.SUB|Env.ALWAYS);
try {
Result<USERROLES> ru = service.getUserRolesByRole(trans,role);
switch(ru.status) {
- case OK:
+ case OK:
RosettaData<USERROLES> data = userrolesDF.newData(trans).load(ru.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2064,7 +2064,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#extendUserRoleExpiration(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String)
@@ -2088,7 +2088,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<Void> rp = service.deleteUserRole(trans,user,role);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -2106,7 +2106,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
private static final String GET_APPROVALS_BY_USER = "getApprovalsByUser.";
private static final String GET_APPROVALS_BY_TICKET = "getApprovalsByTicket.";
private static final String GET_APPROVALS_BY_APPROVER = "getApprovalsByApprover.";
-
+
@Override
public Result<Void> updateApproval(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) {
TimeTaken tt = trans.start(UPDATE_APPROVAL, Env.SUB|Env.ALWAYS);
@@ -2117,9 +2117,9 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
Result<Void> rp = service.updateApproval(trans, data.asObject());
-
+
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,approvalDF.getOutType());
return Result.ok();
default:
@@ -2132,20 +2132,20 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
@Override
public Result<Void> getApprovalsByUser(AuthzTrans trans, HttpServletResponse resp, String user) {
TimeTaken tt = trans.start(GET_APPROVALS_BY_USER + ' ' + user, Env.SUB|Env.ALWAYS);
try {
Result<APPROVALS> rp = service.getApprovalsByUser(trans, user);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<APPROVALS> data = approvalDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
}
data.to(resp.getOutputStream());
-
+
setContentType(resp,permsDF.getOutType());
return Result.ok();
default:
@@ -2165,7 +2165,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<APPROVALS> rp = service.getApprovalsByApprover(trans, approver);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<APPROVALS> data = approvalDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2191,7 +2191,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<APPROVALS> rp = service.getApprovalsByTicket(trans, ticket);
switch(rp.status) {
- case OK:
+ case OK:
RosettaData<APPROVALS> data = approvalDF.newData(trans).load(rp.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2212,7 +2212,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
-
+
public static final String GET_USERS_PERMISSION = "getUsersByPermission";
public static final String GET_USERS_ROLE = "getUsersByRole";
@@ -2225,7 +2225,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<USERS> ru = service.getUsersByRole(trans,role);
switch(ru.status) {
- case OK:
+ case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2249,13 +2249,13 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
* @see com.att.authz.facade.AuthzFacade#getUsersByPermission(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
- public Result<Void> getUsersByPermission(AuthzTrans trans, HttpServletResponse resp,
+ public Result<Void> getUsersByPermission(AuthzTrans trans, HttpServletResponse resp,
String type, String instance, String action) {
TimeTaken tt = trans.start(GET_USERS_PERMISSION + ' ' + type + ' ' + instance + ' ' +action, Env.SUB|Env.ALWAYS);
try {
Result<USERS> ru = service.getUsersByPermission(trans,type,instance,action);
switch(ru.status) {
- case OK:
+ case OK:
RosettaData<USERS> data = usersDF.newData(trans).load(ru.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2275,7 +2275,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
-
+
public static final String GET_HISTORY_USER = "getHistoryByUser";
public static final String GET_HISTORY_ROLE = "getHistoryByRole";
public static final String GET_HISTORY_PERM = "getHistoryByPerm";
@@ -2305,7 +2305,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<HISTORY> rh = service.getHistoryByUser(trans,user,yyyymm,sort);
switch(rh.status) {
- case OK:
+ case OK:
RosettaData<HISTORY> data = historyDF.newData(trans).load(rh.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2348,7 +2348,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<HISTORY> rh = service.getHistoryByRole(trans,role,yyyymm,sort);
switch(rh.status) {
- case OK:
+ case OK:
RosettaData<HISTORY> data = historyDF.newData(trans).load(rh.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2391,7 +2391,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<HISTORY> rh = service.getHistoryByNS(trans,ns,yyyymm,sort);
switch(rh.status) {
- case OK:
+ case OK:
RosettaData<HISTORY> data = historyDF.newData(trans).load(rh.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2434,7 +2434,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<HISTORY> rh = service.getHistoryByPerm(trans,perm,yyyymm,sort);
switch(rh.status) {
- case OK:
+ case OK:
RosettaData<HISTORY> data = historyDF.newData(trans).load(rh.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2478,7 +2478,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
try {
Result<HISTORY> rh = service.getHistoryBySubject(trans,subject,target,yyyymm,sort);
switch(rh.status) {
- case OK:
+ case OK:
RosettaData<HISTORY> data = historyDF.newData(trans).load(rh.value);
if (Question.willSpecialLog(trans, trans.user())) {
Question.logEncryptTrace(trans,data.asString());
@@ -2498,9 +2498,9 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
}
}
- public final static String CACHE_CLEAR = "cacheClear ";
+ public final static String CACHE_CLEAR = "cacheClear ";
// public final static String CACHE_VALIDATE = "validateCache";
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#cacheClear(org.onap.aaf.auth.env.test.AuthzTrans, java.lang.String)
*/
@@ -2601,7 +2601,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
tt.done();
}
}
-
+
public final static String API_EXAMPLE = "apiExample";
@@ -2612,7 +2612,7 @@ public abstract class AuthzFacadeImpl<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
public Result<Void> getAPIExample(AuthzTrans trans, HttpServletResponse resp, String nameOrContentType, boolean optional) {
TimeTaken tt = trans.start(API_EXAMPLE, Env.SUB);
try {
- String content =Examples.print(apiDF.getEnv(), nameOrContentType, optional);
+ String content =Examples.print(apiDF.getEnv(), nameOrContentType, optional);
resp.getOutputStream().print(content);
setContentType(resp,content.contains("<?xml")?TYPE.XML:TYPE.JSON);
return Result.ok();
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade_2_0.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade_2_0.java
index 0e67ac49..d5e1c305 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade_2_0.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/facade/AuthzFacade_2_0.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper.java
index c66525da..549e6ed8 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,7 +55,7 @@ public interface Mapper<
ERROR,
APPROVALS>
{
- enum API{NSS,NS_REQ,
+ enum API{NSS,NS_REQ,
PERMS,PERM_KEY,PERM_REQ,
ROLES,ROLE,ROLE_REQ,ROLE_PERM_REQ,
USERS,USER_ROLE_REQ,USER_ROLES,
@@ -83,12 +83,12 @@ public interface Mapper<
public Result<APPROVALS> approvals(List<ApprovalDAO.Data> lAppr);
public Result<List<ApprovalDAO.Data>> approvals(APPROVALS apprs);
public Result<List<PermDAO.Data>> perms(AuthzTrans trans, PERMS perms);
-
+
public Result<UserRoleDAO.Data> userRole(AuthzTrans trans, REQUEST from);
public Result<PermDAO.Data> permFromRPRequest(AuthzTrans trans, REQUEST from);
public REQUEST ungrantRequest(AuthzTrans trans, String role, String type, String instance, String action);
public Result<RoleDAO.Data> roleFromRPRequest(AuthzTrans trans, REQUEST from);
-
+
/*
* Check Requests of varying sorts for Future fields set
*/
@@ -108,9 +108,9 @@ public interface Mapper<
public Result<KEYS> keys(Collection<String> from);
public Result<HISTORY> history(AuthzTrans trans, List<HistoryDAO.Data> history, final int sort);
-
+
public ERROR errorFromMessage(StringBuilder holder, String msgID, String text, String... detail);
-
+
/*
* A Memo Creator... Use to avoid creating superfluous Strings until needed.
*/
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
index 26216c65..7abbcf6f 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
@@ -7,9 +7,9 @@
* 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.
@@ -103,7 +103,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
public Mapper_2_0(Question q) {
this.q = q;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.auth.service.mapper.Mapper#ns(java.lang.Object, org.onap.aaf.auth.service.mapper.Mapper.Holder)
*/
@@ -116,7 +116,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
namespace.owner = from.getResponsible();
namespace.description = from.getDescription();
trans.checkpoint(namespace.name, Env.ALWAYS);
-
+
NsType nt = NsType.fromString(from.getType());
if (nt.equals(NsType.UNKNOWN)) {
String ns = namespace.name;
@@ -133,7 +133,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
}
}
namespace.type = nt.type;
-
+
return Result.ok(namespace);
}
@@ -215,7 +215,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
} finally {
tt.done();
}
-
+
tt = trans.start("Sort Perms", Env.SUB);
try {
Collections.sort(perms, new Comparator<Perm>() {
@@ -230,14 +230,14 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
return instanceCompare;
}
return typeCompare;
- }
+ }
});
} finally {
tt.done();
}
return Result.ok(to);
}
-
+
@Override
public Result<Perms> perms(AuthzTrans trans, List<PermDAO.Data> from, Perms to, String[] nss, boolean filter) {
List<Perm> perms = to.getPerm();
@@ -268,7 +268,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
} finally {
tt.done();
}
-
+
tt = trans.start("Sort Perms", Env.SUB);
try {
Collections.sort(perms, new Comparator<Perm>() {
@@ -283,7 +283,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
return instanceCompare;
}
return typeCompare;
- }
+ }
});
} finally {
tt.done();
@@ -297,7 +297,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
for (Perm p : perms.getPerm()) {
Result<NsSplit> nss = q.deriveNsSplit(trans, p.getType());
PermDAO.Data pd = new PermDAO.Data();
- if (nss.isOK()) {
+ if (nss.isOK()) {
pd.ns=nss.value.ns;
pd.type = nss.value.name;
pd.instance = p.getInstance();
@@ -313,12 +313,12 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
return Result.ok(lpd);
}
-
+
@Override
public Result<PermDAO.Data> permkey(AuthzTrans trans, Pkey from) {
return q.permFrom(trans, from.getType(),from.getInstance(),from.getAction());
}
-
+
@Override
public Result<PermDAO.Data> permFromRPRequest(AuthzTrans trans, Request req) {
RolePermRequest from = (RolePermRequest)req;
@@ -326,19 +326,19 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
if (perm==null)return Result.err(Status.ERR_NotFound, "Permission not found");
Result<NsSplit> nss = q.deriveNsSplit(trans, perm.getType());
PermDAO.Data pd = new PermDAO.Data();
- if (nss.isOK()) {
+ if (nss.isOK()) {
pd.ns=nss.value.ns;
pd.type = nss.value.name;
pd.instance = from.getPerm().getInstance();
pd.action = from.getPerm().getAction();
trans.checkpoint(pd.fullPerm(), Env.ALWAYS);
-
+
String[] roles = {};
-
+
if (from.getRole() != null) {
roles = from.getRole().split(",");
}
- for (String role : roles) {
+ for (String role : roles) {
pd.roles(true).add(role);
}
return Result.ok(pd);
@@ -346,13 +346,13 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
return Result.err(nss);
}
}
-
+
@Override
public Result<RoleDAO.Data> roleFromRPRequest(AuthzTrans trans, Request req) {
RolePermRequest from = (RolePermRequest)req;
Result<NsSplit> nss = q.deriveNsSplit(trans, from.getRole());
RoleDAO.Data rd = new RoleDAO.Data();
- if (nss.isOK()) {
+ if (nss.isOK()) {
rd.ns = nss.value.ns;
rd.name = nss.value.name;
trans.checkpoint(rd.fullName(), Env.ALWAYS);
@@ -361,7 +361,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
return Result.err(nss);
}
}
-
+
@Override
public Result<PermDAO.Data> perm(AuthzTrans trans, Request req) {
PermRequest from = (PermRequest)req;
@@ -380,7 +380,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
return Result.ok(pd);
} else {
Result<NsSplit> nss = q.deriveNsSplit(trans, from.getType());
- if (nss.isOK()) {
+ if (nss.isOK()) {
pd.ns=nss.value.ns;
pd.type = nss.value.name;
pd.instance = from.getInstance();
@@ -393,7 +393,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
}
}
}
-
+
@Override
public Request ungrantRequest(AuthzTrans trans, String role, String type, String instance, String action) {
RolePermRequest rpr = new RolePermRequest();
@@ -402,7 +402,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
pkey.setInstance(instance);
pkey.setAction(action);
rpr.setPerm(pkey);
-
+
rpr.setRole(role);
return rpr;
}
@@ -429,7 +429,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
*/
@Override
public Result<Roles> roles(AuthzTrans trans, List<RoleDAO.Data> from, Roles to, boolean filter) {
- final boolean needNS = trans.requested(REQD_TYPE.ns);
+ final boolean needNS = trans.requested(REQD_TYPE.ns);
for (RoleDAO.Data frole : from) {
// Only Add Data to view if User is allowed to see this Role
if (!filter || q.mayUser(trans, trans.user(), frole,Access.read).isOK()) {
@@ -443,7 +443,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
Result<String[]> rpa = PermDAO.Data.decodeToArray(trans,q,p);
if (rpa.notOK())
return Result.err(rpa);
-
+
String[] pa = rpa.value;
Pkey pKey = new Pkey();
pKey.setType(pa[0]+'.'+pa[1]);
@@ -460,7 +460,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
/*
* (non-Javadoc)
* @see org.onap.aaf.auth.service.mapper.Mapper#users(java.util.Collection, java.lang.Object)
- *
+ *
* Note: Prevalidate all data for permission to view
*/
@Override
@@ -480,7 +480,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
/*
* (non-Javadoc)
* @see org.onap.aaf.auth.service.mapper.Mapper#users(java.util.Collection, java.lang.Object)
- *
+ *
* Note: Prevalidate all data for permission to view
*/
@Override
@@ -537,12 +537,12 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
}
if (passwd != null) {
to.cred = ByteBuffer.wrap(passwd.getBytes());
- to.type = CredDAO.RAW;
+ to.type = CredDAO.RAW;
} else {
to.type = CredDAO.NONE;
}
}
-
+
// Note: Ensure requested EndDate created will match Organization Password Rules
// P.S. Do not apply TempPassword rule here. Do that when you know you are doing a Create/Reset (see Service)
to.expires = getExpires(trans.org(),Expiration.Password,base,from.getId());
@@ -550,7 +550,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
return Result.ok(to);
}
-
+
@Override
public Result<Users> cred(List<CredDAO.Data> from, Users to) {
List<User> cu = to.getUser();
@@ -564,7 +564,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
}
return Result.ok(to);
}
-
+
@Override
public Result<Certs> cert(List<CertDAO.Data> from, Certs to) {
List<Cert> lc = to.getCert();
@@ -572,7 +572,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
Cert cert = new Cert();
cert.setId(fcred.id);
cert.setX500(fcred.x500);
- /**TODO - change Interface
+ /**TODO - change Interface
* @deprecated */
cert.setFingerprint(fcred.serial.toByteArray());
lc.add(cert);
@@ -583,15 +583,15 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
/**
* Analyze whether Requests should be acted on now, or in the future, based on Start Date, and whether the requester
* is allowed to change this value directly
- *
+ *
* Returning Result.OK means it should be done in the future.
* Returning Result.ACC_Now means to act on table change now.
*/
@Override
- public Result<FutureDAO.Data> future(AuthzTrans trans, String table, Request from,
+ public Result<FutureDAO.Data> future(AuthzTrans trans, String table, Request from,
Bytification content, boolean enableApproval, Memo memo, MayChange mc) {
Result<?> rMayChange;
- boolean needsAppr = enableApproval?trans.requested(REQD_TYPE.future):false;
+ boolean needsAppr = enableApproval?trans.requested(REQD_TYPE.future):false;
if (!needsAppr && (needsAppr = (rMayChange=mc.mayChange()).notOK())) {
if (enableApproval) {
if (!trans.requested(AuthzTrans.REQD_TYPE.future)) {
@@ -601,16 +601,16 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
return Result.err(rMayChange);
}
}
- GregorianCalendar now = new GregorianCalendar();
+ GregorianCalendar now = new GregorianCalendar();
GregorianCalendar start = from.getStart()==null?now:from.getStart().toGregorianCalendar();
-
+
GregorianCalendar expires = trans.org().expiration(start, Expiration.Future);
XMLGregorianCalendar xgc;
if ((xgc=from.getEnd())!=null) {
GregorianCalendar fgc = xgc.toGregorianCalendar();
expires = expires.before(fgc)?expires:fgc; // Min of desired expiration, and Org expiration
}
-
+
//TODO needs two answers from this. What's the NSS, and may Change.
FutureDAO.Data fto;
if (start.after(now) || needsAppr ) {
@@ -669,7 +669,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
item.setUser(data.user);
items.add(item);
}
-
+
if (sort != 0) {
TimeTaken tt = trans.start("Sort ", Env.SUB);
try {
@@ -697,7 +697,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
}
return err;
}
-
+
@Override
public Class<?> getClass(API api) {
switch(api) {
@@ -753,17 +753,17 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
case ERROR: return (A)new Error();
case API: return (A)new Api();
case VOID: return null;
-
+
case APPROVALS: return (A) new Approvals();
case DELG_REQ: return (A) new DelgRequest();
}
return null;
}
-
+
@SuppressWarnings("unchecked")
/**
* Get Typed Marshaler as they are defined
- *
+ *
* @param api
* @return
*/
@@ -799,7 +799,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
}
return Result.ok(apprs);
}
-
+
@Override
public Result<List<ApprovalDAO.Data>> approvals(Approvals apprs) {
List<ApprovalDAO.Data> lappr = new ArrayList<>();
@@ -815,7 +815,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
ad.status=a.getStatus();
ad.operation=a.getOperation();
ad.memo=a.getMemo();
-
+
XMLGregorianCalendar xgc = a.getUpdated();
if (xgc!=null)ad.updated=xgc.toGregorianCalendar().getTime();
lappr.add(ad);
@@ -859,15 +859,15 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
/*
* We want "Expired" dates to start at a specified time set by the Organization, and consistent wherever
* the date is created from.
- */
+ */
private Date getExpires(Organization org, Expiration exp, Request base, String id) {
XMLGregorianCalendar end = base.getEnd();
GregorianCalendar gc = end==null?new GregorianCalendar():end.toGregorianCalendar();
GregorianCalendar orggc;
- orggc = org.expiration(gc,exp,id);
+ orggc = org.expiration(gc,exp,id);
// We'll choose the lesser of dates to ensure Policy Compliance...
-
+
GregorianCalendar endgc = end==null||gc.after(orggc)?orggc:gc;
// Allow the Organization to determine when official "day Start" begins, Specifically when to consider something Expired.
endgc = Chrono.firstMomentOfDay(endgc);
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
index 56785fee..1c0c4aab 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,9 +36,9 @@ import org.onap.aaf.auth.validation.Validator;
/**
* Validator
* Consistently apply content rules for content (incoming)
- *
- * Note: We restrict content for usability in URLs (because RESTful service), and avoid
- * issues with Regular Expressions, and other enabling technologies.
+ *
+ * Note: We restrict content for usability in URLs (because RESTful service), and avoid
+ * issues with Regular Expressions, and other enabling technologies.
* @author Jonathan
*
*/
@@ -57,13 +57,13 @@ public class ServiceValidator extends Validator {
if (pd==null) {
msg("Perm Data is null.");
} else {
- if(!pd.ns.contains("@")) {
+ if(!pd.ns.contains("@")) {
ns(pd.ns);
}
permType(pd.type,pd.ns);
permInstance(pd.instance);
permAction(pd.action);
- if (pd.roles!=null) {
+ if (pd.roles!=null) {
for (String role : pd.roles) {
role(role);
}
@@ -86,7 +86,7 @@ public class ServiceValidator extends Validator {
}
return this;
}
-
+
public ServiceValidator role(RoleDAO.Data pd) {
if (pd==null) {
msg("Role Data is null.");
@@ -151,14 +151,14 @@ public class ServiceValidator extends Validator {
if (idx>0) {
str = str.substring(0,idx);
}
-
+
if (org.supportsRealm(cd.id)) {
String resp = org.isValidID(trans, str);
if (isNew && (resp!=null && resp.length()>0)) {
msg(cd.id,str);
}
}
-
+
if (cd.type==null) {
msg("Credential Type must be set");
} else {
@@ -193,17 +193,17 @@ public class ServiceValidator extends Validator {
ns(ns.name);
for (String s : ns.admin) {
if (nob(s,ID_CHARS)) {
- msg("Admin [" + s + "] is invalid.");
+ msg("Admin [" + s + "] is invalid.");
}
-
+
}
for (String s : ns.owner) {
if (nob(s,ID_CHARS)) {
- msg("Responsible [" + s + "] is invalid.");
+ msg("Responsible [" + s + "] is invalid.");
}
-
+
}
-
+
if (ns.attrib!=null) {
for (Pair<String, String> at : ns.attrib) {
if (nob(at.x,NAME_CHARS)) {
@@ -221,14 +221,14 @@ public class ServiceValidator extends Validator {
public ServiceValidator user_role(String user, UserRoleDAO.Data urdd) {
role(user,urdd.role);
- if(!urdd.role.startsWith(user)) {
+ if(!urdd.role.startsWith(user)) {
nullOrBlank("UserRole.ns",urdd.ns);
nullOrBlank("UserRole.rname",urdd.rname);
}
return this;
}
-
+
public ServiceValidator user_role(UserRoleDAO.Data urdd) {
if (urdd==null) {
msg("UserRole is null");
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Approval.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Approval.java
index a6b1f395..32e2414f 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Approval.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Approval.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Creds.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Creds.java
index 724e5b5a..4f000e62 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Creds.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Creds.java
@@ -7,9 +7,9 @@
* * 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.
@@ -52,13 +52,13 @@ public class JU_API_Creds {
@SuppressWarnings("static-access")
@Test
- public void testInit(){
+ public void testInit(){
try {
api_Creds.init(authzAPI, facade);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
@SuppressWarnings("static-access")
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Delegate.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Delegate.java
index 69db8664..5a430c65 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Delegate.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Delegate.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_History.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_History.java
index ea48c8e4..8a85b5d8 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_History.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_History.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_NS.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_NS.java
index fd27e663..6df1bd61 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_NS.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_NS.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Perms.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Perms.java
index 9868cfe8..7b52b760 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Perms.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Perms.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Roles.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Roles.java
index 6e2f469b..0597da24 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Roles.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_Roles.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_User.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_User.java
index 679665e2..78d85a1e 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_User.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_User.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_UserRole.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_UserRole.java
index 95b26fc1..7330960e 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_UserRole.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/api/test/JU_API_UserRole.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/facade/JU_AuthzFacadeImpl.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/facade/JU_AuthzFacadeImpl.java
index 91c0e140..460113b6 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/facade/JU_AuthzFacadeImpl.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/facade/JU_AuthzFacadeImpl.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/mapper/JU_Mapper_2_0.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/mapper/JU_Mapper_2_0.java
index fd664d6c..f562280b 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/mapper/JU_Mapper_2_0.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/mapper/JU_Mapper_2_0.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_BaseServiceImpl.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_BaseServiceImpl.java
index 9a804c98..e992337b 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_BaseServiceImpl.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_BaseServiceImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -75,7 +75,7 @@ import aaf.v2_0.Users;
@RunWith(MockitoJUnitRunner.class)
public abstract class JU_BaseServiceImpl {
- protected AuthzCassServiceImpl<Nss, Perms, Pkey, Roles, Users, UserRoles, Delgs, Certs, Keys, Request, History, Error, Approvals>
+ protected AuthzCassServiceImpl<Nss, Perms, Pkey, Roles, Users, UserRoles, Delgs, Certs, Keys, Request, History, Error, Approvals>
acsi;
protected Mapper_2_0 mapper;
@@ -88,7 +88,7 @@ public abstract class JU_BaseServiceImpl {
// NOTE: Annotation format (@Mock and @Spy) do NOT seem to always work as a Base Class,
// so we construct manually.
//
-// Mock Objects
+// Mock Objects
protected HistoryDAO historyDAO = mock(HistoryDAO.class);
protected CacheInfoDAO cacheInfoDAO = mock(CacheInfoDAO.class);
protected CachedNSDAO nsDAO = mock(CachedNSDAO.class);
@@ -102,32 +102,32 @@ public abstract class JU_BaseServiceImpl {
protected DelegateDAO delegateDAO = mock(DelegateDAO.class);
protected ApprovalDAO approvalDAO = mock(ApprovalDAO.class);
- // Spy Objects
+ // Spy Objects
@Spy
protected static PropAccess access = new PropAccess();
@Spy
protected static AuthzEnv env = new AuthzEnv(access);
@Spy
protected static AuthzTrans trans = env.newTransNoAvg();
-
+
// @Spy doesn't seem to work on Question.
@Spy
protected Question question = spy(new Question(trans,
historyDAO,cacheInfoDAO,nsDAO,permDAO,
roleDAO,userRoleDAO,credDAO,certDAO,
locateDAO,futureDAO,delegateDAO,approvalDAO));
-
+
public void setUp() throws Exception {
when(trans.org()).thenReturn(org);
when(org.getDomain()).thenReturn("org.onap");
Define.set(access);
access.setProperty(Config.CADI_LATITUDE, "38.0");
access.setProperty(Config.CADI_LONGITUDE, "-72.0");
-
+
mapper = new Mapper_2_0(question);
acsi = new AuthzCassServiceImpl<>(trans, mapper, question);
}
-
+
//////////
// Common Data Objects
/////////
@@ -144,7 +144,7 @@ public abstract class JU_BaseServiceImpl {
rv.add(ndd);
return rv;
}
-
+
/**
* Setup Role Data for Mock Usages
* @param trans
@@ -163,7 +163,7 @@ public abstract class JU_BaseServiceImpl {
}
when(question.userRoleDAO().read(trans, user, ns+'.'+role)).thenReturn(result);
}
-
+
protected UserRoleDAO.Data urData(String user, String ns, String rname, int days) {
UserRoleDAO.Data urdd = new UserRoleDAO.Data();
urdd.user = user;
@@ -182,7 +182,7 @@ public abstract class JU_BaseServiceImpl {
list.add(t);
return list;
}
-
+
protected <T> List<T> emptyList(Class<T> cls) {
return new ArrayList<>();
}
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_ServiceImpl_createUserCred.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_ServiceImpl_createUserCred.java
index 2bb907ac..9cd5ecdf 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_ServiceImpl_createUserCred.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/test/JU_ServiceImpl_createUserCred.java
@@ -7,9 +7,9 @@
* 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.
@@ -49,9 +49,9 @@ import junit.framework.Assert;
@RunWith(MockitoJUnitRunner.class)
public class JU_ServiceImpl_createUserCred extends JU_BaseServiceImpl {
- @Mock
- private Result<CredDAO.Data> rcdd;
-
+ @Mock
+ private Result<CredDAO.Data> rcdd;
+
@Before
public void setUp() throws Exception {
super.setUp();
@@ -110,7 +110,7 @@ public class JU_ServiceImpl_createUserCred extends JU_BaseServiceImpl {
when(orgIdentity.isFound()).thenReturn(true);
String ns = "org.onap.sample";
when(question.nsDAO().read(trans, ns)).thenReturn(Result.ok(nsData(ns)));
-
+
CredDAO.Data cdd = credDataFound(cr,100);
when(question.credDAO().create(any(AuthzTrans.class), any(CredDAO.Data.class) )).thenReturn(Result.ok(cdd));
when(question.credDAO().readID(trans, cr.getId())).thenReturn(Result.ok(listOf(cdd)));
@@ -126,7 +126,7 @@ public class JU_ServiceImpl_createUserCred extends JU_BaseServiceImpl {
cr.setType(CredDAO.RAW);
return cr;
}
-
+
private CredDAO.Data credDataFound(CredRequest cr, int days) {
CredDAO.Data cdd = new CredDAO.Data();
cdd.id = cr.getId();
@@ -144,5 +144,5 @@ public class JU_ServiceImpl_createUserCred extends JU_BaseServiceImpl {
cdd.expires = gc.getTime();
return cdd;
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/validation/test/JU_ServiceValidator.java b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/validation/test/JU_ServiceValidator.java
index 53ba519c..c4829ff1 100644
--- a/auth/auth-service/src/test/java/org/onap/aaf/auth/service/validation/test/JU_ServiceValidator.java
+++ b/auth/auth-service/src/test/java/org/onap/aaf/auth/service/validation/test/JU_ServiceValidator.java
@@ -7,9 +7,9 @@
* * 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.
@@ -54,7 +54,7 @@ public class JU_ServiceValidator {
assertTrue(validator.errs().equals("ERR_Security\n"));
}
-
+
@Test
public void permInstance() {
assertFalse(validator.permInstance("hello").err());
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java
index 8c39e44d..4a486358 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,7 +30,7 @@ import org.onap.aaf.misc.env.util.Split;
/**
* A Class that understands the AAF format of Permission (name/type/action)
* or String "name|type|action"
- *
+ *
* @author Jonathan
*
*/
@@ -38,7 +38,7 @@ public class AAFPermission implements Permission {
private static final List<String> NO_ROLES;
protected String ns,type,instance,action,key;
private List<String> roles;
-
+
static {
NO_ROLES = new ArrayList<>();
}
@@ -71,15 +71,15 @@ public class AAFPermission implements Permission {
}
this.roles = roles==null?NO_ROLES:roles;
}
-
+
/**
* Match a Permission
* if Permission is Fielded type "Permission", we use the fields
* otherwise, we split the Permission with '|'
- *
+ *
* when the type or action starts with REGEX indicator character ( ! ),
* then it is evaluated as a regular expression.
- *
+ *
* If you want a simple field comparison, it is faster without REGEX
*/
public boolean match(Permission p) {
@@ -100,7 +100,7 @@ public class AAFPermission implements Permission {
aafInstance = ap.getInstance();
aafAction = ap.getAction();
} else {
- // Permission is concatenated together: separated by
+ // Permission is concatenated together: separated by
String[] aaf = Split.splitTrim('|', p.getKey());
switch(aaf.length) {
case 1:
@@ -116,13 +116,13 @@ public class AAFPermission implements Permission {
case 3:
aafNS = aaf[0];
aafType = aaf[1];
- aafInstance = aaf[2];
+ aafInstance = aaf[2];
aafAction = "*";
break;
default:
aafNS = aaf[0];
aafType = aaf[1];
- aafInstance = aaf[2];
+ aafInstance = aaf[2];
aafAction = aaf[3];
break;
}
@@ -157,15 +157,15 @@ public class AAFPermission implements Permission {
public String getFullType() {
return ns + '.' + type;
}
-
+
public String getInstance() {
return instance;
}
-
+
public String getAction() {
return action;
}
-
+
public String getKey() {
return key;
}
@@ -183,7 +183,7 @@ public class AAFPermission implements Permission {
public String toString() {
return "AAFPermission:" +
"\n\tNS: " + ns +
- "\n\tType: " + type +
+ "\n\tType: " + type +
"\n\tInstance: " + instance +
"\n\tAction: " + action +
"\n\tKey: " + key;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java
index c631cb9c..ab525af3 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/Defaults.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java
index 498f1bf9..5b092740 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java
@@ -68,7 +68,7 @@ public class PermEval {
String[] pkeys=Split.split(startChar,pInst);
if (pkeys.length<skeys.length) {
return false;
- } else if(pkeys.length > skeys.length &&
+ } else if(pkeys.length > skeys.length &&
(skeys.length==0 || !ASTERIX.equals(skeys[skeys.length-1]))) {
return false;
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
index 2f2d2ac3..0b1238ab 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java
@@ -7,9 +7,9 @@
* 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.
@@ -53,7 +53,7 @@ import org.onap.aaf.cadi.util.FixURIinfo;
import org.onap.aaf.misc.env.APIException;
public class TestConnectivity {
-
+
private static Map<String, String> aaf_urls;
@@ -72,7 +72,7 @@ public class TestConnectivity {
try {
SecurityInfoC<HttpURLConnection> si = SecurityInfoC.instance(access, HttpURLConnection.class);
aaf_urls = Agent.loadURLs(access);
-
+
List<SecuritySetter<HttpURLConnection>> lss = loadSetters(access,si);
/////////
String directAAFURL = aaf_urls.get(Config.AAF_URL);
@@ -80,14 +80,14 @@ public class TestConnectivity {
print(true,"Test Connections by non-located aaf_url");
Locator<URI> locator = new SingleEndpointLocator(directAAFURL);
connectTest(locator,new URI(directAAFURL));
-
+
SecuritySetter<HttpURLConnection> ss = si.defSS;
permTest(locator,ss);
} else {
/////////
print(true,"Test Connections driven by AAFLocator");
String serviceURI = aaf_urls.get(Config.AAF_URL);
-
+
for (String url : new String[] {
serviceURI,
aaf_urls.get(Config.AAF_OAUTH2_TOKEN_URL),
@@ -127,7 +127,7 @@ public class TestConnectivity {
System.out.println("No User/Password to test");
}
}
-
+
} catch (Exception e) {
e.printStackTrace(System.err);
} finally {
@@ -135,14 +135,14 @@ public class TestConnectivity {
}
}
}
-
+
private static List<SecuritySetter<HttpURLConnection>> loadSetters(PropAccess access, SecurityInfoC<HttpURLConnection> si) {
print(true,"Load Security Setters from Configuration Information");
String user = access.getProperty(Config.AAF_APPID);
ArrayList<SecuritySetter<HttpURLConnection>> lss = new ArrayList<>();
-
+
try {
HBasicAuthSS hbass = new HBasicAuthSS(si,true);
@@ -177,7 +177,7 @@ public class TestConnectivity {
} catch (Exception e) {
access.log(Level.INFO, "AAF OAUTH2 Security Setter constructor threw exception: \"",e.getMessage(),"\". AAF OAUTH2 tests will not be conducted... Continuing");
}
-
+
tokenURL = access.getProperty(Config.AAF_ALT_OAUTH2_TOKEN_URL);
if (tokenURL==null) {
access.log(Level.INFO, "AAF Alternative OAUTH2 requires",Config.AAF_ALT_OAUTH2_TOKEN_URL, "OAuth2 tests to", tokenURL, "will not be conducted... Continuing");
@@ -190,7 +190,7 @@ public class TestConnectivity {
access.log(Level.INFO, "ALT OAUTH2 Security Setter constructor threw exception: \"",e.getMessage(),"\". ALT OAuth2 tests to", tokenURL, " will not be conducted... Continuing");
}
}
-
+
return lss;
}
@@ -270,11 +270,11 @@ public class TestConnectivity {
String pathInfo = "/authz/perms/user/"+user;
client.setPathInfo(pathInfo);
System.out.println(pathInfo);
-
+
client.send();
Future<String> future = client.futureReadString();
if (future.get(7000)) {
- System.out.println(future.body());
+ System.out.println(future.body());
} else {
if (future.code()==401 && ss instanceof HX509SS) {
System.out.println(" Authentication denied with 401 for Certificate.\n\t"
@@ -298,11 +298,11 @@ public class TestConnectivity {
client.setPathInfo("/authn/basicAuth");
client.addHeader("Accept", "text/plain");
client.send();
-
-
+
+
Future<String> future = client.futureReadString();
if (future.get(7000)) {
- System.out.println("BasicAuth Validated");
+ System.out.println("BasicAuth Validated");
} else {
System.out.println("Failure " + future.code() + ":" + future.body());
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java
index c23e9b23..f3a45e5e 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,16 +55,16 @@ import aaf.v2_0.Users;
import aaf.v2_0.Users.User;
public class AAFListedCertIdentity implements CertIdentity {
- //TODO should 8 hours be configurable?
- private static final long EIGHT_HOURS = 1000*60*60*8L;
-
+ //TODO should 8 hours be configurable?
+ private static final long EIGHT_HOURS = 1000*60*60*8L;
+
private static Map<ByteArrayHolder,String> certs = null;
-
+
// Did this to add other Trust Mechanisms
- // Trust mechanism set by Property:
+ // Trust mechanism set by Property:
private static final String[] authMechanisms = new String[] {"tguard","basicAuth","csp"};
private static String[] certIDs;
-
+
private static Map<String,Set<String>> trusted =null;
public AAFListedCertIdentity(Access access, AAFCon<?> aafcon) throws APIException {
@@ -86,7 +86,7 @@ public class AAFListedCertIdentity implements CertIdentity {
public static Set<String> trusted(String authMech) {
return trusted.get(authMech);
}
-
+
public TaggedPrincipal identity(HttpServletRequest req, X509Certificate cert, byte[] certBytes) throws CertificateException {
if (cert==null && certBytes==null)return null;
if (certBytes==null)certBytes = cert.getEncoded();
@@ -107,14 +107,14 @@ public class AAFListedCertIdentity implements CertIdentity {
return Hash.compareTo(ba, b.ba);
}
}
-
+
private class CertUpdate extends TimerTask {
private AAFCon<?> aafcon;
public CertUpdate(AAFCon<?> con) {
aafcon = con;
}
-
+
@Override
public void run() {
try {
@@ -142,9 +142,9 @@ public class AAFListedCertIdentity implements CertIdentity {
} else {
aafcon.access.log(Level.WARN, "Could not get Users in Perm com.att.trust|tguard|authenticate",fusr.code(),fusr.body());
}
-
+
}
-
+
for (String u : userLookup) {
Future<Certs> fc = aafcon.client().read("/authn/cert/id/"+u, Certs.class, aafcon.certsDF);
XMLGregorianCalendar now = Chrono.timeStamp();
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java
index d5a2e58a..2d03e6ac 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/ErrMessage.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,16 +34,16 @@ import aaf.v2_0.Error;
public class ErrMessage {
private RosettaDF<Error> errDF;
-
+
public ErrMessage(RosettaEnv env) throws APIException {
errDF = env.newDataFactory(Error.class);
}
/**
* AT&T Requires a specific Error Format for RESTful Services, which AAF complies with.
- *
- * This code will create a meaningful string from this format.
- *
+ *
+ * This code will create a meaningful string from this format.
+ *
* @param ps
* @param df
* @param r
@@ -54,12 +54,12 @@ public class ErrMessage {
Error err = errDF.newData().in(TYPE.JSON).load(attErrJson).asObject();
ps.println(toMsg(sb,err));
}
-
+
/**
* AT&T Requires a specific Error Format for RESTful Services, which AAF complies with.
- *
- * This code will create a meaningful string from this format.
- *
+ *
+ * This code will create a meaningful string from this format.
+ *
* @param sb
* @param df
* @param r
@@ -68,11 +68,11 @@ public class ErrMessage {
public StringBuilder toMsg(StringBuilder sb, String attErrJson) throws APIException {
return toMsg(sb,errDF.newData().in(TYPE.JSON).load(attErrJson).asObject());
}
-
+
public StringBuilder toMsg(Future<?> future) {
return toMsg(new StringBuilder(),future);
}
-
+
public StringBuilder toMsg(StringBuilder sb, Future<?> future) {
try {
toMsg(sb,errDF.newData().in(TYPE.JSON).load(future.body()).asObject());
@@ -93,7 +93,7 @@ public class ErrMessage {
Vars.convert(sb, err.getText(),vars);
return sb;
}
-
+
public Error getError(Future<?> future) throws APIException {
return errDF.newData().in(TYPE.JSON).load(future.body()).asObject();
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java
index 921b5096..65202940 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java
@@ -7,9 +7,9 @@
* 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.
@@ -85,12 +85,12 @@ public class Examples {
} else {
className = nameOrContentType;
}
-
+
// No Void.class in aaf.v2_0 package causing errors when trying to use a newVoidv2_0
// method similar to others in this class. This makes it work, but is it right?
if ("Void".equals(className))
return "";
-
+
if ("1.1".equals(version)) {
version = "v1_0";
} else if (version!=null) {
@@ -98,7 +98,7 @@ public class Examples {
} else {
version = "v2_0";
}
-
+
Class<?> cls=null;
int minorIdx = version.indexOf('_');
if(minorIdx<0) {
@@ -115,29 +115,29 @@ public class Examples {
}
}
}
-
+
if(cls==null) {
throw new APIException("ERROR: " + "aaf."+vprefix+"X not found.");
}
-
+
Method meth;
try {
meth = Examples.class.getDeclaredMethod("new"+cls.getSimpleName()+vprefix+minor,boolean.class);
} catch (Exception e) {
throw new APIException("ERROR: " + cls.getName() + " does not have an Example in Code. Request from AAF Developers");
}
-
+
RosettaDF<C> df = env.newDataFactory(cls);
df.option(Data.PRETTY);
-
+
Object data = meth.invoke(null,optional);
-
+
@SuppressWarnings("unchecked")
String rv = df.newData().load((C)data).out(type).asString();
// Object obj = df.newData().in(type).load(rv).asObject();
return rv;
}
-
+
/*
* Set Base Class Request (easier than coding over and over)
*/
@@ -147,9 +147,9 @@ public class Examples {
gc.add(GregorianCalendar.MONTH, 6);
req.setEnd(Chrono.timeStamp(gc));
// req.setForce("false");
-
+
}
-
+
@SuppressWarnings("unused")
private static Request newRequestv2_0(boolean optional) {
Request r = new Request();
@@ -168,7 +168,7 @@ public class Examples {
if (optional)setOptional(rpr);
return rpr;
}
-
+
@SuppressWarnings("unused")
private static Roles newRolesv2_0(boolean optional) {
Role r;
@@ -206,8 +206,8 @@ public class Examples {
return rs;
}
-
-
+
+
@SuppressWarnings("unused")
private static PermRequest newPermRequestv2_0(boolean optional) {
PermRequest pr = new PermRequest();
@@ -216,12 +216,12 @@ public class Examples {
pr.setAction("myAction");
if (optional) {
pr.setDescription("Short and meaningful verbiage about the Permission");
-
+
setOptional(pr);
}
return pr;
}
-
+
@SuppressWarnings("unused")
private static Perm newPermv2_0(boolean optional) {
Perm pr = new Perm();
@@ -246,7 +246,7 @@ public class Examples {
pr.setAction("myAction");
return pr;
}
-
+
@SuppressWarnings("unused")
private static Perms newPermsv2_0(boolean optional) {
Perms perms = new Perms();
@@ -268,9 +268,9 @@ public class Examples {
p.getRoles().add("org.osaaf.myns.myRole2");
return perms;
-
+
}
-
+
@SuppressWarnings("unused")
private static UserRoleRequest newUserRoleRequestv2_0(boolean optional) {
UserRoleRequest urr = new UserRoleRequest();
@@ -279,7 +279,7 @@ public class Examples {
if (optional) setOptional(urr);
return urr;
}
-
+
@SuppressWarnings("unused")
private static NsRequest newNsRequestv2_0(boolean optional) {
NsRequest nr = new NsRequest();
@@ -287,7 +287,7 @@ public class Examples {
nr.getResponsible().add("ab1234@people.osaaf.org");
nr.getResponsible().add("cd5678@people.osaaf.org");
nr.getAdmin().add("zy9876@people.osaaf.org");
- nr.getAdmin().add("xw5432@people.osaaf.org");
+ nr.getAdmin().add("xw5432@people.osaaf.org");
if (optional) {
nr.setDescription("This is my Namespace to set up");
nr.setType("APP");
@@ -295,12 +295,12 @@ public class Examples {
}
return nr;
}
-
-
+
+
@SuppressWarnings("unused")
private static Nss newNssv2_0(boolean optional) {
Ns ns;
-
+
Nss nss = new Nss();
nss.getNs().add(ns = new Nss.Ns());
ns.setName("org.osaaf.myns");
@@ -309,14 +309,14 @@ public class Examples {
ns.getAdmin().add("zy9876@people.osaaf.org");
ns.getAdmin().add("xw5432@people.osaaf.org");
ns.setDescription("This is my Namespace to set up");
-
+
nss.getNs().add(ns = new Nss.Ns());
ns.setName("org.osaaf.myOtherNs");
ns.getResponsible().add("ab1234@people.osaaf.org");
ns.getResponsible().add("cd5678@people.osaaf.org");
ns.getAdmin().add("zy9876@people.osaaf.org");
- ns.getAdmin().add("xw5432@people.osaaf.org");
-
+ ns.getAdmin().add("xw5432@people.osaaf.org");
+
return nss;
}
@SuppressWarnings("unused")
@@ -343,23 +343,23 @@ public class Examples {
return cr;
}
-
+
@SuppressWarnings("unused")
private static Users newUsersv2_0(boolean optional) {
User user;
-
+
Users users = new Users();
user = new Users.User();
users.getUser().add(user);
- user.setId("ab1234@people.osaaf.org");
+ user.setId("ab1234@people.osaaf.org");
GregorianCalendar gc = new GregorianCalendar();
user.setExpires(Chrono.timeStamp(gc));
user = new Users.User();
users.getUser().add(user);
- user.setId("zy9876@people.osaaf.org");
- user.setExpires(Chrono.timeStamp(gc));
-
+ user.setId("zy9876@people.osaaf.org");
+ user.setExpires(Chrono.timeStamp(gc));
+
return users;
}
@@ -400,7 +400,7 @@ public class Examples {
ur.setRole("com.test.myapp.myRole");
ur.setExpires(Chrono.timeStamp());
urs.getUserRole().add(ur);
-
+
ur = new UserRole();
ur.setUser("yx4321");
ur.setRole("com.test.yourapp.yourRole");
@@ -453,7 +453,7 @@ public class Examples {
return a;
}
-
+
@SuppressWarnings("unused")
private static aaf.v2_0.Error newErrorv2_0(boolean optional) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java
index eb116490..ab95a5a7 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertMarshal.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,7 +52,7 @@ public class CertMarshal extends ObjMarshal<Cert> {
return t.getX500();
}
});
-
+
add(new FieldDateTime<Cert>("expires") {
@Override
protected XMLGregorianCalendar data(Cert t) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java
index 93530793..a69b0a39 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/marshal/CertsMarshal.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ public class CertsMarshal extends ObjMarshal<Certs> {
protected List<Cert> data(Certs t) {
return t.getCert();
}
- });
+ });
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java
index 216468c2..c48e35f4 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFAuthn.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,7 +36,7 @@ import aaf.v2_0.CredRequest;
public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
private AAFCon<CLIENT> con;
private String realm;
-
+
/**
* Configure with Standard AAF properties, Stand alone
* @param con
@@ -51,17 +51,17 @@ public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
/**
* Configure with Standard AAF properties, but share the Cache (with AAF Lur)
* @param con
- * @throws Exception
+ * @throws Exception
*/
// Package on purpose
AAFAuthn(AAFCon<CLIENT> con, AbsUserCache<AAFPermission> cache) {
super(cache);
this.con = con;
}
-
+
/**
* Return Native Realm of AAF Instance.
- *
+ *
* @return
*/
public String getRealm() {
@@ -70,24 +70,24 @@ public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
/**
* Returns null if ok, or an Error String;
- *
+ *
* Convenience function. Passes "null" for State object
*/
public String validate(String user, String password) throws IOException {
return validate(user,password,null);
}
-
+
/**
* Returns null if ok, or an Error String;
- *
+ *
* For State Object, you may put in HTTPServletRequest or AuthzTrans, if available. Otherwise,
* leave null
- *
+ *
* @param user
* @param password
* @return
- * @throws IOException
- * @throws CadiException
+ * @throws IOException
+ * @throws CadiException
* @throws Exception
*/
public String validate(String user, String password, Object state) throws IOException {
@@ -121,11 +121,11 @@ public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
return "user/pass combo invalid for " + user;
case DENIED:
return "AAF denies API for " + user;
- default:
+ default:
return "AAFAuthn doesn't handle Principal " + user;
}
}
-
+
private class AAFCachedPrincipal extends ConfigPrincipal implements CachedPrincipal {
private long expires;
private long timeToLive;
@@ -140,10 +140,10 @@ public class AAFAuthn<CLIENT> extends AbsUserCache<AAFPermission> {
try {
Miss missed = missed(getName(),getCred());
if (missed==null || missed.mayContinue()) {
- CredRequest cr = new CredRequest();
- cr.setId(getName());
- cr.setPassword(new String(getCred()));
- Future<String> fp = con.client().readPost("/authn/validate", con.credReqDF, cr);
+ CredRequest cr = new CredRequest();
+ cr.setId(getName());
+ cr.setPassword(new String(getCred()));
+ Future<String> fp = con.client().readPost("/authn/validate", con.credReqDF, cr);
//Rcli<CLIENT> client = con.client().forUser(con.basicAuth(getName(), new String(getCred())));
//Future<String> fp = client.read(
// "/authn/basicAuth",
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java
index 3b97883b..7c315e1a 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java
@@ -7,9 +7,9 @@
* 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.
@@ -134,12 +134,12 @@ public abstract class AAFCon<CLIENT> implements Connector {
si.defSS=x509Alias(alias);
set(si.defSS);
} else {
-
+
String encpass = access.getProperty(Config.AAF_APPPASS, null);
if (encpass==null) {
encpass = access.getProperty(Config.OAUTH_CLIENT_SECRET,null);
}
-
+
if (encpass==null) {
if (alias==null) {
access.printf(Access.Level.WARN,"%s, %s or %s required before use.", Config.CADI_ALIAS, Config.AAF_APPID, Config.OAUTH_CLIENT_ID);
@@ -151,17 +151,17 @@ public abstract class AAFCon<CLIENT> implements Connector {
set(si.defSS);
} else {
si.defSS=new SecuritySetter<CLIENT>() {
-
+
@Override
public String getID() {
return "";
}
-
+
@Override
public void setSecurity(CLIENT client) throws CadiException {
throw new CadiException("AAFCon has not been initialized with Credentials (SecuritySetter)");
}
-
+
@Override
public int setLastResponse(int respCode) {
return 0;
@@ -172,18 +172,18 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
}
}
-
+
timeout = Integer.parseInt(access.getProperty(Config.AAF_CALL_TIMEOUT, Config.AAF_CALL_TIMEOUT_DEF));
cleanInterval = Integer.parseInt(access.getProperty(Config.AAF_CLEAN_INTERVAL, Config.AAF_CLEAN_INTERVAL_DEF));
highCount = Integer.parseInt(access.getProperty(Config.AAF_HIGH_COUNT, Config.AAF_HIGH_COUNT_DEF).trim());
connTimeout = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF).trim());
userExpires = Integer.parseInt(access.getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF).trim());
usageRefreshTriggerCount = Integer.parseInt(access.getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF).trim())-1; // zero based
-
+
app=FQI.reverseDomain(si.defSS.getID());
//TODO Get Realm from AAF
realm="people.osaaf.org";
-
+
env = new RosettaEnv();
permsDF = env.newDataFactory(Perms.class);
usersDF = env.newDataFactory(Users.class);
@@ -201,22 +201,22 @@ public abstract class AAFCon<CLIENT> implements Connector {
public final String aafVersion() {
return apiVersion;
}
-
+
/**
* Use this call to get the appropriate client based on configuration (HTTP, future)
* using default AAF API Version
- *
+ *
* @param apiVersion
* @return
* @throws CadiException
*/
public Rcli<CLIENT> client() throws CadiException {
return client(apiVersion);
- }
+ }
/**
* Use this call to get the appropriate client based on configuration (HTTP, future)
- *
+ *
* @param apiVersion
* @return
* @throws CadiException
@@ -228,19 +228,19 @@ public abstract class AAFCon<CLIENT> implements Connector {
client.apiVersion(apiVersion)
.readTimeout(connTimeout);
clients.put(apiVersion, client);
- }
+ }
return client;
}
public Rcli<CLIENT> client(URI uri) throws CadiException {
return rclient(uri,si.defSS).readTimeout(connTimeout);
}
-
+
/**
* Use this API when you have permission to have your call act as the end client's ID.
- *
+ *
* Your calls will get 403 errors if you do not have this permission. it is a special setup, rarely given.
- *
+ *
* @param apiVersion
* @param req
* @return
@@ -249,12 +249,12 @@ public abstract class AAFCon<CLIENT> implements Connector {
public Rcli<CLIENT> clientAs(TaggedPrincipal p) throws CadiException {
return clientAs(apiVersion,p);
}
-
+
/**
* Use this API when you have permission to have your call act as the end client's ID.
- *
+ *
* Your calls will get 403 errors if you do not have this permission. it is a special setup, rarely given.
- *
+ *
* @param apiVersion
* @param req
* @return
@@ -265,14 +265,14 @@ public abstract class AAFCon<CLIENT> implements Connector {
return cl.forUser(transferSS(p));
}
-
+
public RosettaEnv env() {
return env;
}
-
+
/**
* Return the backing AAFCon, if there is a Lur Setup that is AAF.
- *
+ *
* If there is no AAFLur setup, it will return "null"
* @param servletRequest
* @return
@@ -295,9 +295,9 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
return null;
}
-
+
public abstract AAFCon<CLIENT> clone(String url) throws CadiException, LocatorException;
-
+
public AAFAuthn<CLIENT> newAuthn() throws APIException {
try {
return new AAFAuthn<>(this);
@@ -324,7 +324,7 @@ public abstract class AAFCon<CLIENT> implements Connector {
throw new CadiException(e);
}
}
-
+
public AAFLurPerm newLur(AbsUserCache<AAFPermission> c) throws APIException {
try {
return new AAFLurPerm(this,c);
@@ -336,33 +336,33 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
protected abstract Rcli<CLIENT> rclient(URI uri, SecuritySetter<CLIENT> ss) throws CadiException;
-
+
public abstract Rcli<CLIENT> rclient(Locator<URI> loc, SecuritySetter<CLIENT> ss) throws CadiException;
public Rcli<CLIENT> client(Locator<URI> locator) throws CadiException {
return rclient(locator,si.defSS);
}
-
+
public abstract<RET> RET best(Retryable<RET> retryable) throws LocatorException, CadiException, APIException;
public abstract<RET> RET bestForUser(GetSetter get, Retryable<RET> retryable) throws LocatorException, CadiException, APIException;
public abstract SecuritySetter<CLIENT> basicAuth(String user, String password) throws CadiException;
-
+
public abstract SecuritySetter<CLIENT> transferSS(TaggedPrincipal principal) throws CadiException;
-
+
public abstract SecuritySetter<CLIENT> basicAuthSS(BasicPrincipal principal) throws CadiException;
-
+
public abstract SecuritySetter<CLIENT> tokenSS(final String client_id, final String accessToken) throws CadiException;
-
+
public abstract SecuritySetter<CLIENT> x509Alias(String alias) throws APIException, CadiException;
-
+
public String getRealm() {
return realm;
}
-
+
/**
* This interface allows the AAFCon, even though generic, to pass in correctly typed values based on the above SS commands.
* @author Jonathan
@@ -379,7 +379,7 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
return ss;
}
-
+
public SecurityInfoC<CLIENT> securityInfo() {
return si;
}
@@ -390,7 +390,7 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
return "unknown";
}
-
+
public void invalidate() throws CadiException {
for (Rcli<CLIENT> client : clients.values()) {
client.invalidate();
@@ -412,7 +412,7 @@ public abstract class AAFCon<CLIENT> implements Connector {
}
return text;
}
-
+
public static AAFCon<?> newInstance(PropAccess pa) throws CadiException, LocatorException {
// Potentially add plugin for other kinds of Access
return new AAFConHttp(pa);
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java
index e60b5d8a..b62bc404 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFConHttp.java
@@ -7,9 +7,9 @@ r * ============LICENSE_START===================================================
* 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.
@@ -82,7 +82,7 @@ public class AAFConHttp extends AAFCon<HttpURLConnection> {
super(access,tag,si);
hman = new HMangr(access, locator);
}
-
+
private AAFConHttp(AAFCon<HttpURLConnection> aafcon, String url) throws LocatorException {
super(aafcon);
si=aafcon.si;
@@ -127,7 +127,7 @@ public class AAFConHttp extends AAFCon<HttpURLConnection> {
@Override
protected Rcli<HttpURLConnection> rclient(URI ignoredURI, SecuritySetter<HttpURLConnection> ss) throws CadiException {
if (hman.loc==null) {
- throw new CadiException("No Locator set in AAFConHttp");
+ throw new CadiException("No Locator set in AAFConHttp");
}
try {
return new HRcli(hman, hman.loc.best() ,ss);
@@ -135,7 +135,7 @@ public class AAFConHttp extends AAFCon<HttpURLConnection> {
throw new CadiException(e);
}
}
-
+
@Override
public Rcli<HttpURLConnection> rclient(Locator<URI> loc, SecuritySetter<HttpURLConnection> ss) throws CadiException {
try {
@@ -149,7 +149,7 @@ public class AAFConHttp extends AAFCon<HttpURLConnection> {
public AbsTransferSS<HttpURLConnection> transferSS(TaggedPrincipal principal) {
return new HTransferSS(principal, app,si);
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.aaf.v2_0.AAFCon#basicAuthSS(java.security.Principal)
*/
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
index 38f6bcea..3611e481 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -67,7 +67,7 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
env = new RosettaEnv(access.getProperties());
}
}
-
+
int connectTimeout = Integer.parseInt(si.access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
try {
String[] path = Split.split('/',locatorURI.getPath());
@@ -86,32 +86,32 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
client = new HClient(si.defSS, locatorURI, connectTimeout);
}
epsDF = env.newDataFactory(Endpoints.class);
-
+
} catch (APIException /*| URISyntaxException*/ e) {
throw new LocatorException(e);
}
lclient = new HClient(si.defSS, locatorURI, connectTimeout);
-
+
if(si.access.willLog(Access.Level.DEBUG)) {
si.access.log(Access.Level.DEBUG, "Root URI:",client.getURI());
}
-
+
String dnsString;
if(locatorURI.getPort()<0) {
- dnsString=locatorURI.getScheme() + "://" + locatorURI.getHost();
+ dnsString=locatorURI.getScheme() + "://" + locatorURI.getHost();
} else {
- dnsString=locatorURI.getScheme() + "://" +locatorURI.getHost()+':'+locatorURI.getPort();
+ dnsString=locatorURI.getScheme() + "://" +locatorURI.getHost()+':'+locatorURI.getPort();
}
if(dnsString.contains("null")) { // for Testing Purposes, mostly.
- locatorLocator = null;
+ locatorLocator = null;
} else {
- locatorLocator = new DNSLocator(access, dnsString);
- if(locatorLocator.hasItems()) {
- locatorItem = locatorLocator.best();
- } else {
- // For when DNS doesn't work, including some K8s Installations
- locatorLocator = new SingleEndpointLocator(dnsString);
- }
+ locatorLocator = new DNSLocator(access, dnsString);
+ if(locatorLocator.hasItems()) {
+ locatorItem = locatorLocator.best();
+ } else {
+ // For when DNS doesn't work, including some K8s Installations
+ locatorLocator = new SingleEndpointLocator(dnsString);
+ }
}
}
@@ -129,7 +129,7 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
}
protected final int maxIters() {
-
+
return locatorLocator.size();
}
@@ -166,7 +166,7 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
for (Endpoint endpoint : fr.value.getEndpoint()) {
epl.add(new EP(endpoint,latitude,longitude));
}
-
+
Collections.sort(epl);
replace(epl);
return true;
@@ -186,9 +186,9 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> {
protected URI getURI() {
return client.getURI();
}
-
+
protected HClient createClient(SecuritySetter<HttpURLConnection> ss, URI uri, int connectTimeout) throws LocatorException {
return new HClient(ss, uri, connectTimeout);
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java
index 9f537bd9..caa1fcc1 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLurPerm.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,11 +52,11 @@ import aaf.v2_0.Perms;
/**
* Use AAF Service as Permission Service.
- *
+ *
* This Lur goes after AAF Permissions, which are elements of Roles, not the Roles themselves.
- *
+ *
* If you want a simple Role Lur, use AAFRoleLur
- *
+ *
* @author Jonathan
*
*/
@@ -65,13 +65,13 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
/**
* Need to be able to transmutate a Principal into either Person or AppID, which are the only ones accepted at this
- * point by AAF. There is no "domain", aka, no "@att.com" in "ab1234@att.com".
- *
+ * point by AAF. There is no "domain", aka, no "@att.com" in "ab1234@att.com".
+ *
* The only thing that matters here for AAF is that we don't waste calls with IDs that obviously aren't valid.
* Thus, we validate that the ID portion follows the rules before we waste time accessing AAF remotely
- * @throws APIException
- * @throws URISyntaxException
- * @throws DME2Exception
+ * @throws APIException
+ * @throws URISyntaxException
+ * @throws DME2Exception
*/
// Package on purpose
AAFLurPerm(AAFCon<?> con) throws CadiException, APIException {
@@ -84,7 +84,7 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
super(con,auc);
attachOAuth2(con);
}
-
+
private void attachOAuth2(AAFCon<?> con) throws APIException {
String oauth2_url;
Class<?> tmcls = Config.loadClass(access,"org.osaaf.cadi.oauth.TokenMgr");
@@ -113,7 +113,7 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
final Holder<Float> remote = new Holder<Float>(0f);
final boolean[] success = new boolean[]{false};
-
+
try {
return aaf.best(new Retryable<User<AAFPermission>>() {
@Override
@@ -125,7 +125,7 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
sb.append("?force");
}
Future<Perms> fp = client.read(sb.toString(),aaf.permsDF);
-
+
// In the meantime, lookup User, create if necessary
User<AAFPermission> user = getUser(principal);
Principal p;
@@ -139,11 +139,11 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
} else {
p = principal;
}
-
+
if (user==null) {
addUser(user = new User<AAFPermission>(p,aaf.userExpires)); // no password
}
-
+
// OK, done all we can, now get content
boolean ok = fp.get(aaf.timeout);
remote.set(Timing.millis(remoteStart));
@@ -199,13 +199,13 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
"/authz/perms/user/"+name,
aaf.permsDF
);
-
+
// OK, done all we can, now get content
boolean ok = fp.get(aaf.timeout);
remote.set(Timing.millis(remoteStart));
if (ok) {
success.set(true);
- Map<String,Permission> newMap = user.newMap();
+ Map<String,Permission> newMap = user.newMap();
boolean willLog = aaf.access.willLog(Level.DEBUG);
for (Perm perm : fp.value.getPerm()) {
user.add(newMap, new AAFPermission(perm.getNs(),perm.getType(),perm.getInstance(),perm.getAction(),perm.getRoles()));
@@ -258,5 +258,5 @@ public class AAFLurPerm extends AbsAAFLur<AAFPermission> {
return new LocalPermission(p);
}
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
index 8f4fff67..314d5c1c 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFSingleLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,15 +28,15 @@ import org.onap.aaf.cadi.Locator;
import org.onap.aaf.cadi.LocatorException;
/**
- * This Locator good for using Inside Docker or K8s, where there is no real lookup,
- * and there is conflict between external and internal host names, due to
+ * This Locator good for using Inside Docker or K8s, where there is no real lookup,
+ * and there is conflict between external and internal host names, due to
* Service abstraction.
- *
+ *
* @author Instrumental(Jonathan)
*
*/
public class AAFSingleLocator implements Locator<URI> {
-
+
private final URI uri;
/**
@@ -44,12 +44,12 @@ public class AAFSingleLocator implements Locator<URI> {
* @param cont_ns
* @param prefix
* @param version
- * @throws URISyntaxException
+ * @throws URISyntaxException
*/
public AAFSingleLocator(final String uri) throws URISyntaxException {
this.uri = new URI(uri);
}
-
+
@Override
public URI get(Item item) throws LocatorException {
return uri;
@@ -87,10 +87,10 @@ public class AAFSingleLocator implements Locator<URI> {
@Override
public void destroy() {
}
-
+
private class SingleItem implements Item {
}
-
+
public static AAFSingleLocator create(Access access, String url) throws URISyntaxException {
return new AAFSingleLocator(url);
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java
index 81b55507..c7744407 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTaf.java
@@ -7,9 +7,9 @@
* 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.
@@ -58,7 +58,7 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
private AAFCon<CLIENT> aaf;
private boolean warn;
private MapBathConverter mapIds;
-
+
public AAFTaf(AAFCon<CLIENT> con, boolean turnOnWarning) {
super(con.access,con.cleanInterval,con.highCount, con.usageRefreshTriggerCount);
aaf = con;
@@ -73,7 +73,7 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
initMapBathConverter();
}
-
+
// Note: Needed for Creation of this Object with Generics
@SuppressWarnings("unchecked")
public AAFTaf(Connector mustBeAAFCon, boolean turnOnWarning, AbsUserCache<AAFPermission> other) {
@@ -133,10 +133,10 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
Miss miss = missed(bp.getName(), bp.getCred());
if (miss!=null && !miss.mayContinue()) {
return new BasicHttpTafResp(aaf.access,bp.getName(),buildMsg(bp,req,
- "User/Pass Retry limit exceeded"),
+ "User/Pass Retry limit exceeded"),
RESP.TRY_AUTHENTICATING,resp,aaf.getRealm(),true);
}
-
+
return aaf.bestForUser(
new GetSetter() {
@Override
@@ -159,11 +159,11 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
boolean rv= addMiss(bp.getName(),bp.getCred());
if (rv) {
return new BasicHttpTafResp(aaf.access,bp.getName(),buildMsg(bp,req,
- "user/pass combo invalid via AAF from " + req.getRemoteAddr()),
+ "user/pass combo invalid via AAF from " + req.getRemoteAddr()),
RESP.TRY_AUTHENTICATING,resp,aaf.getRealm(),true);
} else {
return new BasicHttpTafResp(aaf.access,bp.getName(),buildMsg(bp,req,
- "user/pass combo invalid via AAF from " + req.getRemoteAddr() + " - Retry limit exceeded"),
+ "user/pass combo invalid via AAF from " + req.getRemoteAddr() + " - Retry limit exceeded"),
RESP.FAIL,resp,aaf.getRealm(),true);
}
}
@@ -187,7 +187,7 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
}
return new BasicHttpTafResp(aaf.access,target,"Requesting HTTP Basic Authorization",RESP.TRY_AUTHENTICATING,resp,aaf.getRealm(),false);
}
-
+
private String buildMsg(Principal pr, HttpServletRequest req, Object... msg) {
StringBuilder sb = new StringBuilder();
for (Object s : msg) {
@@ -205,7 +205,7 @@ public class AAFTaf<CLIENT> extends AbsUserCache<AAFPermission> implements HttpT
}
-
+
public Resp revalidate(CachedPrincipal prin, Object state) {
// !!!! TEST THIS.. Things may not be revalidated, if not BasicPrincipal
if (prin instanceof BasicPrincipal) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java
index e3c1c9a3..e912fc53 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFTrustChecker.java
@@ -101,7 +101,7 @@ public class AAFTrustChecker implements TrustChecker {
if (user_info == null) {
return tresp;
}
-
+
tresp.getAccess().log(Level.DEBUG, user_info);
String[] info = Split.split(',', user_info);
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
index a654e6f6..06e2c62d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -111,15 +111,15 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
this.version = (split.length > 1) ? split[1] : access.getProperty(Config.AAF_API_VERSION,Config.AAF_DEFAULT_API_VERSION);
}
}
-
+
/**
* This is the way to setup specialized AAFLocators ahead of time.
* @param preload
*/
public static void setCreator(LocatorCreator lc) {
- locatorCreator = lc;
+ locatorCreator = lc;
}
-
+
public static Locator<URI> create(final String name, final String version) throws LocatorException {
if(locatorCreator==null) {
throw new LocatorException("LocatorCreator is not set");
@@ -142,9 +142,9 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
return locatorURI.toString();
}
}
-
+
/**
- * Setting "self" excludes this service from the list. Critical for contacting peers.
+ * Setting "self" excludes this service from the list. Critical for contacting peers.
*/
public void setSelf(final String hostname, final int port) {
myhostname=hostname;
@@ -161,10 +161,10 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
protected final synchronized void replace(List<EP> list) {
epList = list;
}
-
+
/**
* Call _refresh as needed during calls, but actual refresh will not occur if there
- * are existing entities or if it has been called in the last 10 (settable) seconds.
+ * are existing entities or if it has been called in the last 10 (settable) seconds.
* Timed Refreshes happen by Scheduled Thread
*/
private final boolean _refresh() {
@@ -220,7 +220,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
public void invalidate(Item item) throws LocatorException {
if (item!=null) {
if (item instanceof AAFLItem) {
- AAFLItem ali =(AAFLItem)item;
+ AAFLItem ali =(AAFLItem)item;
EP ep = ali.ep;
synchronized(epList) {
epList.remove(ep);
@@ -237,9 +237,9 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
public Item best() throws LocatorException {
if (!hasItems()) {
throw new LocatorException(String.format("No Entries found for '%s/%s:%s'",
- (aaf_locator_uri==null?aaf_locator_host:aaf_locator_uri.toString()),
- name,
- version));
+ (aaf_locator_uri==null?aaf_locator_host:aaf_locator_uri.toString()),
+ name,
+ version));
}
List<EP> lep = new ArrayList<>();
EP first = null;
@@ -274,7 +274,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
} else {
return new AAFLItem(iter,lep.get(i));
}
-
+
}
}
@@ -291,7 +291,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
private final Object[] epa;
private final List<EP> epList;
private int idx;
-
+
public EPIterator(Object[] epa, List<EP> epList) {
this.epa = epa;
this.epList = epList;
@@ -332,7 +332,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
}
}
}
-
+
@Override
public Item first() {
Iterator<EP> iter = getIterator();
@@ -370,18 +370,18 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
}
return null;
}
-
+
protected static class AAFLItem implements Item {
private Iterator<EP> iter;
private URI uri;
private EP ep;
-
+
public AAFLItem(Iterator<EP> iter, EP ep) {
this.iter = iter;
this.ep = ep;
uri = ep.uri;
}
-
+
private static EP next(Iterator<EP> iter) {
EP ep=null;
while (iter.hasNext() && (ep==null || !ep.valid)) {
@@ -389,7 +389,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
}
return ep;
}
-
+
public String toString() {
return ep==null?"Locator Item Invalid":ep.toString();
}
@@ -399,7 +399,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
private URI uri;
private final double distance;
private boolean valid;
-
+
public EP(final Endpoint ep, double latitude, double longitude) throws URISyntaxException {
uri = new URI(ep.getProtocol(),null,ep.getHostname(),ep.getPort(),null,null,null);
distance = GreatCircle.calc(latitude, longitude, ep.getLatitude(), ep.getLongitude());
@@ -420,13 +420,13 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
return 0;
}
}
-
+
@Override
public String toString() {
return distance + ": " + uri + (valid?" valid":" invalidate");
}
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.Locator#destroy()
*/
@@ -434,7 +434,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI>
public void destroy() {
// Nothing to do
}
-
+
@Override
public String toString() {
return "AAFLocator for " + name + " on " + getURI();
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java
index ac6fc063..8d42455c 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java
@@ -7,9 +7,9 @@
* 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.
@@ -67,12 +67,12 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
public void details(boolean on) {
details = on;
}
-
+
public void setPreemptiveLur(Lur preemptive) {
this.preemptiveLur = preemptive;
}
-
+
protected abstract User<PERM> loadUser(Principal bait);
@Override
@@ -92,9 +92,9 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
return false;
}
-
+
protected abstract boolean isCorrectPermType(Permission pond);
-
+
// This is where you build AAF CLient Code. Answer the question "Is principal "bait" in the "pond"
public boolean fish(Principal bait, Permission ... pond) {
if (preemptiveLur!=null && preemptiveLur.handles(bait)) {
@@ -235,7 +235,7 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
}
}
}
-
+
@Override
public void remove(String user) {
super.remove(user);
@@ -257,7 +257,7 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
}
/**
* This special case minimizes loops, avoids multiple Set hits, and calls all the appropriate Actions found.
- *
+ *
* @param bait
* @param obj
* @param type
@@ -279,7 +279,7 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
}
}
}
-
+
public static interface Action<A> {
public String getName();
/**
@@ -288,7 +288,7 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
*/
public boolean exec(A a);
}
-
+
private class ReuseAAFPermission extends AAFPermission {
public ReuseAAFPermission(String type, String instance) {
super(type,instance,null,null);
@@ -297,9 +297,9 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE
public void setAction(String s) {
action = s;
}
-
+
/**
- * This function understands that AAF Keys are hierarchical, :A:B:C,
+ * This function understands that AAF Keys are hierarchical, :A:B:C,
* Cassandra follows a similar method, so we'll short circuit and do it more efficiently when there isn't a first hit
* @return
*/
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
index 7d149fca..48109e47 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
@@ -7,9 +7,9 @@
* 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.
@@ -94,11 +94,11 @@ public class Agent {
public static final String PKCS12 = "pkcs12";
public static final String JKS = "jks";
private static final String SCRIPT="script";
-
+
private static final String CM_VER = "1.0";
public static final int PASS_SIZE = 24;
private static int TIMEOUT;
-
+
private static RosettaDF<CertificateRequest> reqDF;
private static RosettaDF<CertInfo> certDF;
private static RosettaDF<Artifacts> artifactsDF;
@@ -107,10 +107,10 @@ public class Agent {
private static ErrMessage errMsg;
private static Map<String,PlaceArtifact> placeArtifact;
private static RosettaEnv env;
-
+
private static boolean doExit;
private static AAFCon<?> aafcon;
-
+
private static List<String> CRED_TAGS = Arrays.asList(new String[] {
Config.CADI_KEYFILE,
Config.AAF_APPID, Config.AAF_APPPASS,
@@ -149,8 +149,8 @@ public class Agent {
} else {
try {
AAFSSO aafsso=null;
- PropAccess access=null;
-
+ PropAccess access=null;
+
String hasEtc = null;
for(String a : args) {
if(a.startsWith(Config.CADI_PROP_FILES)) {
@@ -165,7 +165,7 @@ public class Agent {
configNoPasswd=true;
}
}
-
+
if(access==null) {
if(args.length>1 && args[1].contains("@")) {
String domain = FQI.reverseDomain(args[1]);
@@ -181,9 +181,9 @@ public class Agent {
}
}
}
- }
+ }
}
-
+
if(access==null) {
for(Entry<Object, Object> es : System.getProperties().entrySet()) {
if(Config.CADI_PROP_FILES.equals(es.getKey())) {
@@ -194,7 +194,7 @@ public class Agent {
// When using Config file, check if Cred Exists, and if not, work with Deployer.
if(access!=null && !"config".equals(args[0]) && access.getProperty(Config.AAF_APPPASS)==null && access.getProperty(Config.CADI_ALIAS)==null) {
- // not enough credentials to use Props. Use AAFSSO
+ // not enough credentials to use Props. Use AAFSSO
access = null;
}
@@ -213,7 +213,7 @@ public class Agent {
if (args.length>1) {
if (!args[0].equals("keypairgen")) {
props.put(Config.AAF_APPID, args[1]);
- }
+ }
}
return props;
}
@@ -221,7 +221,7 @@ public class Agent {
access = aafsso.access();
}
}
-
+
if (aafsso!=null && aafsso.loginOnly()) {
aafsso.setLogDefault();
aafsso.writeFiles();
@@ -239,7 +239,7 @@ public class Agent {
access.setProperty(p.substring(0,eq), p.substring(eq+1));
}
}
-
+
if (cmds.size()==0) {
if (aafsso!=null) {
aafsso.setLogDefault();
@@ -262,28 +262,28 @@ public class Agent {
System.out.println(" ** Type with no params for Tool Help");
System.out.println(" ** If using with Agent, preface with \"cadi\"");
System.out.println(" cadi <cadi tool params, see -?>");
-
+
if (doExit) {
System.exit(1);
}
}
-
+
TIMEOUT = Integer.parseInt(env.getProperty(Config.AAF_CONN_TIMEOUT, "5000"));
-
+
reqDF = env.newDataFactory(CertificateRequest.class);
artifactsDF = env.newDataFactory(Artifacts.class);
certDF = env.newDataFactory(CertInfo.class);
configDF = env.newDataFactory(Configuration.class);
permDF = env.newDataFactory(Perms.class);
errMsg = new ErrMessage(env);
-
+
placeArtifact = new HashMap<>();
placeArtifact.put(JKS, new PlaceArtifactInKeystore(JKS));
placeArtifact.put(PKCS12, new PlaceArtifactInKeystore(PKCS12));
placeArtifact.put(FILE, new PlaceArtifactInFiles());
placeArtifact.put(PRINT, new PlaceArtifactOnStream(System.out));
placeArtifact.put(SCRIPT, new PlaceArtifactScripts());
-
+
Trans trans = env.newTrans();
String token;
if ((token=access.getProperty("oauth_token"))!=null) {
@@ -294,13 +294,13 @@ public class Agent {
// show Std out again
aafsso.setLogDefault();
aafsso.setStdErrDefault();
-
+
/*urls=*/loadURLs(access);
aafsso.writeFiles();
}
-
-
-
+
+
+
String cmd = cmds.removeFirst();
switch(cmd) {
case "place":
@@ -397,7 +397,7 @@ public class Agent {
lhost=Config.AAF_LOCATE_URL_TAG;
}
value = rph.replacements(AGENT_LOAD_URLS,
- proto + lhost + "/%CNS.%AAF_NS." + ("aaf".equals(u)?"service":u) + ':' + version,
+ proto + lhost + "/%CNS.%AAF_NS." + ("aaf".equals(u)?"service":u) + ':' + version,
null,dot_le);
if(append!=null) {
value+=append;
@@ -457,7 +457,7 @@ public class Agent {
}
return alias!=null?alias:AAFSSO.cons.readLine("AppID: ");
}
- return cmds.removeFirst();
+ return cmds.removeFirst();
}
private static String machine(Deque<String> cmds) throws UnknownHostException {
@@ -489,7 +489,7 @@ public class Agent {
arti.setMechid(mechID!=null?mechID:AAFSSO.cons.readLine("AppID: "));
arti.setMachine(machine!=null?machine:AAFSSO.cons.readLine("Machine (%s): ",InetAddress.getLocalHost().getHostName()));
arti.setCa(AAFSSO.cons.readLine("CA: (%s): ","aaf"));
-
+
String resp = AAFSSO.cons.readLine("Types [file,pkcs12,jks,script] (%s): ", PKCS12);
for (String s : Split.splitTrim(',', resp)) {
arti.getType().add(s);
@@ -506,7 +506,7 @@ public class Agent {
arti.setOsUser(AAFSSO.cons.readLine("OS User (%s): ", System.getProperty("user.name")));
arti.setRenewDays(Integer.parseInt(AAFSSO.cons.readLine("Renewal Days (%s):", "30")));
arti.setNotification(toNotification(AAFSSO.cons.readLine("Notification (mailto owner):", "")));
-
+
TimeTaken tt = trans.start("Create Artifact", Env.REMOTE);
try {
Future<Artifacts> future = aafcon.client(CM_VER).create("/cert/artifacts", artifactsDF, artifacts);
@@ -531,7 +531,7 @@ public class Agent {
}
return notification;
}
-
+
private static void readArtifact(Trans trans, AAFCon<?> aafcon, Deque<String> cmds) throws Exception {
String mechID = fqi(cmds);
@@ -541,14 +541,14 @@ public class Agent {
try {
Future<Artifacts> future = aafcon.client(CM_VER)
.read("/cert/artifacts/"+mechID+'/'+machine, artifactsDF,"Authorization","Bearer " + trans.getProperty("oauth_token"));
-
+
if (future.get(TIMEOUT)) {
boolean printed = false;
for (Artifact a : future.value.getArtifact()) {
- AAFSSO.cons.printf("AppID: %s\n",a.getMechid());
- AAFSSO.cons.printf(" Sponsor: %s\n",a.getSponsor());
- AAFSSO.cons.printf("Machine: %s\n",a.getMachine());
- AAFSSO.cons.printf("CA: %s\n",a.getCa());
+ AAFSSO.cons.printf("AppID: %s\n",a.getMechid());
+ AAFSSO.cons.printf(" Sponsor: %s\n",a.getSponsor());
+ AAFSSO.cons.printf("Machine: %s\n",a.getMachine());
+ AAFSSO.cons.printf("CA: %s\n",a.getCa());
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String t : a.getType()) {
@@ -557,7 +557,7 @@ public class Agent {
sb.append(t);
}
AAFSSO.cons.printf("Types: %s\n",sb);
- AAFSSO.cons.printf("Namespace: %s\n",a.getNs());
+ AAFSSO.cons.printf("Namespace: %s\n",a.getNs());
AAFSSO.cons.printf("Directory: %s\n",a.getDir());
AAFSSO.cons.printf("O/S User: %s\n",a.getOsUser());
AAFSSO.cons.printf("Renew Days: %d\n",a.getRenewDays());
@@ -574,7 +574,7 @@ public class Agent {
tt.done();
}
}
-
+
private static void copyArtifact(Trans trans, AAFCon<?> aafcon, Deque<String> cmds) throws Exception {
String mechID = fqi(cmds);
String machine = machine(cmds);
@@ -586,7 +586,7 @@ public class Agent {
try {
Future<Artifacts> future = aafcon.client(CM_VER)
.read("/cert/artifacts/"+mechID+'/'+machine, artifactsDF);
-
+
if (future.get(TIMEOUT)) {
boolean printed = false;
for (Artifact a : future.value.getArtifact()) {
@@ -599,7 +599,7 @@ public class Agent {
trans.error().printf("Call to AAF Certman failed, %s",
errMsg.toMsg(fup));
}
-
+
printed = true;
}
}
@@ -623,13 +623,13 @@ public class Agent {
try {
Future<Artifacts> fread = aafcon.client(CM_VER)
.read("/cert/artifacts/"+mechID+'/'+machine, artifactsDF);
-
+
if (fread.get(TIMEOUT)) {
Artifacts artifacts = new Artifacts();
for (Artifact a : fread.value.getArtifact()) {
Artifact arti = new Artifact();
artifacts.getArtifact().add(arti);
-
+
AAFSSO.cons.printf("For %s on %s\n", a.getMechid(),a.getMachine());
arti.setMechid(a.getMechid());
arti.setMachine(a.getMachine());
@@ -641,7 +641,7 @@ public class Agent {
else{sb.append(',');}
sb.append(t);
}
-
+
String resp = AAFSSO.cons.readLine("Types [file,jks,pkcs12] (%s): ", sb);
for (String s : Split.splitTrim(',', resp)) {
arti.getType().add(s);
@@ -657,7 +657,7 @@ public class Agent {
arti.setOsUser(AAFSSO.cons.readLine("OS User (%s): ", a.getOsUser()));
arti.setRenewDays(Integer.parseInt(AAFSSO.cons.readLine("Renew Days (%s):", a.getRenewDays())));
arti.setNotification(toNotification(AAFSSO.cons.readLine("Notification (%s):", a.getNotification())));
-
+
}
if (artifacts.getArtifact().size()==0) {
AAFSSO.cons.printf("Artifact for %s %s does not exist", mechID, machine);
@@ -678,16 +678,16 @@ public class Agent {
tt.done();
}
}
-
+
private static void deleteArtifact(Trans trans, AAFCon<?> aafcon, Deque<String> cmds) throws Exception {
String mechid = fqi(cmds);
String machine = machine(cmds);
-
+
TimeTaken tt = trans.start("Delete Artifact", Env.REMOTE);
try {
Future<Void> future = aafcon.client(CM_VER)
.delete("/cert/artifacts/"+mechid+"/"+machine,"application/json" );
-
+
if (future.get(TIMEOUT)) {
trans.info().printf("Call to AAF Certman successful %s, %s",mechid,machine);
} else {
@@ -699,7 +699,7 @@ public class Agent {
}
}
-
+
private static boolean placeCerts(Trans trans, AAFCon<?> aafcon, Deque<String> cmds) throws Exception {
boolean rv = false;
@@ -713,7 +713,7 @@ public class Agent {
} else {
key = machine;
}
-
+
TimeTaken tt = trans.start("Place Artifact", Env.REMOTE);
try {
Future<Artifacts> acf = aafcon.client(CM_VER)
@@ -761,7 +761,7 @@ public class Agent {
}
return rv;
}
-
+
private static void notifyPlaced(Artifact a, boolean rv) {
}
@@ -783,10 +783,10 @@ public class Agent {
boolean allowed;
for (Artifact a : acf.value.getArtifact()) {
allowed = id!=null && (id.equals(a.getSponsor()) ||
- (id.equals(a.getMechid())
+ (id.equals(a.getMechid())
&& aafcon.securityInfo().defSS.getClass().isAssignableFrom(HBasicAuthSS.class)));
if (!allowed) {
- Future<String> pf = aafcon.client(CM_VER).read("/cert/may/" +
+ Future<String> pf = aafcon.client(CM_VER).read("/cert/may/" +
a.getNs()+"|certman|"+a.getCa()+"|showpass","*/*");
if (pf.get(TIMEOUT)) {
allowed = true;
@@ -809,11 +809,11 @@ public class Agent {
} finally {
fis.close();
}
-
+
File f = new File(dir,a.getNs()+".keyfile");
if (f.exists()) {
Symm symm = ArtifactDir.getSymm(f);
-
+
for (Iterator<Entry<Object,Object>> iter = props.entrySet().iterator(); iter.hasNext();) {
Entry<Object,Object> en = iter.next();
if (en.getValue().toString().startsWith("enc:")) {
@@ -835,13 +835,13 @@ public class Agent {
}
}
-
+
private static void keypairGen(final Trans trans, final PropAccess access, final Deque<String> cmds) throws IOException {
final String fqi = fqi(cmds);
final String ns = FQI.reverseDomain(fqi);
File dir = new File(access.getProperty(Config.CADI_ETCDIR,".")); // default to current Directory
File f = new File(dir,ns+".key");
-
+
if (f.exists()) {
String line = AAFSSO.cons.readLine("%s exists. Overwrite? (y/n): ", f.getCanonicalPath());
if (!"Y".equalsIgnoreCase(line)) {
@@ -849,7 +849,7 @@ public class Agent {
return;
}
}
-
+
KeyPair kp = Factory.generateKeyPair(trans);
ArtifactDir.write(f, Chmod.to400, Factory.toString(trans, kp.getPrivate()));
System.out.printf("Wrote %s\n", f.getCanonicalFile());
@@ -858,7 +858,7 @@ public class Agent {
ArtifactDir.write(f, Chmod.to644, Factory.toString(trans, kp.getPublic()));
System.out.printf("Wrote %s\n", f.getCanonicalFile());
}
-
+
private static void config(Trans trans, PropAccess propAccess, String[] args, Deque<String> cmds) throws Exception {
TimeTaken tt = trans.start("Get Configuration", Env.REMOTE);
try {
@@ -880,7 +880,7 @@ public class Agent {
for (String tag : LOC_TAGS) {
loc.add(tag, getProperty(propAccess, trans, false, tag, "%s: ",tag));
}
-
+
String keyfile = cred.getKeyPath();
if(keyfile!=null) {
File fkeyfile = new File(keyfile);
@@ -901,13 +901,13 @@ public class Agent {
}
}
}
-
+
// load all properties that are already setup.
Map<String, String> aaf_urls = loadURLs(propAccess);
for(Entry<String, String> es : aaf_urls.entrySet()) {
app.add(es.getKey(), es.getValue());
}
-
+
app.add(Config.AAF_LOCATE_URL, Config.getAAFLocateUrl(propAccess));
app.add(Config.AAF_ENV,propAccess, "DEV");
String release = propAccess.getProperty(Config.AAF_DEPLOYED_VERSION);
@@ -923,7 +923,7 @@ public class Agent {
app.add(key, aaf_loc_prop.getValue().toString());
}
}
-
+
app.add(Config.AAF_APPID, fqi);
String cts = propAccess.getProperty(Config.CADI_TRUSTSTORE);
@@ -941,7 +941,7 @@ public class Agent {
if (fcpf.exists()) {
int lastSep = cts.lastIndexOf(File.pathSeparator);
origTruststore = new File(fcpf.getParentFile(),lastSep>=0?cts.substring(lastSep):cts);
- if (origTruststore.exists()) {
+ if (origTruststore.exists()) {
break;
}
}
@@ -950,7 +950,7 @@ public class Agent {
throw new CadiException(cts + " does not exist");
}
}
-
+
}
if (!newTruststore.exists() && origTruststore.exists()) {
Files.copy(origTruststore.toPath(), newTruststore.toPath());
@@ -960,14 +960,14 @@ public class Agent {
System.out.println("New Truststore is " + newTruststore);
cred.add(Config.CADI_TRUSTSTORE, newTruststore.getCanonicalPath());
cred.add(Config.CADI_TRUSTSTORE_PASSWORD, "changeit" /* Java default */);
-
+
String cpf = propAccess.getProperty(Config.CADI_PROP_FILES);
if (cpf!=null){
- String[] propFiles = Split.splitTrim(File.pathSeparatorChar, cpf);
+ String[] propFiles = Split.splitTrim(File.pathSeparatorChar, cpf);
for (int pfi = propFiles.length-1;pfi>=0;--pfi) {
String f = propFiles[pfi];
System.out.format("Reading %s\n",f);
- FileInputStream fis = new FileInputStream(f);
+ FileInputStream fis = new FileInputStream(f);
try {
Properties props = new Properties();
props.load(fis);
@@ -1010,7 +1010,7 @@ public class Agent {
}
}
}
-
+
PropHolder.writeAll();
} finally {
tt.done();
@@ -1062,12 +1062,12 @@ public class Agent {
/**
* Check returns Error Codes, so that Scripts can know what to do
- *
+ *
* 0 - Check Complete, nothing to do
* 1 - General Error
* 2 - Error for specific Artifact - read check.msg
* 10 - Certificate Updated - check.msg is email content
- *
+ *
* @param trans
* @param aafcon
* @param cmds
@@ -1078,10 +1078,10 @@ public class Agent {
int exitCode=1;
String mechID = fqi(cmds);
String machine = machine(cmds);
-
+
TimeTaken tt = trans.start("Check Certificate", Env.REMOTE);
try {
-
+
Future<Artifacts> acf = aafcon.client(CM_VER)
.read("/cert/artifacts/"+mechID+'/'+machine, artifactsDF);
if (acf.get(TIMEOUT)) {
@@ -1102,10 +1102,10 @@ public class Agent {
} finally {
fis.close();
}
-
- String prop;
+
+ String prop;
File f;
-
+
if ((prop=trans.getProperty(Config.CADI_KEYFILE))==null ||
!(f=new File(prop)).exists()) {
trans.error().printf("Keyfile must exist to check Certificates for %s on %s",
@@ -1120,7 +1120,7 @@ public class Agent {
Symm symm = ArtifactDir.getSymm(f);
KeyStore ks = KeyStore.getInstance("JKS");
-
+
fis = new FileInputStream(ksf);
try {
ks.load(fis,symm.depass(ksps).toCharArray());
@@ -1140,21 +1140,21 @@ public class Agent {
renew.setTime(cert.getNotAfter());
renew.add(GregorianCalendar.DAY_OF_MONTH,-1*a.getRenewDays());
if (renew.after(now)) {
- msg = String.format("X509Certificate for %s on %s has been checked on %s. It expires on %s; it will not be renewed until %s.\n",
+ msg = String.format("X509Certificate for %s on %s has been checked on %s. It expires on %s; it will not be renewed until %s.\n",
a.getMechid(), a.getMachine(),Chrono.dateOnlyStamp(now),cert.getNotAfter(),Chrono.dateOnlyStamp(renew));
trans.info().log(msg);
exitCode = 0; // OK
} else {
- trans.info().printf("X509Certificate for %s on %s expiration, %s, needs Renewal.\n",
+ trans.info().printf("X509Certificate for %s on %s expiration, %s, needs Renewal.\n",
a.getMechid(), a.getMachine(),cert.getNotAfter());
cmds.offerLast(mechID);
cmds.offerLast(machine);
if (placeCerts(trans,aafcon,cmds)) {
- msg = String.format("X509Certificate for %s on %s has been renewed. Ensure services using are refreshed.\n",
+ msg = String.format("X509Certificate for %s on %s has been renewed. Ensure services using are refreshed.\n",
a.getMechid(), a.getMachine());
exitCode = 10; // Refreshed
} else {
- msg = String.format("X509Certificate for %s on %s attempted renewal, but failed. Immediate Investigation is required!\n",
+ msg = String.format("X509Certificate for %s on %s attempted renewal, but failed. Immediate Investigation is required!\n",
a.getMechid(), a.getMachine());
exitCode = 1; // Error Renewing
}
@@ -1169,7 +1169,7 @@ public class Agent {
}
}
}
-
+
}
}
}
@@ -1185,7 +1185,7 @@ public class Agent {
}
}
-
-
+
+
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java
index 0971ae0c..31a2410d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,19 +42,19 @@ public abstract class ArtifactDir implements PlaceArtifact {
protected static final String C_R = "\n";
protected File dir;
-
+
// This checks for multiple passes of Dir on the same objects. Run clear after done.
protected final static Map<String,Object> processed = new HashMap<>();
private static final Map<String, Symm> symms = new HashMap<>();
-
+
/**
- * Note: Derived Classes should ALWAYS call "super.place(cert,arti)" first, and
+ * Note: Derived Classes should ALWAYS call "super.place(cert,arti)" first, and
* then "placeProperties(arti)" just after they implement
*/
@Override
public final boolean place(Trans trans, CertInfo certInfo, Artifact arti, String machine) throws CadiException {
validate(arti);
-
+
try {
PropHolder cred = PropHolder.get(arti,"cred.props");
@@ -67,7 +67,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
throw new CadiException("Could not create " + dir);
}
}
-
+
// Obtain Issuers
boolean first = true;
StringBuilder issuers = new StringBuilder();
@@ -83,9 +83,9 @@ public abstract class ArtifactDir implements PlaceArtifact {
cred.addEnc("Challenge", certInfo.getChallenge());
}
-
+
_place(trans, certInfo,arti);
-
+
processed.put("dir",dir);
} catch (Exception e) {
@@ -106,7 +106,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
public static void write(File f, Chmod c, String ... data) throws IOException {
System.out.println("Writing file " + f.getCanonicalPath());
f.setWritable(true,true);
-
+
FileOutputStream fos = new FileOutputStream(f);
PrintStream ps = new PrintStream(fos);
try {
@@ -122,7 +122,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
public static void write(File f, Chmod c, byte[] bytes) throws IOException {
System.out.println("Writing file " + f.getCanonicalPath());
f.setWritable(true,true);
-
+
FileOutputStream fos = new FileOutputStream(f);
try {
fos.write(bytes);
@@ -131,11 +131,11 @@ public abstract class ArtifactDir implements PlaceArtifact {
c.chmod(f);
}
}
-
+
public static void write(File f, Chmod c, KeyStore ks, char[] pass ) throws IOException, CadiException {
System.out.println("Writing file " + f.getCanonicalPath());
f.setWritable(true,true);
-
+
FileOutputStream fos = new FileOutputStream(f);
try {
ks.store(fos, pass);
@@ -156,7 +156,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
// } else {
// System.out.println("Encryptor using " + f.getCanonicalPath());
}
- symm = Symm.obtain(f);
+ symm = Symm.obtain(f);
symms.put(f.getCanonicalPath(),symm);
}
return symm;
@@ -174,7 +174,7 @@ public abstract class ArtifactDir implements PlaceArtifact {
}
sb.append("File Artifacts require an AAF Namespace");
}
-
+
if (sb.length()>0) {
throw new CadiException(sb.toString());
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java
index 526673e3..889acf11 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/CertException.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ package org.onap.aaf.cadi.configure;
public class CertException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = 1373028409048516401L;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java
index 642b2d29..775e2246 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Factory.java
@@ -7,9 +7,9 @@
* 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.
@@ -79,8 +79,8 @@ public class Factory {
private static final KeyFactory keyFactory;
private static final CertificateFactory certificateFactory;
private static final SecureRandom random;
-
-
+
+
private static final Symm base64 = Symm.base64.copy(64);
static {
@@ -103,7 +103,7 @@ public class Factory {
e.printStackTrace(System.err);
};
keyFactory = tempKeyFactory;
-
+
CertificateFactory tempCertificateFactory;
try {
tempCertificateFactory = CertificateFactory.getInstance("X.509");
@@ -113,7 +113,7 @@ public class Factory {
}
certificateFactory = tempCertificateFactory;
-
+
}
@@ -131,7 +131,7 @@ public class Factory {
tt.done();
}
}
- }
+ }
private static final String LINE_END = "-----\n";
@@ -145,7 +145,7 @@ public class Factory {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
base64.encode(bais, baos);
sb.append(new String(baos.toByteArray()));
-
+
if (sb.charAt(sb.length()-1)!='\n') {
sb.append('\n');
}
@@ -154,7 +154,7 @@ public class Factory {
sb.append(LINE_END);
return sb.toString();
}
-
+
public static PrivateKey toPrivateKey(Trans trans, String pk) throws IOException, CertException {
byte[] bytes = decode(new StringReader(pk), null);
return toPrivateKey(trans, bytes);
@@ -202,7 +202,7 @@ public class Factory {
tt.done();
}
}
-
+
public static String toString(Trans trans, PublicKey pk) throws IOException {
trans.debug().log("Public Key to String");
return textBuilder("PUBLIC KEY",pk.getEncoded());
@@ -211,7 +211,7 @@ public class Factory {
public static Collection<? extends Certificate> toX509Certificate(String x509) throws CertificateException {
return toX509Certificate(x509.getBytes());
}
-
+
public static Collection<? extends Certificate> toX509Certificate(List<String> x509s) throws CertificateException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
@@ -265,7 +265,7 @@ public class Factory {
}
public static Cipher pkCipher() throws NoSuchAlgorithmException, NoSuchPaddingException {
- return Cipher.getInstance(KEY_ALGO);
+ return Cipher.getInstance(KEY_ALGO);
}
public static Cipher pkCipher(Key key, boolean encrypt) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException {
@@ -277,7 +277,7 @@ public class Factory {
public static byte[] strip(Reader rdr) throws IOException {
return strip(rdr,null);
}
-
+
public static byte[] strip(Reader rdr, Holder<String> hs) throws IOException {
BufferedReader br = new BufferedReader(rdr);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -317,7 +317,7 @@ public class Factory {
}
created = null;
}
-
+
public StripperInputStream(File file) throws FileNotFoundException {
this(new FileReader(file));
created = br;
@@ -365,7 +365,7 @@ public class Factory {
private byte duo[];
private int idx;
-
+
public Base64InputStream(File file) throws FileNotFoundException {
this(new FileInputStream(file));
created = is;
@@ -390,7 +390,7 @@ public class Factory {
}
idx=0;
}
-
+
return duo[idx++];
}
@@ -411,7 +411,7 @@ public class Factory {
Symm.base64.decode(bais, baos);
return baos.toByteArray();
}
-
+
public static byte[] decode(File f, Holder<String> hs) throws IOException {
FileReader fr = new FileReader(f);
try {
@@ -464,12 +464,12 @@ public class Factory {
return sig.verify(signature);
} finally {
tt.done();
- }
+ }
}
/**
* Get the Security Provider, or, if not exists yet, attempt to load
- *
+ *
* @param providerType
* @param params
* @return
@@ -480,7 +480,7 @@ public class Factory {
if (p!=null) {
switch(providerType) {
case "PKCS12":
-
+
break;
case "PKCS11": // PKCS11 only known to be supported by Sun
try {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java
index 2d7d3124..febe01e2 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifact.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java
index 93c5a12a..d3a3e393 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInFiles.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,11 +38,11 @@ public class PlaceArtifactInFiles extends ArtifactDir {
File f = new File(dir,arti.getNs()+".crt");
// In Version 1.0, App Cert is first
write(f,Chmod.to644,certInfo.getCerts().get(0),C_R);
-
+
// Setup Private Key
f = new File(dir,arti.getNs()+".key");
write(f,Chmod.to400,certInfo.getPrivatekey(),C_R);
-
+
} catch (Exception e) {
throw new CadiException(e);
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java
index 18d74fba..31ca3275 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java
@@ -7,9 +7,9 @@
* 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.
@@ -57,12 +57,12 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
if (fks.exists()) {
File backup = File.createTempFile(fks.getName()+'.', ".backup",dir);
fks.renameTo(backup);
- }
+ }
// Get the Cert(s)... Might include Trust store
Collection<? extends Certificate> certColl = Factory.toX509Certificate(certInfo.getCerts());
// find where the trusts end in 1.0 API
-
+
X509Certificate x509;
List<X509Certificate> chainList = new ArrayList<>();
Set<X509Certificate> caSet = new HashSet<>();
@@ -73,7 +73,7 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
if (x509.getSubjectDN().equals(x509.getIssuerDN())) {
caSet.add(x509);
} else {
- // Expect Certs in Trust Chain Order.
+ // Expect Certs in Trust Chain Order.
if(curr==null) {
chainList.add(x509);
curr=x509;
@@ -103,12 +103,12 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
props.add(Config.CADI_KEYSTORE_PASSWORD+'_'+ext,encP);
char[] keystorePassArray = keystorePass.toCharArray();
jks.load(null,keystorePassArray); // load in
-
+
// Add Private Key/Cert Entry for App
// Note: Java SSL security classes, while having a separate key from keystore,
- // is documented to not actually work.
+ // is documented to not actually work.
// java.security.UnrecoverableKeyException: Cannot recover key
- // You can create a custom Key Manager to make it work, but Practicality
+ // You can create a custom Key Manager to make it work, but Practicality
// dictates that you live with the default, meaning, they are the same
String keyPass = keystorePass; //Symm.randomGen(CmAgent.PASS_SIZE);
PrivateKey pk = Factory.toPrivateKey(trans, certInfo.getPrivatekey());
@@ -118,38 +118,38 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
// if (kst.equals("pkcs12")) {
// // Friendly Name
// attribs.add(new PKCS12Attribute("1.2.840.113549.1.9.20", arti.getNs()));
-// }
-//
- KeyStore.ProtectionParameter protParam =
+// }
+//
+ KeyStore.ProtectionParameter protParam =
new KeyStore.PasswordProtection(keyPass.toCharArray());
-
+
Certificate[] trustChain = new Certificate[chainList.size()];
chainList.toArray(trustChain);
- KeyStore.PrivateKeyEntry pkEntry =
+ KeyStore.PrivateKeyEntry pkEntry =
new KeyStore.PrivateKeyEntry(pk, trustChain);
- jks.setEntry(arti.getMechid(),
+ jks.setEntry(arti.getMechid(),
pkEntry, protParam);
// Write out
write(fks,Chmod.to644,jks,keystorePassArray);
-
+
// Change out to TrustStore
// NOTE: PKCS12 does NOT support Trusted Entries. Put in JKS Always
fks = new File(dir,arti.getNs()+".trust.jks");
if (fks.exists()) {
File backup = File.createTempFile(fks.getName()+'.', ".backup",dir);
fks.renameTo(backup);
- }
+ }
jks = KeyStore.getInstance(Agent.JKS);
-
+
// Set Truststore Password
props.add(Config.CADI_TRUSTSTORE,fks.getAbsolutePath());
String trustStorePass = Symm.randomGen(Agent.PASS_SIZE);
props.addEnc(Config.CADI_TRUSTSTORE_PASSWORD,trustStorePass);
char[] truststorePassArray = trustStorePass.toCharArray();
jks.load(null,truststorePassArray); // load in
-
+
// Add Trusted Certificates, but PKCS12 doesn't support
Certificate[] trustCAs = new Certificate[caSet.size()];
caSet.toArray(trustCAs);
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java
index fcc1f623..2dc38825 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactOnStream.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java
index 05ffdbfe..48f0e622 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactScripts.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,7 +47,7 @@ public class PlaceArtifactScripts extends ArtifactDir {
} else {
email=arti.getOsUser() + '\n';
}
-
+
StringBuilder classpath = new StringBuilder();
boolean first = true;
for (String pth : Split.split(File.pathSeparatorChar, System.getProperty("java.class.path"))) {
@@ -59,13 +59,13 @@ public class PlaceArtifactScripts extends ArtifactDir {
File f = new File(pth);
classpath.append(f.getCanonicalPath().replaceAll("[0-9]+\\.[0-9]+\\.[0-9]+",Defaults.AAF_VERSION+".*"));
}
-
+
write(f1,Chmod.to644,
"#!/bin/bash " + f1.getCanonicalPath()+'\n',
"# Certificate Manager Check Script\n",
"# Check on Certificate, and renew if needed.\n",
"# Generated by Certificate Manager " + Chrono.timeStamp()+'\n',
- "# by Deployer " + trans.getProperty(Config.AAF_APPID,"") + '\n',
+ "# by Deployer " + trans.getProperty(Config.AAF_APPID,"") + '\n',
"#\n",
"DIR="+arti.getDir()+'\n',
"APP_ID=" + arti.getMechid() + '\n',
@@ -80,7 +80,7 @@ public class PlaceArtifactScripts extends ArtifactDir {
"fi\n",
checkScript
);
-
+
// Setup check.sh script
File f2 = new File(dir,arti.getNs()+".crontab.sh");
write(f2,Chmod.to644,
@@ -100,9 +100,9 @@ public class PlaceArtifactScripts extends ArtifactDir {
}
return true;
}
-
+
/**
- * Note: java.home gets Absolute Path of Java, where we probably want soft links from
+ * Note: java.home gets Absolute Path of Java, where we probably want soft links from
* JAVA_HOME
* @return
*/
@@ -110,7 +110,7 @@ public class PlaceArtifactScripts extends ArtifactDir {
String rc = System.getenv("JAVA_HOME");
return rc==null?System.getProperty("java.home"):rc;
}
- private final static String checkScript =
+ private final static String checkScript =
"function mailit {\n" +
" if [ -e /bin/mail ]; then\n" +
" MAILER=/bin/mail\n" +
@@ -150,8 +150,8 @@ public class PlaceArtifactScripts extends ArtifactDir {
" ;;\n" +
" esac\n\n" +
" # Note: make sure to cover this sripts' exit Code\n";
-
- private final static String cronScript =
+
+ private final static String cronScript =
"crontab -l | sed -n \"/#### BEGIN $CF/,/END $CF ####/!p\" > $TFILE\n" +
"# Note: Randomize Minutes (0-60) and hours (1-4)\n" +
"echo \"#### BEGIN $CF ####\" >> $TFILE\n" +
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
index 3140df61..a0bd6e8b 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
@@ -7,9 +7,9 @@
* 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.
@@ -68,10 +68,10 @@ public class PropHolder {
if(ph == null) {
ph = new PropHolder(dir,file,new File(dir,arti.getNs()+".keyfile"));
propHolders.put(file.getAbsolutePath(), ph);
- }
+ }
return ph;
}
-
+
private PropHolder(File dir, File file, File keyfile) throws IOException {
this.dir = dir;
this.file = file;
@@ -79,11 +79,11 @@ public class PropHolder {
symm = null;
props = new TreeMap<>();
}
-
+
public String getPath() {
return file.getAbsolutePath();
}
-
+
public File getDir() {
return dir;
}
@@ -125,7 +125,7 @@ public class PropHolder {
}
addEnc(tag,pwd);
}
-
+
public void write() throws IOException {
if (props.size()==0) {
return;
@@ -138,7 +138,7 @@ public class PropHolder {
} else {
System.out.println("Creating new " + file.getCanonicalPath());
}
-
+
// Append if not first
PrintWriter pw = new PrintWriter(new FileWriter(file));
try {
@@ -157,7 +157,7 @@ public class PropHolder {
pw.print('#');
}
pw.println();
-
+
for (Map.Entry<String,String> me : props.entrySet()) {
String key = me.getKey();
pw.print(key);
@@ -169,13 +169,13 @@ public class PropHolder {
}
Chmod.to644.chmod(file);
}
-
+
public static void writeAll() throws IOException {
for(PropHolder ph : propHolders.values()) {
ph.write();
}
}
-
+
@Override
public String toString() {
return file.getAbsolutePath() + ": " + props;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java
index f3ff3898..099ea282 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AAFToken.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,7 +29,7 @@ import org.onap.aaf.cadi.Hash;
public class AAFToken {
private static final int CAPACITY = (Long.SIZE*2+Byte.SIZE*3)/8;
- private static final SecureRandom sr = new SecureRandom();
+ private static final SecureRandom sr = new SecureRandom();
public static final String toToken(UUID uuid) {
long lsb = uuid.getLeastSignificantBits();
@@ -67,7 +67,7 @@ public class AAFToken {
long lsb = bb.getLong();
byte b3 = (byte)(0x3F&bb.get());
int sum=35;
-
+
for (int i=0;i<Long.SIZE;i+=8) {
sum+=((lsb>>i) & 0xFF);
}
@@ -78,9 +78,9 @@ public class AAFToken {
if (b1!=((byte)sum) ||
b2!=((byte)(sum>>8)) ||
b3!=((byte)((sum>>16)))) {
- return null; // not a CADI Token
+ return null; // not a CADI Token
}
return new UUID(msb, lsb);
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java
index 29d0933c..7dfb44d5 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/AbsOTafLur.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,7 +41,7 @@ public abstract class AbsOTafLur {
protected final PropAccess access;
protected final String client_id;
protected static Pool<TokenClient> tokenClientPool;
-
+
protected AbsOTafLur(final PropAccess access, final String token_url, final String introspect_url) throws CadiException {
this.access = access;
String ci;
@@ -68,18 +68,18 @@ public abstract class AbsOTafLur {
private TokenClientFactory tcf;
private final int timeout;
private final String url,enc_secret;
-
- public TCCreator(PropAccess access) throws CadiException {
+
+ public TCCreator(PropAccess access) throws CadiException {
try {
tcf = TokenClientFactory.instance(access);
} catch (APIException | GeneralSecurityException | IOException e1) {
throw new CadiException(e1);
}
-
+
if ((url = access.getProperty(Config.AAF_OAUTH2_TOKEN_URL,null))==null) {
throw new CadiException(Config.AAF_OAUTH2_TOKEN_URL + REQUIRED_FOR_OAUTH2);
}
-
+
try {
timeout = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
} catch (NumberFormatException e) {
@@ -89,7 +89,7 @@ public abstract class AbsOTafLur {
throw new CadiException(Config.AAF_APPPASS + REQUIRED_FOR_OAUTH2);
}
}
-
+
@Override
public TokenClient create() throws APIException {
try {
@@ -121,14 +121,14 @@ public abstract class AbsOTafLur {
public void destroy() {
tkMgr.close();
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.Lur#clear(java.security.Principal, java.lang.StringBuilder)
*/
public void clear(Principal p, StringBuilder report) {
tkMgr.clear(p, report);
}
-
-
+
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java
index 0e57dee8..10a975b8 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/HRenewingTokenSS.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,11 +40,11 @@ public class HRenewingTokenSS extends HAuthorizationHeader {
private final TokenClient tc;
private final String[] scopes;
private final String tokenURL;
-
+
public HRenewingTokenSS(final PropAccess access, final String tokenURL, final String ... nss) throws CadiException, IOException, GeneralSecurityException {
this(access,SecurityInfoC.instance(access, HttpURLConnection.class),tokenURL,nss);
}
-
+
public HRenewingTokenSS(final PropAccess access, final SecurityInfoC<HttpURLConnection> si, final String tokenURL, final String ... nss) throws CadiException, IOException, GeneralSecurityException {
super(si,null,null/*Note: HeadValue overloaded */);
this.tokenURL = tokenURL;
@@ -62,7 +62,7 @@ public class HRenewingTokenSS extends HAuthorizationHeader {
}
}
if (hasDefault) {
- scopes=nss;
+ scopes=nss;
} else {
String[] nssPlus = new String[nss.length+1];
nssPlus[0]=defaultNS;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java
index 27e92142..e22eed0b 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTaf.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,7 +48,7 @@ public class OAuth2HttpTaf implements HttpTaf {
this.tmgr = tmgr;
this.access = access;
}
-
+
@Override
public TafResp validate(LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
String authz = req.getHeader("Authorization");
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java
index 4fa58700..cc0d26bc 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2HttpTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,23 +35,23 @@ public class OAuth2HttpTafResp extends AbsTafResp implements TafResp {
private HttpServletResponse httpResp;
private RESP status;
private final boolean wasFailed;
-
+
public OAuth2HttpTafResp(Access access, OAuth2Principal principal, String desc, RESP status, HttpServletResponse resp, boolean wasFailed) {
super(access,tafName, principal, desc);
httpResp = resp;
- this.status = status;
+ this.status = status;
this.wasFailed = wasFailed;
}
public OAuth2HttpTafResp(Access access, TrustPrincipal principal, String desc, RESP status,HttpServletResponse resp) {
super(access,tafName, principal, desc);
httpResp = resp;
- this.status = status;
+ this.status = status;
wasFailed = true; // if Trust Principal added, must be good
}
public RESP authenticate() throws IOException {
- httpResp.setStatus(401); // Unauthorized
+ httpResp.setStatus(401); // Unauthorized
return RESP.HTTP_REDIRECT_INVOKED;
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java
index 1a1adcc5..2c5c93d2 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Lur.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ public class OAuth2Lur implements Lur {
public OAuth2Lur(TokenMgr tm) {
this.tm = tm;
}
-
+
@Override
public Permission createPerm(String p) {
String[] params = Split.split('|', p);
@@ -54,12 +54,12 @@ public class OAuth2Lur implements Lur {
@Override
public boolean fish(Principal bait, Permission ... pond) {
boolean rv = false;
-
+
if (bait instanceof OAuth2Principal) {
- OAuth2Principal oap = (OAuth2Principal)bait;
+ OAuth2Principal oap = (OAuth2Principal)bait;
for (Permission p : pond ) {
AAFPermission apond = (AAFPermission)p;
-
+
TokenPerm tp = oap.tokenPerm();
if (tp==null) {
} else {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java
index 86475d53..6d07219d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/OAuth2Principal.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,17 +26,17 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
public class OAuth2Principal extends TaggedPrincipal {
private TokenPerm tp;
// private byte[] hash; // hashed cred for disk validation
-
+
public OAuth2Principal(TokenPerm tp, byte[] hash) {
this.tp = tp;
// this.hash = hash;
}
-
+
@Override
public String getName() {
return tp.getUsername();
}
-
+
public TokenPerm tokenPerm() {
return tp;
}
@@ -50,5 +50,5 @@ public class OAuth2Principal extends TaggedPrincipal {
public String personalName() {
return tp.getUsername();
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java
index 38accc7a..81fee11d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TimedToken.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,16 +33,16 @@ import aafoauth.v2_0.Token;
* TimedToken
* Tokens come from the Token Server with an "Expired In" setting. This class will take that, and
* create a date from time of Creation, which works with local code.
- *
+ *
* We create a Derived class, so that it can be used as is the originating Token type.
- *
- * "expired" is local computer time
+ *
+ * "expired" is local computer time
* @author Jonathan
*
*/
// Package on purpose
public class TimedToken extends Token implements Persistable<Token> {
- private Persisting<Token> cacheable; // no double inheritance...
+ private Persisting<Token> cacheable; // no double inheritance...
// public TimedToken(Token t, byte[] hash) {
// this(t,(System.currentTimeMillis()/1000)+t.getExpiresIn(),hash,null);
@@ -51,7 +51,7 @@ public class TimedToken extends Token implements Persistable<Token> {
public TimedToken(Persist<Token,?> p, Token t, byte[] hash, Path path){
this(p,t,t.getExpiresIn()+(System.currentTimeMillis()/1000),hash, path);
}
-
+
public TimedToken(Persist<Token,?> p, Token t, long expires_secsFrom1970, byte[] hash, Path path) {
cacheable = new Persisting<Token>(p, t,expires_secsFrom1970, hash, path);
accessToken=t.getAccessToken();
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java
index 58ecaa84..0ebd8acc 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -85,18 +85,18 @@ public class TokenClient {
introspectDF = tkCon.env().newDataFactory(Introspect.class);
}
}
-
+
}
public void client_id(String client_id) {
this.client_id = client_id;
default_scope = FQI.reverseDomain(client_id);
}
-
+
public String client_id() {
return client_id;
}
-
+
/**
* This scope based on client_id... the App configured for call
* @return
@@ -121,9 +121,9 @@ public class TokenClient {
/**
* Note: OAuth2 provides for normal Authentication parameters when getting tokens. Basic Auth is one such valid
* way to get Credentials. However, support is up to the OAuth2 Implementation
- *
+ *
* This method is for setting an App's creds (client) to another App.
- *
+ *
* @param client_id
* @param client_secret
* @throws IOException
@@ -170,13 +170,13 @@ public class TokenClient {
return con.x509Alias(client_id);// no password, assume Cert
} catch (APIException e) {
throw new CadiException(e);
- }
- }
+ }
+ }
};
authn_method = AUTHN_METHOD.client_credentials;
}
}
-
+
public void username(String username) {
this.username = username;
}
@@ -184,9 +184,9 @@ public class TokenClient {
/**
* Note: OAuth2 provides for normal Authentication parameters when getting tokens. Basic Auth is one such valid
* way to get Credentials. However, support is up to the OAuth2 Implementation
- *
+ *
* This method is for setting the End-User's Creds
- *
+ *
* @param client_id
* @param client_secret
* @throws IOException
@@ -222,7 +222,7 @@ public class TokenClient {
}
}
}
-
+
public void clearEndUser() {
username = null;
enc_password = null;
@@ -254,9 +254,9 @@ public class TokenClient {
}
/**
* Get AuthToken
- * @throws APIException
- * @throws CadiException
- * @throws LocatorException
+ * @throws APIException
+ * @throws CadiException
+ * @throws LocatorException
*/
public Result<TimedToken> getToken(final char kind, final String ... scopes) throws LocatorException, CadiException, APIException {
final String scope = addScope(scopes);
@@ -270,14 +270,14 @@ public class TokenClient {
if (ss==null) {
throw new APIException("client_creds(...) must be set before obtaining Access Tokens");
}
-
+
Result<TimedToken> rtt = factory.get(key,hash,new Loader<TimedToken>() {
@Override
public Result<TimedToken> load(final String key) throws APIException, CadiException, LocatorException {
final List<String> params = new ArrayList<>();
params.add(scope);
addSecurity(params,authn_method);
-
+
final String paramsa[] = new String[params.size()];
params.toArray(paramsa);
Result<Token> rt = tkCon.best(new Retryable<Result<Token>>() {
@@ -292,7 +292,7 @@ public class TokenClient {
}
}
});
-
+
if (rt.isOK()) {
try {
return Result.ok(rt.code,factory.putTimedToken(key,rt.value, hash));
@@ -326,7 +326,7 @@ public class TokenClient {
}
return Result.err(404,"Not Found");
}
-
+
public Result<TimedToken> refreshToken(Token token) throws APIException, LocatorException, CadiException {
if (ss==null) {
throw new APIException("client_creds(...) must be set before obtaining Access Tokens");
@@ -336,7 +336,7 @@ public class TokenClient {
addSecurity(params,AUTHN_METHOD.refresh_token);
final String scope="scope="+token.getScope().replace(' ', '+');
params.add(scope);
-
+
final String paramsa[] = new String[params.size()];
params.toArray(paramsa);
Result<Token> rt = tkCon.best(new Retryable<Result<Token>>() {
@@ -389,7 +389,7 @@ public class TokenClient {
}
);
}
-
+
private String addScope(String[] scopes) {
String rv = null;
StringBuilder scope=null;
@@ -428,14 +428,14 @@ public class TokenClient {
// Nothing to do
break;
}
-
- // Set Credentials appropriate
+
+ // Set Credentials appropriate
switch(authn_method) {
case client_credentials:
if (client_id!=null) {
params.add("client_id="+client_id);
}
-
+
if (enc_client_secret!=null) {
try {
params.add("client_secret="+URLEncoder.encode(new String(factory.symm.decode(enc_client_secret)),UTF_8));
@@ -443,7 +443,7 @@ public class TokenClient {
throw new APIException("Error Decrypting Password",e);
}
}
-
+
if (username!=null) {
params.add("username="+username);
}
@@ -453,7 +453,7 @@ public class TokenClient {
if (client_id!=null) {
params.add("client_id="+client_id);
}
-
+
if (enc_client_secret!=null) {
try {
params.add("client_secret="+URLEncoder.encode(new String(factory.symm.decode(enc_client_secret)),UTF_8));
@@ -467,7 +467,7 @@ public class TokenClient {
if (client_id!=null) {
params.add("client_id="+client_id);
}
-
+
if (enc_client_secret!=null) {
try {
params.add("client_secret="+ URLEncoder.encode(new String(factory.symm.decode(enc_client_secret)),UTF_8));
@@ -478,7 +478,7 @@ public class TokenClient {
if (username!=null) {
params.add("username="+username);
}
-
+
if (enc_password!=null) {
try {
params.add("password="+ URLEncoder.encode(new String(factory.symm.decode(enc_password)),UTF_8));
@@ -486,7 +486,7 @@ public class TokenClient {
throw new APIException("Error Decrypting Password",e);
}
}
-
+
break;
default:
// Nothing to do
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java
index 8c47b6cb..6d2fd7fc 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -65,18 +65,18 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
private TokenClientFactory(Access pa) throws APIException, GeneralSecurityException, IOException, CadiException {
super(pa, new RosettaEnv(pa.getProperties()),Token.class,"outgoing");
-
+
Map<String, String> aaf_urls = Agent.loadURLs(pa);
alts = new TreeSet<>();
-
+
if (access.getProperty(Config.AAF_OAUTH2_TOKEN_URL,null)==null) {
access.getProperties().put(Config.AAF_OAUTH2_TOKEN_URL, aaf_urls.get(Config.AAF_OAUTH2_TOKEN_URL)); // Default to AAF
}
-
+
if (access.getProperty(Config.AAF_OAUTH2_INTROSPECT_URL,null)==null) {
access.getProperties().put(Config.AAF_OAUTH2_INTROSPECT_URL, aaf_urls.get(Config.AAF_OAUTH2_INTROSPECT_URL)); // Default to AAF);
}
-
+
for(String tag : new String[] {Config.AAF_ALT_OAUTH2_TOKEN_URL, Config.AAF_ALT_OAUTH2_INTROSPECT_URL}) {
String value = access.getProperty(tag, null);
if(value!=null) {
@@ -84,21 +84,21 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
alts.add(value);
}
}
-
+
symm = Symm.encrypt.obtain();
hsi = SecurityInfoC.instance(access, HttpURLConnection.class);
}
-
+
public synchronized static final TokenClientFactory instance(Access access) throws APIException, GeneralSecurityException, IOException, CadiException {
if (instance==null) {
instance = new TokenClientFactory(access);
}
return instance;
}
-
+
/**
* Pickup Timeout from Properties
- *
+ *
* @param tagOrURL
* @return
* @throws CadiException
@@ -108,7 +108,7 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
public<INTR> TokenClient newClient(final String tagOrURL) throws CadiException, LocatorException, APIException {
return newClient(tagOrURL,Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF)));
}
-
+
public<INTR> TokenClient newClient(final String tagOrURL, final int timeout) throws CadiException, LocatorException, APIException {
AAFConHttp ach;
if (tagOrURL==null) {
@@ -134,7 +134,7 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
tci.client_creds(access);
return tci;
}
-
+
public TzClient newTzClient(final String locatorURL) throws CadiException, LocatorException {
try {
return new TzHClient(access,hsi,bestLocator(locatorURL));
@@ -180,7 +180,7 @@ public class TokenClientFactory extends Persist<Token,TimedToken> {
put(key,tt);
return tt;
}
-
+
private static final Pattern locatePattern = Pattern.compile("https://.*/locate/.*");
public Locator<URI> bestLocator(final String locatorURL ) throws LocatorException, URISyntaxException {
if (locatorURL==null) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java
index 5a4e7f0c..89d5c1a0 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java
@@ -7,9 +7,9 @@
* 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.
@@ -51,7 +51,7 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
public static RosettaDF<Introspect> introspectDF;
private final TokenPermLoader tpLoader;
-
+
private TokenMgr(PropAccess access, String tokenURL, String introspectURL) throws APIException, CadiException {
super(access,new RosettaEnv(access.getProperties()),Introspect.class,"introspect");
synchronized(access) {
@@ -99,7 +99,7 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
}
return tm;
}
-
+
public Result<OAuth2Principal> toPrincipal(final String accessToken, final byte[] hash) throws APIException, CadiException, LocatorException {
Result<TokenPerm> tp = get(accessToken, hash, new Loader<TokenPerm>() {
@Override
@@ -117,14 +117,14 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
return Result.err(tp);
}
}
-
+
public Result<TokenPerm> get(final String accessToken, final byte[] hash) throws APIException, CadiException, LocatorException {
return get(accessToken,hash,new Loader<TokenPerm>() {
@Override
public Result<TokenPerm> load(String key) throws APIException, CadiException, LocatorException {
return tpLoader.load(key,hash);
}
-
+
});
// return tpLoader.load(accessToken,hash);
}
@@ -132,7 +132,7 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
public interface TokenPermLoader{
public Result<TokenPerm> load(final String accessToken, final byte[] cred) throws APIException, CadiException, LocatorException;
}
-
+
private class RemoteTokenPermLoader implements TokenPermLoader {
private TokenClientFactory tcf;
private TokenClient tokenCL, introCL;
@@ -141,12 +141,12 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
try {
tcf = TokenClientFactory.instance(access);
int timeout = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF));
- tokenCL = tcf.newClient(tokenURL,
+ tokenCL = tcf.newClient(tokenURL,
timeout);
if (introspectURL.equals(tokenURL)) {
introCL = tokenCL;
} else {
- introCL = tcf.newClient(introspectURL,
+ introCL = tcf.newClient(introspectURL,
timeout);
}
@@ -154,7 +154,7 @@ public class TokenMgr extends Persist<Introspect, TokenPerm> {
throw new CadiException(e);
}
}
-
+
public Result<TokenPerm> load(final String accessToken, final byte[] cred) throws APIException, CadiException, LocatorException {
long start = System.currentTimeMillis();
try {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java
index 6efd9ce3..23153c28 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java
@@ -7,9 +7,9 @@
* 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.
@@ -62,23 +62,23 @@ public class TokenPerm extends Persisting<Introspect>{
}
scopes = ti.getScope();
}
-
+
public List<AAFPermission> perms() {
return perms;
}
-
+
public String getClientId() {
return introspect.getClientId();
}
-
+
public String getUsername() {
return introspect.getUsername();
}
-
+
public String getToken() {
return introspect.getAccessToken();
}
-
+
public synchronized String getScopes() {
return scopes;
}
@@ -86,7 +86,7 @@ public class TokenPerm extends Persisting<Introspect>{
public Introspect getIntrospect() {
return introspect;
}
-
+
// Direct Parse Perms into List
public static class LoadPermissions {
public List<AAFPermission> perms;
@@ -138,7 +138,7 @@ public class TokenPerm extends Persisting<Introspect>{
}
}
}
-
+
// Gathering object for parsing objects, then creating AAF Permission
private static class PermInfo {
public String ns,type,instance,action;
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java
index 1ebbe877..2afc4b5e 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,7 +30,7 @@ import org.onap.aaf.misc.env.APIException;
/**
* TimedToken Client
- *
+ *
* @author Jonathan
*
*/
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java
index c07332d1..241abf41 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TzHClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,7 +40,7 @@ import org.onap.aaf.misc.env.APIException;
/**
* Tokenized HClient
- *
+ *
* @author Jonathan
*
*/
@@ -62,7 +62,7 @@ public class TzHClient extends TzClient {
si = hsi;
hman = new HMangr(access, loc);
}
-
+
public void setToken(final String client_id, TimedToken token) throws IOException {
this.token = token;
tokenSS = new HTokenSS(si, client_id, token.getAccessToken());
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java
index 4ae8ba5f..0f3b4587 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/obasic/OBasicHttpTaf.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,31 +55,31 @@ import org.onap.aaf.misc.env.util.Pool.Pooled;
/**
* BasicHttpTaf
- *
- * This TAF implements the "Basic Auth" protocol.
- *
- * WARNING! It is true for any implementation of "Basic Auth" that the password is passed unencrypted.
- * This is because the expectation, when designed years ago, was that it would only be used in
+ *
+ * This TAF implements the "Basic Auth" protocol.
+ *
+ * WARNING! It is true for any implementation of "Basic Auth" that the password is passed unencrypted.
+ * This is because the expectation, when designed years ago, was that it would only be used in
* conjunction with SSL (https). It is common, however, for users to ignore this on the assumption that
* their internal network is secure, or just ignorance. Therefore, a WARNING will be printed
* when the HTTP Channel is not encrypted (unless explicitly turned off).
- *
+ *
* @author Jonathan
*
*/
public class OBasicHttpTaf extends AbsOTafLur implements HttpTaf {
private final String realm;
private final CredVal rbac;
-
-
+
+
public OBasicHttpTaf(final PropAccess access, final CredVal rbac, final String realm, final String token_url, final String introspect_url) throws CadiException {
super(access, token_url,introspect_url);
this.rbac = rbac;
this.realm = realm;
}
-
+
/**
- * Note: BasicHttp works for either Carbon Based (Humans) or Silicon Based (machine) Lifeforms.
+ * Note: BasicHttp works for either Carbon Based (Humans) or Silicon Based (machine) Lifeforms.
* @see Taf
*/
public TafResp validate(Taf.LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
@@ -109,7 +109,7 @@ public class OBasicHttpTaf extends AbsOTafLur implements HttpTaf {
return new BasicHttpTafResp(access,user,"Malformed BasicAuth entry",RESP.FAIL,resp,realm,false);
}
if (!rbac.validate(user,Type.PASSWORD,password.getBytes(),req)) {
- return new BasicHttpTafResp(access,user,buildMsg(null,req,"user/pass combo invalid for ",user,"from",req.getRemoteAddr()),
+ return new BasicHttpTafResp(access,user,buildMsg(null,req,"user/pass combo invalid for ",user,"from",req.getRemoteAddr()),
RESP.TRY_AUTHENTICATING,resp,realm,true);
}
} catch (IOException e) {
@@ -150,13 +150,13 @@ public class OBasicHttpTaf extends AbsOTafLur implements HttpTaf {
}
} finally {
pclient.done();
- }
+ }
} catch (APIException | CadiException | LocatorException | NoSuchAlgorithmException e) {
access.log(e, ERROR_GETTING_TOKEN_CLIENT);
return new BasicHttpTafResp(access,user,ERROR_GETTING_TOKEN_CLIENT,RESP.TRY_ANOTHER_TAF,resp,realm,false);
}
}
-
+
protected String buildMsg(Principal pr, HttpServletRequest req, Object ... msg) {
StringBuilder sb = new StringBuilder();
if (pr!=null) {
@@ -189,7 +189,7 @@ public class OBasicHttpTaf extends AbsOTafLur implements HttpTaf {
// }
return Resp.NOT_MINE;
}
-
+
public String toString() {
return "Basic Auth enabled on realm: " + realm;
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java
index b85e311d..5b78585d 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/olur/OLur.java
@@ -7,9 +7,9 @@
* 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.
@@ -62,7 +62,7 @@ public class OLur extends AbsOTafLur implements Lur {
} else {
tp=null;
}
- if (tp==null) {
+ if (tp==null) {
// if no Token Perm preset, get
try {
Pooled<TokenClient> tcp = tokenClientPool.get();
@@ -80,7 +80,7 @@ public class OLur extends AbsOTafLur implements Lur {
}
String[] scopes = new String[scopeSet.size()];
scopeSet.toArray(scopes);
-
+
Result<TimedToken> rtt = tc.getToken(Kind.getKind(bait),scopes);
if (rtt.isOK()) {
Result<TokenPerm> rtp = tkMgr.get(rtt.value.getAccessToken(), bait.getName().getBytes());
@@ -95,18 +95,18 @@ public class OLur extends AbsOTafLur implements Lur {
access.log(e, "Unable to Get a Token");
}
}
-
+
boolean rv = false;
if (tp!=null) {
if (tkMgr.access.willLog(Level.DEBUG)) {
StringBuilder sb = new StringBuilder("AAF Permissions for user ");
sb.append(bait.getName());
- sb.append(", from token ");
+ sb.append(", from token ");
sb.append(tp.get().getAccessToken());
for (AAFPermission p : tp.perms()) {
sb.append("\n\t[");
sb.append(p.getNS());
- sb.append(']');
+ sb.append(']');
sb.append(p.getType());
sb.append('|');
sb.append(p.getInstance());
@@ -139,7 +139,7 @@ public class OLur extends AbsOTafLur implements Lur {
for (AAFPermission p : ((OAuth2Principal)bait).tokenPerm().perms()) {
permissions.add(p);
}
- }
+ }
}
/* (non-Javadoc)
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java
index 472bb529..ea539271 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,12 +55,12 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
// store all the directories to review
// No Concurrent HashSet, or at least, it is all implemented with HashMap in older versions
private static Queue<Persist<?,?>> allPersists = new ConcurrentLinkedQueue<Persist<?,?>>();
-
+
private Map<String,CT> tmap;
protected RosettaEnv env;
private RosettaDF<T> df;
-
+
public Persist(Access access, RosettaEnv env, Class<T> cls, String sub_dir) throws CadiException, APIException {
super(access, sub_dir);
this.env = env;
@@ -74,11 +74,11 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
}
allPersists.add(this);
}
-
+
public void close() {
allPersists.remove(this);
}
-
+
protected abstract CT newCacheable(T t, long expires_secsFrom1970, byte[] hash, Path path) throws APIException, IOException;
public RosettaDF<T> getDF() {
@@ -113,7 +113,7 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
access.log(e,"Reading Token from",key);
}
} // if not read, then ct still==null
-
+
// If not in memory, or on disk, get from Remote... IF reloadable (meaning, isn't hitting too often, etc).
if (ct==null || ct.checkReloadable()) {
// Load from external (if makes sense)
@@ -133,7 +133,7 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
return Result.err(rtp);
}
}
-
+
if (ct!=null) {
tmap.put(key, ct);
}
@@ -149,39 +149,39 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
writeDisk(df, ct.get(), ct.getHash(), key, ct.expires());
tmap.put(key,ct);
}
-
+
public void delete(String key) {
tmap.remove(key);
deleteFromDisk(key);
}
public interface Loader<CT> {
- Result<CT> load(String key) throws APIException, CadiException, LocatorException;
+ Result<CT> load(String key) throws APIException, CadiException, LocatorException;
}
/**
* Clean will examine resources, and remove those that have expired.
- *
+ *
* If "highs" have been exceeded, then we'll expire 10% more the next time. This will adjust after each run
* without checking contents more than once, making a good average "high" in the minimum speed.
- *
+ *
* @author Jonathan
*
*/
private static final class Clean extends TimerTask {
private final Access access;
private long hourly;
-
+
public Clean(Access access) {
this.access = access;
hourly=0;
}
-
+
private static class Metrics {
public int mexists = 0, dexists=0;
public int mremoved = 0, dremoved=0;
}
-
+
public void run() {
final long now = System.currentTimeMillis();
final long dayFromNow = now + ONE_DAY;
@@ -203,7 +203,7 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
p.clearCount();
}
} else if (Files.exists(p.path())) {
-
+
}
}
// Clear disk
@@ -246,7 +246,7 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
sb.append(e.getMessage());
++metrics.dremoved;
}
-
+
}
return FileVisitResult.CONTINUE;
}
@@ -262,14 +262,14 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
access.log(Level.DEBUG, sb);
return FileVisitResult.CONTINUE;
}
-
+
});
} catch (IOException e) {
access.log(e, "Exception while cleaning Persistance");
}
-
+
}
-
+
// We want to print some activity of Persistence Check at least hourly, even if no activity has occurred, but not litter the log if nothing is happening
boolean go=false;
Level level=Level.WARN;
@@ -279,9 +279,9 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
} else if (access.willLog(Level.WARN)) {
go = metrics.mremoved>0 || metrics.dremoved>0 || --hourly <= 0;
}
-
+
if (go) {
- access.printf(level, "Persist Cache: removed %d of %d items from memory and %d of %d from disk",
+ access.printf(level, "Persist Cache: removed %d of %d items from memory and %d of %d from disk",
metrics.mremoved, metrics.mexists, metrics.dremoved, metrics.dexists);
hourly = 3600000/CLEAN_CHECK;
}
@@ -296,6 +296,6 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile {
close(); // can call twice.
}
-
+
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java
index c7d71488..db9852ec 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/PersistFile.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,13 +52,13 @@ public class PersistFile {
private static final String HASH_NO_MATCH = "Hash does not match in Persistence";
private static final Object LOCK = new Object();
-
+
protected static Symm symm;
public Access access;
protected final Path tokenPath;
protected final String tokenDir;
private static final boolean isWindows = System.getProperty("os.name").startsWith("Windows");
-
+
public PersistFile(Access access, String sub_dir) throws CadiException, APIException {
this.access = access;
tokenPath = Paths.get(access.getProperty(Config.CADI_TOKEN_DIR,"tokens"), sub_dir);
@@ -112,7 +112,7 @@ public class PersistFile {
}
df.newData().load(t).to(os);
} finally {
- // Note: Someone on the Web noticed that using a DataOutputStream would not full close out without a flush first,
+ // Note: Someone on the Web noticed that using a DataOutputStream would not full close out without a flush first,
// leaving files open.
try {
os.flush();
@@ -146,7 +146,7 @@ public class PersistFile {
}
return readDisk(df,cred,hp.get(),hl);
}
-
+
public <T> T readDisk(final RosettaDF<T> df, final byte[] cred, final Path target, final Holder<Long> hexpired) throws CadiException {
// Try from Disk
T t = null;
@@ -160,7 +160,7 @@ public class PersistFile {
exp |= ((long)is.read()<<i);
}
hexpired.set(exp);
-
+
t = symm.exec(new Symm.SyncExec<T>() {
@Override
public T exec(Encryption enc) throws Exception {
@@ -194,7 +194,7 @@ public class PersistFile {
} finally {
is.close();
}
- } catch (NoSuchFileException e) {
+ } catch (NoSuchFileException e) {
return t;
} catch (Exception e) {
throw new CadiException(e);
@@ -202,7 +202,7 @@ public class PersistFile {
}
return t;
}
-
+
public long readExpiration(final Path target) throws CadiException {
long exp=0L;
if (Files.exists(target)) {
@@ -243,7 +243,7 @@ public class PersistFile {
public Path getPath(String filename) {
return Paths.get(tokenDir,filename);
}
-
+
public FileTime getFileTime(String filename, Holder<Path> hp) throws IOException {
Path p = hp.get();
if (p==null) {
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java
index 1f22028b..3fceb6f6 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persistable.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java
index bde60777..55b013e3 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persisting.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,7 +41,7 @@ public class Persisting<T> implements Persistable<T> {
private T t;
private Path path;
private Persist<T, ?> persist;
-
+
public Persisting(Persist<T,?> p, T t, long expiresSecsFrom1970, byte[] hash, Path path) {
persist = p;
this.t=t;
@@ -110,7 +110,7 @@ public class Persisting<T> implements Persistable<T> {
*/
@Override
public boolean checkReloadable() {
- //TODO other elements to add here...
+ //TODO other elements to add here...
// Ideas: Is it valid?
// if not, How many times has it been checked in the last minute
return expired();
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java
index 4bbe5ff9..fea6c1bd 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrant.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java
index 18eb7357..4555171b 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/Registrar.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,8 +43,8 @@ public class Registrar<ENV extends BasicEnv> {
erroringTimer = null;
timer = new Timer(REGISTRAR,true);
- timer.schedule(new RegistrationTimerTask(env), START, INTERVAL);
-
+ timer.schedule(new RegistrationTimerTask(env), START, INTERVAL);
+
if (shutdownHook) {
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
@@ -53,7 +53,7 @@ public class Registrar<ENV extends BasicEnv> {
});
}
}
-
+
private class RegistrationTimerTask extends TimerTask {
private final ENV env;
public RegistrationTimerTask(ENV env) {
@@ -82,11 +82,11 @@ public class Registrar<ENV extends BasicEnv> {
}
}
}
-
+
public void register(Registrant<ENV> r) {
registrants.addLast(r);
}
-
+
public void deregister(Registrant<ENV> r) {
registrants.remove(r);
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
index 80fc1a4f..de006ae2 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RegistrationCreator.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,11 +37,11 @@ import locate.v1_0.MgmtEndpoints;
public class RegistrationCreator {
private Access access;
-
+
public RegistrationCreator(Access access) {
this.access = access;
}
-
+
public MgmtEndpoints create(final int port) throws CadiException {
MgmtEndpoints me = new MgmtEndpoints();
List<MgmtEndpoint> lme = me.getMgmtEndpoint();
@@ -52,9 +52,9 @@ public class RegistrationCreator {
String dot_le;
String version=null;
String defProtocol="https";
-
+
RegistrationPropHolder ph = new RegistrationPropHolder(access, port);
-
+
String firstPrivateHostname = null;
// Now, loop through by Container
for(String le : Split.splitTrim(',', ph.lcontainer)) {
@@ -72,7 +72,7 @@ public class RegistrationCreator {
locate.setProtocol(defProtocol = access.getProperty(Config.AAF_LOCATOR_PROTOCOL,defProtocol));
List<String> ls = locate.getSubprotocol();
for(String sp : Split.splitTrim(',', access.getProperty(Config.AAF_LOCATOR_SUBPROTOCOL,""))) {
- ls.add(sp);
+ ls.add(sp);
}
locate.setLatitude(ph.latitude);
locate.setLongitude(ph.longitude);
@@ -80,27 +80,27 @@ public class RegistrationCreator {
} else {
locate = copy(defData);
}
-
+
locate.setName(ph.getEntryName(entry,dot_le));
/* Cover the situation where there is a Container, and multiple locator Entries,
* the first of which is the only real private FQDN
* example: oauth
* aaf_locator_entries=oauth,token,introspect
- *
+ *
* Entries for token and introspect, but they point to oauth service.
*/
String locateHostname;
- if(le.isEmpty()) {
+ if(le.isEmpty()) {
locateHostname=ph.getEntryFQDN(entry, dot_le);
} else if(firstPrivateHostname==null) {
firstPrivateHostname=locateHostname=ph.getEntryFQDN(entry, dot_le);
} else {
locateHostname=firstPrivateHostname;
}
-
+
locate.setHostname(locateHostname);
locate.setPort(ph.getEntryPort(dot_le));
-
+
String specificVersion = access.getProperty(Config.AAF_LOCATOR_VERSION + dot_le,null);
if(specificVersion == null && locate == defData) {
specificVersion = version;
@@ -142,13 +142,13 @@ public class RegistrationCreator {
} catch (NumberFormatException | UnknownHostException e) {
throw new CadiException("Error extracting Data from Properties for Registrar",e);
}
-
+
if(access.willLog(Level.INFO)) {
access.log(Level.INFO, print(new StringBuilder(),me.getMgmtEndpoint()));
}
return me;
}
-
+
/*
* Find the best version between Actual Interface and Deployed version
*/
@@ -165,8 +165,8 @@ public class RegistrationCreator {
break;
}
}
- }
-
+ }
+
if(sb.length()==0 && deploy.length>i) {
s=deploy[i];
for(int j=0;j<s.length();++j) {
@@ -177,7 +177,7 @@ public class RegistrationCreator {
}
}
}
-
+
return sb.length()==0?0:Integer.parseInt(sb.toString());
}
@@ -242,7 +242,7 @@ public class RegistrationCreator {
out.append(s);
}
}
-
+
private MgmtEndpoint copy(MgmtEndpoint mep) {
MgmtEndpoint out = new MgmtEndpoint();
out.setName(mep.getName());
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
index b49b911b..49af80fd 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/register/RemoteRegistrant.java
@@ -7,9 +7,9 @@
* 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.
@@ -79,11 +79,11 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
throw new CadiException(e);
}
}
-
+
RegistrationCreator rcreator = new RegistrationCreator(access);
meps = rcreator.create(port);
}
-
+
@Override
@@ -103,7 +103,7 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
access.log(e, "Error registering service to AAF Locator");
return Result.err(503,e.getMessage());
}
-
+
} catch (CadiException e) {
return Result.err(503,e.getMessage());
}
@@ -125,7 +125,7 @@ public class RemoteRegistrant<ENV extends BasicEnv> implements Registrant<ENV> {
access.log(e, "Error deregistering service on AAF Locator");
return Result.err(503,e.getMessage());
}
-
+
} catch (CadiException e) {
return Result.err(503,e.getMessage());
}
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java
index c9b21b2a..a6a74103 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java
@@ -83,7 +83,7 @@ public class AAFSSO {
public AAFSSO(String[] args) throws IOException, CadiException {
this(args,new Properties());
}
-
+
public AAFSSO(String[] args, ProcessArgs pa) throws IOException, CadiException {
this(args,pa.process(args, new Properties()));
}
@@ -114,7 +114,7 @@ public class AAFSSO {
propStream.close();
}
}
-
+
File dot_aaf_kf = new File(dot_aaf, "keyfile");
if (removeSSO) {
@@ -143,7 +143,7 @@ public class AAFSSO {
System.out.println("AAF SSO information removed");
} else {
// Config.setDefaultRealm(access);
-
+
if (!dot_aaf_kf.exists()) {
// This will create, as required, or reuse
ArtifactDir.getSymm(dot_aaf_kf);
@@ -155,9 +155,9 @@ public class AAFSSO {
String[] naargs = new String[nargs.size()];
nargs.toArray(naargs);
access = new PropAccess(os, naargs);
-
+
if (loginOnly) {
- for (String tag : new String[] {Config.AAF_APPID, Config.AAF_APPPASS,
+ for (String tag : new String[] {Config.AAF_APPID, Config.AAF_APPPASS,
Config.CADI_ALIAS, Config.CADI_KEYSTORE,Config.CADI_KEYSTORE_PASSWORD,Config.CADI_KEY_PASSWORD}) {
access.getProperties().remove(tag);
diskprops.remove(tag);
@@ -171,14 +171,14 @@ public class AAFSSO {
// }
// touchDiskprops=true;
}
-
+
String keyfile = access.getProperty(Config.CADI_KEYFILE); // in case its CertificateMan props
if (keyfile == null) {
access.setProperty(Config.CADI_KEYFILE, dot_aaf_kf.getAbsolutePath());
addProp(Config.CADI_KEYFILE,dot_aaf_kf.getAbsolutePath());
}
-
-
+
+
String alias, appID;
alias = access.getProperty(Config.CADI_ALIAS);
if (alias==null) {
@@ -188,7 +188,7 @@ public class AAFSSO {
user=alias;
appID=null;
}
-
+
String aaf_container_ns = "";
if (appID!=null) {
if( access.getProperty(Config.AAF_APPPASS)==null) {
@@ -204,10 +204,10 @@ public class AAFSSO {
}
diskprops.setProperty(Config.AAF_APPID,appID);
}
-
+
String keystore=access.getProperty(Config.CADI_KEYSTORE);
String keystore_pass=access.getProperty(Config.CADI_KEYSTORE_PASSWORD);
-
+
if (user==null || (alias!=null && (keystore==null || keystore_pass==null))) {
String select = null;
String name;
@@ -224,7 +224,7 @@ public class AAFSSO {
encrypted_pass= access.encrypt(new String(password));
access.setProperty(Config.CADI_KEYSTORE_PASSWORD, encrypted_pass);
addProp(Config.CADI_KEYSTORE_PASSWORD, encrypted_pass);
-
+
// TODO READ Aliases out of Keystore?
user = alias = cons.readLine("Keystore alias: ");
access.setProperty(Config.CADI_ALIAS, user);
@@ -251,8 +251,8 @@ public class AAFSSO {
keystore_pass = encrypted_pass;
}
}
-
-
+
+
if (alias!=null) {
use_X509 = true;
} else {
@@ -302,7 +302,7 @@ public class AAFSSO {
if (user == null) {
err = new StringBuilder("Add -D" + Config.AAF_APPID + "=<id> ");
}
-
+
if (encrypted_pass == null && alias == null) {
if (err == null) {
err = new StringBuilder();
@@ -311,7 +311,7 @@ public class AAFSSO {
}
err.append("-D" + Config.AAF_APPPASS + "=<passwd> ");
}
-
+
String cadiLatitude = access.getProperty(Config.CADI_LATITUDE);
if (cadiLatitude==null) {
System.out.println("# If you do not know your Global Coordinates, we suggest bing.com/maps");
@@ -321,7 +321,7 @@ public class AAFSSO {
}
access.setProperty(Config.CADI_LATITUDE, cadiLatitude);
addProp(Config.CADI_LATITUDE, cadiLatitude);
-
+
}
String cadiLongitude = access.getProperty(Config.CADI_LONGITUDE);
if (cadiLongitude==null) {
@@ -332,14 +332,14 @@ public class AAFSSO {
access.setProperty(Config.CADI_LONGITUDE, cadiLongitude);
addProp(Config.CADI_LONGITUDE, cadiLongitude);
}
-
+
String cadi_truststore = access.getProperty(Config.CADI_TRUSTSTORE);
if (cadi_truststore==null) {
- String name;
+ String name;
String select;
for (File tsf : dot_aaf.listFiles()) {
name = tsf.getName();
- if (name.contains("trust") &&
+ if (name.contains("trust") &&
(name.endsWith(".jks") || name.endsWith(".p12"))) {
select = cons.readLine("Use %s for TrustStore? (y/n):",tsf.getName());
if ("y".equalsIgnoreCase(select)) {
@@ -401,7 +401,7 @@ public class AAFSSO {
access.log(e);
}
}
-
+
final String apiVersion = access.getProperty(Config.AAF_API_VERSION, Config.AAF_DEFAULT_API_VERSION);
final String aaf_root_ns = access.getProperty(Config.AAF_ROOT_NS);
String locateRoot;
@@ -521,7 +521,7 @@ public class AAFSSO {
}
return larg;
}
-
+
private void setReadonly(File file) {
file.setExecutable(false, false);
file.setWritable(false, false);
@@ -532,7 +532,7 @@ public class AAFSSO {
public boolean ok() {
return ok;
}
-
+
public static interface ProcessArgs {
public Properties process(final String[] args, final Properties props);
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java
index b7dfec46..a58edc22 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java
@@ -7,9 +7,9 @@
* * 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.
@@ -44,29 +44,29 @@ import org.onap.aaf.misc.rosetta.env.RosettaEnv;
import aaf.v2_0.Error;
public class JU_ErrMessageTest {
-
+
@Mock
private RosettaEnv env;
-
+
@Mock(answer=Answers.RETURNS_DEEP_STUBS)
private RosettaDF<Object> errDF;
private ErrMessage errMessage;
private String attErrJson = "key:value";
-
+
private Error error;
private Future<?> future;
private ByteArrayOutputStream errStream;
-
+
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
-
+
when(env.newDataFactory(Error.class)).thenReturn(errDF);
-
+
future = new Future<Error>() {
@Override
@@ -89,47 +89,47 @@ public class JU_ErrMessageTest {
return "header";
}
};
-
+
error = new Error();
error.setMessageId("Error Message Id");
error.setText("Error Text");
errMessage = new ErrMessage(env);
-
+
errStream = new ByteArrayOutputStream();
}
@Test
public void testPrintErrMessage() throws APIException {
when(errDF.newData().in(TYPE.JSON).load(attErrJson).asObject()).thenReturn(error);
-
+
errMessage.printErr(new PrintStream(errStream), attErrJson);
assertEquals("Error Message Id Error Text" + System.lineSeparator(), errStream.toString());
}
-
+
@Test
public void testToMsgJsonErrAttribute() throws APIException {
when(errDF.newData().in(TYPE.JSON).load(attErrJson).asObject()).thenReturn(error);
-
+
StringBuilder sb = new StringBuilder();
errMessage.toMsg(sb,attErrJson);
-
+
assertEquals(sb.toString(),"Error Message Id Error Text");
}
-
+
@Test
public void testToMsgFuture() {
StringBuilder sb = errMessage.toMsg(future);
-
+
assertEquals(sb.toString(), "0: Body");
}
-
+
@Test
public void testToMsgFutureWithoutException() throws APIException {
when(errDF.newData().in(TYPE.JSON).load(future.body()).asObject()).thenReturn(error);
-
+
StringBuilder sb = errMessage.toMsg(future);
-
+
assertEquals(sb.toString(), "Error Message Id Error Text");
}
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java
index 5d242005..d39cbdb0 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_PermEval.java
@@ -211,7 +211,7 @@ public class JU_PermEval {
@SuppressWarnings("unused")
PermEval pe = new PermEval();
}
-
+
@Test
public void pathTest() {
assertTrue(PermEval.evalInstance("/","/"));
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java
index 5e642c67..18e72b4b 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/TestHClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,14 +54,14 @@ public class TestHClient {
for (Item item = loc.first(); item!=null; item=loc.next(item)) {
System.out.println(loc.get(item));
}
-
+
hman = new HMangr(access,loc);
final String path = String.format("/authz/perms/user/%s",
access.getProperty(Config.AAF_APPID,"xx9999@people.osaaf.org"));
hman.best(si.defSS, new Retryable<Void>() {
@Override
public Void code(Rcli<?> cli) throws APIException, CadiException {
- Future<String> ft = cli.read(path,"application/json");
+ Future<String> ft = cli.read(path,"application/json");
if (ft.get(10000)) {
System.out.println("Hurray,\n"+ft.body());
} else {
@@ -79,5 +79,5 @@ public class TestHClient {
e.printStackTrace();
}
}
-
+
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java
index 7dccc8c1..51ed8de2 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthn.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,13 +42,13 @@ public class JU_AAFAuthn {
@Mock
AAFCon con;
-
+
@Mock
AbsUserCache<AAFPermission> cache;
-
+
@Mock
PropAccess propaccess;
-
+
@Before
public void setUp() {
initMocks(this);
@@ -60,7 +60,7 @@ public class JU_AAFAuthn {
String realm = authnObj.getRealm();
assertNull(realm);
}
-
+
@Test
public void testValidateFailure() {
AAFAuthnImplWithGetUserNull authnObj = new AAFAuthnImplWithGetUserNull(con, cache);
@@ -74,7 +74,7 @@ public class JU_AAFAuthn {
assertNull( e.getLocalizedMessage());
}
}
-
+
@Test
public void testValidate() {
AAFAuthnImpl authnObj = new AAFAuthnImpl(con);
@@ -93,7 +93,7 @@ public class JU_AAFAuthn {
e.printStackTrace();
}
}
-
+
@Test
public void testValidateRevalidate() {
AAFAuthnImpl authnObj = new AAFAuthnImpl(con);
@@ -113,7 +113,7 @@ public class JU_AAFAuthn {
e.printStackTrace();
}
}
-
+
@Test
public void testValidateValidUser() {
AAFAuthnImplWithGetUser authnObj = new AAFAuthnImplWithGetUser(con);
@@ -127,7 +127,7 @@ public class JU_AAFAuthn {
e.printStackTrace();
}
}
-
+
@Test
public void testValidateValidUserNull() {
AAFAuthnImplWithGetUserNull authnObj = new AAFAuthnImplWithGetUserNull(con);
@@ -147,48 +147,48 @@ public class JU_AAFAuthn {
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
AAFAuthnImpl(AAFCon con, AbsUserCache cache) {
super(con, cache);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
-
+
+
}
-
+
class AAFAuthnImplWithGetUser extends AAFAuthn{
AAFAuthnImplWithGetUser(AAFCon con) {
super(con);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
AAFAuthnImplWithGetUser(AAFCon con, AbsUserCache cache) {
super(con, cache);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
@Override
protected User getUser(String user, byte[] cred) {
return new User<>("test",new byte[] {});
}
}
-
+
class AAFAuthnImplWithGetUserNull extends AAFAuthn{
AAFAuthnImplWithGetUserNull(AAFCon con) {
super(con);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
AAFAuthnImplWithGetUserNull(AAFCon con, AbsUserCache cache) {
super(con, cache);
this.access = propaccess;
// TODO Auto-generated constructor stub
}
-
+
@Override
protected User getUser(String user, byte[] cred) {
User user1 = null;
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java
index 89066c99..10b89485 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFSingleLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,16 +44,16 @@ public class JU_AAFSingleLocator {
@Mock
AAFCon con;
-
+
@Mock
AbsUserCache<AAFPermission> cache;
-
+
@Mock
PropAccess propaccess;
-
+
AAFSingleLocator authnObj;
-
+
@Before
public void setUp() {
initMocks(this);
@@ -62,7 +62,7 @@ public class JU_AAFSingleLocator {
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
@Test
@@ -75,13 +75,13 @@ public class JU_AAFSingleLocator {
e.printStackTrace();
}
}
-
+
@Test
public void testHasItem() {
boolean retVal = authnObj.hasItems();
assertTrue(retVal);
}
-
+
@Test
public void testInvalidate() {
try {
@@ -91,7 +91,7 @@ public class JU_AAFSingleLocator {
e.printStackTrace();
}
}
-
+
@Test
public void testBest() {
try {
@@ -122,17 +122,17 @@ public class JU_AAFSingleLocator {
e.printStackTrace();
}
}
-
+
@Test
public void testRefres() {
boolean retVal = authnObj.refresh();
assertFalse(retVal);
}
-
+
@Test
public void testdestroy() {
authnObj.destroy();
}
-
-
+
+
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java
index c76d178f..37710138 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,43 +56,43 @@ import locate.v1_0.Endpoint;
import locate.v1_0.Endpoints;
public class JU_AAFLocator {
-
+
@Mock private HClient clientMock;
@Mock private Future<Endpoints> futureMock;
@Mock private Endpoints endpointsMock;
-
+
private PropAccess access;
-
+
private ByteArrayOutputStream errStream;
-
+
private static final String uriString = "https://example.com";
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
-
+
doReturn(futureMock).when(clientMock).futureRead((RosettaDF<?>)any(), eq(TYPE.JSON));
when(clientMock.timeout()).thenReturn(1);
when(clientMock.getURI()).thenReturn(new URI(uriString));
when(futureMock.get(1)).thenReturn(true);
-
+
futureMock.value = endpointsMock;
List<Endpoint> endpoints = new ArrayList<>();
endpoints.add(new Endpoint());
when(endpointsMock.getEndpoint()).thenReturn(endpoints);
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
-
+
errStream = new ByteArrayOutputStream();
System.setErr(new PrintStream(errStream));
}
-
+
@After
public void tearDown() {
System.setErr(System.err);
}
-
+
@AfterClass
public static void tearDownAfterClass() throws Exception {
Field field = SecurityInfoC.class.getDeclaredField("sicMap");
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java
index 004eed3a..5f5858ce 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AbsAAFLocator.java
@@ -149,7 +149,7 @@ public class JU_AbsAAFLocator {
assertThat(loc.setPathInfo("pathInfo"), is(not(nullValue())));
assertThat(loc.setQuery("query"), is(not(nullValue())));
assertThat(loc.setFragment("fragment"), is(not(nullValue())));
-
+
assertThat(loc.exposeGetURI(uri), is(not(uri)));
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java
index 8bb873b3..ab377183 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_ArtifactDir.java
@@ -55,7 +55,7 @@ public class JU_ArtifactDir {
@Mock private Trans transMock;
@Mock private CertInfo certInfoMock;
@Mock private Artifact artiMock;
-
+
private static final String dirName = "src/test/resources/artifacts";
private static final String nsName = "org.onap.test";
private static final String luggagePassword = "12345"; // That's the stupidest combination I've ever heard in my life
@@ -65,17 +65,17 @@ public class JU_ArtifactDir {
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
-
+
issuers = new ArrayList<>();
issuers.add("issuer1");
issuers.add("issuer2");
}
-
+
@After
public void tearDown() {
ArtifactDir.clear();
}
-
+
@AfterClass
public static void tearDownOnce() {
cleanup();
@@ -91,7 +91,7 @@ public class JU_ArtifactDir {
} catch (CadiException e) {
assertThat(e.getMessage(), is("File Artifacts require a path\nFile Artifacts require an AAF Namespace"));
}
-
+
when(artiMock.getDir()).thenReturn(dirName);
try {
artiDir.place(transMock, certInfoMock, artiMock, "machine");
@@ -99,12 +99,12 @@ public class JU_ArtifactDir {
} catch (CadiException e) {
assertThat(e.getMessage(), is("File Artifacts require an AAF Namespace"));
}
-
+
when(artiMock.getNs()).thenReturn(nsName);
when(certInfoMock.getCaIssuerDNs()).thenReturn(issuers);
when(certInfoMock.getChallenge()).thenReturn(luggagePassword);
artiDir.place(transMock, certInfoMock, artiMock, "machine");
-
+
File writableFile = new File(dirName + '/' + nsName + "writable.txt");
ArtifactDir.write(writableFile, Chmod.to755, "first data point", "second data point");
try {
@@ -112,17 +112,17 @@ public class JU_ArtifactDir {
fail("Should've thrown an exception");
} catch (NullPointerException e) {
}
-
+
KeyStore ks = KeyStore.getInstance(Agent.PKCS12);
try {
ArtifactDir.write(writableFile, Chmod.to755, ks, luggagePassword.toCharArray());
fail("Should've thrown an exception");
} catch (CadiException e) {
}
-
+
ks.load(null, null);
ArtifactDir.write(writableFile, Chmod.to755, ks, luggagePassword.toCharArray());
-
+
ArtifactDirStud artiDir2 = new ArtifactDirStud();
artiDir2.place(transMock, certInfoMock, artiMock, "machine");
@@ -131,7 +131,7 @@ public class JU_ArtifactDir {
ArtifactDir.clear();
artiDir.place(transMock, certInfoMock, artiMock, "machine");
-
+
}
public void throwsTest() throws CadiException {
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java
index 177ad3aa..36b3f220 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_CertException.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java
index 6bb31b2f..f8b082fb 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInFiles.java
@@ -78,7 +78,7 @@ public class JU_PlaceArtifactInFiles {
assertThat(placer._place(transMock, certInfoMock, artiMock), is(true));
assertThat(new File(dirName + '/' + nsName + ".crt").exists(), is(true));
assertThat(new File(dirName + '/' + nsName + ".key").exists(), is(true));
-
+
when(certInfoMock.getCerts()).thenReturn(null);
try {
placer._place(transMock, certInfoMock, artiMock);
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java
index a2782e78..237e0f64 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactInKeystore.java
@@ -114,7 +114,7 @@ public class JU_PlaceArtifactInKeystore {
// coverage
assertThat(placer.place(transMock, certInfoMock, artiMock, "machine"), is(true));
-
+
when(certInfoMock.getCerts()).thenReturn(null);
try {
placer._place(transMock, certInfoMock, artiMock);
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java
index d66546bf..18292b21 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_PlaceArtifactOnStream.java
@@ -47,7 +47,7 @@ public class JU_PlaceArtifactOnStream {
private static final String luggagePassword = "12345"; // That's the stupidest combination I've ever heard in my life
private static final String privateKeyString = "I'm a private key!";
-
+
private ByteArrayOutputStream outStream;
private List<String> certs;
@@ -63,7 +63,7 @@ public class JU_PlaceArtifactOnStream {
when(certInfoMock.getChallenge()).thenReturn(luggagePassword);
when(certInfoMock.getCerts()).thenReturn(certs);
when(certInfoMock.getPrivatekey()).thenReturn(privateKeyString);
-
+
outStream = new ByteArrayOutputStream();
}
@@ -71,9 +71,9 @@ public class JU_PlaceArtifactOnStream {
public void test() {
PlaceArtifactOnStream placer = new PlaceArtifactOnStream(new PrintStream(outStream));
placer.place(transMock, certInfoMock, artiMock, "machine");
-
+
String[] output = outStream.toString().split(System.lineSeparator(), 0);
-
+
String[] expected = {
"Challenge: " + luggagePassword,
"PrivateKey:",
@@ -82,7 +82,7 @@ public class JU_PlaceArtifactOnStream {
"cert1",
"cert2"
};
-
+
assertThat(output.length, is(expected.length));
for (int i = 0; i < output.length; i++) {
assertThat(output[i], is(expected[i]));
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java
index 24e30a46..f94da881 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,7 +38,7 @@ public class JU_AAFToken {
UUID uuid2 = AAFToken.fromToken(token);
assertEquals(uuid, uuid2);
}
-
+
@Test
public void testMin() throws CadiException {
UUID uuid = new UUID(Long.MIN_VALUE,Long.MIN_VALUE);
@@ -61,7 +61,7 @@ public class JU_AAFToken {
public void nullTest() {
// Invalid characters
assertNull(AAFToken.fromToken("~~invalid characters~~"));
-
+
// Invalid CADI tokens
assertNull(AAFToken.fromToken("ABCDEF"));
assertNull(AAFToken.fromToken("12345678901234567890123456789012345678"));
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java
index 3864cc25..ba83102e 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Lur.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,17 +42,17 @@ import org.onap.aaf.cadi.oauth.TokenPerm;
import org.onap.aaf.cadi.principal.BearerPrincipal;
public class JU_OAuth2Lur {
-
+
private List<AAFPermission> aafPerms;
private List<Permission> perms;
-
+
@Mock private TokenMgr tmMock;
@Mock private AAFPermission pondMock;
@Mock private Principal princMock;
@Mock private OAuth2Principal oauthPrincMock;
@Mock private BearerPrincipal bearPrincMock;
@Mock private TokenPerm tpMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -66,10 +66,10 @@ public class JU_OAuth2Lur {
assertThat(lur.fish(princMock, pondMock), is(false));
assertThat(lur.fish(oauthPrincMock, pondMock), is(false));
-
+
when(oauthPrincMock.tokenPerm()).thenReturn(tpMock);
assertThat(lur.fish(oauthPrincMock, pondMock), is(false));
-
+
aafPerms = new ArrayList<>();
aafPerms.add(pondMock);
aafPerms.add(pondMock);
@@ -84,9 +84,9 @@ public class JU_OAuth2Lur {
when(oauthPrincMock.tokenPerm()).thenReturn(null);
lur.fishAll(oauthPrincMock, perms);
-
+
assertThat(lur.handlesExclusively(pondMock), is(false));
-
+
assertThat(lur.handles(null), is(false));
assertThat(lur.handles(princMock), is(false));
assertThat(lur.handles(bearPrincMock), is(false));
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java
index 630adacb..5cc15e25 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuth2Principal.java
@@ -22,7 +22,7 @@
package org.onap.aaf.cadi.oauth.test;
import static org.junit.Assert.assertThat;
-import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Mockito.when;
import org.junit.Before;
@@ -35,16 +35,16 @@ import org.onap.aaf.cadi.oauth.TokenPerm;
public class JU_OAuth2Principal {
@Mock TokenPerm tpMock;
-
-
+
+
private static final String username = "username";
-
+
private static final byte[] hash = "hashstring".getBytes();
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
-
+
when(tpMock.getUsername()).thenReturn(username);
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java
index 6759d314..a0a6c10d 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -145,7 +145,7 @@ public class JU_OAuthTest {
Assert.fail(rtt.code + ' ' + rtt.error);
}
}
-
+
// ISAM Test
if (true) {
System.out.println("**** ISAM TEST ****");
@@ -156,7 +156,7 @@ public class JU_OAuthTest {
tc = tcf.newClient(tokenServiceURL, 3000);
tc.client_creds(client_id, client_secret);
int at = username.indexOf('@');
-
+
tc.password(at>=0?username.substring(0, at):username,access.getProperty("cadi_password"));
rtt = tc.getToken("org.osaaf.aaf","org.osaaf.test");
if (rtt.isOK()) {
@@ -164,7 +164,7 @@ public class JU_OAuthTest {
rtt = tc.refreshToken(rtt.value);
if (rtt.isOK()) {
print(rtt.value);
-
+
tc = tcf.newClient(tokenAltIntrospectURL, 3000);
tc.client_creds(client_id, client_secret);
Result<Introspect> rti = tc.introspect(rtt.value.getAccessToken());
@@ -211,8 +211,8 @@ public class JU_OAuthTest {
// Assert.fail();
}
}
-
-
+
+
// private TokenClient testROPCFlow(final String url, final String client_id, final String client_secret, String user, String password, final String ... scope) throws Exception {
// TokenClient tclient = tcf.newClient(url,3000);
// tclient.client_creds(client_id, client_secret);
@@ -233,7 +233,7 @@ public class JU_OAuthTest {
// }
// return tclient;
// }
-
+
private String serviceCall(TzClient tzClient) throws Exception {
return tzClient.best(new Retryable<String>() {
@Override
@@ -263,7 +263,7 @@ public class JU_OAuthTest {
t.getScope(),
t.getRefreshToken());
}
-
+
private void print(Introspect ti) {
if (ti==null || ti.getClientId()==null) {
System.out.println("Empty Introspect");
@@ -288,7 +288,7 @@ public class JU_OAuthTest {
Chrono.timeStamp(exp),
ti.getScope(),
ti.getContent()==null?"":ti.getContent());
-
+
System.out.println();
}
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java
index e8fbbbd5..bc0ddc18 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenClientFactoryTest.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java
index c40e4eb5..f2d46039 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TokenPerm.java
@@ -98,7 +98,7 @@ public class JU_TokenPerm {
String json;
LoadPermissions lp;
Permission p;
-
+
json = "{\"perm\":[" +
" {\"ns\":\"com\",\"type\":\"access\",\"instance\":\"*\",\"action\":\"read,approve\"}," +
"]}";
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java
index 805b13f1..504fa42d 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_TzHClient.java
@@ -53,32 +53,32 @@ import org.onap.aaf.cadi.oauth.TzHClient;
import org.onap.aaf.misc.env.APIException;
public class JU_TzHClient {
-
+
@Mock private Retryable<Integer> retryableMock;
@Mock private TimedToken tokenMock;
@Mock private SecurityInfoC<HttpURLConnection> siMock;
@Mock private Locator<URI> locMock;
@Mock private Item itemMock;
@Mock private Rcli<HttpURLConnection> clientMock;
-
+
private PropAccess access;
-
+
private ByteArrayOutputStream errStream;
-
+
private final static String client_id = "id";
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
access.setProperty(Config.CADI_LATITUDE, "38.62"); // St Louis approx lat
access.setProperty(Config.CADI_LONGITUDE, "90.19"); // St Louis approx long
- //access.setProperty("tag", "http://aaf.something.com");
-
+ //access.setProperty("tag", "http://aaf.something.com");
+
errStream = new ByteArrayOutputStream();
System.setErr(new PrintStream(errStream));
}
-
+
@After
public void tearDown() {
System.setErr(System.err);
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java
index 0394be97..74f2cf40 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/register/test/JU_RegistrationCreator.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,7 +46,7 @@ public class JU_RegistrationCreator {
pa.setProperty(Config.CADI_LATITUDE, "32.7");
pa.setProperty(Config.CADI_LONGITUDE, "-72.0");
pa.setProperty(Config.AAF_LOCATOR_NAME, "");
-
+
try {
String hostname = Inet4Address.getLocalHost().getHostName();
String entry = "";
@@ -82,7 +82,7 @@ public class JU_RegistrationCreator {
assertEquals(protocol,me.getProtocol());
assertEquals(0,me.getSpecialPorts().size());
}
-
+
pa.setProperty(Config.AAF_LOCATOR_ENTRIES, "service");
rc = new RegistrationCreator(pa);
for(MgmtEndpoint me : rc.create(port).getMgmtEndpoint()) {
@@ -141,7 +141,7 @@ public class JU_RegistrationCreator {
pa.setProperty(Config.AAF_LOCATOR_CONTAINER_NS+DOT_OOM, "onap");
String k8s_public_hostname="k8s.public.com";
int public_port = 30001;
-
+
pa.setProperty(Config.AAF_LOCATOR_PUBLIC_FQDN,k8s_public_hostname);
pa.setProperty(Config.AAF_LOCATOR_PUBLIC_PORT+DOT_OOM,Integer.toString(public_port));
pa.setProperty(Config.AAF_LOCATOR_APP_NS, Config.AAF_ROOT_NS_DEF);
@@ -173,7 +173,7 @@ public class JU_RegistrationCreator {
} catch (CadiException | UnknownHostException e) {
Assert.fail(e.getMessage());
}
-
+
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java
index 9871c471..407a4ffd 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java
@@ -60,8 +60,8 @@ public class JU_AAFSSO {
@Test
public void test() {
-
- // Note this is desctructive of personal dirs, and doesn't really test anything. Needs redoing.
+
+ // Note this is desctructive of personal dirs, and doesn't really test anything. Needs redoing.
// AAFSSO sso;
// String[] args;
//
@@ -71,7 +71,7 @@ public class JU_AAFSSO {
// };
// try {
// sso = new AAFSSO(args);
-//
+//
// assertThat(new File(aafDir).exists(), is(true));
// assertThat(new File(aafDir + "/.aaf").exists(), is(true));
// assertThat(new File(aafDir + "/.aaf/keyfile").exists(), is(true));
@@ -80,7 +80,7 @@ public class JU_AAFSSO {
//
//// Not necessarily true
//// assertThat(new File(aafDir + "/.aaf/sso.props").exists(), is(true));
-//
+//
// sso.setLogDefault();
// sso.setStdErrDefault();
//
@@ -104,7 +104,7 @@ public class JU_AAFSSO {
//
// sso.addProp("key", "value");
// assertThat(sso.err(), is(nullValue()));
-//
+//
// assertThat(sso.useX509(), is(false));
////
//// sso.close();
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java b/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java
index 4e51579d..5e715b22 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,7 +44,7 @@ public class Sample {
final private AAFConHttp aafcon;
final private AAFLurPerm aafLur;
final private AAFAuthn<?> aafAuthn;
-
+
/**
* This method is to emphasize the importance of not creating the AAFObjects over and over again.
* @return
@@ -58,15 +58,15 @@ public class Sample {
aafLur = aafcon.newLur();
aafAuthn = aafcon.newAuthn(aafLur);
}
-
+
/**
* Checking credentials outside of HTTP/S presents fewer options initially. There is not, for instance,
- * the option of using 2-way TLS HTTP/S.
- *
- * However, Password Checks are still useful, and, if the Client Certificate could be obtained in other ways, the
+ * the option of using 2-way TLS HTTP/S.
+ *
+ * However, Password Checks are still useful, and, if the Client Certificate could be obtained in other ways, the
* Interface can be expanded in the future to include Certificates.
- * @throws CadiException
- * @throws IOException
+ * @throws CadiException
+ * @throws IOException
*/
public Principal checkUserPass(String fqi, String pass) throws IOException, CadiException {
String ok = aafAuthn.validate(fqi, pass);
@@ -76,7 +76,7 @@ public class Sample {
UnAuthPrincipal means that it is not coming from the official Authorization chain.
This is useful for Security Plugins which don't use Principal as the tie between
Authentication and Authorization
-
+
You can also use this if you want to check Authorization without actually Authenticating, as may
be the case with certain Onboarding Tooling.
*/
@@ -85,64 +85,64 @@ public class Sample {
System.out.printf("Failure: %s\n",ok);
return null;
}
-
+
}
/**
* An example of looking for One Permission within all the permissions user has. CADI does cache these,
* so the call is not expensive.
- *
- * Note: If you are using "J2EE" (Servlets), CADI ties this function to the method:
+ *
+ * Note: If you are using "J2EE" (Servlets), CADI ties this function to the method:
* HttpServletRequest.isUserInRole(String user)
- *
+ *
* The J2EE user can expect that his servlet will NOT be called without a Validated Principal, and that
* "isUserInRole()" will validate if the user has the Permission designated.
- *
+ *
*/
public boolean oneAuthorization(Principal fqi, Permission p) {
return aafLur.fish(fqi, p);
}
-
+
public List<Permission> allAuthorization(Principal fqi) {
List<Permission> pond = new ArrayList<>();
aafLur.fishAll(fqi, pond);
return pond;
}
-
-
+
+
public static void main(String[] args) {
// Note: you can pick up Properties from Command line as well as VM Properties
// Code "user_fqi=... user_pass=..." (where user_pass can be encrypted) in the command line for this sample.
// Also code "perm=<perm type>|<instance>|<action>" to test a specific Permission
- PropAccess myAccess = new PropAccess(args);
+ PropAccess myAccess = new PropAccess(args);
try {
/*
* NOTE: Do NOT CREATE new aafcon, aafLur and aafAuthn each transaction. They are built to be
* reused!
- *
+ *
* This is why this code demonstrates "Sample" as a singleton.
*/
singleton = new Sample(myAccess);
String user = myAccess.getProperty("user_fqi");
String pass= myAccess.getProperty("user_pass");
-
+
if (user==null || pass==null) {
System.err.println("This Sample class requires properties user_fqi and user_pass");
} else {
pass = myAccess.decrypt(pass, false); // Note, with "false", decryption will only happen if starts with "enc:"
// See the CODE for Java Methods used
Principal fqi = Sample.singleton().checkUserPass(user,pass);
-
+
if (fqi==null) {
System.out.println("OK, normally, you would cease processing for an "
+ "unauthenticated user, but for the purpose of Sample, we'll keep going.\n");
fqi=new UnAuthPrincipal(user);
}
-
+
// AGAIN, NOTE: If your client fails Authentication, the right behavior 99.9%
// of the time is to drop the transaction. We continue for sample only.
-
+
// note, default String for perm
String permS = myAccess.getProperty("perm","org.osaaf.aaf.access|*|read");
String[] permA = Split.splitTrim('|', permS);
@@ -155,8 +155,8 @@ public class Sample {
System.out.printf("%s does NOT have %s\n",fqi.getName(),permS);
}
}
-
-
+
+
// Another form, you can get ALL permissions in a list
// See the CODE for Java Methods used
List<Permission> permL = singleton().allAuthorization(fqi);
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java b/cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java
index 41be6df8..efa0106b 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/content/JU_Content.java
@@ -7,9 +7,9 @@
* * 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.
@@ -48,13 +48,13 @@ public class JU_Content {
"\"m55555@jr583u.cred.test.com 1 Thu Oct 09 12:54:46 CDT 2014\"," +
"\"m55555@jr583u.cred.test.com 1 Tue Jan 06 05:00:00 CST 2015\"," +
"\"m55555@jr583u.cred.test.com 1 Wed Jan 07 05:00:00 CST 2015\"]}";
-
+
Error err = new Error();
err.setText("Hello");
err.getVariables().add("I'm a teapot");
err.setMessageId("12");
-
-
+
+
// System.out.println(msg);
RosettaEnv env = new RosettaEnv();
RosettaDF<aaf.v2_0.Error> errDF = env.newDataFactory(aaf.v2_0.Error.class);
@@ -62,16 +62,16 @@ public class JU_Content {
errDF.out(RosettaData.TYPE.JSON);
RosettaData<Error> data = errDF.newData();
data.load(err);
-
+
@SuppressWarnings("unused")
String output = data.asString();
// System.out.println(output);
-
+
data.load(new StringReader(msg));
err = data.asObject();
output = err.getText();
// System.out.println(output);
}
-
+
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java
index da85702d..1db9317a 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsAuthentication.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,19 +29,19 @@ import org.onap.aaf.cadi.config.SecurityInfoC;
/**
* AbsAuthentication is a class representing how to Authenticate onto a Client.
- *
+ *
* Methods of setting Authentication on a Client vary, so CLIENT is a Generic Type
- * This allows the ability to apply security onto Different Client Types, as they come
+ * This allows the ability to apply security onto Different Client Types, as they come
* into vogue, or change over time.
- *
+ *
* Password is encrypted at rest.
- *
+ *
* @author Jonathan
*
* @param <CLIENT>
*/
public abstract class AbsAuthentication<CLIENT> implements SecuritySetter<CLIENT> {
- // HTTP Header for Authentication is "Authorization". This was from an early stage of internet where
+ // HTTP Header for Authentication is "Authorization". This was from an early stage of internet where
// Access by Credential "Authorized" you for everything on the site. Since those early days, it became
// clear that "full access" wasn't appropriate, so the split between Authentication and Authorization
// came into being... But the Header remains.
@@ -57,14 +57,14 @@ public abstract class AbsAuthentication<CLIENT> implements SecuritySetter<CLIENT
protected final SecurityInfoC<CLIENT> securityInfo;
protected long lastMiss;
protected int count;
-
+
static {
try {
symm = Symm.encrypt.obtain();
} catch (IOException e) {
throw new RuntimeException("Cannot create critical internal encryption key",e);
}
-
+
}
public AbsAuthentication(final SecurityInfoC<CLIENT> securityInfo, final String user, final byte[] headValue) throws IOException {
@@ -82,11 +82,11 @@ public abstract class AbsAuthentication<CLIENT> implements SecuritySetter<CLIENT
return new String(symm.decode(headValue));
}
}
-
+
protected void setUser(String id) {
user = id;
}
-
+
@Override
public String getID() {
return user;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java
index baac6daa..80234460 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/AbsTransferSS.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,10 +29,10 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
/**
* This client represents the ability to Transfer the Identity of the caller to the authenticated
- * user being transferred to. This ability is critical for App-to-App communication to ensure that
+ * user being transferred to. This ability is critical for App-to-App communication to ensure that
* Authorization can happen on the End-Users' credentials when appropriate, even though Authentication
* to App1 by App2 must be by App2's credentials.
- *
+ *
* @author Jonathan
*
* @param <CLIENT>
@@ -59,8 +59,8 @@ public abstract class AbsTransferSS<CLIENT> implements SecuritySetter<CLIENT> {
if (principal==null) {
return;
} else {
- value = principal.getName() + ':' +
- app + ':' +
+ value = principal.getName() + ':' +
+ app + ':' +
principal.tag() + ':' +
"AS";
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java
index 1eb8d7c4..021229ce 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/BasicAuth.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java
index 9aa9cad6..7a437e39 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/EClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,7 +44,7 @@ public interface EClient<CT> {
public<T> Future<T> futureRead(RosettaDF<T> df,Data.TYPE type);
public<T> Future<T> future(T t);
public Future<Void> future(HttpServletResponse resp, int expected) throws APIException;
-
+
public interface Transfer {
public void transfer(OutputStream os) throws IOException, APIException;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java
index 39f88687..de32d959 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Future.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,7 +26,7 @@ import org.onap.aaf.cadi.CadiException;
public abstract class Future<T> {
public T value;
public abstract boolean get(int timeout) throws CadiException;
-
+
public abstract int code();
public abstract String body();
public abstract String header(String tag);
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java
index af97c465..8744e896 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Holder.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,7 +36,7 @@ public class Holder<T> {
value = t;
return t;
}
-
+
public T get() {
return value;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
index 6b486b8e..cfc52fb4 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Rcli.java
@@ -7,9 +7,9 @@
* 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.
@@ -94,9 +94,9 @@ public abstract class Rcli<CT> {
rv.apiVersion = apiVersion;
return rv;
}
-
+
protected abstract Rcli<CT> clone(URI uri, SecuritySetter<CT> ss);
-
+
public abstract void invalidate() throws CadiException;
public Rcli<CT> readTimeout(int millis) {
@@ -118,7 +118,7 @@ public abstract class Rcli<CT> {
this.apiVersion = apiVersion;
return this;
}
-
+
public boolean isApiVersion(String prospective) {
return apiVersion.equals(prospective);
}
@@ -294,7 +294,7 @@ public abstract class Rcli<CT> {
/**
* Read String, using POST for keyInfo
- *
+ *
* @param pathinfo
* @param df
* @param t
@@ -335,7 +335,7 @@ public abstract class Rcli<CT> {
*/
public<T,R> Future<R> readPost(String pathinfo, final RosettaDF<T> df, final T t, final RosettaDF<R> resp) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(POST);
client.addHeader(CONTENT_TYPE,typeString(df.getTypeClass()));
@@ -371,11 +371,11 @@ public abstract class Rcli<CT> {
public Future<String> read(String pathinfo, String accept, String ... headers) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(GET);
client.addHeader(ACCEPT, accept);
-
+
for (int i=1;i<headers.length;i=i+2) {
client.addHeader(headers[i-1],headers[i]);
}
@@ -416,7 +416,7 @@ public abstract class Rcli<CT> {
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
client.setFragment(pp.frag());
-
+
client.setPayload(null);
client.send();
return client.futureRead(df,type);
@@ -430,7 +430,7 @@ public abstract class Rcli<CT> {
client.addHeader(ACCEPT, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(null);
client.send();
@@ -445,7 +445,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE,contentType);
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -455,16 +455,16 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
-
+
public<T> Future<String> updateRespondString(String pathinfo, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(PUT);
client.addHeader(CONTENT_TYPE, typeString(df.getTypeClass()));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
@@ -476,7 +476,7 @@ public abstract class Rcli<CT> {
client.send();
return client.futureReadString();
}
-
+
public Future<String> update(String pathinfo, String contentType, EClient.Transfer content) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
@@ -502,8 +502,8 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(df.getTypeClass()));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
-
+ client.setFragment(pp.frag());
+
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -513,16 +513,16 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
-
+
public<T> Future<T> update(String pathinfo, Class<?> cls, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
-
+
EClient<CT> client = client();
client.setMethod(PUT);
client.addHeader(CONTENT_TYPE, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
@@ -533,7 +533,7 @@ public abstract class Rcli<CT> {
client.send();
return client.future(t);
}
-
+
/**
@@ -553,7 +553,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(Void.class));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
// client.setPayload(new EClient.Transfer() {
// @Override
@@ -563,7 +563,7 @@ public abstract class Rcli<CT> {
client.send();
return client.future(null);
}
-
+
public<T> Future<T> delete(String pathinfo, String contentType, final RosettaDF<T> df, final T t) throws APIException, CadiException {
final ParsePath pp = new ParsePath(pathinfo);
@@ -573,7 +573,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, contentType);
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
@@ -593,7 +593,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -612,7 +612,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(df.getTypeClass()));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(new EClient.Transfer() {
@Override
public void transfer(OutputStream os) throws IOException, APIException {
@@ -633,7 +633,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, typeString(cls));
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(null);
client.send();
@@ -648,7 +648,7 @@ public abstract class Rcli<CT> {
client.addHeader(CONTENT_TYPE, contentType);
client.setPathInfo(pp.path());
client.setQueryParams(pp.query());
- client.setFragment(pp.frag());
+ client.setFragment(pp.frag());
client.setPayload(null);
client.send();
@@ -681,7 +681,7 @@ public abstract class Rcli<CT> {
int read;
// reuse Buffers
Pooled<byte[]> pbuff = buffPool.get();
- try {
+ try {
while ((read=is.read(pbuff.content))>=0) {
os.write(pbuff.content,0,read);
}
@@ -713,13 +713,13 @@ public abstract class Rcli<CT> {
queryEnd = pound>=0?pound:path.length();
if (oneCallQueryParams==null) {
if (query>=0) {
- queryParams = path.substring(query+1,queryEnd);
+ queryParams = path.substring(query+1,queryEnd);
} else {
queryParams=null;
}
} else {
if (query>=0) {
- queryParams = oneCallQueryParams + '&' + path.substring(query+1,queryEnd);
+ queryParams = oneCallQueryParams + '&' + path.substring(query+1,queryEnd);
} else {
queryParams = oneCallQueryParams;
}
@@ -727,7 +727,7 @@ public abstract class Rcli<CT> {
}
}
}
-
+
public String path() {
if (query>=0) {
if (pound>=0) {
@@ -740,11 +740,11 @@ public abstract class Rcli<CT> {
return path;
}
}
-
+
public String query() {
return queryParams;
}
-
+
public String frag() {
if (pound>=0) {
return path.substring(pound+1);
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java
index 0e2a4b16..5b8bf920 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Result.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,7 +35,7 @@ public class Result<T> {
public static<T> Result<T> ok(int code,T t) {
return new Result<T>(code,t,null);
}
-
+
public static<T> Result<T> err(int code,String body) {
return new Result<T>(code,null,body);
}
@@ -47,7 +47,7 @@ public class Result<T> {
public boolean isOK() {
return error==null;
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder("Code: ");
sb.append(code);
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java
index 58e7718d..6d85a420 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/client/Retryable.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,7 +28,7 @@ import org.onap.aaf.cadi.Locator;
import org.onap.aaf.misc.env.APIException;
/**
- *
+ *
* @author Jonathan
*
* @param <RT>
@@ -38,7 +38,7 @@ public abstract class Retryable<RET> {
// be able to hold state for consistent Connections. Not required for all connection types.
public Rcli<?> lastClient;
private Locator.Item item;
-
+
public Retryable() {
lastClient = null;
item = null;
@@ -57,7 +57,7 @@ public abstract class Retryable<RET> {
public Locator.Item item() {
return item;
}
-
+
public abstract RET code(Rcli<?> client) throws CadiException, ConnectException, APIException;
/**
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java
index c2f56458..744aba43 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HAuthorizationHeader.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,7 +31,7 @@ import org.onap.aaf.cadi.client.AbsAuthentication;
import org.onap.aaf.cadi.config.SecurityInfoC;
public class HAuthorizationHeader extends AbsAuthentication<HttpURLConnection> {
-
+
public HAuthorizationHeader(SecurityInfoC<HttpURLConnection> si, String user, String headValue) throws IOException {
super(si,user,headValue==null?null:headValue.getBytes());
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java
index 38465da4..d280b9cb 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HBasicAuthSS.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,12 +42,12 @@ public class HBasicAuthSS extends HAuthorizationHeader implements BasicAuth {
this(si,si.access.getProperty(Config.AAF_APPID, null),
si.access.decrypt(si.access.getProperty(Config.AAF_APPPASS, null), false));
}
-
+
public HBasicAuthSS(SecurityInfoC<HttpURLConnection> si, boolean setDefault) throws IOException {
this(si,si.access.getProperty(Config.AAF_APPID, null),
si.access.decrypt(si.access.getProperty(Config.AAF_APPPASS, null), false),setDefault);
}
-
+
public HBasicAuthSS(SecurityInfoC<HttpURLConnection> si, String user, String pass, boolean asDefault) throws IOException {
this(si, user,pass);
@@ -55,11 +55,11 @@ public class HBasicAuthSS extends HAuthorizationHeader implements BasicAuth {
si.set(this);
}
}
-
+
public HBasicAuthSS(BasicPrincipal bp, SecurityInfoC<HttpURLConnection> si) throws IOException {
this(si, bp.getName(),new String(bp.getCred()));
}
-
+
public HBasicAuthSS(BasicPrincipal bp, SecurityInfoC<HttpURLConnection> si, boolean asDefault) throws IOException {
this(si, bp.getName(),new String(bp.getCred()));
if (asDefault) {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
index 61112c47..cef4ae47 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -49,7 +49,7 @@ import org.onap.aaf.misc.rosetta.env.RosettaDF;
/**
* Low Level Http Client Mechanism. Chances are, you want the high level "HRcli"
* for Rosetta Object Translation
- *
+ *
* @author Jonathan
*
*/
@@ -72,7 +72,7 @@ public class HClient implements EClient<HttpURLConnection> {
this.uri = uri;
this.ss = ss;
this.connectTimeout = connectTimeout;
- pathinfo = query = fragment = null;
+ pathinfo = query = fragment = null;
}
@Override
@@ -89,7 +89,7 @@ public class HClient implements EClient<HttpURLConnection> {
public void setPayload(Transfer transfer) {
this.transfer = transfer;
}
-
+
@Override
public void addHeader(String tag, String value) {
if (headers == null)
@@ -133,10 +133,10 @@ public class HClient implements EClient<HttpURLConnection> {
huc = getConnection(sendURI, pi);
huc.setRequestMethod(meth);
if (ss!=null) {
- ss.setSecurity(huc);
+ ss.setSecurity(huc);
}
if (headers != null)
- for (Header d : headers) {
+ for (Header d : headers) {
huc.addRequestProperty(d.tag, d.value);
}
huc.setDoInput(true);
@@ -164,11 +164,11 @@ public class HClient implements EClient<HttpURLConnection> {
pathinfo = query = fragment = "";
}
}
-
+
public URI getURI() {
return uri;
}
-
+
public void setURI(URI uri) {
this.uri = uri;
}
@@ -176,31 +176,31 @@ public class HClient implements EClient<HttpURLConnection> {
public int timeout() {
return connectTimeout;
}
-
+
protected HttpURLConnection getConnection(URI uri, StringBuilder pi) throws IOException, URISyntaxException {
URL url = new URI(
- uri.getScheme(),
+ uri.getScheme(),
uri.getAuthority(),
- pi==null?uri.getPath():pi.toString(),
+ pi==null?uri.getPath():pi.toString(),
query,
fragment).toURL();
return (HttpURLConnection) url.openConnection();
}
-
+
public abstract class HFuture<T> extends Future<T> {
protected HttpURLConnection huc;
protected int respCode;
protected IOException exception;
protected StringBuilder errContent;
-
+
public HFuture(final HttpURLConnection huc) {
this.huc = huc;
}
-
+
protected boolean evalInfo(HttpURLConnection huc) throws APIException, IOException{
return respCode == 200;
};
-
+
@Override
public final boolean get(int timeout) throws CadiException {
try {
@@ -219,7 +219,7 @@ public class HClient implements EClient<HttpURLConnection> {
close();
}
}
-
+
private void extractError() {
InputStream is = huc.getErrorStream();
try {
@@ -237,7 +237,7 @@ public class HClient implements EClient<HttpURLConnection> {
exception = e;
}
}
-
+
// Typically only used by Read
public StringBuilder inputStreamToString(InputStream is) {
// Avoids Carriage returns, and is reasonably efficient, given
@@ -260,26 +260,26 @@ public class HClient implements EClient<HttpURLConnection> {
return null;
}
}
-
-
+
+
@Override
public int code() {
return respCode;
}
-
+
public HttpURLConnection huc() {
return huc;
}
-
+
public IOException exception() {
return exception;
}
-
+
@Override
public String header(String tag) {
return huc.getHeaderField(tag);
}
-
+
public void close() {
if (huc!=null) {
huc.disconnect();
@@ -393,7 +393,7 @@ public class HClient implements EClient<HttpURLConnection> {
is = huc.getInputStream();
// reuse Buffers
Pooled<byte[]> pbuff = Rcli.buffPool.get();
- try {
+ try {
while ((read=is.read(pbuff.content))>=0) {
os.write(pbuff.content,0,read);
}
@@ -409,7 +409,7 @@ public class HClient implements EClient<HttpURLConnection> {
if (is!=null) {
errContent = new StringBuilder();
Pooled<byte[]> pbuff = Rcli.buffPool.get();
- try {
+ try {
while ((read=is.read(pbuff.content))>=0) {
os.write(pbuff.content,0,read);
}
@@ -436,12 +436,12 @@ public class HClient implements EClient<HttpURLConnection> {
this.tag = t;
this.value = v;
}
-
+
public String toString() {
return tag + '=' + value;
}
}
-
+
public String toString() {
return "HttpURLConnection Client configured to " + uri.toString();
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
index 19e40b3a..1d1f2732 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HMangr.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,7 +46,7 @@ public class HMangr {
private int readTimeout, connectionTimeout;
public final Locator<URI> loc;
private Access access;
-
+
public HMangr(Access access, Locator<URI> loc) throws LocatorException {
readTimeout = 10000;
connectionTimeout=3000;
@@ -58,18 +58,18 @@ public class HMangr {
}
/**
- * Reuse the same service. This is helpful for multiple calls that change service side cached data so that
+ * Reuse the same service. This is helpful for multiple calls that change service side cached data so that
* there is not a speed issue.
- *
+ *
* If the service goes down, another service will be substituted, if available.
- *
+ *
* @param access
* @param loc
* @param ss
* @param item
* @param retryable
* @return
- * @throws URISyntaxException
+ * @throws URISyntaxException
* @throws Exception
*/
public<RET> RET same(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) throws APIException, CadiException, LocatorException {
@@ -107,7 +107,7 @@ public class HMangr {
} else {
client.setSecuritySetter(ss);
}
-
+
retry = false;
try {
ret = retryable.code(client);
@@ -118,14 +118,14 @@ public class HMangr {
try {
Throwable ec = e.getCause();
if (ec instanceof java.net.ConnectException) {
- if (client!=null && loc.hasItems()) {
+ if (client!=null && loc.hasItems()) {
access.log(Level.WARN,"Connection refused, trying next available service");
retry = true;
} else {
throw new CadiException("Connection refused, no more services to try");
}
} else if (ec instanceof java.net.SocketException) {
- if (client!=null && loc.hasItems()) {
+ if (client!=null && loc.hasItems()) {
access.log(Level.WARN,"Socket prematurely closed, trying next available service");
retry = true;
} else {
@@ -155,8 +155,8 @@ public class HMangr {
}
return ret;
}
-
-
+
+
public<RET> RET best(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable) throws LocatorException, CadiException, APIException {
retryable.item(loc.best());
return same(ss,retryable);
@@ -168,7 +168,7 @@ public class HMangr {
public<RET> RET all(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable,boolean notify) throws LocatorException, CadiException, APIException {
return call(ss,retryable,notify,null);
}
-
+
public <RET> RET allExcept(SecuritySetter<HttpURLConnection> ss, Retryable<RET> retryable,boolean notify, String selfHost) throws LocatorException, CadiException, APIException {
return call(ss,retryable,notify,selfHost);
}
@@ -211,12 +211,12 @@ public class HMangr {
access.log(Level.ERROR,"Connection to",uri,"refused during call to all services");
}
}
-
- if (ret == null && notify)
+
+ if (ret == null && notify)
throw new LocatorException("No available clients to call");
return ret;
}
-
+
public void close() {
// TODO Anything here?
@@ -230,7 +230,7 @@ public class HMangr {
public int readTimeout() {
return readTimeout;
}
-
+
public void connectionTimeout(int t) {
connectionTimeout = t;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java
index 1fecce2b..2b6a9ac2 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HNoAuthSS.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java
index cbd7b33e..70ca4902 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HRcli.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,9 +36,9 @@ import org.onap.aaf.misc.env.Data.TYPE;
/**
* Rosetta Client
- *
+ *
* JAXB defined JSON or XML over HTTP/S
- *
+ *
* @author Jonathan
*
* @param <T>
@@ -74,10 +74,10 @@ public class HRcli extends Rcli<HttpURLConnection> {
/**
- *
+ *
* @return
- * @throws APIException
- * @throws DME2Exception
+ * @throws APIException
+ * @throws DME2Exception
*/
protected EClient<HttpURLConnection> client() throws CadiException {
try {
@@ -93,7 +93,7 @@ public class HRcli extends Rcli<HttpURLConnection> {
throw new CadiException(e);
}
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.client.Rcli#setSecuritySetter(org.onap.aaf.cadi.SecuritySetter)
*/
@@ -117,7 +117,7 @@ public class HRcli extends Rcli<HttpURLConnection> {
throw new CadiException(e);
}
}
-
+
public HRcli setManager(HMangr hman) {
this.hman = hman;
return this;
@@ -126,5 +126,5 @@ public class HRcli extends Rcli<HttpURLConnection> {
public String toString() {
return uri.toString();
}
-
+
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java
index 7c7d391f..0da76e91 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HSecurityInfoInit.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,7 @@ import org.onap.aaf.misc.env.APIException;
/**
* This class will pick out the best default SS for Clients per Client type
- *
+ *
* @author Instrumental
*
*/
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java
index cd20585f..99b73ed7 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTokenSS.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java
index f68c1f61..d8c8d5ad 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HTransferSS.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ public class HTransferSS extends AbsTransferSS<HttpURLConnection> {
public HTransferSS(TaggedPrincipal principal, String app) throws IOException {
super(principal, app);
}
-
+
public HTransferSS(TaggedPrincipal principal, String app, SecurityInfoC<HttpURLConnection> si) {
super(principal, app, si);
}
@@ -55,7 +55,7 @@ public class HTransferSS extends AbsTransferSS<HttpURLConnection> {
securityInfo.setSocketFactoryOn((HttpsURLConnection)huc);
}
}
-
+
@Override
public int setLastResponse(int respCode) {
return 0;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java
index f441186e..89c11b69 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HX509SS.java
@@ -7,9 +7,9 @@
* 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.
@@ -57,11 +57,11 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
public HX509SS(SecurityInfoC<HttpURLConnection> si) throws APIException, CadiException {
this(null,si,false);
}
-
+
public HX509SS(SecurityInfoC<HttpURLConnection> si, boolean asDefault) throws APIException, CadiException {
this(null,si,asDefault);
}
-
+
public HX509SS(final String sendAlias, SecurityInfoC<HttpURLConnection> si) throws APIException, CadiException {
this(sendAlias, si, false);
}
@@ -75,7 +75,7 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
alias = si.defaultAlias;
}
}
-
+
priv=null;
X509KeyManager[] xkms = si.getKeyManagers();
if (xkms==null || xkms.length==0) {
@@ -88,9 +88,9 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
for (int i=0;cert==null&&i<xkms.length;++i) {
X509Certificate[] chain = xkms[i].getCertificateChain(alias);
if (chain!=null&&chain.length>0) {
- algo = chain[0].getSigAlgName();
+ algo = chain[0].getSigAlgName();
pub = chain[0].getEncoded();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(pub.length*2);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(pub.length*2);
ByteArrayInputStream bais = new ByteArrayInputStream(pub);
Symm.base64noSplit.encode(bais,baos,X509);
cert = baos.toString();
@@ -111,32 +111,32 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
}
if (alias==null) { // must be a one-way
huc.setRequestProperty(AbsAuthentication.AUTHORIZATION, cert);
-
+
// Test Signed content
try {
String data = "SignedContent["+ inc() + ']' + Chrono.dateTime();
huc.setRequestProperty("Data", data);
-
+
Signature sig = Signature.getInstance(algo);
sig.initSign(priv);
sig.update(data.getBytes());
byte[] signature = sig.sign();
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream((int)(signature.length*1.3));
ByteArrayInputStream bais = new ByteArrayInputStream(signature);
Symm.base64noSplit.encode(bais, baos);
huc.setRequestProperty("Signature", new String(baos.toByteArray()));
-
+
} catch (Exception e) {
throw new CadiException(e);
}
}
}
-
+
private synchronized int inc() {
return ++count;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.SecuritySetter#getID()
*/
@@ -144,7 +144,7 @@ public class HX509SS implements SecuritySetter<HttpURLConnection> {
public String getID() {
return alias;
}
-
+
@Override
public int setLastResponse(int respCode) {
return 0;
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
index 8053dabf..c0b9f375 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/DNSLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ import org.onap.aaf.cadi.LocatorException;
public class DNSLocator implements SizedLocator<URI> {
private static enum Status {UNTRIED, OK, INVALID, SLOW};
private static final int CHECK_TIME = 3000;
-
+
private String host, protocol;
private Access access;
private Host[] hosts;
@@ -41,7 +41,7 @@ public class DNSLocator implements SizedLocator<URI> {
private String suffix;
private int size = 1; // initial, until refreshed.
-
+
public DNSLocator(Access access, String protocol, String host, String range) {
this.host = host;
this.protocol = protocol;
@@ -164,7 +164,7 @@ public class DNSLocator implements SizedLocator<URI> {
}
return false;
}
-
+
private String parseHostAndPorts(String aaf_locate, int _start, int defaultPort) throws LocatorException {
int slash, start;
int colon = aaf_locate.indexOf(':',_start);
@@ -193,7 +193,7 @@ public class DNSLocator implements SizedLocator<URI> {
if(slash>=0) {
suffix = aaf_locate.substring(slash);
}
-
+
} else {
slash = aaf_locate.indexOf('/', start);
if (slash == start) {
@@ -211,7 +211,7 @@ public class DNSLocator implements SizedLocator<URI> {
host = slash<_start?aaf_locate.substring(_start):aaf_locate.substring(_start,slash);
startPort = endPort = defaultPort;
}
-
+
return host;
}
@@ -219,18 +219,18 @@ public class DNSLocator implements SizedLocator<URI> {
private URI uri;
private InetAddress ia;
private Status status;
-
+
public Host(InetAddress inetAddress, int port, String suffix) throws URISyntaxException {
ia = inetAddress;
uri = new URI(protocol,null,inetAddress.getCanonicalHostName(),port,suffix,null,null);
status = Status.UNTRIED;
}
-
+
public String toString() {
return uri.toString() + " - " + status.name();
}
}
-
+
private class DLItem implements Item {
public DLItem(int i) {
cnt = i;
@@ -238,7 +238,7 @@ public class DNSLocator implements SizedLocator<URI> {
private int cnt;
}
-
+
public void destroy() {}
public int size() {
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java
index 488d35d5..57eca417 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/HClientHotPeerLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,7 +35,7 @@ public class HClientHotPeerLocator extends HotPeerLocator<HClient> {
public HClientHotPeerLocator(Access access, String urlstr, long invalidateTime, String localLatitude,
String localLongitude, HX509SS ss) throws LocatorException {
super(access, urlstr, invalidateTime, localLatitude, localLongitude);
-
+
this.ss = ss;
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
index 34889138..d332a7f3 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -54,7 +54,7 @@ public class PropertyLocator implements Locator<URI> {
}
/**
* comma delimited root url list
- *
+ *
* @param locList
* @throws LocatorException
*/
@@ -67,9 +67,9 @@ public class PropertyLocator implements Locator<URI> {
}
String[] locarray = Split.split(',',locList);
List<URI> uriList = new ArrayList<>();
-
+
random = new SecureRandom();
-
+
for (int i=0;i<locarray.length;++i) {
try {
int range = locarray[i].indexOf(":[");
@@ -234,7 +234,7 @@ public class PropertyLocator implements Locator<URI> {
} else {
newCurrent = current;
}
-
+
for (int i=0; i< end; ++i) {
if (newCurrent[i]==null){
newCurrent[i]=new PLItem(i);
@@ -257,14 +257,14 @@ public class PropertyLocator implements Locator<URI> {
protected Socket createSocket() {
return new Socket();
}
-
+
private class PLItem implements Item {
public int idx,order;
-
+
public PLItem(int i) {
idx = order =i;
}
-
+
public String toString() {
return "Item: " + idx + " order: " + order;
}
@@ -294,7 +294,7 @@ public class PropertyLocator implements Locator<URI> {
}
return sb.toString();
}
-
+
public void destroy() {
}
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
index b0654cfa..862868f0 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SingleEndpointLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,19 +28,19 @@ import org.onap.aaf.cadi.LocatorException;
public class SingleEndpointLocator implements SizedLocator<URI> {
private final URI uri;
- private final static Item item = new Item() {};
+ private final static Item item = new Item() {};
private Date noRetryUntil;
-
+
public SingleEndpointLocator(final URI uri) {
this.uri = uri;
}
-
+
public SingleEndpointLocator(final String endpoint) throws LocatorException {
try {
- this.uri = new URI(endpoint);
- } catch (URISyntaxException e) {
- throw new LocatorException(e);
- }
+ this.uri = new URI(endpoint);
+ } catch (URISyntaxException e) {
+ throw new LocatorException(e);
+ }
}
@Override
@@ -63,7 +63,7 @@ public class SingleEndpointLocator implements SizedLocator<URI> {
@Override
public void invalidate(Item item) throws LocatorException {
// one minute timeout, because there is no other item
- noRetryUntil = new Date(System.currentTimeMillis()+60000);
+ noRetryUntil = new Date(System.currentTimeMillis()+60000);
}
@Override
@@ -87,10 +87,10 @@ public class SingleEndpointLocator implements SizedLocator<URI> {
// Never refreshed
return true;
}
-
+
@Override
public int size() {
- return 1;
+ return 1;
}
@Override
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
index 65a34738..40792649 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/SizedLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,5 +24,5 @@ package org.onap.aaf.cadi.locator;
import org.onap.aaf.cadi.Locator;
public interface SizedLocator<T> extends Locator<T> {
- public abstract int size();
+ public abstract int size();
}
diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java b/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
index 27eb507f..f72e5290 100644
--- a/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
+++ b/cadi/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,33 +24,33 @@ package org.onap.aaf.cadi.routing;
import org.onap.aaf.misc.env.util.Split;
public class GreatCircle {
- // Note: multiplying by this constant is faster than calling Math equivalent function
+ // Note: multiplying by this constant is faster than calling Math equivalent function
private static final double DEGREES_2_RADIANS = Math.PI/180.0;
-
+
public static final double DEGREES_2_NM = 60;
public static final double DEGREES_2_KM = DEGREES_2_NM * 1.852; // 1.852 is exact ratio per 1929 Standard Treaty, adopted US 1954
- public static final double DEGREES_2_MI = DEGREES_2_NM * 1.1507795;
-
+ public static final double DEGREES_2_MI = DEGREES_2_NM * 1.1507795;
+
/**
- *
+ *
* Calculate the length of an arc on a perfect sphere based on Latitude and Longitudes of two points
* Parameters are in Degrees (i.e. the coordinate system you get from GPS, Mapping WebSites, Phones, etc)
- *
+ *
* L1 = Latitude of point A
* G1 = Longitude of point A
* L2 = Latitude of point B
* G2 = Longitude of point B
- *
+ *
* d = acos (sin(L1)*sin(L2) + cos(L1)*cos(L2)*cos(G1 - G2))
- *
+ *
* Returns answer in Degrees
- *
+ *
* Since there are 60 degrees per nautical miles, you can convert to NM by multiplying by 60
- *
- * Essential formula from a Princeton website, the "Law of Cosines" method.
- *
+ *
+ * Essential formula from a Princeton website, the "Law of Cosines" method.
+ *
* Refactored cleaned up for speed Jonathan 3/8/2013
- *
+ *
* @param latA
* @param lonA
* @param latB
@@ -66,19 +66,19 @@ public class GreatCircle {
lonB *= DEGREES_2_RADIANS;
return Math.acos(
- Math.sin(latA) * Math.sin(latB) +
+ Math.sin(latA) * Math.sin(latB) +
Math.cos(latA) * Math.cos(latB) * Math.cos(lonA-lonB)
)
/ DEGREES_2_RADIANS;
}
-
- /**
+
+ /**
* Convert from "Lat,Long Lat,Long" String format
* "Lat,Long,Lat,Long" Format
* or all four entries "Lat Long Lat Long"
- *
+ *
* (Convenience function)
- *
+ *
* Since Distance is positive, a "-1" indicates an error in String formatting
*/
public static double calc(String ... coords) {
@@ -111,7 +111,7 @@ public class GreatCircle {
Double.parseDouble(coords[2]),
Double.parseDouble(coords[3])
);
-
+
default:
return -1;
}
@@ -124,7 +124,7 @@ public class GreatCircle {
///**
//* Haverside method, from Princeton
-//*
+//*
//* @param alat
//* @param alon
//* @param blat
@@ -169,16 +169,16 @@ public class GreatCircle {
// alon *= DEGREES_2_RADIANS;
// blat *= DEGREES_2_RADIANS;
// blon *= DEGREES_2_RADIANS;
-//
+//
// // Reused values
// double cosAlat,cosBlat;
-//
+//
// return Math.acos(
// ((cosAlat=Math.cos(alat))*Math.cos(alon)*(cosBlat=Math.cos(blat))*Math.cos(blon)) +
// (cosAlat*Math.sin(alon)*cosBlat*Math.sin(blon)) +
// (Math.sin(alat)*Math.sin(blat))
// )/DEGREES_2_RADIANS;
-//
+//
//}
/*
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java
index 65daa7b6..9c293c92 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsAuthentication.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,20 +34,20 @@ import java.io.PrintStream;
import java.net.HttpURLConnection;
public class JU_AbsAuthentication {
-
+
private final static String ID = "id";
private final static String PASSWORD = "password";
private final static String WARNING = "Your service has 1000 consecutive bad service " +
"logins to AAF. AAF Access will be disabled after 10000\n";
-
+
private static ByteArrayOutputStream errStream;
-
+
@Before
public void setup() {
errStream = new ByteArrayOutputStream();
System.setErr(new PrintStream(errStream));
}
-
+
@After
public void tearDown() {
System.setErr(System.err);
@@ -59,7 +59,7 @@ public class JU_AbsAuthentication {
assertThat(stub.getID(), is(nullValue()));
assertThat(stub.headValue(), is(""));
assertThat(stub.count(), is(0));
-
+
stub.setUser(ID);
assertThat(stub.getID(), is(ID));
@@ -67,7 +67,7 @@ public class JU_AbsAuthentication {
assertThat(stub.getID(), is(ID));
assertThat(stub.headValue(), is(PASSWORD));
assertThat(stub.count(), is(0));
-
+
assertThat(stub.setLastResponse(200), is(0));
assertThat(stub.isDenied(), is(false));
@@ -81,12 +81,12 @@ public class JU_AbsAuthentication {
stub.setCount(999);
assertThat(stub.setLastResponse(401), is(1000));
assertThat(errStream.toString(), is(WARNING));
-
+
// coverage...
stub.setLastMiss(1);
assertThat(stub.isDenied(), is(false));
}
-
+
private class AuthStub extends AbsAuthentication<HttpURLConnection> {
public AuthStub(SecurityInfoC<HttpURLConnection> securityInfo, String user, byte[] headValue)
@@ -95,7 +95,7 @@ public class JU_AbsAuthentication {
@Override public void setSecurity(HttpURLConnection client) throws CadiException { }
@Override public void setUser(String id) { super.setUser(id); }
@Override public String headValue() throws IOException { return super.headValue(); }
-
+
public void setLastMiss(long lastMiss) { this.lastMiss = lastMiss; }
public void setCount(int count) { this.count = count; }
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java
index c7720775..6d09b379 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_AbsTransferSS.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,18 +34,18 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
import java.net.HttpURLConnection;
public class JU_AbsTransferSS {
-
+
@Mock TaggedPrincipal princMock;
@Mock SecurityInfoC<HttpURLConnection> siMock;
-
+
private static final String princName = "name";
private static final String princTag = "tag";
private static final String app = "app";
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
-
+
when(princMock.getName()).thenReturn(princName);
when(princMock.tag()).thenReturn(princTag);
}
@@ -55,12 +55,12 @@ public class JU_AbsTransferSS {
TransferSSStub stub = new TransferSSStub(princMock, app);
assertThat(stub.getID(), is(princName));
assertThat(stub.getValue(), is(princName + ':' + app + ':' + princTag + ':' + "AS"));
-
+
stub = new TransferSSStub(null, app, siMock);
assertThat(stub.getID(), is(""));
assertThat(stub.getValue(), is(nullValue()));
}
-
+
private class TransferSSStub extends AbsTransferSS<HttpURLConnection> {
public TransferSSStub(TaggedPrincipal principal, String app) { super(principal, app); }
public TransferSSStub(TaggedPrincipal principal, String app, SecurityInfoC<HttpURLConnection> si) { super(principal, app, si); }
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java
index 97fa9d21..a631dfbc 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Future.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,11 +34,11 @@ public class JU_Future {
@SuppressWarnings("unused")
Future<Integer> f = new FutureStub();
}
-
+
private class FutureStub extends Future<Integer> {
- @Override public boolean get(int timeout) throws CadiException { return false; }
- @Override public int code() { return 0; }
- @Override public String body() { return null; }
+ @Override public boolean get(int timeout) throws CadiException { return false; }
+ @Override public int code() { return 0; }
+ @Override public String body() { return null; }
@Override public String header(String tag) { return null; }
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java
index 6412d243..d8c5a598 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Holder.java
@@ -7,9 +7,9 @@
* * 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.
@@ -37,7 +37,7 @@ public class JU_Holder {
Holder<String> holder = new Holder<String>(str1);
assertThat(holder.get(), is(str1));
assertThat(holder.toString(), is(str1));
-
+
holder.set(str2);
assertThat(holder.get(), is(str2));
assertThat(holder.toString(), is(str2));
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java
index d33811e3..8fe0190c 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Rcli.java
@@ -7,9 +7,9 @@
* 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.
@@ -61,24 +61,24 @@ public class JU_Rcli {
@Mock HttpServletRequest reqMock;
@Mock HttpServletResponse respMock;
@Mock ServletInputStream isMock;
-
+
private final static String uriString = "example.com";
private final static String apiVersion = "v1.0";
private final static String contentType = "contentType";
-
+
private static URI uri;
private static Enumeration<String> enumeration;
private Client client;
-
+
@Before
public void setup() throws URISyntaxException, IOException {
MockitoAnnotations.initMocks(this);
-
+
when(dfMock.getTypeClass()).thenReturn(HttpURLConnection.class);
when(dfMock.newData()).thenReturn(dataMock);
when(dataMock.out((TYPE) any())).thenReturn(dataMock);
-
+
when(reqMock.getInputStream()).thenReturn(isMock);
when(isMock.read((byte[]) any())).thenReturn(-1);
@@ -86,7 +86,7 @@ public class JU_Rcli {
enumeration = new CustomEnumeration();
client = new Client();
}
-
+
@Test
public void createTest() throws APIException, CadiException {
RcliStub rcli = new RcliStub(uri);
@@ -112,7 +112,7 @@ public class JU_Rcli {
rcli.create("No question mark", contentType);
rcli.create("question?mark", contentType);
}
-
+
@Test
public void postFormTest() throws APIException, CadiException {
RcliStub rcli = new RcliStub(uri);
@@ -121,7 +121,7 @@ public class JU_Rcli {
rcli.postForm(null, dfMock);
rcli.postForm("No question mark", dfMock);
rcli.postForm("question?mark", dfMock);
-
+
rcli.type(Data.TYPE.JSON);
rcli.postForm("question?mark", dfMock);
@@ -145,7 +145,7 @@ public class JU_Rcli {
rcli.readPost("First string", "Second string");
}
-
+
@Test
public void readTest() throws APIException, CadiException {
RcliStub rcli = new RcliStub(uri);
@@ -189,7 +189,7 @@ public class JU_Rcli {
when(reqMock.getRequestURI()).thenReturn(uriString);
when(reqMock.getHeaderNames()).thenReturn(enumeration);
rcli.transfer(reqMock, respMock, "string", 200);
-
+
// coverage...
when(reqMock.getMethod()).thenReturn("GET");
rcli.transfer(reqMock, respMock, "string", 200);
@@ -207,13 +207,13 @@ public class JU_Rcli {
public void accessorMutatorTest() throws URISyntaxException {
RcliStub rcli = new RcliStub();
Rcli<?> rcliClone = rcli.forUser(null);
-
+
rcli = new RcliStub(uri);
assertThat(rcli.toString(), is(uriString));
assertThat(rcli.getURI(), is(uri));
assertThat(rcli.getReadTimeout(), is(5000));
assertThat(rcli.getConnectionTimeout(), is(3000));
-
+
rcli.connectionTimeout(3001);
assertThat(rcli.getConnectionTimeout(), is(3001));
rcli.readTimeout(5001);
@@ -224,7 +224,7 @@ public class JU_Rcli {
assertThat(rcli.typeString(HttpURLConnection.class), is("application/HttpURLConnection+xml;version=" + apiVersion));
rcli.apiVersion(null);
assertThat(rcli.typeString(HttpURLConnection.class), is("application/HttpURLConnection+xml"));
-
+
rcliClone = rcli.forUser(null);
assertThat(rcliClone.toString(), is(uriString));
}
@@ -232,15 +232,15 @@ public class JU_Rcli {
private class RcliStub extends Rcli<HttpURLConnection> {
public RcliStub() { super(); }
public RcliStub(URI uri) { this.uri = uri; }
- @Override public void setSecuritySetter(SecuritySetter<HttpURLConnection> ss) { }
- @Override public SecuritySetter<HttpURLConnection> getSecuritySetter() { return null; }
- @Override protected Rcli<HttpURLConnection> clone(URI uri, SecuritySetter<HttpURLConnection> ss) { return this; }
- @Override public void invalidate() throws CadiException { }
- @Override protected EClient<HttpURLConnection> client() throws CadiException { return client; }
+ @Override public void setSecuritySetter(SecuritySetter<HttpURLConnection> ss) { }
+ @Override public SecuritySetter<HttpURLConnection> getSecuritySetter() { return null; }
+ @Override protected Rcli<HttpURLConnection> clone(URI uri, SecuritySetter<HttpURLConnection> ss) { return this; }
+ @Override public void invalidate() throws CadiException { }
+ @Override protected EClient<HttpURLConnection> client() throws CadiException { return client; }
public int getReadTimeout() { return readTimeout; }
public int getConnectionTimeout() { return connectionTimeout; }
}
-
+
private class CustomEnumeration implements Enumeration<String> {
private int idx = 0;
private final String[] elements = {"This", "is", "a", "test"};
@@ -257,11 +257,11 @@ public class JU_Rcli {
private class Client implements EClient<HttpURLConnection> {
private Transfer transfer;
@Override public void setPayload(Transfer transfer) { this.transfer = transfer; }
- @Override public void setMethod(String meth) { }
- @Override public void setPathInfo(String pathinfo) { }
- @Override public void addHeader(String tag, String value) { }
- @Override public void setQueryParams(String q) { }
- @Override public void setFragment(String f) { }
+ @Override public void setMethod(String meth) { }
+ @Override public void setPathInfo(String pathinfo) { }
+ @Override public void addHeader(String tag, String value) { }
+ @Override public void setQueryParams(String q) { }
+ @Override public void setFragment(String f) { }
@Override public void send() throws APIException {
try {
if (transfer != null) {
@@ -269,14 +269,14 @@ public class JU_Rcli {
}
} catch (IOException e) {
}
- }
- @Override public <T> Future<T> futureCreate(Class<T> t) { return null; }
- @Override public Future<String> futureReadString() { return null; }
- @Override public <T> Future<T> futureRead(RosettaDF<T> df, TYPE type) { return null; }
- @Override public <T> Future<T> future(T t) { return null; }
- @Override public Future<Void> future(HttpServletResponse resp, int expected) throws APIException { return null; }
+ }
+ @Override public <T> Future<T> futureCreate(Class<T> t) { return null; }
+ @Override public Future<String> futureReadString() { return null; }
+ @Override public <T> Future<T> futureRead(RosettaDF<T> df, TYPE type) { return null; }
+ @Override public <T> Future<T> future(T t) { return null; }
+ @Override public Future<Void> future(HttpServletResponse resp, int expected) throws APIException { return null; }
}
-
+
//private class FutureStub implements Future<String> {
//}
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java
index 41570980..1da04064 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Result.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,7 +28,7 @@ import org.junit.*;
import org.onap.aaf.cadi.client.Result;
public class JU_Result {
-
+
private static final int OK = 200;
private static final int NOT_FOUND = 404;
@@ -38,7 +38,7 @@ public class JU_Result {
result = Result.ok(OK, 10);
assertThat(result.toString(), is("Code: 200"));
assertThat(result.isOK(), is(true));
-
+
result = Result.err(NOT_FOUND, "File not found");
assertThat(result.toString(), is("Code: 404 = File not found"));
assertThat(result.isOK(), is(false));
@@ -47,5 +47,5 @@ public class JU_Result {
assertThat(result.toString(), is("Code: 404 = File not found"));
assertThat(result.isOK(), is(false));
}
-
+
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java
index 200b393d..b876710d 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/client/test/JU_Retryable.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,10 +40,10 @@ public class JU_Retryable {
RetryableStub retry = new RetryableStub();
assertThat(retry.item(), is(nullValue()));
assertThat(retry.lastClient(), is(nullValue()));
-
+
Locator.Item item = null;
assertThat(retry.item(item), is(item));
-
+
retry = new RetryableStub(retry);
assertThat(retry.item(), is(nullValue()));
assertThat(retry.lastClient(), is(nullValue()));
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java
index 4bb44e10..c2f75002 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HAuthorizationHeader.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,10 +41,10 @@ public class JU_HAuthorizationHeader {
@Mock
HttpsURLConnection hucsMock;
-
+
@Mock
HttpURLConnection hucMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -59,7 +59,7 @@ public class JU_HAuthorizationHeader {
header = new HAuthorizationHeader(null, null, null);
header.setSecurity(hucsMock);
}
-
+
@Test(expected = CadiException.class)
public void throwsWhenDeniedTest() throws CadiException, IOException {
HAuthorizationHeader header = new HAuthorizationHeader(siMock, "string1", "string2") {
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java
index d0655979..9d3b5a4e 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HBasicAuthSS.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,23 +39,23 @@ import org.onap.aaf.cadi.http.HSecurityInfoInit;
import org.onap.aaf.cadi.principal.BasicPrincipal;
public class JU_HBasicAuthSS {
-
+
@Mock
BasicPrincipal bpMock;
-
+
private SecurityInfoC<HttpURLConnection> si;
private PropAccess access;
-
+
private final static String id = "id";
private final static String password = "password";
-
+
@Before
public void setup() throws CadiException, IOException {
MockitoAnnotations.initMocks(this);
-
+
when(bpMock.getName()).thenReturn(id);
when(bpMock.getCred()).thenReturn(password.getBytes());
-
+
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
access.setProperty(Config.AAF_APPID, id);
access.setProperty(Config.AAF_APPPASS, access.encrypt(password));
@@ -68,7 +68,7 @@ public class JU_HBasicAuthSS {
// All the constructors accomplish the same thing
@SuppressWarnings("unused")
HBasicAuthSS auth = new HBasicAuthSS(si);
-
+
// TODO: While these test _should_ pass, and they _do_ pass on my local machine, they won't
// pass when then onap jobbuilder runs them. Good luck!
// assertThat(auth.getID(), is(id));
@@ -84,10 +84,10 @@ public class JU_HBasicAuthSS {
auth = new HBasicAuthSS(bpMock, si);
// assertThat(auth.getID(), is(id));
-
+
auth = new HBasicAuthSS(bpMock, si, false);
// assertThat(auth.getID(), is(id));
-
+
auth = new HBasicAuthSS(bpMock, si, true);
// assertThat(auth.getID(), is(id));
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java
index c32abe43..c224676c 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HClient.java
@@ -99,7 +99,7 @@ public class JU_HClient {
HClientStub client;
client = new HClientStub(ssMock, uri, 0, null);
client.send();
-
+
client.setPathInfo("/pathinfo");
client.send();
@@ -116,7 +116,7 @@ public class JU_HClient {
client.setPayload(transferMock);
client.send();
}
-
+
@Test(expected = APIException.class)
public void sendThrows1Test() throws APIException, LocatorException, URISyntaxException {
HClientStub client = new HClientStub(ssMock, new URI("mailto:me@domain.com"), 0, null);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java
index 10eb8184..98070d6b 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HMangr.java
@@ -7,9 +7,9 @@
* 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.
@@ -58,14 +58,14 @@ import org.onap.aaf.misc.env.APIException;
import junit.framework.Assert;
public class JU_HMangr {
-
+
@Mock Locator<URI> locMock;
@Mock SecuritySetter<HttpURLConnection> ssMock;
@Mock Retryable<Void> retryableMock;
@Mock Retryable<Integer> goodRetry;
@Mock Locator.Item itemMock;
@Mock Rcli<Object> clientMock;
-
+
private PropAccess access;
private URI uri;
private final static String uriString = "http://example.com";
@@ -84,11 +84,11 @@ public class JU_HMangr {
when(retryableMock.item()).thenReturn(itemMock);
when(locMock.get(itemMock)).thenReturn(uri);
assertThat(hman.same(ssMock, retryableMock), is(nullValue()));
-
+
//coverage...
when(retryableMock.lastClient()).thenReturn(clientMock);
assertThat(hman.same(ssMock, retryableMock), is(nullValue()));
-
+
CadiException cadiException;
ConnectException connectException = new ConnectException();
@@ -210,7 +210,7 @@ public class JU_HMangr {
assertThat(hman.oneOf(ssMock, retryableMock, false, "host"), is(nullValue()));
assertThat(hman.oneOf(ssMock, retryableMock, false, uriString.substring(7)), is(nullValue()));
-
+
CadiException cadiException;
cadiException = new CadiException(new ConnectException());
@@ -244,7 +244,7 @@ public class JU_HMangr {
fail("Should've thrown an exception");
} catch (CadiException e) {
}
-
+
doThrow(new ConnectException()).when(retryableMock).code((Rcli<?>) any());
assertThat(hman.oneOf(ssMock, retryableMock, false, uriString.substring(7)), is(nullValue()));
@@ -274,5 +274,5 @@ public class JU_HMangr {
return null;
}
}
-
+
} \ No newline at end of file
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java
index 923dd1a0..e1a1e70b 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HNoAuthSS.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,21 +33,21 @@ import org.onap.aaf.cadi.config.SecurityInfoC;
import org.onap.aaf.cadi.http.HNoAuthSS;
public class JU_HNoAuthSS {
-
+
@Mock
SecurityInfoC<HttpURLConnection> siMock;
-
+
@Mock
HttpURLConnection httpMock;
@Mock
HttpsURLConnection httpsMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
}
-
+
@Test
public void test() throws IOException, CadiException {
HNoAuthSS noAuth = new HNoAuthSS(null);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java
index ab6a39c0..92f7dd63 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HRcli.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,22 +44,22 @@ import org.onap.aaf.cadi.http.HMangr;
import org.onap.aaf.cadi.http.HRcli;
public class JU_HRcli {
-
+
@Mock
SecuritySetter<HttpURLConnection> ssMock;
-
+
@Mock
Locator<URI> locMock;
-
+
@Mock
Locator.Item itemMock;
-
+
private HMangr hman;
private PropAccess access;
private static URI uri;
-
+
private static final String uriString = "example.com";
-
+
@Before
public void setup() throws LocatorException, URISyntaxException {
MockitoAnnotations.initMocks(this);
@@ -79,20 +79,20 @@ public class JU_HRcli {
hrcli.setSecuritySetter(ssMock);
assertThat(hrcli.getSecuritySetter(), is(ssMock));
-
+
// No throw
hrcli.invalidate();
// Throw
doThrow(CadiException.class).when(locMock).invalidate(itemMock);
hrcli.invalidate();
}
-
+
@Test(expected = CadiException.class)
public void protectedInterfaceTest() throws CadiException, LocatorException {
HRcliStub hrcli = new HRcliStub(hman, uri, itemMock, ssMock);
HRcli clone = hrcli.clone(uri, ssMock);
assertThat(clone.toString(), is(hrcli.toString()));
-
+
EClient<HttpURLConnection> eclient = hrcli.client();
assertThat(eclient, is(not(nullValue())));
@@ -105,7 +105,7 @@ public class JU_HRcli {
when(locMock.best()).thenReturn(null);
eclient = hrcli.client();
}
-
+
private class HRcliStub extends HRcli {
public HRcliStub(HMangr hman, URI uri, Item locItem, SecuritySetter<HttpURLConnection> secSet) {
super(hman, uri, locItem, secSet);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java
index 9f2c9a71..eaf668e0 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTokenSS.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,7 +36,7 @@ public class JU_HTokenSS {
@Mock
SecurityInfoC<HttpURLConnection> siMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java
index 77fac567..809863e4 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HTransferSS.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,10 +41,10 @@ import org.onap.aaf.cadi.http.HTransferSS;
import org.onap.aaf.cadi.principal.TaggedPrincipal;
public class JU_HTransferSS {
-
+
@Mock
TaggedPrincipal princMock;
-
+
@Mock
HttpURLConnection hucMock;
@@ -53,15 +53,15 @@ public class JU_HTransferSS {
@Mock
SecurityInfoC<HttpURLConnection> siMock;
-
+
@Mock
SecurityInfoC<HttpURLConnection> siMockNoDefSS;
@Mock
SecuritySetter<HttpURLConnection> ssMock;
-
+
private static final String princName = "name";
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -73,7 +73,7 @@ public class JU_HTransferSS {
public void test() throws IOException, CadiException {
HTransferSS transfer = new HTransferSS(princMock, "string1");
assertThat(transfer.setLastResponse(0), is(0));
-
+
transfer = new HTransferSS(princMock, "string1", siMock);
transfer.setSecurity(hucsMock);
assertThat(transfer.getID(), is(princName));
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java
index fd102a95..f85697ae 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/http/test/JU_HX509SS.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,33 +48,33 @@ import org.onap.aaf.cadi.http.HX509SS;
import org.onap.aaf.misc.env.APIException;
public class JU_HX509SS {
-
+
@Mock X509Certificate x509Mock;
@Mock X509KeyManager keyManagerMock;
@Mock PrivateKey privateKeyMock;
@Mock SecurityInfoC<HttpURLConnection> siMock;
@Mock HttpURLConnection hucMock;
@Mock HttpsURLConnection hucsMock;
-
+
private final static String alias = "Some alias";
private final static String algName = "Some algName";
private final static byte[] publicKeyBytes = "a public key".getBytes();
-
+
private PropAccess access;
private SecurityInfoC<HttpURLConnection> si;
-
+
@Before
public void setup() throws IOException, CadiException, CertificateEncodingException {
MockitoAnnotations.initMocks(this);
-
+
when(x509Mock.getSigAlgName()).thenReturn(algName);
when(x509Mock.getEncoded()).thenReturn(publicKeyBytes);
-
+
when(keyManagerMock.getCertificateChain(alias)).thenReturn(new X509Certificate[] {x509Mock});
when(keyManagerMock.getPrivateKey(alias)).thenReturn(privateKeyMock);
when(siMock.getKeyManagers()).thenReturn(new X509KeyManager[] {keyManagerMock});
-
+
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
access.setProperty(Config.CADI_ALIAS, alias);
// si = SecurityInfoC.instance(access, HttpURLConnectionStub.class);
@@ -87,12 +87,12 @@ public class JU_HX509SS {
assertThat(x509.setLastResponse(0), is(0));
assertThat(x509.setLastResponse(1), is(0));
assertThat(x509.setLastResponse(2), is(0));
-
+
// coverage...
x509.setSecurity(hucMock);
x509.setSecurity(hucsMock);
}
-
+
// TODO: Test the setSecurity method - Ian
// @Test
// public void test2() throws APIException, CadiException {
@@ -100,7 +100,7 @@ public class JU_HX509SS {
// x509.setSecurity(hucMock);
// x509.setSecurity(hucsMock);
// }
-
+
@Test(expected = APIException.class)
public void throws1Test() throws APIException, CadiException {
@SuppressWarnings("unused")
@@ -113,5 +113,5 @@ public class JU_HX509SS {
@SuppressWarnings("unused")
HX509SS x509 = new HX509SS(alias, siMock);
}
-
+
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java
index b786cf68..e2c8f828 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_DNSLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,9 +38,9 @@ import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.locator.DNSLocator;
public class JU_DNSLocator {
-
+
private PropAccess access;
-
+
@Before
public void setup() {
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
@@ -53,7 +53,7 @@ public class JU_DNSLocator {
URI uri;
dl = new DNSLocator(access, "https", "localhost", "8100-8101");
-
+
item = dl.best();
uri = dl.get(item);
assertThat(uri.toString(), is("https://localhost:8100"));
@@ -66,10 +66,10 @@ public class JU_DNSLocator {
}
assertThat(dl.hasItems(), is(false));
- // This doesn't actually do anything besides increase coverage
+ // This doesn't actually do anything besides increase coverage
dl.destroy();
}
-
+
@Test
public void constructorTest() throws LocatorException {
// For coverage
@@ -84,20 +84,20 @@ public class JU_DNSLocator {
new DNSLocator(access, "https://localhost:8000/");
new DNSLocator(access, "https://aaf-locatexx.onapxxx:8095/locate");
try {
- new DNSLocator(access, "https:localhost:8000");
- fail("Invalid URL should not pass");
+ new DNSLocator(access, "https:localhost:8000");
+ fail("Invalid URL should not pass");
} catch (LocatorException e) {
- access.log(Level.DEBUG, "Valid Exception");
-
+ access.log(Level.DEBUG, "Valid Exception");
+
}
}
-
+
@Test
public void refreshTest() throws LocatorException {
DNSLocator dl = new DNSLocator(access, "https", "bogushost", "8100-8101");
assertThat(dl.refresh(), is(false));
}
-
+
@Test(expected = LocatorException.class)
public void throws1Test() throws LocatorException {
new DNSLocator(access, null);
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java
index d85a84a2..496017a8 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_HClientHotPeerLocator.java
@@ -86,7 +86,7 @@ public class JU_HClientHotPeerLocator {
item = loc.first();
loc.invalidate(item);
-
+
loc.invalidate(loc.bestClient());
loc.invalidate(loc.get(loc.next(item)));
loc.destroy();
@@ -106,13 +106,13 @@ public class JU_HClientHotPeerLocator {
assertThat(alternate2, is("Alternate Client is " + goodURL2));
outStream.reset();
-
+
loc.invalidate(loc.first());
loc.destroy();
loc.best();
}
-
+
@Test
public void hasNoItemTest() throws LocatorException {
HClientHotPeerLocator loc;
@@ -134,7 +134,7 @@ public class JU_HClientHotPeerLocator {
loc = new CoverageLocator(access, urlStr, 0, "38.627", "-90.199", ssMock);
assertThat(loc._invalidate(null), is(nullValue()));
loc._destroy(null);
-
+
loc._newClient("bad string");
}
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java
index 0eae1198..26673dd5 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/locator/test/JU_PropertyLocator.java
@@ -7,9 +7,9 @@
* 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.
@@ -85,7 +85,7 @@ public class JU_PropertyLocator {
pl.refresh();
assertThat(pl.hasItems(), is(true));
-
+
assertThat(pl.next(null), is(nullValue()));
// coverage...
@@ -97,7 +97,7 @@ public class JU_PropertyLocator {
pl.destroy();
pl = new PropertyLocator(uris);
-
+
}
@Test(expected=LocatorException.class)
diff --git a/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java b/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java
index 31fda501..1cc74e56 100644
--- a/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java
+++ b/cadi/client/src/test/java/org/onap/aaf/cadi/routing/test/JU_GreatCircle.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java b/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java
index 575bc2ee..ef26f475 100644
--- a/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java
+++ b/cadi/client/src/test/java/org/onap/aaf/client/test/JU_ResultTest.java
@@ -7,9 +7,9 @@
* * 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.
@@ -52,7 +52,7 @@ public class JU_ResultTest {
assertFalse(t.isOK());
assertThat(t.toString(), is("Code: 1 = Error Body"));
}
-
+
@Test
public void testOk1() {
Result<String> t = Result.ok(1, "Ok");
@@ -70,7 +70,7 @@ public class JU_ResultTest {
assertFalse(t.isOK());
assertThat(t.toString(), is("Code: 1 = Error Body"));
}
-
+
@Test
public void testOk2() {
Result<String> t = Result.ok(1, "Ok");
@@ -88,7 +88,7 @@ public class JU_ResultTest {
assertFalse(t.isOK());
assertThat(t.toString(), is("Code: 1 = Error Body"));
}
-
+
@Test
public void testOk3() {
Result<String> t = Result.ok(1, "Ok");
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/AES.java b/cadi/core/src/main/java/org/onap/aaf/cadi/AES.java
index 4ec51682..d32df881 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/AES.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/AES.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,14 +47,14 @@ import org.onap.aaf.cadi.util.Chmod;
* AES Class wraps Cipher AES, 128
* NOTE: While not explicitly stated in JavaDocs, Ciphers AND SecretKeySpecs are NOT ThreadSafe
* Ciphers take time to create, therefore, we have pooled them.
- *
+ *
* @author Jonathan
*
*/
public class AES implements Encryption {
public static final String AES = AES.class.getSimpleName();
public static final int AES_KEY_SIZE = 128; // 256 isn't supported on all JDKs.
-
+
private SecretKeySpec aeskeySpec;
public static SecretKey newKey() throws NoSuchAlgorithmException {
@@ -66,7 +66,7 @@ public class AES implements Encryption {
public AES(byte[] aeskey, int offset, int len){
aeskeySpec = new SecretKeySpec(aeskey,offset,len,AES);
}
-
+
public byte[] encrypt(byte[] in) throws CadiException {
try {
Cipher c = Cipher.getInstance(AES);
@@ -76,17 +76,17 @@ public class AES implements Encryption {
throw new CadiException(e);
}
}
-
+
public byte[] decrypt(byte[] in) throws CadiException {
try {
Cipher c = Cipher.getInstance(AES);
- c.init(Cipher.DECRYPT_MODE,aeskeySpec);
+ c.init(Cipher.DECRYPT_MODE,aeskeySpec);
return c.doFinal(in);
} catch (InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchAlgorithmException | NoSuchPaddingException e) {
throw new CadiException(e);
}
}
-
+
public void save(File keyfile) throws IOException {
FileOutputStream fis = new FileOutputStream(keyfile);
try {
@@ -112,7 +112,7 @@ public class AES implements Encryption {
return null; // should never get here.
}
}
-
+
public CipherInputStream inputStream(InputStream is, boolean encrypt) {
try {
Cipher c = Cipher.getInstance(AES);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java b/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java
index e6d24dab..561995de 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,11 +39,11 @@ import org.onap.aaf.cadi.principal.CachedBasicPrincipal;
/**
* Implement Fast lookup and Cache for Local User Info
- *
+ *
* Include ability to add and remove Users
- *
+ *
* Also includes a Timer Thread (when necessary) to invoke cleanup on expiring Credentials
- *
+ *
* @author Jonathan
*
*/
@@ -57,10 +57,10 @@ public abstract class AbsUserCache<PERM extends Permission> {
private final Map<String, User<PERM>> userMap;
private static final Map<String, Miss> missMap = new TreeMap<>();
private final Symm missEncrypt;
-
+
private Clean clean;
protected Access access;
-
+
protected AbsUserCache(Access access, long cleanInterval, int highCount, int usageCount) {
this.access = access;
Symm s;
@@ -72,29 +72,29 @@ public abstract class AbsUserCache<PERM extends Permission> {
s = Symm.base64noSplit;
}
missEncrypt = s;
-
+
userMap = new ConcurrentHashMap<>();
-
+
if (cleanInterval>0) {
cleanInterval = Math.max(MIN_INTERVAL, cleanInterval);
synchronized(AbsUserCache.class) { // Lazy instantiate.. in case there is no cleanup needed
if (timer==null) {
timer = new Timer("CADI Cleanup Timer",true);
}
-
+
timer.schedule(clean = new Clean(access, cleanInterval, highCount, usageCount), cleanInterval, cleanInterval);
access.log(Access.Level.INIT, "Cleaning Thread initialized with interval of",cleanInterval, "ms and max objects of", highCount);
}
}
}
-
+
@SuppressWarnings("unchecked")
public AbsUserCache(AbsUserCache<PERM> cache) {
this.access = cache.access;
userMap = cache.userMap;
missEncrypt = cache.missEncrypt;
-
+
synchronized(AbsUserCache.class) {
if (cache.clean!=null && cache.clean.lur==null && this instanceof CachingLur) {
cache.clean.lur=(CachingLur<PERM>)this;
@@ -104,9 +104,9 @@ public abstract class AbsUserCache<PERM extends Permission> {
protected void setLur(CachingLur<PERM> lur) {
if (clean!=null)clean.lur = lur;
-
+
}
-
+
protected void addUser(User<PERM> user) {
Principal p = user.principal;
String key;
@@ -132,16 +132,16 @@ public abstract class AbsUserCache<PERM extends Permission> {
protected void addUser(String key, User<PERM> user) {
userMap.put(key, user);
}
-
+
/**
* Add miss to missMap. If Miss exists, or too many tries, returns false.
- *
+ *
* otherwise, returns true to allow another attempt.
- *
+ *
* @param key
* @param bs
* @return
- * @throws IOException
+ * @throws IOException
*/
protected synchronized boolean addMiss(String key, byte[] bs) {
String mkey;
@@ -156,7 +156,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
missMap.put(mkey, new Miss(bs,clean==null?MIN_INTERVAL:clean.timeInterval,key));
return true;
}
- return miss.mayContinue();
+ return miss.mayContinue();
}
protected Miss missed(String key, byte[] bs) throws IOException {
@@ -182,11 +182,11 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
return u;
}
-
+
protected User<PERM> getUser(CachedBasicPrincipal cbp) {
return getUser(cbp.getName(), cbp.getCred());
}
-
+
protected User<PERM> getUser(String user, byte[] cred) {
User<PERM> u;
String key=null;
@@ -207,7 +207,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
return u;
}
-
+
/**
* Removes User from the Cache
* @param user
@@ -215,10 +215,10 @@ public abstract class AbsUserCache<PERM extends Permission> {
protected void remove(User<PERM> user) {
userMap.remove(user.principal.getName());
}
-
+
/**
* Removes user from the Cache
- *
+ *
* @param user
*/
public void remove(String user) {
@@ -227,14 +227,14 @@ public abstract class AbsUserCache<PERM extends Permission> {
access.log(Level.INFO, user,"removed from Client Cache by Request");
}
}
-
+
/**
* Clear all Users from the Client Cache
*/
public void clearAll() {
userMap.clear();
}
-
+
public final List<DumpInfo> dumpInfo() {
List<DumpInfo> rv = new ArrayList<>();
for (User<PERM> user : userMap.values()) {
@@ -249,10 +249,10 @@ public abstract class AbsUserCache<PERM extends Permission> {
public boolean handlesExclusively(Permission ... pond) {
return false;
}
-
+
/**
- * Container calls when cleaning up...
- *
+ * Container calls when cleaning up...
+ *
* If overloading in Derived class, be sure to call "super.destroy()"
*/
public void destroy() {
@@ -261,8 +261,8 @@ public abstract class AbsUserCache<PERM extends Permission> {
timer.cancel();
}
}
-
-
+
+
// Simple map of Group name to a set of User Names
// private Map<String, Set<String>> groupMap = new HashMap<>();
@@ -273,34 +273,34 @@ public abstract class AbsUserCache<PERM extends Permission> {
public final class DumpInfo {
public String user;
public List<String> perms;
-
+
public DumpInfo(User<PERM> user) {
this.user = user.principal.getName();
perms = new ArrayList<>(user.perms.keySet());
}
}
-
+
/**
* Clean will examine resources, and remove those that have expired.
- *
+ *
* If "highs" have been exceeded, then we'll expire 10% more the next time. This will adjust after each run
* without checking contents more than once, making a good average "high" in the minimum speed.
- *
+ *
* @author Jonathan
*
*/
private final class Clean extends TimerTask {
private final Access access;
private CachingLur<PERM> lur;
-
- // The idea here is to not be too restrictive on a high, but to Expire more items by
+
+ // The idea here is to not be too restrictive on a high, but to Expire more items by
// shortening the time to expire. This is done by judiciously incrementing "advance"
// when the "highs" are exceeded. This effectively reduces numbers of cached items quickly.
private final int high;
private long advance;
private final long timeInterval;
private final int usageTriggerCount;
-
+
public Clean(Access access, long cleanInterval, int highCount, int usageTriggerCount) {
this.access = access;
lur = null;
@@ -342,7 +342,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
}
}
-
+
if (!removed && lur!=null && user.permExpires<= now ) {
if (lur.reload(user).equals(Resp.REVALIDATED)) {
user.renewPerm();
@@ -354,7 +354,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
if (touched) {
++renewed;
}
-
+
} else {
if (user.permExpired()) {
remove(user);
@@ -362,7 +362,7 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
}
}
-
+
// Clean out Misses
int missTotal = missMap.keySet().size();
int miss = 0;
@@ -385,12 +385,12 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
}
}
-
+
if (count+renewed+miss>0) {
access.log(Level.INFO, (lur==null?"Cache":lur.getClass().getSimpleName()), "removed",count,
"and renewed",renewed,"expired Permissions out of", total,"and removed", miss, "password misses out of",missTotal);
}
-
+
// If High (total) is reached during this period, increase the number of expired services removed for next time.
// There's no point doing it again here, as there should have been cleaned items.
if (total>high) {
@@ -421,17 +421,17 @@ public abstract class AbsUserCache<PERM extends Permission> {
private long tries;
private final String name;
-
+
public Miss(final byte[] first, final long timeInterval, final String name) {
timestamp = System.currentTimeMillis() + timeInterval;
this.timetolive = timeInterval;
tries = 0L;
this.name = name;
}
-
-
+
+
public synchronized boolean mayContinue() {
- long ts = System.currentTimeMillis();
+ long ts = System.currentTimeMillis();
if (ts>timestamp) {
tries = 0;
timestamp = ts + timetolive;
@@ -440,20 +440,20 @@ public abstract class AbsUserCache<PERM extends Permission> {
}
return true;
}
-
+
}
-
+
/**
* Report on state
*/
public String toString() {
- return getClass().getSimpleName() +
+ return getClass().getSimpleName() +
" Cache:\n Users Cached: " +
userMap.size() +
"\n Misses Saved: " +
missMap.size() +
'\n';
-
+
}
public void clear(Principal p, StringBuilder sb) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Access.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Access.java
index a673ab4f..4009521c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Access.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Access.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,8 +29,8 @@ import java.util.Properties;
* Various Environments require different logging mechanisms, or at least allow
* for different ones. We need the Framework to be able to hook into any particular instance of logging
* mechanism, whether it be a Logging Object within a Servlet Context, or a direct library like log4j.
- * This interface, therefore, allows maximum pluggability in a variety of different app styles.
- *
+ * This interface, therefore, allows maximum pluggability in a variety of different app styles.
+ *
* @author Jonathan
*
*/
@@ -39,15 +39,15 @@ public interface Access {
public enum Level {
DEBUG(0x1), INFO(0x10), AUDIT(0x100), WARN(0x2000), ERROR(0x4000), INIT(0x8000),TRACE(0x10000),NONE(0XFFFF);
private final int bit;
-
+
Level(int ord) {
bit = ord;
}
-
+
public boolean inMask(int mask) {
return (mask & bit) == bit;
}
-
+
public int addToMask(int mask) {
return mask | bit;
}
@@ -89,8 +89,8 @@ public interface Access {
* @param elements
*/
public void printf(Level level, String fmt, Object ... elements);
-
- /**
+
+ /**
* Check if message will log before constructing
* @param level
* @return
@@ -98,24 +98,24 @@ public interface Access {
public boolean willLog(Level level);
/**
- * Write the contents of an exception, followed by a variable list of Object's text via the
+ * Write the contents of an exception, followed by a variable list of Object's text via the
* toString() method with appropriate space, etc.
- *
+ *
* The Loglevel is always "ERROR"
- *
+ *
* @param elements
*/
public void log(Exception e, Object ... elements);
-
+
/**
* Set the Level to compare logging too
*/
public void setLogLevel(Level level);
-
+
/**
* It is important in some cases to create a class from within the same Classloader that created
* Security Objects. Specifically, it's pretty typical for Web Containers to separate classloaders
- * so as to allow Apps with different dependencies.
+ * so as to allow Apps with different dependencies.
* @return
*/
public ClassLoader classLoader();
@@ -127,7 +127,7 @@ public interface Access {
public void load(InputStream is) throws IOException;
/**
- * if "anytext" is true, then decryption will always be attempted. Otherwise, only if starts with
+ * if "anytext" is true, then decryption will always be attempted. Otherwise, only if starts with
* Symm.ENC
* @param encrypted
* @param anytext
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java b/cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java
index ebb41aba..bdbef713 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/BasicCred.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,7 +25,7 @@ package org.onap.aaf.cadi;
* An Interface for testing on Requests to see if we can get a User and Password
* It works for CadiWrap, but also, Container Specific Wraps (aka Tomcat) should also
* implement.
- *
+ *
* @author Jonathan
*
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java b/cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java
index 8202183d..b6aabf32 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/BufferedServletInputStream.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,21 +28,21 @@ import javax.servlet.ServletInputStream;
/**
* BufferedServletInputStream
- *
+ *
* There are cases in brain-dead middleware (SOAP) where they store routing information in the content.
- *
+ *
* In HTTP, this requires reading the content from the InputStream which, of course, cannot be re-read.
- *
- * BufferedInputStream exists to implement the "Mark" protocols for Streaming, which will enable being
+ *
+ * BufferedInputStream exists to implement the "Mark" protocols for Streaming, which will enable being
* re-read. Unfortunately, J2EE chose to require a "ServletInputStream" as an abstract class, rather than
- * an interface, which requires we create a delegating pattern, rather than the preferred inheriting pattern.
- *
+ * an interface, which requires we create a delegating pattern, rather than the preferred inheriting pattern.
+ *
* Unfortunately, the standard "BufferedInputStream" cannot be used, because it simply creates a byte array
- * in the "mark(int)" method of that size. This is not appropriate for this application, because the Header
- * can be potentially huge, and if a buffer was allocated to accommodate all possibilities, the cost of memory
+ * in the "mark(int)" method of that size. This is not appropriate for this application, because the Header
+ * can be potentially huge, and if a buffer was allocated to accommodate all possibilities, the cost of memory
* allocation would be too large for high performance transactions.
*
- *
+ *
* @author Jonathan
*
*/
@@ -50,7 +50,7 @@ public class BufferedServletInputStream extends ServletInputStream {
private static final int NONE = 0;
private static final int STORE = 1;
private static final int READ = 2;
-
+
private InputStream is;
private int state = NONE;
private Capacitor capacitor;
@@ -81,7 +81,7 @@ public class BufferedServletInputStream extends ServletInputStream {
value = is.read();
}
}
- }
+ }
return value;
}
@@ -113,7 +113,7 @@ public class BufferedServletInputStream extends ServletInputStream {
if (temp>0) { // watch for -1
count+=temp;
} else if (count<=0) {
- count = temp; // must account for Stream coming back -1
+ count = temp; // must account for Stream coming back -1
}
}
break;
@@ -134,9 +134,9 @@ public class BufferedServletInputStream extends ServletInputStream {
public int available() throws IOException {
int count = is.available();
if (capacitor!=null)count+=capacitor.available();
- return count;
+ return count;
}
-
+
/**
* Return just amount buffered (for debugging purposes, mostly)
* @return
@@ -156,7 +156,7 @@ public class BufferedServletInputStream extends ServletInputStream {
/**
- * Note: Readlimit is ignored in this implementation, because the need was for unknown buffer size which wouldn't
+ * Note: Readlimit is ignored in this implementation, because the need was for unknown buffer size which wouldn't
* require allocating and dumping huge chunks of memory every use, or risk overflow.
*/
public synchronized void mark(int readlimit) {
@@ -174,10 +174,10 @@ public class BufferedServletInputStream extends ServletInputStream {
/**
* Reset Stream
- *
+ *
* Calling this twice is not supported in typical Stream situations, but it is allowed in this service. The caveat is that it can only reset
* the data read in since Mark has been called. The data integrity is only valid if you have not continued to read past what is stored.
- *
+ *
*/
public synchronized void reset() throws IOException {
switch(state) {
@@ -188,7 +188,7 @@ public class BufferedServletInputStream extends ServletInputStream {
case READ:
capacitor.reset();
break;
- case NONE:
+ case NONE:
throw new IOException("InputStream has not been marked");
}
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java
index 6f3fe126..68fa1f63 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CachedPrincipal.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,20 +25,20 @@ import java.security.Principal;
/**
* Cached Principals need to be able to revalidate in the background.
- *
+ *
* @author Jonathan
*
*/
public interface CachedPrincipal extends Principal {
public enum Resp {NOT_MINE,UNVALIDATED,REVALIDATED,INACCESSIBLE,DENIED};
-
+
/**
* Re-validate with Creator
- *
+ *
* @return
*/
public abstract Resp revalidate(Object state);
-
+
/**
* Store when last updated.
* @return
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java
index c790f39e..6f4d8d8a 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CachingLur.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java
index 96a55f93..89d42b25 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiException.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,7 +27,7 @@ package org.onap.aaf.cadi;
*/
public class CadiException extends Exception {
/**
- * Generated ID
+ * Generated ID
*/
private static final long serialVersionUID = -4180145363107742619L;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java
index 34d11623..102782a4 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,23 +41,23 @@ import org.onap.aaf.cadi.util.Timing;
/**
* Inherit the HttpServletRequestWrapper, which calls methods of delegate it's created with, but
* overload the key security mechanisms with CADI mechanisms
- *
+ *
* This works with mechanisms working strictly with HttpServletRequest (i.e. Servlet Filters)
- *
+ *
* Specialty cases, i.e. Tomcat, which for their containers utilize their own mechanisms and Wrappers, you may
* need something similar. See AppServer specific code (i.e. tomcat) for these.
- *
+ *
* @author Jonathan
*
*/
public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRequest, BasicCred {
private TaggedPrincipal principal;
private Lur lur;
- private String user; // used to set user/pass from brain-dead protocols like WSSE
+ private String user; // used to set user/pass from brain-dead protocols like WSSE
private byte[] password;
private PermConverter pconv;
- private Access access;
-
+ private Access access;
+
/**
* Standard Wrapper constructor for Delegate pattern
* @param request
@@ -93,35 +93,35 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
}
/**
- * Part of the HTTP Security API. Return the User Principal associated with this HTTP
+ * Part of the HTTP Security API. Return the User Principal associated with this HTTP
* Transaction.
*/
@Override
public Principal getUserPrincipal() {
return principal;
}
-
+
/**
* This is the key API call for AUTHZ in J2EE. Given a Role (String passed in), is the user
* associated with this HTTP Transaction allowed to function in this Role?
- *
+ *
* For CADI, we pass the responsibility for determining this to the "LUR", which may be
* determined by the Enterprise.
- *
+ *
* Note: Role check is also done in "CadiRealm" in certain cases...
- *
+ *
*
*/
@Override
public boolean isUserInRole(String perm) {
return perm==null?false:checkPerm(access,"isUserInRole",principal,pconv,lur,perm);
}
-
+
public static boolean checkPerm(Access access, String caller, Principal principal, PermConverter pconv, Lur lur, String perm) {
if (principal== null) {
access.log(Level.AUDIT,caller, "No Principal in Transaction");
return false;
- } else {
+ } else {
final long start = System.nanoTime();
perm = pconv.convert(perm);
if (lur.fish(principal,lur.createPerm(perm))) {
@@ -135,10 +135,10 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
}
- /**
+ /**
* CADI Function (Non J2EE standard). GetPermissions will read the Permissions from AAF (if configured) and Roles from Local Lur, etc
* as implemented with lur.fishAll
- *
+ *
* To utilize, the Request must be a "CadiWrap" object, then call.
*/
public List<Permission> getPermissions(Principal p) {
@@ -148,7 +148,7 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
}
/**
* Allow setting of tafResp and lur after construction
- *
+ *
* This can happen if the CadiWrap is constructed in a Valve other than CadiValve
*/
public void set(TafResp tafResp, Lur lur) {
@@ -175,12 +175,12 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
public void setCred(byte[] passwd) {
password = passwd;
}
-
+
public CadiWrap setPermConverter(PermConverter pc) {
pconv = pc;
return this;
}
-
+
// Add a feature
public void invalidate(String id) {
if (lur instanceof EpiLur) {
@@ -189,11 +189,11 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe
((CachingLur<?>)lur).remove(id);
}
}
-
+
public Lur getLur() {
return lur;
}
-
+
public Access access() {
return access;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java
index f3a2a7fa..57ee115d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,10 +26,10 @@ import java.util.ArrayList;
/**
* Capacitor
- *
+ *
* Storage mechanism for read data, specifically designed for InputStreams.
- *
- * The Standard BufferedInputStream requires a limit to be set for buffered reading, which is
+ *
+ * The Standard BufferedInputStream requires a limit to be set for buffered reading, which is
* impractical for reading SOAP headers, which can be quite large.
* @author Jonathan
*
@@ -39,22 +39,22 @@ public class Capacitor {
private ArrayList<ByteBuffer> bbs = new ArrayList<>();
private ByteBuffer curr = null;
private int idx;
-
+
// Maintain a private RingBuffer for Memory, for efficiency
private static ByteBuffer[] ring = new ByteBuffer[16];
private static int start, end;
-
-
+
+
public void put(byte b) {
if (curr == null || curr.remaining()==0) { // ensure we have a "curr" buffer ready for data
curr = ringGet();
bbs.add(curr);
}
- curr.put(b);
+ curr.put(b);
}
public int read() {
- if (curr!=null) {
+ if (curr!=null) {
if (curr.remaining()>0) { // have a buffer, use it!
return curr.get();
} else if (idx<bbs.size()){ // Buffer not enough, get next one from array
@@ -64,10 +64,10 @@ public class Capacitor {
} // if no curr buffer, treat as end of stream
return -1;
}
-
+
/**
* read into an array like Streams
- *
+ *
* @param array
* @param offset
* @param length
@@ -99,7 +99,7 @@ public class Capacitor {
/**
* Put an array of data into Capacitor
- *
+ *
* @param array
* @param offset
* @param length
@@ -109,7 +109,7 @@ public class Capacitor {
curr = ringGet();
bbs.add(curr);
}
-
+
int len;
while (length>0) {
if ((len=curr.remaining())>length) {
@@ -125,7 +125,7 @@ public class Capacitor {
}
}
}
-
+
/**
* Move state from Storage mode into Read mode, changing all internal buffers to read mode, etc
*/
@@ -141,7 +141,7 @@ public class Capacitor {
idx=1;
}
}
-
+
/**
* reuse all the buffers
*/
@@ -152,10 +152,10 @@ public class Capacitor {
bbs.clear();
curr = null;
}
-
+
/**
* Declare amount of data available to be read at once.
- *
+ *
* @return
*/
public int available() {
@@ -165,7 +165,7 @@ public class Capacitor {
}
return count;
}
-
+
/**
* Returns how many are left that were not skipped
* @param n
@@ -184,7 +184,7 @@ public class Capacitor {
n=0;
} else {
curr.position(curr.limit());
-
+
skipped-=skip;
if (idx<bbs.size()) {
curr=bbs.get(idx++);
@@ -214,7 +214,7 @@ public class Capacitor {
}
/*
- * Ring Functions. Reuse allocated memory
+ * Ring Functions. Reuse allocated memory
*/
private ByteBuffer ringGet() {
ByteBuffer bb = null;
@@ -230,7 +230,7 @@ public class Capacitor {
}
return bb;
}
-
+
private void ringPut(ByteBuffer bb) {
synchronized(ring) {
ring[end]=bb; // if null or not, BB will just be Garbage collected
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java
index b697f373..53c35fc5 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CmdLine.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ import org.onap.aaf.cadi.util.JsonOutputStream;
/**
* A Class to run on command line to determine suitability of environment for certain TAFs.
- * *
+ * *
* @author Jonathan
*
*/
@@ -90,7 +90,7 @@ public class CmdLine {
System.out.println(args[1]);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
b64.enpass(args[1], baos);
- String pass;
+ String pass;
System.out.println(pass=new String(baos.toByteArray()));
ByteArrayOutputStream reconstituted = new ByteArrayOutputStream();
b64.depass(pass, reconstituted);
@@ -104,13 +104,13 @@ public class CmdLine {
}
System.out.flush();
*/
-
+
} catch (IOException e) {
System.err.println("Cannot digest password");
System.err.println(" \""+ e.getMessage() + '"');
}
// DO NOT LEAVE THIS METHOD Compiled IN CODE... Do not want looking at passwords on disk too easy
-// Jonathan. Oh, well, Deployment services need this behavior. I will put this code in, but leave it undocumented.
+// Jonathan. Oh, well, Deployment services need this behavior. I will put this code in, but leave it undocumented.
// One still needs access to the keyfile to read.
// July 2016 - thought of a tool "CMPass" to regurgitate from properties, but only if allowed.
} else if (("regurgitate".equalsIgnoreCase(args[0]) || "undigest".equalsIgnoreCase(args[0]))
@@ -151,7 +151,7 @@ public class CmdLine {
}
} else {
int idx;
- if ((idx = line.indexOf(' '))>=0
+ if ((idx = line.indexOf(' '))>=0
&& (idx = line.indexOf(' ',++idx))>0
&& (idx = line.indexOf('=',++idx))>0
) {
@@ -249,7 +249,7 @@ public class CmdLine {
int salt = Integer.parseInt(args[i]);
System.out.println(Hash.hashSHA256asStringHex(args[1],salt));
}
- } else {
+ } else {
System.out.println(Hash.hashSHA256asStringHex(args[1]));
}
} catch (NoSuchAlgorithmException e) {
@@ -280,13 +280,13 @@ public class CmdLine {
System.err.println("Cannot create a key " + args[0]);
System.err.println(" \""+ e.getMessage() + '"');
}
-
+
} else if ("passgen".equalsIgnoreCase(args[0])) {
int numDigits;
if (args.length <= 1) {
numDigits = 24;
} else {
- numDigits = Integer.parseInt(args[1]);
+ numDigits = Integer.parseInt(args[1]);
if (numDigits<8)numDigits = 8;
}
String pass;
@@ -305,17 +305,17 @@ public class CmdLine {
}
if (noLower) {
noLower=!(c>=0x61 && c<=0x7A);
- }
+ }
if (noUpper) {
noUpper=!(c>=0x41 && c<=0x5A);
- }
+ }
if (noDigits) {
noDigits=!(c>=0x30 && c<=0x39);
- }
+ }
if (noSpecial) {
noSpecial = "+!@#$%^&*(){}[]?:;,.".indexOf(c)<0;
- }
-
+ }
+
missingChars = (noLower || noUpper || noDigits || noSpecial);
}
} while (missingChars || repeatingChars);
@@ -325,7 +325,7 @@ public class CmdLine {
if (args.length <= 1) {
numDigits = 24;
} else {
- numDigits = Integer.parseInt(args[1]);
+ numDigits = Integer.parseInt(args[1]);
}
System.out.println(Symm.randomGen(Symm.base64url.codeset, numDigits).substring(0,numDigits));
}
@@ -349,9 +349,9 @@ public class CmdLine {
System.exit(1);
}
}
-
+
public static void setSystemExit(boolean shouldExit) {
systemExit = shouldExit;
}
-
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java
index f88c3fbe..88ac57e6 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Connector.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java
index 6019f551..dcb30088 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CredVal.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,16 +24,16 @@ package org.onap.aaf.cadi;
/**
* UserPass
- *
- * The essential interface required by BasicAuth to determine if a given User/Password combination is
+ *
+ * The essential interface required by BasicAuth to determine if a given User/Password combination is
* valid. This is done as an interface.
- *
+ *
* @author Jonathan
*/
public interface CredVal {
public enum Type{PASSWORD};
/**
- * Validate if the User/Password combination matches records
+ * Validate if the User/Password combination matches records
* @param user
* @param pass
* @return
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java
index db5ab0f2..4a8015a3 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CredValDomain.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java b/cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java
index 039ba8f7..4c5ca543 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/GetCred.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java
index 3027fd74..26c33c84 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Hash.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,7 +27,7 @@ import java.security.NoSuchAlgorithmException;
public class Hash {
private static char hexDigit[] = "0123456789abcdef".toCharArray();
-
+
/////////////////////////////////
// MD5
/////////////////////////////////
@@ -38,9 +38,9 @@ public class Hash {
* @throws NoSuchAlgorithmException
*/
public static byte[] hashMD5 (byte[] input) throws NoSuchAlgorithmException {
- // Note: Protect against Multi-thread issues with new MessageDigest
+ // Note: Protect against Multi-thread issues with new MessageDigest
MessageDigest md = MessageDigest.getInstance("MD5");
- md.update(input);
+ md.update(input);
return md.digest();
}
@@ -51,17 +51,17 @@ public class Hash {
* @throws NoSuchAlgorithmException
*/
public static byte[] hashMD5 (byte[] input, int offset, int length) throws NoSuchAlgorithmException {
- // Note: Protect against Multi-thread issues with new MessageDigest
+ // Note: Protect against Multi-thread issues with new MessageDigest
MessageDigest md = MessageDigest.getInstance("MD5");
- md.update(input,offset,length);
+ md.update(input,offset,length);
return md.digest();
}
/**
- * Convenience Function: Encrypt MD5 from String to String Hex representation
- *
+ * Convenience Function: Encrypt MD5 from String to String Hex representation
+ *
* @param input
* @return
* @throws NoSuchAlgorithmException
@@ -83,9 +83,9 @@ public class Hash {
* SHA256 Hashing
*/
public static byte[] hashSHA256(byte[] input) throws NoSuchAlgorithmException {
- // Note: Protect against Multi-thread issues with new MessageDigest
+ // Note: Protect against Multi-thread issues with new MessageDigest
MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(input);
+ md.update(input);
return md.digest();
}
@@ -93,15 +93,15 @@ public class Hash {
* SHA256 Hashing
*/
public static byte[] hashSHA256(byte[] input, int offset, int length) throws NoSuchAlgorithmException {
- // Note: Protect against Multi-thread issues with new MessageDigest
+ // Note: Protect against Multi-thread issues with new MessageDigest
MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(input,offset,length);
+ md.update(input,offset,length);
return md.digest();
}
-
+
/**
* Convenience Function: Hash from String to String Hex representation
- *
+ *
* @param input
* @return
* @throws NoSuchAlgorithmException
@@ -112,7 +112,7 @@ public class Hash {
/**
* Convenience Function: Hash from String to String Hex representation
- *
+ *
* @param input
* @return
* @throws NoSuchAlgorithmException
@@ -124,7 +124,7 @@ public class Hash {
bb.put(input.getBytes());
return toHex(Hash.hashSHA256(bb.array()));
}
-
+
/**
* Compare two byte arrays for equivalency
* @param ba1
@@ -166,7 +166,7 @@ public class Hash {
}
return sb.toString();
}
-
+
public static String toHex(byte[] ba, int start, int length) {
StringBuilder sb = new StringBuilder("0x");
for (int i=start;i<length;++i) {
@@ -176,7 +176,7 @@ public class Hash {
return sb.toString();
}
-
+
public static byte[] fromHex(String s) throws CadiException{
if (!s.startsWith("0x")) {
throw new CadiException("HexString must start with \"0x\"");
@@ -212,7 +212,7 @@ public class Hash {
/**
* Does not expect to start with "0x"
* if Any Character doesn't match, it returns null;
- *
+ *
* @param s
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java
index c40cb998..46e6f7e5 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Locator.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,7 +30,7 @@ public interface Locator<T> {
public Item next(Item item) throws LocatorException;
public boolean refresh();
public void destroy();
-
+
public interface Item {}
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java b/cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java
index da56d4b2..8eb0e27a 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/LocatorException.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,7 +23,7 @@ package org.onap.aaf.cadi;
public class LocatorException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = -4267929804321134469L;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java
index bdc9f643..cce91e06 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Lur.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,37 +30,37 @@ import java.util.List;
* LUR: Local User Registry
*
* Concept by Robert Garskof, Implementation by Jonathan Gathman
- *
+ *
* Where we can keep local copies of users and roles for faster Authorization when asked.
- *
- * Note: Author cannot resist the mental image of using a Fishing Lure to this LUR pattern
- *
+ *
+ * Note: Author cannot resist the mental image of using a Fishing Lure to this LUR pattern
+ *
* @author Jonathan
*
*/
public interface Lur {
/**
- * Allow the Lur, which has correct Permission access, to create and hand back.
+ * Allow the Lur, which has correct Permission access, to create and hand back.
*/
public Permission createPerm(String p);
-
- /**
+
+ /**
* Fish for Principals in a Pond
- *
+ *
* or more boringly, is the User identified within a named collection representing permission.
- *
+ *
* @param principalName
* @return
*/
public boolean fish(Principal bait, Permission ... pond);
- /**
+ /**
* Fish all the Principals out a Pond
- *
+ *
* For additional humor, pronounce the following with a Southern Drawl, "FishOil"
- *
+ *
* or more boringly, load the List with Permissions found for Principal
- *
+ *
* @param principalName
* @return
*/
@@ -72,19 +72,19 @@ public interface Lur {
public void destroy();
/**
- * Does this LUR handle this pond exclusively? Important for EpiLUR to determine whether
- * to try another (more expensive) LUR
+ * Does this LUR handle this pond exclusively? Important for EpiLUR to determine whether
+ * to try another (more expensive) LUR
* @param pond
* @return
*/
- public boolean handlesExclusively(Permission ... pond);
-
+ public boolean handlesExclusively(Permission ... pond);
+
/**
* Does the LUR support a particular kind of Principal
* This can be used to check name's domain, like above, or Principal type
*/
public boolean handles(Principal principal);
-
+
/**
* Clear: Clear any Caching, if exists
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java
index 2537c386..f45e5e07 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Permission.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
index 92756d8c..c4719f86 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
@@ -3,15 +3,15 @@
* org.onap.aaf
* ===========================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- *
+ *
* Modifications Copyright (C) 2018 IBM.
* ===========================================================================
* 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.
@@ -59,7 +59,7 @@ public class PropAccess implements Access {
logIt = new StreamLogIt(System.out);
init(null);
}
-
+
/**
* This Constructor soly exists to instantiate Servlet Context Based Logging that will call "init" later.
* @param sc
@@ -68,29 +68,29 @@ public class PropAccess implements Access {
logIt = new StreamLogIt(System.out);
props = new Properties();
}
-
+
public PropAccess(String ... args) {
this(System.out,args);
}
-
+
public PropAccess(PrintStream ps, String[] args) {
logIt = new StreamLogIt(ps==null?System.out:ps);
init(logIt,args);
}
-
+
public PropAccess(LogIt logit, String[] args) {
init(logit, args);
}
-
+
public PropAccess(Properties p) {
this(System.out,p);
}
-
+
public PropAccess(PrintStream ps, Properties p) {
logIt = new StreamLogIt(ps==null?System.out:ps);
init(p);
}
-
+
protected void init(final LogIt logIt, final String[] args) {
this.logIt = logIt;
Properties nprops=new Properties();
@@ -102,7 +102,7 @@ public class PropAccess implements Access {
}
init(nprops);
}
-
+
public static SimpleDateFormat newISO8601() {
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
}
@@ -110,7 +110,7 @@ public class PropAccess implements Access {
protected synchronized void init(Properties p) {
// Make sure these two are set before any changes in Logging
name = "cadi";
-
+
props = new Properties();
// First, load related System Properties
for (Entry<Object,Object> es : System.getProperties().entrySet()) {
@@ -119,24 +119,24 @@ public class PropAccess implements Access {
if (key.startsWith(start)) {
props.put(key, es.getValue());
}
- }
+ }
}
// Second, overlay or fill in with Passed in Props
if (p!=null) {
props.putAll(p);
}
-
+
// Preset LogLevel
- String sLevel = props.getProperty(Config.CADI_LOGLEVEL);
+ String sLevel = props.getProperty(Config.CADI_LOGLEVEL);
// Third, load any Chained Property Files
load(props.getProperty(Config.CADI_PROP_FILES));
-
+
if(sLevel==null) { // if LogLev wasn't set before, check again after Chained Load
- sLevel = props.getProperty(Config.CADI_LOGLEVEL);
+ sLevel = props.getProperty(Config.CADI_LOGLEVEL);
if (sLevel==null) {
level=DEFAULT.maskOf();
} else {
- level=Level.valueOf(sLevel).maskOf();
+ level=Level.valueOf(sLevel).maskOf();
}
}
// Setup local Symmetrical key encryption
@@ -149,21 +149,21 @@ public class PropAccess implements Access {
System.exit(1);
}
}
-
+
name = props.getProperty(Config.CADI_LOGNAME, name);
-
+
SecurityInfo.setHTTPProtocols(this);
-
+
}
-
-
+
+
private void load(String cadi_prop_files) {
if (cadi_prop_files==null) {
return;
}
String prevKeyFile = props.getProperty(Config.CADI_KEYFILE);
-
+
for(String filename : Split.splitTrim(File.pathSeparatorChar, cadi_prop_files)) {
Properties fileProps = new Properties();
File file = new File(filename);
@@ -208,8 +208,8 @@ public class PropAccess implements Access {
printf(Level.WARN,"Warning: recursive CADI Property %s does not exist",file.getAbsolutePath());
}
}
-
- // Trim
+
+ // Trim
for (Entry<Object, Object> es : props.entrySet()) {
Object value = es.getValue();
if (value instanceof String) {
@@ -237,7 +237,7 @@ public class PropAccess implements Access {
prevKeyFile=newKeyFile;
}
-
+
String loglevel = props.getProperty(Config.CADI_LOGLEVEL);
if (loglevel!=null) {
try {
@@ -247,7 +247,7 @@ public class PropAccess implements Access {
}
}
}
-
+
@Override
public void load(InputStream is) throws IOException {
props.load(is);
@@ -264,7 +264,7 @@ public class PropAccess implements Access {
public StringBuilder buildMsg(Level level, Object[] elements) {
return buildMsg(name,iso8601,level,elements);
}
-
+
/*
* Need to pass in DateFormat per thread, because not marked as thread safe
*/
@@ -286,7 +286,7 @@ public class PropAccess implements Access {
sb.append("] ");
} else {
int idx = 0;
- if(elements[idx]!=null &&
+ if(elements[idx]!=null &&
elements[idx] instanceof Integer) {
sb.append('-');
sb.append(elements[idx]);
@@ -298,7 +298,7 @@ public class PropAccess implements Access {
}
return sb;
}
-
+
private static boolean write(boolean first, StringBuilder sb, Object[] elements) {
String s;
for (Object o : elements) {
@@ -374,7 +374,7 @@ public class PropAccess implements Access {
? symm.depass(encrypted)
: encrypted;
}
-
+
public String encrypt(String unencrypted) throws IOException {
return Symm.ENC+symm.enpass(unencrypted);
}
@@ -385,7 +385,7 @@ public class PropAccess implements Access {
public String getProperty(String tag) {
return props.getProperty(tag);
}
-
+
public Properties getProperties() {
return props;
@@ -410,10 +410,10 @@ public class PropAccess implements Access {
public interface LogIt {
public void push(Level level, Object ... elements) ;
}
-
+
private class StreamLogIt implements LogIt {
private PrintStream ps;
-
+
public StreamLogIt(PrintStream ps) {
this.ps = ps;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java
index 66ba86ae..33a5bc91 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Revalidator.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,7 +25,7 @@ package org.onap.aaf.cadi;
public interface Revalidator<TRANS> {
/**
* Re-Validate Credential
- *
+ *
* @param prin
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java
index 194712e0..7e263831 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/SecuritySetter.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,17 +24,17 @@ package org.onap.aaf.cadi;
/**
* Apply any particular security mechanism
- *
- * This allows the definition of various mechanisms involved outside of DRcli jars
- *
+ *
+ * This allows the definition of various mechanisms involved outside of DRcli jars
+ *
* @author Jonathan
*
*/
public interface SecuritySetter<CT> {
public String getID();
-
+
public void setSecurity(CT client) throws CadiException;
-
+
/**
* Returns number of bad logins registered
* @param respCode
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java
index 998b87c9..be6e5329 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/ServletContextAccess.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java
index e7533610..b1ec4caf 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,37 +43,37 @@ import org.onap.aaf.cadi.config.Config;
/**
* Key Conversion, primarily "Base64"
- *
+ *
* Base64 is required for "Basic Authorization", which is an important part of the overall CADI Package.
- *
- * Note: This author found that there is not a "standard" library for Base64 conversion within Java.
- * The source code implementations available elsewhere were surprisingly inefficient, requiring, for
+ *
+ * Note: This author found that there is not a "standard" library for Base64 conversion within Java.
+ * The source code implementations available elsewhere were surprisingly inefficient, requiring, for
* instance, multiple string creation, on a transaction pass. Integrating other packages that might be
- * efficient enough would put undue Jar File Dependencies given this Framework should have none-but-Java
+ * efficient enough would put undue Jar File Dependencies given this Framework should have none-but-Java
* dependencies.
- *
+ *
* The essential algorithm is good for a symmetrical key system, as Base64 is really just
- * a symmetrical key that everyone knows the values.
- *
- * This code is quite fast, taking about .016 ms for encrypting, decrypting and even .08 for key
- * generation. The speed quality, especially of key generation makes this a candidate for a short term token
+ * a symmetrical key that everyone knows the values.
+ *
+ * This code is quite fast, taking about .016 ms for encrypting, decrypting and even .08 for key
+ * generation. The speed quality, especially of key generation makes this a candidate for a short term token
* used for identity.
- *
- * It may be used to easily avoid placing Clear-Text passwords in configurations, etc. and contains
- * supporting functions such as 2048 keyfile generation (see keygen). This keyfile should, of course,
- * be set to "400" (Unix) and protected as any other mechanism requires.
- *
+ *
+ * It may be used to easily avoid placing Clear-Text passwords in configurations, etc. and contains
+ * supporting functions such as 2048 keyfile generation (see keygen). This keyfile should, of course,
+ * be set to "400" (Unix) and protected as any other mechanism requires.
+ *
* AES Encryption is also employed to include standards.
- *
+ *
* @author Jonathan
*
*/
public class Symm {
- private static final byte[] DOUBLE_EQ = new byte[] {'=','='};
+ private static final byte[] DOUBLE_EQ = new byte[] {'=','='};
public static final String ENC = "enc:";
private static final Object LOCK = new Object();
private static final SecureRandom random = new SecureRandom();
-
+
public final char[] codeset;
private final int splitLinesAt;
private final String encoding;
@@ -83,7 +83,7 @@ public class Symm {
//Note: AES Encryption is not Thread Safe. It is Synchronized
//private AES aes = null; // only initialized from File, and only if needed for Passwords
private String name;
-
+
/**
* This is the standard base64 Key Set.
* RFC 2045
@@ -116,15 +116,15 @@ public class Symm {
* Note, this is too large to fit into the algorithm. Only use with PassGen
*/
private static char passChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+!@#$%^&*(){}[]?:;,.".toCharArray();
-
+
private static Symm internalOnly = null;
-
+
/**
* Use this to create special case Case Sets and/or Line breaks
- *
+ *
* If you don't know why you need this, use the Singleton Method
- *
+ *
* @param codeset
* @param split
*/
@@ -136,8 +136,8 @@ public class Symm {
this.name = name;
char prev = 0, curr=0, first = 0;
int offset=Integer.SIZE; // something that's out of range for integer array
-
- // There can be time efficiencies gained when the underlying keyset consists mainly of ordered
+
+ // There can be time efficiencies gained when the underlying keyset consists mainly of ordered
// data (i.e. abcde...). Therefore, we'll quickly analyze the keyset. If it proves to have
// too much entropy, the "Unordered" algorithm, which is faster in such cases is used.
ArrayList<int[]> la = new ArrayList<>();
@@ -146,7 +146,7 @@ public class Symm {
if (prev+1==curr) { // is next character in set
prev = curr;
} else {
- if (offset!=Integer.SIZE) { // add previous range
+ if (offset!=Integer.SIZE) { // add previous range
la.add(new int[]{first,prev,offset});
}
first = prev = curr;
@@ -162,11 +162,11 @@ public class Symm {
convert = new Ordered(range);
}
}
-
+
public Symm copy(int lines) {
return new Symm(codeset,lines,encoding,endEquals, "Copied " + lines);
}
-
+
// Only used by keygen, which is intentionally randomized. Therefore, always use unordered
private Symm(char[] codeset, Symm parent) {
this.codeset = codeset;
@@ -186,7 +186,7 @@ public class Symm {
}
/**
- * Obtain the base64() behavior of this class, for use in standard BASIC AUTH mechanism, etc.
+ * Obtain the base64() behavior of this class, for use in standard BASIC AUTH mechanism, etc.
* No Line Splitting
* @return
*/
@@ -222,7 +222,7 @@ public class Symm {
}
return exec.exec(new AES(keyBytes,0,keyBytes.length));
}
-
+
public interface Encryption {
public CipherOutputStream outputStream(OutputStream os, boolean encrypt);
public CipherInputStream inputStream(InputStream is, boolean encrypt);
@@ -231,7 +231,7 @@ public class Symm {
public static interface SyncExec<T> {
public T exec(Encryption enc) throws IOException, Exception;
}
-
+
public byte[] encode(byte[] toEncrypt) throws IOException {
if (toEncrypt==null) {
return EMPTY;
@@ -251,7 +251,7 @@ public class Symm {
/**
* Helper function for String API of "Encode"
* use "getBytes" with appropriate char encoding, etc.
- *
+ *
* @param str
* @return
* @throws IOException
@@ -259,7 +259,7 @@ public class Symm {
public String encode(String str) throws IOException {
byte[] array;
boolean useDefaultEncoding = false;
- try {
+ try {
array = str.getBytes(encoding);
} catch (IOException e) {
array = str.getBytes(); // take default
@@ -267,14 +267,14 @@ public class Symm {
}
// Calculate expected size to avoid any buffer expansion copies within the ByteArrayOutput code
ByteArrayOutputStream baos = new ByteArrayOutputStream((int)(array.length*1.363)); // account for 4 bytes for 3 and a byte or two more
-
+
encode(new ByteArrayInputStream(array),baos);
if (useDefaultEncoding) {
return baos.toString();
}
return baos.toString(encoding);
}
-
+
/**
* Helper function for the String API of "Decode"
* use "getBytes" with appropriate char encoding, etc.
@@ -285,7 +285,7 @@ public class Symm {
public String decode(String str) throws IOException {
byte[] array;
boolean useDefaultEncoding = false;
- try {
+ try {
array = str.getBytes(encoding);
} catch (IOException e) {
array = str.getBytes(); // take default
@@ -302,9 +302,9 @@ public class Symm {
/**
* Convenience Function
- *
+ *
* encode String into InputStream and call encode(InputStream, OutputStream)
- *
+ *
* @param string
* @param out
* @throws IOException
@@ -315,9 +315,9 @@ public class Symm {
/**
* Convenience Function
- *
+ *
* encode String into InputStream and call decode(InputStream, OutputStream)
- *
+ *
* @param string
* @param out
* @throws IOException
@@ -331,16 +331,16 @@ public class Symm {
encode(is,os);
}
- /**
+ /**
* encode InputStream onto Output Stream
- *
+ *
* @param is
* @param estimate
* @return
* @throws IOException
*/
public void encode(InputStream is, OutputStream os) throws IOException {
- // StringBuilder sb = new StringBuilder((int)(estimate*1.255)); // try to get the right size of StringBuilder from start.. slightly more than 1.25 times
+ // StringBuilder sb = new StringBuilder((int)(estimate*1.255)); // try to get the right size of StringBuilder from start.. slightly more than 1.25 times
int prev=0;
int read, idx=0, line=0;
boolean go;
@@ -360,7 +360,7 @@ public class Symm {
os.write(codeset[((prev & 0x03)<<4) | (read>>4)]);
prev = read;
break;
- default: //(3+)
+ default: //(3+)
// Char 1 is last 4 bits of prev plus the first 2 bits of read
// Char 2 is the last 6 bits of read
os.write(codeset[(((prev & 0xF)<<2) | (read>>6))]);
@@ -387,7 +387,7 @@ public class Symm {
}
idx = 0;
}
-
+
} while (go);
}
@@ -412,7 +412,7 @@ public class Symm {
if (index>=0) {
switch(++idx) { // 1 based cases, slightly faster ++
case 1: // index goes into first 6 bits of prev
- prev = index<<2;
+ prev = index<<2;
break;
case 2: // write second 2 bits of into prev, write byte, last 4 bits go into prev
os.write((byte)(prev|(index>>4)));
@@ -430,7 +430,7 @@ public class Symm {
};
os.flush();
}
-
+
/**
* Interface to allow this class to choose which algorithm to find index of character in Key
* @author Jonathan
@@ -454,7 +454,7 @@ public class Symm {
public int convert(int read) throws IOException {
// System.out.print((char)read);
switch(read) {
- case -1:
+ case -1:
case '=':
case ' ':
case '\n':
@@ -469,7 +469,7 @@ public class Symm {
throw new IOException("Unacceptable Character in Stream");
}
}
-
+
/**
* Unordered, i.e. the key is purposely randomized, simply has to investigate each character
* until we find a match.
@@ -483,7 +483,7 @@ public class Symm {
}
public int convert(int read) throws IOException {
switch(read) {
- case -1:
+ case -1:
case '=':
case '\n':
case '\r':
@@ -499,7 +499,7 @@ public class Symm {
/**
* Generate a 2048 based Key from which we extract our code base
- *
+ *
* @return
* @throws IOException
*/
@@ -510,7 +510,7 @@ public class Symm {
base64url.encode(new ByteArrayInputStream(inkey), baos);
return baos.toByteArray();
}
-
+
// A class allowing us to be less predictable about significant digits (i.e. not picking them up from the
// beginning, and not picking them up in an ordered row. Gives a nice 2048 with no visible patterns.
private class Obtain {
@@ -518,7 +518,7 @@ public class Symm {
private int skip;
private int length;
private byte[] key;
-
+
private Obtain(Symm b64, byte[] key) {
skip = Math.abs(key[key.length-13]%key.length);
if ((key.length&0x1) == (skip&0x1)) { // if both are odd or both are even
@@ -528,19 +528,19 @@ public class Symm {
last = 17+length%59; // never start at beginning
this.key = key;
}
-
+
private int next() {
return Math.abs(key[(++last*skip)%key.length])%length;
}
};
-
+
/**
* Obtain a Symm from "keyfile" (Config.KEYFILE) property
- *
+ *
* @param acesss
* @return
- * @throws IOException
- * @throws CadiException
+ * @throws IOException
+ * @throws CadiException
*/
public static Symm obtain(Access access) throws CadiException {
String keyfile = access.getProperty(Config.CADI_KEYFILE,null);
@@ -586,7 +586,7 @@ public class Symm {
}
}
/**
- * Create a new random key
+ * Create a new random key
*/
public Symm obtain() throws IOException {
byte inkey[] = new byte[0x800];
@@ -595,10 +595,10 @@ public class Symm {
s.name = "from Random";
return s;
}
-
+
/**
* Obtain a Symm from 2048 key from a String
- *
+ *
* @param key
* @return
* @throws IOException
@@ -608,10 +608,10 @@ public class Symm {
s.name = "from String";
return s;
}
-
+
/**
* Obtain a Symm from 2048 key from a Stream
- *
+ *
* @param is
* @return
* @throws IOException
@@ -635,7 +635,7 @@ public class Symm {
/**
* Convenience for picking up Keyfile
- *
+ *
* @param f
* @return
* @throws IOException
@@ -654,7 +654,7 @@ public class Symm {
* Decrypt into a String
*
* Convenience method
- *
+ *
* @param password
* @return
* @throws IOException
@@ -667,7 +667,7 @@ public class Symm {
/**
* Create an encrypted password, making sure that even short passwords have a minimum length.
- *
+ *
* @param password
* @param os
* @throws IOException
@@ -682,7 +682,7 @@ public class Symm {
if (this.getClass().getSimpleName().startsWith("base64")) { // don't expose randomization
dos.write(bytes);
} else {
-
+
Random r = new SecureRandom();
int start = 0;
byte b;
@@ -710,7 +710,7 @@ public class Symm {
dos.write(bytes);
}
}
-
+
// 7/21/2016 Jonathan add AES Encryption to the mix
try {
exec(new SyncExec<Void>() {
@@ -735,9 +735,9 @@ public class Symm {
/**
* Decrypt a password into a String
- *
+ *
* Convenience method
- *
+ *
* @param password
* @return
* @throws IOException
@@ -748,12 +748,12 @@ public class Symm {
depass(password,baos);
return new String(baos.toByteArray());
}
-
+
/**
* Decrypt a password
- *
+ *
* Skip Symm.ENC
- *
+ *
* @param password
* @param os
* @return
@@ -803,7 +803,7 @@ public class Symm {
dos.writeByte(dis.readByte());
}
} else {
- int pre =((Byte.SIZE*3+Integer.SIZE+Byte.SIZE)/Byte.SIZE)+start;
+ int pre =((Byte.SIZE*3+Integer.SIZE+Byte.SIZE)/Byte.SIZE)+start;
os.write(bytes, pre, bytes.length-pre);
}
}
@@ -811,9 +811,9 @@ public class Symm {
}
public static String randomGen(int numBytes) {
- return randomGen(passChars,numBytes);
+ return randomGen(passChars,numBytes);
}
-
+
public static String randomGen(char[] chars ,int numBytes) {
int rint;
StringBuilder sb = new StringBuilder(numBytes);
@@ -824,11 +824,11 @@ public class Symm {
return sb.toString();
}
// Internal mechanism for helping to randomize placement of characters within a Symm codeset
- // Based on an incoming data stream (originally created randomly, but can be recreated within
+ // Based on an incoming data stream (originally created randomly, but can be recreated within
// 2048 key), go after a particular place in the new codeset. If that codeset spot is used, then move
- // right or left (depending on iteration) to find the next available slot. In this way, key generation
+ // right or left (depending on iteration) to find the next available slot. In this way, key generation
// is speeded up by only enacting N iterations, but adds a spreading effect of the random number stream, so that keyset is also
- // shuffled for a good spread. It is, however, repeatable, given the same number set, allowing for
+ // shuffled for a good spread. It is, however, repeatable, given the same number set, allowing for
// quick recreation when the official stream is actually obtained.
public Symm obtain(byte[] key) throws IOException {
int filled = codeset.length;
@@ -844,7 +844,7 @@ public class Symm {
if (index<0 || index>=codeset.length) {
System.out.println("uh, oh");
}
- if (right) { // alternate going left or right to find the next open slot (keeps it from taking too long to hit something)
+ if (right) { // alternate going left or right to find the next open slot (keeps it from taking too long to hit something)
for (int j=index;j<end;++j) {
if (seq[j]==0) {
seq[j]=codeset[filled];
@@ -879,12 +879,12 @@ public class Symm {
return newSymm;
}
-
- /**
+
+ /**
* This Symm is generated for internal JVM use. It has no external keyfile, but can be used
* for securing Memory, as it remains the same ONLY of the current JVM
* @return
- * @throws IOException
+ * @throws IOException
*/
public static synchronized Symm internalOnly() throws IOException {
if (internalOnly==null) {
@@ -897,7 +897,7 @@ public class Symm {
}
return internalOnly;
}
-
+
@Override
public String toString() {
return name;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java
index 771ebcf4..ee9b343a 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Taf.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,33 +25,33 @@ import org.onap.aaf.cadi.taf.TafResp;
/**
- * TAF - Transmutative Assertion Framework.
- *
+ * TAF - Transmutative Assertion Framework.
+ *
* This main Interface embodies the essential of the assertion, where a number of different TAFs might be used to authenticate
* and that authentication to be recognized through other elements.
- *
+ *
* Concept by Robert Garskof. Implemented by Jonathan Gathman
- *
+ *
* @author Jonathan
*
*/
public interface Taf {
enum LifeForm {CBLF, SBLF, LFN};
/**
- * The lifeForm param is a humorous way of describing whether the interaction is proceeding from direct Human Interaction via a browser
+ * The lifeForm param is a humorous way of describing whether the interaction is proceeding from direct Human Interaction via a browser
* or App which can directly query a memorized password, key sequence, bio-feedback, from that user, or a machine mechanism for which identity
- * can more easily be determined by Certificate, Mechanical ID/Password etc. Popularized in modern culture and Science Fiction (especially
- * Star Trek), we (starting with Robert Garskof) use the terms "Carbon Based Life Form" (CBLF) for mechanisms with people at the end of them, or
+ * can more easily be determined by Certificate, Mechanical ID/Password etc. Popularized in modern culture and Science Fiction (especially
+ * Star Trek), we (starting with Robert Garskof) use the terms "Carbon Based Life Form" (CBLF) for mechanisms with people at the end of them, or
* "Silicon Based Life Forms" (SBLF) to indicate machine only interactions. I have added "LFN" for (Life-Form Neutral) to aid identifying
- * processes for which it doesn't matter whether there is a human at the immediate end of the chain, or cannot be determined mechanically.
- *
+ * processes for which it doesn't matter whether there is a human at the immediate end of the chain, or cannot be determined mechanically.
+ *
* The variable parameter is not necessarily ideal, but with too many unknown Tafs to be created, flexibility,
* is unfortunately required at this point. Future versions could lock this down more. Jonathan 10/18/2012
- *
+ *
* @param lifeForm
* @param info
* @return
*/
public TafResp validate(LifeForm reading, String ... info);
-
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java
index 1203b8d2..b88591fa 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Transmutate.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,18 +26,18 @@ import java.security.Principal;
/**
* The unique element of TAF is that we establish the relationship/mechanism to mutate the Principal derived from
* one Authentication mechanism into a trustable Principal of another. The mechanism needs to be decided by system
- * trusting.
- *
+ * trusting.
+ *
* The Generic "T" is used so that the code used will be very specific for the implementation, enforced by Compiler
- *
- * This interface will allow differences of trusting Transmutation of Authentication
+ *
+ * This interface will allow differences of trusting Transmutation of Authentication
* @author Jonathan
*
*/
public interface Transmutate<T> {
/**
* Mutate the (assumed validated) Principal into the expected Principal name to be used to construct
- *
+ *
* @param p
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java b/cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java
index 6b1433f4..3ab9c290 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/TrustChecker.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,13 +27,13 @@ import org.onap.aaf.cadi.taf.TafResp;
/**
* Change to another Principal based on Trust of caller and User Chain (if desired)
- *
+ *
* @author Jonathan
*
*/
public interface TrustChecker {
public TafResp mayTrust(TafResp tresp, HttpServletRequest req);
-
+
/**
* A class that trusts no-one else, so just return same TResp
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/User.java b/cadi/core/src/main/java/org/onap/aaf/cadi/User.java
index cb3b4e8f..97837555 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/User.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/User.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,7 +31,7 @@ import org.onap.aaf.cadi.lur.LocalPermission;
/**
* Class to hold info from the User Perspective.
- *
+ *
* @author Jonathan
*
*/
@@ -44,7 +44,7 @@ public final class User<PERM extends Permission> {
long permExpires;
private final long interval;
int count;
-
+
// Note: This should only be used for Local RBAC (in memory)
public User(Principal principal) {
this.principal = principal;
@@ -86,23 +86,23 @@ public final class User<PERM extends Permission> {
count = 0;
renewPerm();
}
-
+
public void renewPerm() {
permExpires = System.currentTimeMillis()+interval;
}
-
+
public long permExpires() {
return permExpires;
}
-
+
public boolean permExpired() {
return System.currentTimeMillis() > permExpires;
}
public boolean noPerms() {
- return perms==null || perms==NULL_MAP || perms.values().size()==0;
+ return perms==null || perms==NULL_MAP || perms.values().size()==0;
}
-
+
public synchronized void setNoPerms() {
perms=NULL_MAP;
renewPerm();
@@ -115,11 +115,11 @@ public final class User<PERM extends Permission> {
public synchronized void incCount() {
++count;
}
-
+
public synchronized void resetCount() {
count=0;
}
-
+
public Map<String,Permission> newMap() {
return new ConcurrentHashMap<>();
}
@@ -146,11 +146,11 @@ public final class User<PERM extends Permission> {
}
return false;
}
-
+
public void copyPermsTo(List<Permission> sink) {
sink.addAll(perms.values());
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(principal.getName());
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java b/cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java
index f6a98085..f299f931 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/UserChain.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,17 +23,17 @@ package org.onap.aaf.cadi;
/**
* Interface to add a User Chain String to Principal
- *
- *
- *
+ *
+ *
+ *
* Where
- * APP is name suitable for Logging (i.e. official App Acronym)
+ * APP is name suitable for Logging (i.e. official App Acronym)
* ID is official User or MechID, best if includes Identity Source (i.e. ab1234@people.osaaf.org)
* Protocol is the Security protocol,
- *
+ *
* Format:<ID>:<APP>:<protocol>[:AS][,<ID>:<APP>:<protocol>]*
- *
- *
+ *
+ *
* @author Jonathan
*
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
index 7bd578a5..a231b393 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java
@@ -7,9 +7,9 @@
* 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.
@@ -64,7 +64,7 @@ import org.onap.aaf.cadi.util.Split;
/**
* Create a Consistent Configuration mechanism, even when configuration styles are as vastly different as
* Properties vs JavaBeans vs FilterConfigs...
- *
+ *
* @author Jonathan
*
*/
@@ -110,16 +110,16 @@ public class Config {
public static final String CADI_PROTOCOLS = "cadi_protocols";
public static final String CADI_NOAUTHN = "cadi_noauthn";
public static final String CADI_LOC_LIST = "cadi_loc_list";
-
+
// Special Behaviors
public static final String CADI_BATH_CONVERT = "cadi_bath_convert";
public static final String CADI_API_ENFORCEMENT = "cadi_api_enforcement";
public static final String CADI_ADD_TAFS = "cadi_add_tafs";
public static final String CADI_ADD_LURS = "cadi_add_lurs";
-
+
public static final String CADI_USER_CHAIN_TAG = "cadi_user_chain";
public static final String CADI_USER_CHAIN = "USER_CHAIN";
-
+
public static final String CADI_OAUTH2_URL="cadi_oauth2_url";
public static final String CADI_TOKEN_DIR = "cadi_token_dir";
@@ -133,20 +133,20 @@ public class Config {
+ "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,TLS_ECDHE_RSA_WITH_RC4_128_SHA,TLS_ECDH_ECDSA_WITH_RC4_128_SHA,"
+ "TLS_ECDH_RSA_WITH_RC4_128_SHA,TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,"
+ "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,TLS_EMPTY_RENEGOTIATION_INFO_SCSV";
-
+
public static final String LOCALHOST_ALLOW = "localhost_allow";
public static final String LOCALHOST_DENY = "localhost_deny";
-
- public static final String BASIC_REALM = "basic_realm"; // what is sent to the client
- public static final String BASIC_WARN = "basic_warn"; // Warning of insecure channel
+
+ public static final String BASIC_REALM = "basic_realm"; // what is sent to the client
+ public static final String BASIC_WARN = "basic_warn"; // Warning of insecure channel
public static final String USERS = "local_users";
public static final String GROUPS = "local_groups";
public static final String WRITE_TO = "local_writeto"; // dump RBAC to local file in Tomcat Style (some apps use)
-
+
public static final String OAUTH_CLIENT_ID="client_id";
public static final String OAUTH_CLIENT_SECRET="client_secret";
-
+
public static final String AAF_ENV = "aaf_env";
public static final String AAF_ROOT_NS = "aaf_root_ns";
public static final String AAF_ROOT_NS_DEF = "org.osaaf.aaf";
@@ -159,15 +159,15 @@ public class Config {
public static final String AAF_DEFAULT_API_VERSION = "2.1";
public static final String AAF_DEPLOYED_VERSION="aaf_deployed_version";
public static final String AAF_API_VERSION = "aaf_api_version";
- public static final String AAF_URL = "aaf_url"; //URL for AAF... Use to trigger AAF configuration
+ public static final String AAF_URL = "aaf_url"; //URL for AAF... Use to trigger AAF configuration
public static final String AAF_LOCATOR_CLASS = "aaf_locator_class";
// AAF Locator Entries are ADDITIONAL entries, which also gives the Property ability
// to set these entries manually
// example: adding a K8S name like "oom"
- // this will allow Registrations to pick up
+ // this will allow Registrations to pick up
// locator_ns.oom for onap's "OOM" based k8s entries, etc.
public static final String AAF_LOCATOR_CONTAINER="aaf_locator_container";
- // An ID for another Container, to be used to avoid picking up the wrong internal info
+ // An ID for another Container, to be used to avoid picking up the wrong internal info
// for another container.
public static final String AAF_LOCATOR_CONTAINER_ID = "aaf_locator_container_id";
public static final String AAF_LOCATOR_CONTAINER_NS = "aaf_locator_container_ns";
@@ -181,7 +181,7 @@ public class Config {
public static final String AAF_LOCATOR_PUBLIC_PORT = "aaf_locator_public_port";
public static final String AAF_LOCATOR_PUBLIC_FQDN = "aaf_locator_public_fqdn";
public static final String AAF_LOCATOR_PUBLIC_NAME = "aaf_locator_public_name";
-
+
// AAF Service will write to the Audit Log if a past due AAF stored Password
// is being used within # of days specified.
public static final String AAF_CRED_WARN_DAYS="aaf_cred_warn_days";
@@ -196,7 +196,7 @@ public class Config {
public static final String AAF_CONN_TIMEOUT_DEF = "3000";
public static final String AAF_CONN_IDLE_TIMEOUT = "aaf_conn_idle_timeout"; // only for Direct Jetty Access.
public static final String AAF_CONN_IDLE_TIMEOUT_DEF = "10000"; // only for Direct Jetty Access.
-
+
// Default Classes: These are for Class loading to avoid direct compile links
public static final String AAF_TAF_CLASS_DEF = "org.onap.aaf.cadi.aaf.v2_0.AAFTaf";
public static final String AAF_LOCATOR_CLASS_DEF = "org.onap.aaf.cadi.aaf.v2_0.AAFLocator";
@@ -212,7 +212,7 @@ public class Config {
public static final String AAF_CLEAN_INTERVAL_DEF = "30000"; // Default is 30 seconds
public static final String AAF_REFRESH_TRIGGER_COUNT = "aaf_refresh_trigger_count";
public static final String AAF_REFRESH_TRIGGER_COUNT_DEF = "3"; // Default is 10 mins
-
+
public static final String AAF_HIGH_COUNT = "aaf_high_count";
public static final String AAF_HIGH_COUNT_DEF = "1000"; // Default is 1000 entries
public static final String AAF_PERM_MAP = "aaf_perm_map";
@@ -251,7 +251,7 @@ public class Config {
public static final String AAF_OAUTH2_INTROSPECT_URL = "aaf_oauth2_introspect_url";
public static final String AAF_ALT_OAUTH2_TOKEN_URL = "aaf_alt_oauth2_token_url";
public static final String AAF_ALT_OAUTH2_INTROSPECT_URL = "aaf_alt_oauth2_introspect_url";
- public static final String AAF_ALT_OAUTH2_DOMAIN = "aaf_alt_oauth2_domain";
+ public static final String AAF_ALT_OAUTH2_DOMAIN = "aaf_alt_oauth2_domain";
public static final String AAF_ALT_CLIENT_ID = "aaf_alt_oauth2_client_id";
public static final String AAF_ALT_CLIENT_SECRET = "aaf_alt_oauth2_client_secret";
public static final String AAF_OAUTH2_HELLO_URL = "aaf_oauth2_hello_url";
@@ -300,9 +300,9 @@ public class Config {
// IMPORTANT! Don't attempt to load AAF Connector if there is no AAF URL
String aafURL = logProp(rph, AAF_URL,null);
if (!hasDirectAAF && aafcon==null && aafURL!=null) {
- aafcon = loadAAFConnector(si, aafURL);
+ aafcon = loadAAFConnector(si, aafURL);
}
-
+
HttpTaf taf;
// Setup Host, in case Network reports an unusable Hostname (i.e. VTiers, VPNs, etc)
String hostname = logProp(access, HOSTNAME,null);
@@ -313,7 +313,7 @@ public class Config {
throw new CadiException("Unable to determine Hostname",e1);
}
}
-
+
access.log(Level.INIT, "Hostname set to",hostname);
// Get appropriate TAFs
ArrayList<Priori<HttpTaf>> htlist = new ArrayList<>();
@@ -355,7 +355,7 @@ public class Config {
} else {
access.log(Level.INIT,"Certificate Authorization not enabled");
}
-
+
/////////////////////////////////////////////////////
// Configure Basic Auth (local content)
/////////////////////////////////////////////////////
@@ -406,7 +406,7 @@ public class Config {
} else {
access.log(Level.INIT,"Local Basic Authorization is disabled. Enable by setting basicRealm=<appropriate realm, i.e. my.att.com>");
}
-
+
/////////////////////////////////////////////////////
// Configure AAF Driven Basic Auth
/////////////////////////////////////////////////////
@@ -414,10 +414,10 @@ public class Config {
access.log(Level.INIT,"AAF Connection (AAFcon) is null. Cannot create an AAF TAF");
} else if (aafURL==null) {
access.log(Level.INIT,"No AAF URL in properties, Cannot create an AAF TAF");
- } else {// There's an AAF_URL... try to configure an AAF
+ } else {// There's an AAF_URL... try to configure an AAF
String aafTafClassName = logProp(access, AAF_TAF_CLASS,AAF_TAF_CLASS_DEF);
// Only 2.0 available at this time
- if (AAF_TAF_CLASS_DEF.equals(aafTafClassName)) {
+ if (AAF_TAF_CLASS_DEF.equals(aafTafClassName)) {
try {
Class<?> aafTafClass = loadClass(access,aafTafClassName);
if (aafTafClass!=null) {
@@ -447,7 +447,7 @@ public class Config {
}
}
}
-
+
/////////////////////////////////////////////////////
// Configure OAuth TAF
/////////////////////////////////////////////////////
@@ -490,7 +490,7 @@ public class Config {
access.log(Level.INIT,"OAuth TAF is not configured");
}
}
-
+
/////////////////////////////////////////////////////
// Adding BasicAuth (AAF) last, after other primary Cookie Based
// Needs to be before Cert... see below
@@ -498,7 +498,7 @@ public class Config {
if (aaftaf!=null) {
htlist.add(new Priori<HttpTaf>(aaftaf,40));
}
- }
+ }
/////////////////////////////////////////////////////
// Any Additional Tafs passed in Constructor
@@ -534,7 +534,7 @@ public class Config {
}
}
}
-
+
// Add BasicAuth, if any, to x509Taf
if (x509TAF!=null) {
for ( Priori<HttpTaf> ht : htlist) {
@@ -543,12 +543,12 @@ public class Config {
}
}
}
-
+
/////////////////////////////////////////////////////
// Additional TAFs by Plugin
/////////////////////////////////////////////////////
Priori.add(access, CADI_ADD_TAFS, htlist);
-
+
/////////////////////////////////////////////////////
// Create EpiTaf from configured TAFs
/////////////////////////////////////////////////////
@@ -571,17 +571,17 @@ public class Config {
access.log(Level.INIT, sb);
Locator<URI> locator = loadLocator(si, aafURL);
-
+
taf = new HttpEpiTaf(access,locator, tc, htarray); // ok to pass locator == null
String level = logProp(access, CADI_LOGLEVEL, null);
if (level!=null) {
access.setLogLevel(Level.valueOf(level));
}
}
-
+
return taf;
}
-
+
public static String logProp(RegistrationPropHolder rph, String tag, String def) {
String rv = rph.access().getProperty(tag, def);
if (rv == null) {
@@ -591,9 +591,9 @@ public class Config {
rph.access().log(Level.INIT,tag,"is set to",rv);
}
return rv;
-
+
}
-
+
public static String logProp(Access access,String tag, String def) {
String rv = access.getProperty(tag, def);
if (rv == null) {
@@ -603,7 +603,7 @@ public class Config {
}
return rv;
}
-
+
public static Lur configLur(SecurityInfoC<HttpURLConnection> si, Connector con, Object ... additionalTafLurs) throws CadiException {
Access access = si.access;
RegistrationPropHolder rph;
@@ -614,7 +614,7 @@ public class Config {
}
List<Priori<Lur>> lurs = new ArrayList<>();
-
+
/////////////////////////////////////////////////////
// Configure a Local Property Based RBAC/LUR
/////////////////////////////////////////////////////
@@ -625,7 +625,7 @@ public class Config {
if (groups!=null || users!=null) {
LocalLur ll = new LocalLur(access, users, groups); // note b64==null is ok.. just means no encryption.
lurs.add(new Priori<Lur>(ll,10));
-
+
String writeto = access.getProperty(WRITE_TO,null);
if (writeto!=null) {
String msg = UsersDump.updateUsers(writeto, ll);
@@ -660,14 +660,14 @@ public class Config {
msg = e.getCause().getMessage();
}
access.log(Level.INIT,"AAF/OAuth LUR is not instantiated.",msg,e);
- }
+ }
} else {
access.log(Level.INIT, "OAuth2 Lur disabled");
}
if (con!=null) { // try to reutilize connector
lurs.add(new Priori<Lur>(con.newLur(),30));
- } else {
+ } else {
/////////////////////////////////////////////////////
// Configure the AAF Lur (if any)
/////////////////////////////////////////////////////
@@ -693,7 +693,7 @@ public class Config {
} else {// There's an AAF_URL... try to configure an AAF
String aafLurClassStr = logProp(access,AAF_LUR_CLASS,AAF_V2_0_AAF_LUR_PERM);
////////////AAF Lur 2.0 /////////////
- if (aafLurClassStr!=null && aafLurClassStr.startsWith(AAF_V2_0)) {
+ if (aafLurClassStr!=null && aafLurClassStr.startsWith(AAF_V2_0)) {
try {
Object aafcon = loadAAFConnector(si, aafURL);
if (aafcon==null) {
@@ -703,7 +703,7 @@ public class Config {
if (aafAbsAAFCon!=null) {
Method mNewLur = aafAbsAAFCon.getMethod("newLur");
Object aaflur = mNewLur.invoke(aafcon);
-
+
if (aaflur==null) {
access.log(Level.INIT,"ERROR! AAF LUR Failed construction. NOT Configured");
} else {
@@ -719,7 +719,7 @@ public class Config {
} catch (Exception e) {
access.log(e,"AAF LUR class,",aafLurClassStr,"could not be constructed with given Constructors.");
}
- }
+ }
}
}
}
@@ -740,13 +740,13 @@ public class Config {
/////////////////////////////////////////////////////
// Additional LURs by Plugin
/////////////////////////////////////////////////////
- Priori.add(access, CADI_ADD_LURS, lurs);
+ Priori.add(access, CADI_ADD_LURS, lurs);
/////////////////////////////////////////////////////
- // Return a Lur based on how many there are...
+ // Return a Lur based on how many there are...
/////////////////////////////////////////////////////
switch(lurs.size()) {
- case 0:
+ case 0:
access.log(Level.INIT,"WARNING! No CADI LURs configured");
// Return a NULL Lur that does nothing.
return new NullLur();
@@ -770,7 +770,7 @@ public class Config {
return new EpiLur(la);
}
}
-
+
private static boolean hasDirect(String simpleClassName, Object[] additionalTafLurs) {
if (additionalTafLurs!=null) {
for (Object tf : additionalTafLurs) {
@@ -922,7 +922,7 @@ public class Config {
locator = (Locator<URI>)cnst.newInstance(new Object[] {si,locatorURI});
int port = fui.getPort();
String portS = port<0?"":(":"+port);
-
+
access.log(Level.INFO, "AAFLocator enabled using " + locatorURI.getScheme() +"://"+fui.getHost() + portS);
} else {
access.log(Level.INFO, "AAFLocator enabled using preloaded " + locator.getClass().getSimpleName());
@@ -943,7 +943,7 @@ public class Config {
public static String getDefaultRealm() {
return defaultRealm;
}
-
+
public static String getAAFLocateUrl(Access access) {
String rv = null;
String cont = access.getProperty(AAF_LOCATOR_CONTAINER,null);
@@ -959,7 +959,7 @@ public class Config {
private static class Priori<T> implements Comparable<Priori<T>> {
public final T t;
public final int priority;
-
+
public Priori(final T t, final int priority) {
this.t = t;
this.priority = priority;
@@ -997,7 +997,7 @@ public class Config {
access.printf(Level.ERROR, "%s format is <classname>,priority[;...]\n",CADI_ADD_TAFS);
}
}
-
+
if(clssn!=null) {
Class<?> cls = loadClass(access, clssn);
if(cls!=null) {
@@ -1009,7 +1009,7 @@ public class Config {
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
String hostname = access.getProperty(Config.HOSTNAME,null);
if(hostname==null) {
- access.printf(Level.ERROR, "%s cannot be constructed on this machine. Set valid 'hostname' in your properties\n",clssn);
+ access.printf(Level.ERROR, "%s cannot be constructed on this machine. Set valid 'hostname' in your properties\n",clssn);
} else {
access.printf(Level.ERROR, "%s cannot be constructed on %s with Access.\n",clssn, hostname);
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java
index b48dd74d..0f65b374 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Get.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,8 +28,8 @@ import org.onap.aaf.cadi.Access.Level;
public interface Get {
public String get(String name, String def, boolean print);
-
-
+
+
/**
* A class for Getting info out of "JavaBean" format
* @author Jonathan
@@ -40,24 +40,24 @@ public interface Get {
private Class<?> bc;
private Class<?>[] params;
private Object[] args;
-
+
public Bean(Object bean) {
this.bean = bean;
bc = bean.getClass();
params = new Class<?>[0]; // note, this will allow to go out of scope after config
args = new Object[0];
}
-
+
public String get(String name, String def, boolean print) {
String str = null;
String gname = "get"+Character.toUpperCase(name.charAt(0))+name.substring(1);
try {
Method meth = bc.getMethod(gname, params);
Object obj = meth.invoke(bean, args);
- str = obj==null?null:obj.toString(); // easy string convert...
+ str = obj==null?null:obj.toString(); // easy string convert...
} catch (Exception e) {
}
-
+
// Take def if nothing else
if (str==null) {
str = def;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java
index 30adcc97..65501a67 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/GetAccess.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,12 +25,12 @@ import org.onap.aaf.cadi.PropAccess;
public class GetAccess extends PropAccess {
private final Get getter;
-
+
public GetAccess(Get getter) {
super(new String[]{"cadi_prop_files="+getter.get("cadi_prop_files", null, true)});
this.getter = getter;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.cadi.PropAccess#getProperty(java.lang.String, java.lang.String)
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java
index c5e5a50e..d73e1b71 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/MultiGet.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ public class MultiGet implements Get {
String str;
for (Get getter : getters) {
str = getter.get(name, null, print);
- if (str!=null)
+ if (str!=null)
return str;
}
return def;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
index f73179a9..2825e9a5 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/RegistrationPropHolder.java
@@ -7,9 +7,9 @@
* 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.
@@ -99,11 +99,11 @@ public class RegistrationPropHolder {
}
}
default_name = container_public_name;
-
+
if(firstlog) {
access.printf(Level.INIT, REGI,"default_name",default_name);
}
-
+
latitude=null;
String slatitude = access.getProperty(Config.CADI_LATITUDE, null);
if(slatitude == null) {
@@ -138,7 +138,7 @@ public class RegistrationPropHolder {
}
}
}
-
+
default_fqdn = access.getProperty(Config.AAF_LOCATOR_FQDN, hostname);
if(firstlog) {
access.printf(Level.INIT, REGI,"default_fqdn",default_fqdn);
@@ -157,7 +157,7 @@ public class RegistrationPropHolder {
errs.append('\n');
errs.append(propname);
errs.append(" must be defined.");
-
+
}
public String getEntryFQDN(final String entry, final String dot_le) {
@@ -169,7 +169,7 @@ public class RegistrationPropHolder {
}
return replacements("RegistrationPropHolder.getEntryFQDN",str,entry,dot_le);
}
-
+
public String getEntryName(final String entry, final String dot_le) {
String str;
if(dot_le.isEmpty()) {
@@ -179,7 +179,7 @@ public class RegistrationPropHolder {
}
return replacements("RegistrationPropHolder.getEntryName",str,entry,dot_le);
}
-
+
public String getPublicEntryName(final String entry, final String dot_le) {
String str = access.getProperty(Config.AAF_LOCATOR_PUBLIC_NAME+dot_le, null);
if(str==null) {
@@ -190,8 +190,8 @@ public class RegistrationPropHolder {
}
return replacements("RegistrationPropHolder.getEntryName",str,entry,dot_le);
}
-
-
+
+
private String getNS(String dot_le) {
String ns;
ns = access.getProperty(Config.AAF_LOCATOR_APP_NS+dot_le,null);
@@ -201,7 +201,7 @@ public class RegistrationPropHolder {
return ns;
}
-
+
public String replacements(final String fromCode, final String source, final String name, final String _dot_le) {
if(source == null) {
return "";
@@ -238,13 +238,13 @@ public class RegistrationPropHolder {
value = value.replace("http://AAF_LOCATE_URL/", str);
} else {
value = value.replace("https://AAF_LOCATE_URL/", str);
-
+
}
}
}
}
- int atC = value.indexOf("%C");
+ int atC = value.indexOf("%C");
if(atC>=0) {
// aaf_locator_container_ns
str = access.getProperty(Config.AAF_LOCATOR_CONTAINER_NS+dot_le, default_container_ns);
@@ -252,14 +252,14 @@ public class RegistrationPropHolder {
value = value.replace("%CNS"+'.', str);
}
value = value.replace("%CNS", str);
-
+
str = access.getProperty(Config.AAF_LOCATOR_CONTAINER+dot_le,default_container);
if(str.isEmpty()) {
value = value.replace("%C"+'.', str);
}
value = value.replace("%C", str);
}
-
+
if(value.indexOf("%NS")>=0) {
str = getNS(dot_le);
if(str==null || str.isEmpty()) {
@@ -280,7 +280,7 @@ public class RegistrationPropHolder {
}
}
-
+
if(value.indexOf('%')>=0) {
// These shouldn't be expected to have dot elements
if(name!=null) {
@@ -293,13 +293,13 @@ public class RegistrationPropHolder {
value = value.replace("%PH", public_fqdn);
}
}
- access.printf(Level.DEBUG,
+ access.printf(Level.DEBUG,
"RegistrationReplacement from %s, source: %s, dot_le: %s, value: %s",
fromCode,source,dot_le,value);
return value;
}
-
+
public int getEntryPort(final String dot_le) {
return public_port!=null && dot_le.isEmpty()?
public_port:
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java
index 8dbc38e1..60c75719 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -64,7 +64,7 @@ public class SecurityInfo {
private static final String LOADED_FROM_SYSTEM_PROPERTIES = "%s loaded from System Properties";
public static final String SSL_KEY_MANAGER_FACTORY_ALGORITHM;
-
+
private SSLSocketFactory socketFactory;
private X509KeyManager[] x509KeyManager;
private X509TrustManager[] x509TrustManager;
@@ -83,21 +83,21 @@ public class SecurityInfo {
SSL_KEY_MANAGER_FACTORY_ALGORITHM = "SunX509";
}
}
-
+
public SecurityInfo(final Access access) throws CadiException {
String msgHelp = "";
try {
this.access = access;
// reuse DME2 Properties for convenience if specific Properties don't exist
-
+
String str = access.getProperty(Config.CADI_ALIAS, null);
if(str==null || str.isEmpty()) {
defaultAlias = null;
} else {
defaultAlias = str;
}
-
+
str = access.getProperty(Config.CADI_CLIENT_ALIAS, null);
if(str==null) {
defaultClientAlias = defaultAlias;
@@ -110,17 +110,17 @@ public class SecurityInfo {
msgHelp = String.format(INITIALIZING_ERR_FMT,"Keystore", access.getProperty(Config.CADI_KEYSTORE, ""));
initializeKeyManager();
-
+
msgHelp = String.format(INITIALIZING_ERR_FMT,"Truststore", access.getProperty(Config.CADI_TRUSTSTORE, ""));
initializeTrustManager();
-
+
msgHelp = String.format(INITIALIZING_ERR_FMT,"Trustmasks", access.getProperty(Config.CADI_TRUST_MASKS, ""));
initializeTrustMasks();
msgHelp = String.format(INITIALIZING_ERR_FMT,"HTTP Protocols", "access properties");
setHTTPProtocols(access);
-
+
msgHelp = String.format(INITIALIZING_ERR_FMT,"Context", "TLS");
context = SSLContext.getInstance("TLS");
context.init(x509KeyManager, x509TrustManager, null);
@@ -146,7 +146,7 @@ public class SecurityInfo {
// This needs to be set when people do not.
System.setProperty(HTTPS_PROTOCOLS, httpsProtocols);
}
- String httpsClientProtocols = System.getProperty(JDK_TLS_CLIENT_PROTOCOLS,null);
+ String httpsClientProtocols = System.getProperty(JDK_TLS_CLIENT_PROTOCOLS,null);
if(httpsClientProtocols!=null) {
access.printf(Level.INIT, LOADED_FROM_SYSTEM_PROPERTIES, JDK_TLS_CLIENT_PROTOCOLS);
} else {
@@ -197,7 +197,7 @@ public class SecurityInfo {
hsuc.setHostnameVerifier(maskHV);
}
}
-
+
protected void initializeKeyManager() throws CadiException, IOException, NoSuchAlgorithmException, KeyStoreException, CertificateException, UnrecoverableKeyException {
String keyStore = access.getProperty(Config.CADI_KEYSTORE, null);
if(keyStore==null) {
@@ -208,7 +208,7 @@ public class SecurityInfo {
String keyStorePasswd = access.getProperty(Config.CADI_KEYSTORE_PASSWORD, null);
keyStorePasswd = (keyStorePasswd == null) ? null : access.decrypt(keyStorePasswd, false);
- if (keyStore == null || keyStorePasswd == null) {
+ if (keyStore == null || keyStorePasswd == null) {
x509KeyManager = new X509KeyManager[0];
return;
}
@@ -240,7 +240,7 @@ public class SecurityInfo {
}
}
}
-
+
StringBuilder sb = null;
for (KeyManager keyManager : keyManagerFactory.getKeyManagers()) {
if (keyManager instanceof X509KeyManager) {
@@ -263,12 +263,12 @@ public class SecurityInfo {
}
x509KeyManager = new X509KeyManager[keyManagers.size()];
keyManagers.toArray(x509KeyManager);
-
+
if(sb!=null) {
access.log(Level.INIT, sb);
}
}
-
+
private void x509Info(StringBuilder sb, X509Certificate[] chain) {
if(chain!=null) {
int i=0;
@@ -290,7 +290,7 @@ public class SecurityInfo {
protected void initializeTrustManager() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException, CadiException {
String trustStore = access.getProperty(Config.CADI_TRUSTSTORE, null);
if(trustStore==null) {
- return;
+ return;
} else if(!new File(trustStore).exists()) {
throw new CadiException(trustStore + " does not exist");
}
@@ -307,7 +307,7 @@ public class SecurityInfo {
try {
KeyStore ts = KeyStore.getInstance("JKS");
ts.load(fis, trustStorePasswd.toCharArray());
- trustManagerFactory.init(ts);
+ trustManagerFactory.init(ts);
} finally {
fis.close();
}
@@ -328,7 +328,7 @@ public class SecurityInfo {
}
}
}
-
+
protected void initializeTrustMasks() throws AccessException {
String tips = access.getProperty(Config.CADI_TRUST_MASKS, null);
if (tips == null) {
@@ -345,7 +345,7 @@ public class SecurityInfo {
throw new AccessException("Invalid IP Mask in " + Config.CADI_TRUST_MASKS, e);
}
}
-
+
final HostnameVerifier origHV = HttpsURLConnection.getDefaultHostnameVerifier();
maskHV = new HostnameVerifier() {
@Override
@@ -366,5 +366,5 @@ public class SecurityInfo {
};
HttpsURLConnection.setDefaultHostnameVerifier(maskHV);
}
-
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java
index 4e365fba..7c5f50ed 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,13 +34,13 @@ public class SecurityInfoC<CLIENT> extends SecurityInfo {
public static final String DEF_ID = "ID not Set";
private static Map<Class<?>,SecurityInfoC<?>> sicMap = new HashMap<>();
public SecuritySetter<CLIENT> defSS;
-
+
public SecurityInfoC(Access access) throws CadiException {
super(access);
defSS = new DEFSS<CLIENT>();
}
-
+
@SuppressWarnings("unchecked")
public static synchronized <CLIENT> SecurityInfoC<CLIENT> instance(Access access, Class<CLIENT> cls) throws CadiException {
SecurityInfoInit<CLIENT> sii;
@@ -58,9 +58,9 @@ public class SecurityInfoC<CLIENT> extends SecurityInfo {
public SecuritySetter<CLIENT> bestDefault(SecurityInfoC<CLIENT> si) throws CadiException {
return new DEFSS<CLIENT>();
}
- };
+ };
}
-
+
SecurityInfoC<CLIENT> sic = (SecurityInfoC<CLIENT>) sicMap.get(cls);
if (sic==null) {
sic = new SecurityInfoC<CLIENT>(access);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java
index 614f363b..e5b7a0ea 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoInit.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java
index 98ab4706..4f7db1ab 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,7 +56,7 @@ public class UsersDump {
// We loop through Users, but want to write Groups first... therefore, save off print
StringBuilder sb = new StringBuilder();
-
+
// Obtain all unique role names
HashSet<String> groups = new HashSet<>();
for (AbsUserCache<?>.DumpInfo di : lur.dumpInfo()) {
@@ -80,7 +80,7 @@ public class UsersDump {
ps.print(group);
ps.println("\"/>");
}
-
+
ps.println(sb);
ps.println("</tomcat-users>");
@@ -91,13 +91,13 @@ public class UsersDump {
}
return true;
}
-
+
/**
- *
+ *
* Note: This method returns a String if there's an error, or null if ok.
- * This unusual style is necessitated by the fact that any Exceptions thrown are likely to
+ * This unusual style is necessitated by the fact that any Exceptions thrown are likely to
* be unlogged and hidden from view, making debugging almost impossible.
- *
+ *
* @param writeto
* @param up
* @return
@@ -129,7 +129,7 @@ public class UsersDump {
int startA=0, startB=0;
for (int i=0;startA<orig.length && i<3;++startA) if (orig[startA]=='<')++i;
for (int i=0;startB<orig.length && i<3;++startB) if (postulate[startB]=='<')++i;
-
+
writeIt=orig.length-startA!=postulate.length-startB; // first, check if remaining length is the same
while (!writeIt && startA<orig.length && startB<postulate.length) {
if (orig[startA++]!=postulate[startB++])writeIt = true;
@@ -141,7 +141,7 @@ public class UsersDump {
} else {
writeIt = true;
}
-
+
if (writeIt) {
try {
FileOutputStream fos = new FileOutputStream(file);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java
index 5aa502d4..fefb0970 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZ.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java
index 0bd87d98..8073249c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AUTHZServlet.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
- *
+ *
* @author Jonathan
*
*/
@@ -53,14 +53,14 @@ public class AUTHZServlet<S extends Servlet> implements Servlet {
roles = rolesAllowed.value();
}
}
-
+
public void init(ServletConfig sc) throws ServletException {
if (delegate == null) {
throw new ServletException("Invalid Servlet Delegate");
}
delegate.init(sc);
}
-
+
public ServletConfig getServletConfig() {
return delegate.getServletConfig();
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java
index ae4347d3..96eebf5e 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/AccessGetter.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java
index 292f8e1c..d97fe28b 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiApiEnforcementFilter.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,15 +41,15 @@ import org.onap.aaf.cadi.util.Split;
/**
* This filter allows one to protect the APIs from data stored in AAF
- *
+ *
* @author Instrumental(Jonathan)
*/
public class CadiApiEnforcementFilter implements Filter {
private String type;
private Map<String,List<String>> publicPaths;
private Access access;
-
-
+
+
public CadiApiEnforcementFilter(Access access, String enforce) throws ServletException {
this.access = access;
init(enforce);
@@ -60,12 +60,12 @@ public class CadiApiEnforcementFilter implements Filter {
public void init(FilterConfig fc) throws ServletException {
init(fc.getInitParameter(Config.CADI_API_ENFORCEMENT));
// need the Context for Logging, instantiating ClassLoader, etc
- ServletContextAccess sca=new ServletContextAccess(fc);
+ ServletContextAccess sca=new ServletContextAccess(fc);
if (access==null) {
access = sca;
}
}
-
+
private void init(final String ptypes) throws ServletException {
if(ptypes==null) {
throw new ServletException("CadiApiEnforcement requires " + Config.CADI_API_ENFORCEMENT + " property");
@@ -99,10 +99,10 @@ public class CadiApiEnforcementFilter implements Filter {
HttpServletRequest hreq = (HttpServletRequest)req;
final String meth = hreq.getMethod();
String path = hreq.getContextPath()+hreq.getPathInfo();
-
+
if(path == null || path.isEmpty() || "null".equals(path))
path = hreq.getRequestURI().substring(hreq.getContextPath().length());
-
+
List<String> list = publicPaths.get(meth);
if(list!=null) {
for( String p : publicPaths.get(meth)) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
index 50efe8b4..a2f168a1 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,16 +52,16 @@ import org.onap.aaf.cadi.util.Timing;
/**
* CadiFilter
- *
+ *
* This class implements Servlet Filter, and ties together CADI implementations
- *
+ *
* This class can be used in a standard J2EE Servlet manner. Optimal usage is for POJO operations, where
- * one can enforce this Filter being first and primary. Depending on the Container, it
- * may be more effective, in some cases, to utilize features that allow earlier determination of
+ * one can enforce this Filter being first and primary. Depending on the Container, it
+ * may be more effective, in some cases, to utilize features that allow earlier determination of
* AUTHN (Authorization). An example would be "Tomcat Valve". These implementations, however, should
* be modeled after the "init" and "doFilter" functions, and be kept up to date as this class changes.
- *
- *
+ *
+ *
* @author Jonathan
*
*/
@@ -73,18 +73,18 @@ public class CadiFilter implements Filter {
private Object[] additionalTafLurs;
private SideChain sideChain;
private static int count=0;
-
+
public Lur getLur() {
return httpChecker.getLur();
}
-
+
/**
* Construct a viable Filter
- *
- * Due to the vagaries of many containers, there is a tendency to create Objects and call "Init" on
+ *
+ * Due to the vagaries of many containers, there is a tendency to create Objects and call "Init" on
* them at a later time. Therefore, this object creates with an object that denies all access
* until appropriate Init happens, just in case the container lets something slip by in the meantime.
- *
+ *
*/
public CadiFilter() {
additionalTafLurs = CadiHTTPManip.noAdditional;
@@ -92,10 +92,10 @@ public class CadiFilter implements Filter {
/**
* This constructor to be used when directly constructing and placing in HTTP Engine
- *
+ *
* @param access
* @param moreTafLurs
- * @throws ServletException
+ * @throws ServletException
*/
public CadiFilter(Access access, Object ... moreTafLurs) throws ServletException {
additionalTafLurs = moreTafLurs;
@@ -120,7 +120,7 @@ public class CadiFilter implements Filter {
/**
* Init
- *
+ *
* Standard Filter "init" call with FilterConfig to obtain properties. POJOs can construct a
* FilterConfig with the mechanism of their choice, and standard J2EE Servlet engines utilize this
* mechanism already.
@@ -128,15 +128,15 @@ public class CadiFilter implements Filter {
//TODO Always validate changes against Tomcat AbsCadiValve and Jaspi CadiSAM Init functions
public void init(FilterConfig filterConfig) throws ServletException {
// need the Context for Logging, instantiating ClassLoader, etc
- ServletContextAccess sca=new ServletContextAccess(filterConfig);
+ ServletContextAccess sca=new ServletContextAccess(filterConfig);
if (access==null) {
access = sca;
}
-
+
// Set Protected getter with base Access, for internal class instantiations
init(new FCGet(access, sca.context(), filterConfig));
}
-
+
@SuppressWarnings("unchecked")
protected void init(Get getter) throws ServletException {
@@ -154,7 +154,7 @@ public class CadiFilter implements Filter {
} catch (Exception e) {
access.log(Level.INIT, "AAFTrustChecker cannot be loaded",e.getMessage());
}
-
+
try {
Class<Filter> cf=null;
try {
@@ -167,7 +167,7 @@ public class CadiFilter implements Filter {
access.log(Level.INIT, "AAFTrustChecker cannot be loaded",e.getMessage());
}
-
+
// Synchronize, because some instantiations call init several times on the same object
// In this case, the epiTaf will be changed to a non-NullTaf, and thus not instantiate twice.
synchronized(CadiHTTPManip.noAdditional /*will always remain same Object*/) {
@@ -194,8 +194,8 @@ public class CadiFilter implements Filter {
pathExceptions = str.split("\\s*:\\s*");
}
}
-
- /*
+
+ /*
* SETUP Permission Converters... those that can take Strings from a Vendor Product, and convert to appropriate AAF Permissions
*/
if (mapPairs==null) {
@@ -227,7 +227,7 @@ public class CadiFilter implements Filter {
}
// Add API Enforcement Point
- String enforce = getter.get(Config.CADI_API_ENFORCEMENT, null, true);
+ String enforce = getter.get(Config.CADI_API_ENFORCEMENT, null, true);
if(enforce!=null && enforce.length()>0) {
sideChain.add(new CadiApiEnforcementFilter(access,enforce));
}
@@ -236,7 +236,7 @@ public class CadiFilter implements Filter {
}
/**
- * Containers call "destroy" when time to cleanup
+ * Containers call "destroy" when time to cleanup
*/
public void destroy() {
// Synchronize, in case multiCadiFilters are used.
@@ -252,7 +252,7 @@ public class CadiFilter implements Filter {
/**
* doFilter
- *
+ *
* This is the standard J2EE invocation. Analyze the request, modify response as necessary, and
* only call the next item in the filterChain if request is suitably Authenticated.
*/
@@ -295,7 +295,7 @@ public class CadiFilter implements Filter {
}
- /**
+ /**
* If PathExceptions exist, report if these should not have Authn applied.
* @param hreq
* @return
@@ -317,7 +317,7 @@ public class CadiFilter implements Filter {
}
return false;
}
-
+
/**
* Get Converter by Path
*/
@@ -332,7 +332,7 @@ public class CadiFilter implements Filter {
}
return NullPermConverter.singleton();
}
-
+
/**
* store PermConverters by Path prefix
* @author Jonathan
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java
index 0a89af0c..7c63a822 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiHTTPManip.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,10 +47,10 @@ import org.onap.aaf.cadi.util.UserChainManip;
/**
* Encapsulate common HTTP Manipulation Behavior. It will appropriately set
* HTTPServletResponse for Redirect or Forbidden, as needed.
- *
+ *
* Further, this is useful, because it avoids multiple creates of Connections, where some Filters
* are created and destroyed regularly.
- *
+ *
* @author Jonathan
*
*/
@@ -73,7 +73,7 @@ public class CadiHTTPManip {
private CredVal up;
private Lur lur;
private String thisPerm,companyPerm,aaf_id;
-
+
public static final Object[] noAdditional = new Object[0]; // CadiFilter can be created each call in some systems
@@ -82,7 +82,7 @@ public class CadiHTTPManip {
this.access = access;
// Get getter = new AccessGetter(access);
Config.setDefaultRealm(access);
-
+
aaf_id = access.getProperty(Config.CADI_ALIAS,access.getProperty(Config.AAF_APPID, null));
if (aaf_id==null) {
access.printf(Level.INIT, "%s is not set. %s can be used instead",Config.AAF_APPID,Config.CADI_ALIAS);
@@ -107,9 +107,9 @@ public class CadiHTTPManip {
}
SecurityInfoC<HttpURLConnection> si;
si = SecurityInfoC.instance(access, HttpURLConnection.class);
-
+
lur = Config.configLur(si, con, additionalTafLurs);
-
+
tc.setLur(lur);
if (lur instanceof EpiLur) {
up = ((EpiLur)lur).getUserPassImpl();
@@ -126,33 +126,33 @@ public class CadiHTTPManip {
TafResp tresp = taf.validate(Taf.LifeForm.LFN, hreq, hresp);
switch(tresp.isAuthenticated()) {
case IS_AUTHENTICATED:
- access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),AUTHENTICATED,tresp.desc());
break;
case TRY_AUTHENTICATING:
switch (tresp.authenticate()) {
case IS_AUTHENTICATED:
- access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),AUTHENTICATED,tresp.desc());
break;
case HTTP_REDIRECT_INVOKED:
- access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.DEBUG,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),AUTHENTICATING_VIA_REDIRECTION,tresp.desc());
break;
case NO_FURTHER_PROCESSING:
- access.printf(Level.AUDIT,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.AUDIT,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),AUTHENTICATION_FAILURE,tresp.desc());
hresp.sendError(403, tresp.desc()); // Forbidden
break;
default:
- access.printf(Level.AUDIT,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.AUDIT,MSG_FMT,tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),NO_TAF_WILL_AUTHORIZE,tresp.desc());
hresp.sendError(403, tresp.desc()); // Forbidden
}
break;
case NO_FURTHER_PROCESSING:
- access.printf(Level.AUDIT,MSG_FMT, tresp.getTarget(),hreq.getRemoteAddr(),
+ access.printf(Level.AUDIT,MSG_FMT, tresp.getTarget(),hreq.getRemoteAddr(),
hreq.getRemotePort(),NO_TAF_WILL_AUTHORIZE,tresp.desc());
hresp.sendError(403, ACCESS_DENIED); // FORBIDDEN
break;
@@ -161,12 +161,12 @@ public class CadiHTTPManip {
hreq.getRemotePort(),NO_TAF_WILL_AUTHORIZE,tresp.desc());
hresp.sendError(403, ACCESS_DENIED); // FORBIDDEN
}
-
+
return tresp;
}
-
+
public boolean notCadi(CadiWrap req, HttpServletResponse resp) {
-
+
String pathInfo = req.getPathInfo();
if (METH.equalsIgnoreCase(req.getMethod()) && pathInfo!=null && pathInfo.contains(CADI)) {
if (req.getUser().equals(aaf_id) || req.isUserInRole(thisPerm) || req.isUserInRole(companyPerm)) {
@@ -201,11 +201,11 @@ public class CadiHTTPManip {
}
return true;
}
-
+
public Lur getLur() {
return lur;
}
-
+
public void destroy() {
access.log(Level.INFO,"CadiHttpChecker destroyed.");
if (lur!=null) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
index 1805c782..e9cb59ce 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/FCGet.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,7 +34,7 @@ import org.onap.aaf.cadi.config.Get;
*/
public class FCGet implements Get {
/**
- *
+ *
*/
private final Access access;
private FilterConfig filterConfig;
@@ -52,12 +52,12 @@ public class FCGet implements Get {
if (context!=null) {
str = context.getInitParameter(name);
}
-
+
// Try Filter Context next
if (str==null && filterConfig != null) {
str = filterConfig.getInitParameter(name);
}
-
+
if (str==null) {
str = access.getProperty(name, def);
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java
index 8c616f4a..7ad1921c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapBathConverter.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,21 +39,21 @@ import org.onap.aaf.cadi.util.CSV;
import org.onap.aaf.cadi.util.CSV.Visitor;
/**
- * This Filter is designed to help MIGRATE users from systems that don't match the FQI style.
- *
+ * This Filter is designed to help MIGRATE users from systems that don't match the FQI style.
+ *
* Style 1, where just the ID is translated, i.e. OLD => new@something.onap.org, that is acceptable
* longer term, because it does not store Creds locally. The passwords are in appropriate systems, but
* it's still painful operationally, though it does ease migration.
*
* Style 3, however, which is Direct match of Authorization Header to replacement, is only there
* because some passwords are simply not acceptable for AAF, (too easy, for instance), and it is
- * not feasible to break Organization Password rules for a Migration. Therefore, this method
+ * not feasible to break Organization Password rules for a Migration. Therefore, this method
* should not considered something that is in any way a permanent
- *
+ *
- *
+ *
* It goes without saying that any file with the password conversion should be protected by "400", etc.
- *
+ *
* @author Instrumental (Jonathan)
*
*/
@@ -63,15 +63,15 @@ public class MapBathConverter {
/**
* Create with colon separated name value pairs
- * Enter the entire "Basic dXNlcjpwYXNz" "Authorization" header, where "dXNlcjpwYXNz" is
+ * Enter the entire "Basic dXNlcjpwYXNz" "Authorization" header, where "dXNlcjpwYXNz" is
* base64 encoded, which can be created with "cadi" tool (in jar)
- *
- * The replacement should also be an exact replacement of what you want. Recognize that
- * this should be TEMPORARY as you are storing credentials outside the users control.
- *
+ *
+ * The replacement should also be an exact replacement of what you want. Recognize that
+ * this should be TEMPORARY as you are storing credentials outside the users control.
+ *
* @param value
- * @throws IOException
- * @throws CadiException
+ * @throws IOException
+ * @throws CadiException
*/
public MapBathConverter(final Access access, final CSV csv) throws IOException, CadiException {
map = new TreeMap<>();
@@ -110,7 +110,7 @@ public class MapBathConverter {
}
});
}
-
+
private static String idFromBasic(String bath, Holder<String> hpass) throws IOException, CadiException {
if(bath.startsWith(BASIC)) {
String cred = Symm.base64noSplit.decode(bath.substring(6));
@@ -128,8 +128,8 @@ public class MapBathConverter {
}
/**
- * use to instantiate entries
- *
+ * use to instantiate entries
+ *
* @return
*/
public Map<String,String> map() {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java
index 7953e076..24c7d290 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/MapPermConverter.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,7 +30,7 @@ public class MapPermConverter implements PermConverter {
/**
* Create with colon separated name value pairs
* i.e. teAdmin=com.att.myNS.myPerm|*|*:teUser=...
- *
+ *
* @param value
*/
public MapPermConverter() {
@@ -38,8 +38,8 @@ public class MapPermConverter implements PermConverter {
}
/**
- * use to instantiate entries
- *
+ * use to instantiate entries
+ *
* @return
*/
public Map<String,String> map() {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java
index dfd0f64b..e074a7fe 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/PermConverter.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,7 +23,7 @@ package org.onap.aaf.cadi.filter;
/**
* Convert a simplistic, single string Permission into an Enterprise Scoped Perm
- *
+ *
* @author Jonathan
*
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java
index ac61a5c6..c27519fb 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/RolesAllowed.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,16 +20,16 @@
*/
/**
- * RolesAllowed
- *
+ * RolesAllowed
+ *
* @author Jonathan
- *
+ *
* Similar to Java EE's Spec from Annotations 1.1, 2.8
- *
+ *
* That Spec, however, was geared towards being able to route calls to Methods on Objects, and thus needed a more refined
* sense of permissions hierarchy. The same mechanism, however, can easily be achieved on single Servlet/Handlers in
* POJOs like Jetty by simply adding the Roles Allowed in a similar Annotation
- *
+ *
*/
package org.onap.aaf.cadi.filter;
import static java.lang.annotation.ElementType.TYPE;
@@ -39,9 +39,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
- * JASPI Style Annotation of RolesAllowed when the coding style is desired but actually including all
+ * JASPI Style Annotation of RolesAllowed when the coding style is desired but actually including all
* JEE jars is not. If using actual JASPI, use official @interface classes, not this one...
- *
+ *
* @author Jonathan
*/
@Target({TYPE})
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java
index 5386eb2d..33bc29de 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/ServletImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,16 +20,16 @@
*/
/**
- * RolesAllowed
- *
+ * RolesAllowed
+ *
* @author Jonathan
- *
+ *
* Similar to Java EE's Spec from Annotations 1.1, 2.8
- *
+ *
* That Spec, however, was geared towards being able to route calls to Methods on Objects, and thus needed a more refined
* sense of permissions hierarchy. The same mechanism, however, can easily be achieved on single Servlet/Handlers in
* POJOs like Jetty by simply adding the Roles Allowed in a similar Annotation
- *
+ *
*/
package org.onap.aaf.cadi.filter;
import static java.lang.annotation.ElementType.TYPE;
@@ -41,7 +41,7 @@ import java.lang.annotation.Target;
import javax.servlet.Servlet;
/**
- *
+ *
* @author Jonathan
*/
@Target({TYPE})
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java
index 18e76b96..0f69b5b0 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/SideChain.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,21 +33,21 @@ import javax.xml.ws.Holder;
/**
* Add various Filters by CADI Property not in the official Chain
- *
+ *
* @author Instrumental(Jonathan)
*
*/
public class SideChain {
private List<Filter> sideChain;
-
+
public SideChain() {
sideChain = new ArrayList<Filter>();
}
-
+
public void add(Filter f) {
sideChain.add(f);
}
-
+
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)throws IOException, ServletException {
final Holder<Boolean> hbool = new Holder<Boolean>(Boolean.TRUE);
FilterChain truth = new FilterChain() {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java
index a41c5eb7..56ba80a7 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/ConfigPrincipal.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,7 +47,7 @@ public class ConfigPrincipal implements Principal, GetCred {
public String getName() {
return name;
}
-
+
public byte[] getCred() {
return cred;
}
@@ -55,14 +55,14 @@ public class ConfigPrincipal implements Principal, GetCred {
public String toString() {
return name;
}
-
+
public String getAsBasicAuthHeader() throws IOException {
if (content ==null) {
String s = name + ':' + new String(cred);
- content = "Basic " + Symm.base64.encode(s);
+ content = "Basic " + Symm.base64.encode(s);
} else if (!content.startsWith("Basic ")) { // content is the saved password from construction
String s = name + ':' + content;
- content = "Basic " + Symm.base64.encode(s);
+ content = "Basic " + Symm.base64.encode(s);
}
return content;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java
index 5443dec2..3504290b 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/EpiLur.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,25 +32,25 @@ import org.onap.aaf.cadi.Permission;
/**
* EpiLUR
- *
+ *
* Short for "Epic LUR". Be able to run through a series of LURs to obtain the validation needed.
- *
- * The pun is better for the other pattern... "TAF" (aka EpiTaf), but it's still the larger picture of
+ *
+ * The pun is better for the other pattern... "TAF" (aka EpiTaf), but it's still the larger picture of
* LURs that will be accomplished.
- *
+ *
* FYI, the reason we separate LURs, rather than combine, is that Various User Repository Resources have
* different Caching requirements. For instance, the Local User Repo (with stand alone names), never expire, but might be
- * refreshed with a change in Configuration File, while the Remote Service based LURs will need to expire at prescribed intervals
- *
+ * refreshed with a change in Configuration File, while the Remote Service based LURs will need to expire at prescribed intervals
+ *
* @author Jonathan
*
*/
public final class EpiLur implements Lur {
private final Lur[] lurs;
-
+
/**
* EpiLur constructor
- *
+ *
* Construct the EpiLur from variable TAF parameters
* @param lurs
* @throws CadiException
@@ -86,7 +86,7 @@ public final class EpiLur implements Lur {
}
/**
- * Return the first Lur (if any) which also implements UserPass
+ * Return the first Lur (if any) which also implements UserPass
* @return
*/
public CredVal getUserPassImpl() {
@@ -102,7 +102,7 @@ public final class EpiLur implements Lur {
public boolean handlesExclusively(Permission ... pond) {
return false;
}
-
+
/**
* Get Lur for index. Returns null if out of range
* @param idx
@@ -131,7 +131,7 @@ public final class EpiLur implements Lur {
}
}
}
-
+
public Lur subLur(Class<? extends Lur> cls ) {
for (Lur l : lurs) {
if (l.getClass().isAssignableFrom(cls)) {
@@ -155,7 +155,7 @@ public final class EpiLur implements Lur {
lur.clear(p, report);
}
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder();
for (Lur lur : lurs) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java
index f8fa02e5..d6db6f4d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalLur.java
@@ -148,7 +148,7 @@ public final class LocalLur extends AbsUserCache<LocalPermission> implements Lur
public Permission createPerm(String p) {
return new LocalPermission(p);
}
-
+
private void parseUserProperties(String userProperties) throws IOException {
// For each User name...
for (String userProperty : userProperties.trim().split(SEMI)) {
@@ -179,7 +179,7 @@ public final class LocalLur extends AbsUserCache<LocalPermission> implements Lur
}
}
-
+
private void parseGroupProperties(String groupProperties) throws IOException {
// For each Group name...
for (String group : groupProperties.trim().split(SEMI)) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java
index ee7bab9c..64cb7550 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/LocalPermission.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,11 +25,11 @@ import org.onap.aaf.cadi.Permission;
public class LocalPermission implements Permission {
private String key;
-
+
public LocalPermission(String role) {
this.key = role;
}
-
+
public String getKey() {
return key;
}
@@ -45,6 +45,6 @@ public class LocalPermission implements Permission {
public String permType() {
return "LOCAL";
}
-
-
+
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java
index fe9bbd30..c8ff2747 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/lur/NullLur.java
@@ -7,9 +7,9 @@
* 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.
@@ -80,7 +80,7 @@ public class NullLur implements Lur {
report.append(NullLur.class.getSimpleName());
report.append('\n');
}
-
+
public String toString() {
return NullLur.class.getSimpleName() + '\n';
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java
index 746e67d8..8846f5f6 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BasicPrincipal.java
@@ -7,9 +7,9 @@
* 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.
@@ -66,7 +66,7 @@ public class BasicPrincipal extends BearerPrincipal implements GetCred {
name = name + '@' + defaultDomain;
}
}
-
+
public BasicPrincipal(BasicCred bc, String domain) {
name = bc.getUser();
cred = bc.getCred();
@@ -76,7 +76,7 @@ public class BasicPrincipal extends BearerPrincipal implements GetCred {
private class BasicOS extends OutputStream {
private boolean first = true;
private ByteArrayOutputStream baos;
-
+
public BasicOS(int size) {
baos = new ByteArrayOutputStream(size);
}
@@ -86,33 +86,33 @@ public class BasicPrincipal extends BearerPrincipal implements GetCred {
if (b==':' && first) {
first = false;
name = new String(baos.toByteArray());
- baos.reset(); //
+ baos.reset(); //
} else {
baos.write(b);
}
}
-
+
private byte[] toCred() {
return baos.toByteArray();
}
}
-
+
public String getName() {
return name;
}
-
+
public String getShortName() {
return shortName;
}
-
+
public String getDomain() {
return domain;
}
-
+
public byte[] getCred() {
return cred;
}
-
+
public long created() {
return created;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java
index 6fdcdc0d..4930796c 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/BearerPrincipal.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java
index 4a6e4cda..1a733e04 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/CachedBasicPrincipal.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,7 +29,7 @@ import org.onap.aaf.cadi.taf.HttpTaf;
/**
* Cached Principals need to be able to revalidate in the Background
- *
+ *
* @author Jonathan
*
*/
@@ -44,7 +44,7 @@ public class CachedBasicPrincipal extends BasicPrincipal implements CachedPrinci
this.timeToLive = timeToLive;
expires = System.currentTimeMillis()+timeToLive;
}
-
+
public CachedBasicPrincipal(HttpTaf creator, String content, String domain, long timeToLive) throws IOException {
super(content, domain);
this.creator = creator;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java
index 20f22846..368908a8 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/Kind.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,8 +29,8 @@ public class Kind {
public static final char AAF_OAUTH='A';
public static final char BASIC_AUTH = 'B';
public static final char UNKNOWN = 'U';
-
-
+
+
public static char getKind(final Principal principal) {
Principal check;
if (principal instanceof TrustPrincipal) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java
index 01326054..5a7a7761 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/OAuth2FormPrincipal.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,20 +24,20 @@ package org.onap.aaf.cadi.principal;
public class OAuth2FormPrincipal extends TaggedPrincipal {
private final String username;
private final String client_id;
-
+
/*
* Note: client_id and username might be the same, if only authenticating the Client_ID
*/
public OAuth2FormPrincipal(final String client_id, final String username) {
this.username = username;
- this.client_id = client_id;
+ this.client_id = client_id;
}
-
+
@Override
public String getName() {
return username;
}
-
+
public String client_id() {
return client_id;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java
index 7bb4ff52..8aaad117 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TaggedPrincipal.java
@@ -39,9 +39,9 @@ public abstract class TaggedPrincipal implements Principal {
public interface TagLookup {
public String lookup() throws CadiException;
}
-
+
private TagLookup tagLookup;
-
+
public void setTagLookup(TagLookup tl) {
tagLookup = tl;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java
index 7e92aaca..352b4e1d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/TrustPrincipal.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,7 +29,7 @@ public class TrustPrincipal extends BearerPrincipal implements UserChain {
private final String name;
private final Principal original;
private String userChain;
-
+
public TrustPrincipal(final Principal actual, final String asName) {
this.original = actual;
name = asName.trim();
@@ -42,17 +42,17 @@ public class TrustPrincipal extends BearerPrincipal implements UserChain {
userChain = actual.getClass().getSimpleName();
}
}
-
+
@Override
public String getName() {
return name;
}
-
+
@Override
public String userChain() {
return userChain;
}
-
+
public Principal original() {
return original;
}
@@ -66,5 +66,5 @@ public class TrustPrincipal extends BearerPrincipal implements UserChain {
public String personalName() {
return original.getName() + '[' + userChain + ']';
}
-
+
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java
index f0cacd8d..872f4aa4 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/UnAuthPrincipal.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,7 +25,7 @@ import java.security.Principal;
public class UnAuthPrincipal implements Principal {
private String name;
-
+
public UnAuthPrincipal(final String name) {
this.name = name;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java
index 0348cd1f..f5303584 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/principal/X509Principal.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,7 +34,7 @@ public class X509Principal extends BearerPrincipal implements GetCred {
private final X509Certificate cert;
private final String name;
private byte[] content;
- private BasicHttpTaf bht;
+ private BasicHttpTaf bht;
public X509Principal(String identity, X509Certificate cert) {
name = identity;
@@ -71,7 +71,7 @@ public class X509Principal extends BearerPrincipal implements GetCred {
name = _name;
this.bht = bht;
}
-
+
public String getAsHeader() throws IOException {
try {
if (content==null) {
@@ -82,7 +82,7 @@ public class X509Principal extends BearerPrincipal implements GetCred {
}
return "X509 " + content;
}
-
+
public String toString() {
return "X509 Authentication for " + name;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java
index f420f41f..c8f2a629 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/AbsTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,9 +27,9 @@ import org.onap.aaf.cadi.util.Timing;
/**
* AbsTafResp
- *
+ *
* Base class for TafResp (TAF Response Objects)
- *
+ *
* @author Jonathan
*
*/
@@ -45,14 +45,14 @@ public abstract class AbsTafResp implements TafResp {
/**
* AbsTafResp
- *
+ *
* Set and hold
* Description (for logging)
* Principal (as created by derived class)
* Access (for access to underlying container, i.e. for Logging, auditing, ClassLoaders, etc)
- *
+ *
* @param access
- * @param tafname
+ * @param tafname
* @param principal
* @param description
*/
@@ -63,17 +63,17 @@ public abstract class AbsTafResp implements TafResp {
this.target = principal==null?"unknown":principal.getName();
this.desc = description;
}
-
+
/**
* AbsTafResp
- *
+ *
* Set and hold
* Description (for logging)
* Principal (as created by derived class)
* Access (for access to underlying container, i.e. for Logging, auditing, ClassLoaders, etc)
- *
+ *
* @param access
- * @param tafname
+ * @param tafname
* @param principal
* @param description
*/
@@ -87,7 +87,7 @@ public abstract class AbsTafResp implements TafResp {
/**
* isValid()
- *
+ *
* Respond in the affirmative if the TAF was able to Authenticate
*/
public boolean isValid() {
@@ -96,8 +96,8 @@ public abstract class AbsTafResp implements TafResp {
/**
* desc()
- *
- * Respond with description of response as given by the TAF
+ *
+ * Respond with description of response as given by the TAF
*/
public String desc() {
return desc;
@@ -105,11 +105,11 @@ public abstract class AbsTafResp implements TafResp {
/**
* isAuthenticated()
- *
+ *
* Respond with the TAF's code of whether Authenticated, or suggested next steps
* default is either IS_AUTHENTICATED, or TRY_ANOTHER_TAF. The TAF can overload
* and suggest others, such as "NO_FURTHER_PROCESSING", if it can detect that this
- * is some sort of security breach (i.e. Denial of Service)
+ * is some sort of security breach (i.e. Denial of Service)
*/
public RESP isAuthenticated() {
return principal==null?RESP.TRY_ANOTHER_TAF:RESP.IS_AUTHENTICATED;
@@ -117,9 +117,9 @@ public abstract class AbsTafResp implements TafResp {
/**
* getPrincipal()
- *
- * Return the principal created by the TAF based on Authentication.
- *
+ *
+ * Return the principal created by the TAF based on Authentication.
+ *
* Returns "null" if Authentication failed (no principal)
*/
public TaggedPrincipal getPrincipal() {
@@ -133,10 +133,10 @@ public abstract class AbsTafResp implements TafResp {
public String getTarget() {
return target;
}
-
+
/**
* getAccess()
- *
+ *
* Get the Access object from the TAF, so that appropriate Logging, etc can be coordinated.
*/
public Access getAccess() {
@@ -154,7 +154,7 @@ public abstract class AbsTafResp implements TafResp {
public float timing() {
return timing;
}
-
+
@Override
public void timing(final long start) {
timing = Timing.millis(start);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java
index d2cbf3fa..683b10ba 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/EpiTaf.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,21 +26,21 @@ import org.onap.aaf.cadi.Taf;
/**
* EpiTAF
- *
+ *
* Short for "Epic TAF". Be able to run through a series of TAFs to obtain the validation needed.
- *
+ *
* OK, the name could probably be better as "Tafs", like it was originally, but the pun was too
* irresistible for this author to pass up.
- *
+ *
* @author Jonathan
*
*/
public class EpiTaf implements Taf {
private Taf[] tafs;
-
+
/**
* EpiTaf constructor
- *
+ *
* Construct the EpiTaf from variable TAF parameters
* @param tafs
* @throws CadiException
@@ -52,13 +52,13 @@ public class EpiTaf implements Taf {
/**
* validate
- *
- * Respond with the first TAF to authenticate user based on variable info and "LifeForm" (is it
+ *
+ * Respond with the first TAF to authenticate user based on variable info and "LifeForm" (is it
* a human behind an interface, or a server behind a protocol).
- *
+ *
* If there is no TAF that can authenticate, respond with the first TAF that suggests it can
* establish an Authentication conversation (TRY_AUTHENTICATING).
- *
+ *
* If no TAF declares either, respond with NullTafResp (which denies all questions)
*/
public TafResp validate(LifeForm reading, String... info) {
@@ -76,7 +76,7 @@ public class EpiTaf implements Taf {
}
}
- // No TAFs configured, at this point. It is safer at this point to be "not validated",
+ // No TAFs configured, at this point. It is safer at this point to be "not validated",
// rather than "let it go"
return firstTryAuth == null?NullTafResp.singleton():firstTryAuth;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java
index 6334164e..f8eb089e 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java
@@ -181,7 +181,7 @@ public class HttpEpiTaf implements HttpTaf {
}
return Resp.NOT_MINE;
}
-
+
private void addToLog(List<TafResp> log, final TafResp tresp, final long start) {
if (log == null) {
return;
@@ -189,7 +189,7 @@ public class HttpEpiTaf implements HttpTaf {
tresp.timing(start);
log.add(tresp);
}
-
+
private void printLog(List<TafResp> log) {
if (log == null) {
return;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java
index 77976ce2..76938036 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpTaf.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,31 +28,31 @@ import org.onap.aaf.cadi.CachedPrincipal;
import org.onap.aaf.cadi.Taf.LifeForm;
/**
- * A TAF which is in a specific HTTP environment in which the engine implements
+ * A TAF which is in a specific HTTP environment in which the engine implements
* javax Servlet.
- *
+ *
* Using the Http Request and Response interfaces takes the effort out of implementing in almost any kind of
* HTTP Container or Engine.
- *
+ *
* @author Jonathan
*
*/
public interface HttpTaf {
/**
* validate
- *
+ *
* Validate the Request, and respond with created TafResp object.
- *
+ *
* @param reading
* @param req
* @param resp
* @return
*/
public TafResp validate(LifeForm reading, HttpServletRequest req, HttpServletResponse resp);
-
+
/**
* Re-Validate Credential
- *
+ *
* @param prin
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java
index d64fbe0d..541fa395 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/LoginPageTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,15 +47,15 @@ public class LoginPageTafResp extends AbsTafResp {
httpResp.sendRedirect(loginPageURL);
return RESP.HTTP_REDIRECT_INVOKED;
}
-
+
@Override
public RESP isAuthenticated() {
return RESP.TRY_AUTHENTICATING;
}
-
+
public static TafResp create(Access access, Locator<URI> locator, final HttpServletResponse resp, List<Redirectable> redirectables) {
if (locator == null) {
- if (!redirectables.isEmpty()) {
+ if (!redirectables.isEmpty()) {
access.log(Level.DEBUG,"LoginPage Locator is not configured. Taking first Redirectable Taf");
return redirectables.get(0);
}
@@ -91,7 +91,7 @@ public class LoginPageTafResp extends AbsTafResp {
return NullTafResp.singleton();
}
-
+
@Override
public String taf() {
return "LoginPage";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java
index 7e834794..5b31e103 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTaf.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,7 @@ import org.onap.aaf.cadi.CachedPrincipal.Resp;
/**
* This TAF is set at the very beginning of Filters and Valves so that if any configuration issues hit while
* starting, the default behavior is to shut down traffic rather than leaving an open hole
- *
+ *
* @author Jonathan
*
*/
@@ -41,8 +41,8 @@ public class NullTaf implements Taf, HttpTaf {
public NullTaf() {}
/**
- * validate
- *
+ * validate
+ *
* Always Respond with a NullTafResp, which declares it is unauthenticated, and unauthorized
*/
public TafResp validate(LifeForm reading, String... info) {
@@ -50,8 +50,8 @@ public class NullTaf implements Taf, HttpTaf {
}
/**
- * validate
- *
+ * validate
+ *
* Always Respond with a NullTafResp, which declares it is unauthenticated, and unauthorized
*/
public TafResp validate(LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java
index b3b7fb59..3e77cfac 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/NullTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,25 +33,25 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
*/
class NullTafResp implements TafResp {
private NullTafResp(){}
-
+
private static TafResp singleton = new NullTafResp();
-
+
public static TafResp singleton() {
return singleton;
}
-
+
public boolean isValid() {
return false;
}
-
+
public RESP isAuthenticated() {
return RESP.NO_FURTHER_PROCESSING;
}
-
+
public String desc() {
return "All Authentication denied";
}
-
+
public RESP authenticate() throws IOException {
return RESP.NO_FURTHER_PROCESSING;
}
@@ -87,7 +87,7 @@ class NullTafResp implements TafResp {
@Override
public void timing(long start) {
}
-
+
@Override
public String taf() {
return "NULL";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java
index 6bb57d36..aa5f34ca 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/PuntTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,19 +42,19 @@ public class PuntTafResp implements TafResp {
this.name = name;
desc = "Not processing this transaction: " + explanation;
}
-
+
public boolean isValid() {
return false;
}
-
+
public RESP isAuthenticated() {
return RESP.TRY_ANOTHER_TAF;
}
-
+
public String desc() {
return desc;
}
-
+
public RESP authenticate() throws IOException {
return RESP.TRY_ANOTHER_TAF;
}
@@ -88,7 +88,7 @@ public class PuntTafResp implements TafResp {
public void timing(long start) {
timing = Timing.millis(start);
}
-
+
@Override
public String taf() {
return name;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java
index 47c262b0..37b531c9 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/Redirectable.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java
index 6850a372..c1563f59 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,38 +29,38 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
/**
* Response from Taf objects, which inform users what has happened and/or what should be done
- *
+ *
* @author Jonathan
*
*/
public interface TafResp {
public static enum RESP {
- IS_AUTHENTICATED,
- NO_FURTHER_PROCESSING,
- TRY_AUTHENTICATING,
+ IS_AUTHENTICATED,
+ NO_FURTHER_PROCESSING,
+ TRY_AUTHENTICATING,
TRY_ANOTHER_TAF,
- FAIL,
- // A note was made to avoid the response REDIRECT. However, I have deemed that it is
+ FAIL,
+ // A note was made to avoid the response REDIRECT. However, I have deemed that it is
// unavoidable when the underlying TAF did do a REDIRECT, because it requires a HTTP
// Service code to exit without modifying the Response any further.
- // Therefore, I have changed this to indicate what HAS happened, with should accommodate
+ // Therefore, I have changed this to indicate what HAS happened, with should accommodate
// both positions. Jonathan 10/18/2012
// public static final int HTTP_REDIRECT_INVOKED = 11;
HTTP_REDIRECT_INVOKED,
HAS_PROCESSED};
-
+
/**
* Basic success check
* @return
*/
public boolean isValid();
-
+
/**
* String description of what has occurred (for logging/exceptions)
* @return
*/
public String desc();
-
+
/**
* Check Response
* @return
@@ -69,10 +69,10 @@ public interface TafResp {
/**
* Authenticate, returning FAIL or Other Valid indication
- *
+ *
* HTTP implementations should watch for "HTTP_REDIRECT_INVOKED", and end the HTTP call appropriately.
* @return
- * @throws CadiException
+ * @throws CadiException
*/
public RESP authenticate() throws IOException;
@@ -81,7 +81,7 @@ public interface TafResp {
* @return
*/
public TaggedPrincipal getPrincipal();
-
+
/** Target - when Authentication Fails, need to know what ID was being attempted
* @return
*/
@@ -91,12 +91,12 @@ public interface TafResp {
* get the Access object which created this object, allowing the responder to appropriate Log, etc
*/
public Access getAccess();
-
+
/**
* Be able to check if part of a Failed attempt
*/
public boolean isFailedAttempt();
-
+
/**
* report how long this took
* @return
@@ -108,7 +108,7 @@ public interface TafResp {
* @param start
*/
void timing(long start);
-
+
/**
* Support Taf Name
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java
index dee0ba07..290d5f03 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustNotTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,12 +31,12 @@ public class TrustNotTafResp implements TafResp {
private final TafResp delegate;
private final String desc;
private float timing;
-
+
public TrustNotTafResp(final TafResp delegate, final String desc) {
this.delegate = delegate;
this.desc = desc;
}
-
+
@Override
public boolean isValid() {
return false;
@@ -88,12 +88,12 @@ public class TrustNotTafResp implements TafResp {
public void timing(long start) {
timing = Timing.millis(start);
}
-
+
@Override
public String toString() {
return desc();
}
-
+
@Override
public String taf() {
return "TrustNot";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java
index 2701c27a..5a85ebfd 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/TrustTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,13 +32,13 @@ public class TrustTafResp implements TafResp {
private final TaggedPrincipal principal;
private final String desc;
private float timing;
-
+
public TrustTafResp(final TafResp delegate, final TaggedPrincipal principal, final String desc) {
this.delegate = delegate;
this.principal = principal;
this.desc = desc + ' ' + delegate.desc();
}
-
+
@Override
public boolean isValid() {
return delegate.isValid();
@@ -90,11 +90,11 @@ public class TrustTafResp implements TafResp {
public void timing(long start) {
timing = Timing.millis(start);
}
-
+
public String toString() {
return principal.getName() + " by trust of " + desc();
}
-
+
@Override
public String taf() {
return "Trust";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java
index 93360761..b3cf4a7d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTaf.java
@@ -7,9 +7,9 @@
* 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.
@@ -51,15 +51,15 @@ import org.onap.aaf.cadi.util.CSV;
/**
* BasicHttpTaf
- *
- * This TAF implements the "Basic Auth" protocol.
- *
- * WARNING! It is true for any implementation of "Basic Auth" that the password is passed unencrypted.
- * This is because the expectation, when designed years ago, was that it would only be used in
+ *
+ * This TAF implements the "Basic Auth" protocol.
+ *
+ * WARNING! It is true for any implementation of "Basic Auth" that the password is passed unencrypted.
+ * This is because the expectation, when designed years ago, was that it would only be used in
* conjunction with SSL (https). It is common, however, for users to ignore this on the assumption that
* their internal network is secure, or just ignorance. Therefore, a WARNING will be printed
* when the HTTP Channel is not encrypted (unless explicitly turned off).
- *
+ *
* @author Jonathan
*
*/
@@ -71,7 +71,7 @@ public class BasicHttpTaf implements HttpTaf {
private boolean warn;
private long timeToLive;
private MapBathConverter mapIds;
-
+
public BasicHttpTaf(Access access, CredVal rbac, String realm, long timeToLive, boolean turnOnWarning) {
this.access = access;
this.realm = realm;
@@ -93,9 +93,9 @@ public class BasicHttpTaf implements HttpTaf {
public void add(final CredValDomain cvd) {
rbacs.put(cvd.domain(), cvd);
}
-
+
/**
- * Note: BasicHttp works for either Carbon Based (Humans) or Silicon Based (machine) Lifeforms.
+ * Note: BasicHttp works for either Carbon Based (Humans) or Silicon Based (machine) Lifeforms.
* @see Taf
*/
public TafResp validate(Taf.LifeForm reading, HttpServletRequest req, HttpServletResponse resp) {
@@ -107,20 +107,20 @@ public class BasicHttpTaf implements HttpTaf {
return DenialOfServiceTaf.respDenyID(access,bc.getUser());
}
CachedBasicPrincipal bp = new CachedBasicPrincipal(this,bc,realm,timeToLive);
-
+
// Be able to do Organizational specific lookups by Domain
CredVal cv = rbacs.get(bp.getDomain());
if (cv==null) {
cv = rbac;
}
-
- // ONLY FOR Last Ditch DEBUGGING...
+
+ // ONLY FOR Last Ditch DEBUGGING...
// access.log(Level.WARN,bp.getName() + ":" + new String(bp.getCred()));
if (cv.validate(bp.getName(),Type.PASSWORD,bp.getCred(),req)) {
return new BasicHttpTafResp(access,bp,bp.getName()+" authenticated by password",RESP.IS_AUTHENTICATED,resp,realm,false);
} else {
//TODO may need timed retries in a given time period
- return new BasicHttpTafResp(access,bc.getUser(),buildMsg(bp,req,"user/pass combo invalid for ",bc.getUser(),"from",req.getRemoteAddr()),
+ return new BasicHttpTafResp(access,bc.getUser(),buildMsg(bp,req,"user/pass combo invalid for ",bc.getUser(),"from",req.getRemoteAddr()),
RESP.TRY_AUTHENTICATING,resp,realm,true);
}
}
@@ -142,20 +142,20 @@ public class BasicHttpTaf implements HttpTaf {
if (DenialOfServiceTaf.isDeniedID(ba.getName())!=null) {
return DenialOfServiceTaf.respDenyID(access,ba.getName());
}
-
+
final int at = ba.getName().indexOf('@');
CredVal cv = rbacs.get(ba.getName().substring(at+1));
- if (cv==null) {
+ if (cv==null) {
cv = rbac; // default
}
- // ONLY FOR Last Ditch DEBUGGING...
+ // ONLY FOR Last Ditch DEBUGGING...
// access.log(Level.WARN,ba.getName() + ":" + new String(ba.getCred()));
if (cv.validate(ba.getName(), Type.PASSWORD, ba.getCred(), req)) {
return new BasicHttpTafResp(access,ba, ba.getName()+" authenticated by BasicAuth password",RESP.IS_AUTHENTICATED,resp,realm,false);
} else {
//TODO may need timed retries in a given time period
- return new BasicHttpTafResp(access,target,buildMsg(ba,req,"user/pass combo invalid"),
+ return new BasicHttpTafResp(access,target,buildMsg(ba,req,"user/pass combo invalid"),
RESP.TRY_AUTHENTICATING,resp,realm,true);
}
} catch (IOException e) {
@@ -166,7 +166,7 @@ public class BasicHttpTaf implements HttpTaf {
}
return new BasicHttpTafResp(access,target,"Requesting HTTP Basic Authorization",RESP.TRY_AUTHENTICATING,resp,realm,false);
}
-
+
protected String buildMsg(Principal pr, HttpServletRequest req, Object ... msg) {
StringBuilder sb = new StringBuilder();
if (pr!=null) {
@@ -187,7 +187,7 @@ public class BasicHttpTaf implements HttpTaf {
}
return sb.toString();
}
-
+
public void addCredVal(final String realm, final CredVal cv) {
rbacs.put(realm, cv);
}
@@ -199,7 +199,7 @@ public class BasicHttpTaf implements HttpTaf {
}
return cv;
}
-
+
@Override
public Resp revalidate(CachedPrincipal prin, Object state) {
if (prin instanceof BasicPrincipal) {
@@ -211,7 +211,7 @@ public class BasicHttpTaf implements HttpTaf {
}
return Resp.NOT_MINE;
}
-
+
public String toString() {
return "Basic Auth enabled on realm: " + realm;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java
index e2174493..36da354b 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/basic/BasicHttpTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,7 +36,7 @@ public class BasicHttpTafResp extends AbsTafResp implements TafResp {
private String realm;
private RESP status;
private final boolean wasFailed;
-
+
public BasicHttpTafResp(Access access, TaggedPrincipal principal, String description, RESP status, HttpServletResponse resp, String realm, boolean wasFailed) {
super(access, tafName, principal, description);
httpResp = resp;
@@ -54,7 +54,7 @@ public class BasicHttpTafResp extends AbsTafResp implements TafResp {
}
public RESP authenticate() throws IOException {
- httpResp.setStatus(401); // Unauthorized
+ httpResp.setStatus(401); // Unauthorized
httpResp.setHeader("WWW-Authenticate", "Basic realm=\""+realm+'"');
return RESP.HTTP_REDIRECT_INVOKED;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java
index f597159e..18c0049f 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/CertIdentity.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,16 +31,16 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
public interface CertIdentity {
/**
* identity from X509Certificate Object and/or certBytes
- *
+ *
* If you have both, include them. If you only have one, leave the other null, and it will be generated if needed
- *
+ *
* The Request is there to obtain Header or Attribute info of ultimate user
- *
+ *
* @param req
* @param cert
* @param certBytes
* @return
- * @throws CertificateException
+ * @throws CertificateException
*/
public TaggedPrincipal identity(HttpServletRequest req, X509Certificate cert, byte[] certBytes) throws CertificateException;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java
index d51cc86a..46a01d3e 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509HttpTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,7 @@ public class X509HttpTafResp extends AbsTafResp implements TafResp {
private static final String tafName = X509Taf.class.getSimpleName();
private RESP status;
-
+
public X509HttpTafResp(Access access, TaggedPrincipal principal, String description, RESP status) {
super(access, tafName, principal, description);
this.status = status;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java
index 914c57b5..a06fb8e1 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java
@@ -7,9 +7,9 @@
* 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.
@@ -77,7 +77,7 @@ public class X509Taf implements HttpTaf {
throw new RuntimeException("X.509 and SHA-256 are required for X509Taf",e);
}
}
-
+
public X509Taf(Access access, Lur lur, CertIdentity ... cis) throws CertificateException, NoSuchAlgorithmException, CadiException {
this.access = access;
env = access.getProperty(Config.AAF_ENV,null);
@@ -103,7 +103,7 @@ public class X509Taf implements HttpTaf {
} catch (Exception e) {
certIdents = cis;
}
-
+
si = new SecurityInfo(access);
}
@@ -141,7 +141,7 @@ public class X509Taf implements HttpTaf {
int end = 1;
int comma;
int length = subject.length();
-
+
compare:
while(start<length) {
while(Character.isWhitespace(subject.charAt(start))) {
@@ -165,9 +165,9 @@ public class X509Taf implements HttpTaf {
int at = subject.indexOf('@', start);
if(at<end && at>=0) {
String[] sa = Split.splitTrim(':', subject, start+3,end+1);
- if (sa.length==1 || (sa.length>1 && env!=null && env.equals(sa[1]))) { // Check Environment
- return new X509HttpTafResp(access,
- new X509Principal(sa[0], certarr[0],(byte[])null,bht),
+ if (sa.length==1 || (sa.length>1 && env!=null && env.equals(sa[1]))) { // Check Environment
+ return new X509HttpTafResp(access,
+ new X509Principal(sa[0], certarr[0],(byte[])null,bht),
"X509Taf validated " + sa[0] + (sa.length<2?"":" for aaf_env " + env ), RESP.IS_AUTHENTICATED);
} else {
access.printf(Level.DEBUG,"Certificate is not for environment '%s'",env);
@@ -184,7 +184,7 @@ public class X509Taf implements HttpTaf {
} else {
access.log(Level.DEBUG,"There is no client certificate on the transaction");
}
-
+
byte[] array = null;
byte[] certBytes = null;
@@ -213,30 +213,30 @@ public class X509Taf implements HttpTaf {
Symm.base64noSplit.decode(bais, baos, 5);
certBytes = baos.toByteArray();
cert = getCert(certBytes);
-
- /**
+
+ /**
* Identity from CERT if well know CA and specific encoded information
*/
// If found Identity doesn't work, try SignedStuff Protocol
// cert.checkValidity();
// cert.--- GET FINGERPRINT?
String stuff = req.getHeader("Signature");
- if (stuff==null)
+ if (stuff==null)
return new X509HttpTafResp(access, null, "Header entry 'Signature' required to validate One way X509 Certificate", RESP.TRY_ANOTHER_TAF);
- String data = req.getHeader("Data");
- // if (data==null)
+ String data = req.getHeader("Data");
+ // if (data==null)
// return new X509HttpTafResp(access, null, "No signed Data to validate with X509 Certificate", RESP.TRY_ANOTHER_TAF);
-
+
// Note: Data Pos shows is "<signatureType> <data>"
// int dataPos = (stuff.indexOf(' ')); // determine what is Algorithm
- // Get Signature
+ // Get Signature
bais = new ByteArrayInputStream(stuff.getBytes());
baos = new ByteArrayOutputStream(stuff.length());
Symm.base64noSplit.decode(bais, baos);
array = baos.toByteArray();
// Signature sig = Signature.getInstance(stuff.substring(0, dataPos)); // get Algorithm from first part of Signature
-
- Signature sig = Signature.getInstance(cert.getSigAlgName());
+
+ Signature sig = Signature.getInstance(cert.getSigAlgName());
sig.initVerify(cert.getPublicKey());
sig.update(data.getBytes());
if (!sig.verify(array)) {
@@ -254,16 +254,16 @@ public class X509Taf implements HttpTaf {
if (cert==null) {
return new X509HttpTafResp(access, null, "No Certificate Info on Transaction", RESP.TRY_ANOTHER_TAF);
}
-
+
// A cert has been found, match Identify
TaggedPrincipal prin=null;
-
+
for (int i=0;prin==null && i<certIdents.length;++i) {
if ((prin=certIdents[i].identity(req, cert, certBytes))!=null) {
responseText = prin.getName() + " matches Certificate " + cert.getSubjectX500Principal().getName() + responseText;
}
}
-
+
// if Principal is found, check for "AS_USER" and whether this entity is trusted to declare
if (prin!=null) {
// Note: Tag for Certs is Fingerprint, but that takes computation... leaving off
@@ -275,9 +275,9 @@ public class X509Taf implements HttpTaf {
}
}
} catch (Exception e) {
- return new X509HttpTafResp(access, null, e.getMessage(), RESP.TRY_ANOTHER_TAF);
+ return new X509HttpTafResp(access, null, e.getMessage(), RESP.TRY_ANOTHER_TAF);
}
-
+
return new X509HttpTafResp(access, null, "Certificate cannot be used for authentication", RESP.TRY_ANOTHER_TAF);
}
@@ -289,7 +289,7 @@ public class X509Taf implements HttpTaf {
public void add(BasicHttpTaf bht) {
this.bht = bht;
}
-
+
public CredVal getCredVal(final String key) {
if (bht==null) {
return null;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java
index f083e5aa..1eadc1ae 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,9 +52,9 @@ public class DenialOfServiceTaf implements HttpTaf {
private Access access;
private final TafResp puntNotDenied;
private static File dosIP, dosID;
-
+
/**
- *
+ *
* @param hostname
* @param prod
* @throws CadiException
@@ -84,7 +84,7 @@ public class DenialOfServiceTaf implements HttpTaf {
return respDenyIP(access,ip);
}
}
-
+
// Note: Can't process Principal, because this is the first TAF, and no Principal is created.
// Other TAFs use "isDenied()" on this Object to validate.
return puntNotDenied;
@@ -97,7 +97,7 @@ public class DenialOfServiceTaf implements HttpTaf {
}
/*
- * for use in Other TAFs, before they attempt backend validation of
+ * for use in Other TAFs, before they attempt backend validation of
*/
public static Counter isDeniedID(String identity) {
if (deniedID!=null) {
@@ -105,9 +105,9 @@ public class DenialOfServiceTaf implements HttpTaf {
}
return null;
}
-
+
/**
- *
+ *
*/
public static Counter isDeniedIP(String ipvX) {
if (deniedIP!=null) {
@@ -119,7 +119,7 @@ public class DenialOfServiceTaf implements HttpTaf {
/**
* Return of "True" means IP has been added.
* Return of "False" means IP already added.
- *
+ *
* @param ip
* @return
*/
@@ -138,7 +138,7 @@ public class DenialOfServiceTaf implements HttpTaf {
}
return rv;
}
-
+
private static void writeIP() {
if (dosIP!=null && deniedIP!=null) {
if (deniedIP.isEmpty()) {
@@ -162,7 +162,7 @@ public class DenialOfServiceTaf implements HttpTaf {
}
}
}
-
+
private static void readIP() {
if (dosIP!=null && dosIP.exists()) {
BufferedReader br;
@@ -190,7 +190,7 @@ public class DenialOfServiceTaf implements HttpTaf {
/**
* Return of "True" means IP has was removed.
* Return of "False" means IP wasn't being denied.
- *
+ *
* @param ip
* @return
*/
@@ -208,7 +208,7 @@ public class DenialOfServiceTaf implements HttpTaf {
/**
* Return of "True" means ID has been added.
* Return of "False" means ID already added.
- *
+ *
* @param ip
* @return
*/
@@ -262,7 +262,7 @@ public class DenialOfServiceTaf implements HttpTaf {
if (deniedID==null) {
deniedID=new HashMap<>();
}
-
+
String line;
while ((line=br.readLine())!=null) {
deniedID.put(line, new Counter(line));
@@ -279,12 +279,12 @@ public class DenialOfServiceTaf implements HttpTaf {
/**
* Return of "True" means ID has was removed.
* Return of "False" means ID wasn't being denied.
- *
+ *
* @param ip
* @return
*/
public static synchronized boolean removeDenyID(String id) {
- if (deniedID!=null && deniedID.remove(id)!=null) {
+ if (deniedID!=null && deniedID.remove(id)!=null) {
writeID();
if (deniedID.isEmpty()) {
deniedID=null;
@@ -294,7 +294,7 @@ public class DenialOfServiceTaf implements HttpTaf {
}
return false;
}
-
+
public List<String> report() {
int initSize = 0;
if (deniedIP!=null)initSize+=deniedIP.size();
@@ -312,24 +312,24 @@ public class DenialOfServiceTaf implements HttpTaf {
}
return al;
}
-
+
public static class Counter {
- private final String name;
+ private final String name;
private int count = 0;
private Date first;
private long last; // note, we use "last" as long, to avoid popping useless dates on Heap.
-
+
public Counter(String name) {
this.name = name;
first = null;
last = 0L;
count = 0;
}
-
+
public String getName() {
return name;
}
-
+
public int getCount() {
return count;
}
@@ -337,7 +337,7 @@ public class DenialOfServiceTaf implements HttpTaf {
public long getLast() {
return last;
}
-
+
/*
* Only allow Denial of ServiceTaf to increment
*/
@@ -348,12 +348,12 @@ public class DenialOfServiceTaf implements HttpTaf {
first = new Date(last);
}
}
-
+
public String toString() {
- if (count==0)
- return name + " is on the denied list, but has not attempted Access";
- else
- return
+ if (count==0)
+ return name + " is on the denied list, but has not attempted Access";
+ else
+ return
name +
" has been denied " +
count +
@@ -367,7 +367,7 @@ public class DenialOfServiceTaf implements HttpTaf {
public static TafResp respDenyID(Access access, String identity) {
return new DenialOfServiceTafResp(access, RESP.NO_FURTHER_PROCESSING, identity + " is on the Identity Denial list");
}
-
+
public static TafResp respDenyIP(Access access, String ip) {
return new DenialOfServiceTafResp(access, RESP.NO_FURTHER_PROCESSING, ip + " is on the IP Denial list");
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java
index 2215a6f9..eea0d928 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTafResp.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,12 +41,12 @@ public class DenialOfServiceTafResp extends AbsTafResp {
public RESP isAuthenticated() {
return ect;
}
-
+
public RESP authenticate() throws IOException {
return ect;
}
-
+
@Override
public String taf() {
return "DOS";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java
index 2c9bb8c4..476b2df1 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/CSV.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,7 +36,7 @@ import org.onap.aaf.cadi.CadiException;
/**
* Read CSV file for various purposes
- *
+ *
* @author Instrumental(Jonathan)
*
*/
@@ -46,26 +46,26 @@ public class CSV {
private boolean processAll;
private char delimiter = ',';
private boolean go;
-
+
public CSV(Access access, File file) {
this.access = access;
csv = file;
processAll = false;
go = true;
}
-
+
public CSV(Access access, String csvFilename) {
this.access = access;
csv = new File(csvFilename);
processAll = false;
go = true;
}
-
+
public CSV setDelimiter(char delimiter) {
this.delimiter = delimiter;
return this;
}
-
+
public String name() {
return csv.getName();
}
@@ -76,16 +76,16 @@ public class CSV {
}
/*
* Create your code to accept the List<String> row.
- *
+ *
* Your code may keep the List... CSV does not hold onto it.
- *
+ *
* @author Instrumental(Jonathan)
*
*/
public interface Visitor {
void visit(List<String> row) throws IOException, CadiException;
}
-
+
public void visit(Visitor visitor) throws IOException, CadiException {
BufferedReader br = new BufferedReader(new FileReader(csv));
try {
@@ -165,7 +165,7 @@ public class CSV {
br.close();
}
}
-
+
public Writer writer() throws FileNotFoundException {
return new Writer(false);
}
@@ -177,10 +177,10 @@ public class CSV {
public interface RowSetter {
public void row(Object ... objs);
}
-
+
public static class Saver implements RowSetter {
List<String> ls= new ArrayList<>();
-
+
@Override
public void row(Object ... objs) {
if(objs.length>0) {
@@ -197,7 +197,7 @@ public class CSV {
}
}
}
-
+
public List<String> asList() {
List<String> rv = ls;
ls = new ArrayList<>();
@@ -210,7 +210,7 @@ public class CSV {
private Writer(final boolean append) throws FileNotFoundException {
ps = new PrintStream(new FileOutputStream(csv,append));
}
-
+
@Override
public void row(Object ... objs) {
if(objs.length>0) {
@@ -233,7 +233,7 @@ public class CSV {
ps.println();
}
}
-
+
private void print(String s) {
boolean quote = s.matches(".*[,|\"].*");
if(quote) {
@@ -246,7 +246,7 @@ public class CSV {
ps.append(s);
}
-
+
}
/**
* Note: CSV files do not actually support Comments as a standard, but it is useful
@@ -257,32 +257,32 @@ public class CSV {
ps.printf(comment,objs);
ps.println();
}
-
+
public void flush() {
ps.flush();
}
-
+
public void close() {
flush();
ps.close();
}
-
+
public String toString() {
return csv.getAbsolutePath();
}
}
-
+
/**
* Provides a way to stop processing records from inside a Visit
*/
public void stop() {
- go = false;
+ go = false;
}
public void delete() {
csv.delete();
}
-
+
public String toString() {
return csv.getAbsolutePath();
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java
index 70fabd82..037bd4a0 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Chmod.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,7 +26,7 @@ import java.io.IOException;
public interface Chmod {
public void chmod(File f) throws IOException;
-
+
public static final Chmod to755 = new Chmod() {
public void chmod(File f) throws IOException {
f.setExecutable(true, false);
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java
index 07389aad..69d429c9 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FQI.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,7 +44,7 @@ public class FQI {
sb.append(split[i]);
}
}
-
+
return sb==null?"":sb.toString();
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
index f2c6be6f..3943cdcd 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/FixURIinfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ import java.net.URI;
/**
* URI and URL, if the host does not have "dots", will interpret Host:port as Authority
- *
+ *
* This is very problematic for Containers, which like single name entries.
* @author Instrumental(Jonathan)
*
@@ -33,7 +33,7 @@ public class FixURIinfo {
private String auth;
private String host;
private int port;
-
+
public FixURIinfo(URI uri) {
auth = uri.getAuthority();
host = uri.getHost();
@@ -51,11 +51,11 @@ public class FixURIinfo {
}
}
}
-
+
public String getHost() {
return host;
}
-
+
public int getPort() {
return port;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java
index e790766b..c4079d1a 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/JsonOutputStream.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,12 +50,12 @@ public class JsonOutputStream extends OutputStream {
}
switch(b) {
case '{':
- case '[':
+ case '[':
ret = '\n';
++indent;
break;
case '}':
- case ']':
+ case ']':
--indent;
os.write('\n');
for (int i=0;i<indent;++i) {
@@ -65,7 +65,7 @@ public class JsonOutputStream extends OutputStream {
case ',':
ret = '\n';
break;
-
+
}
os.write(b);
prev = b;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java
index 15390285..58bf5a6d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/MaskFormatException.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java
index b930bc28..78e8b719 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/MyConsole.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java
index 19fd1e2d..99105989 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/NetMask.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,10 +21,10 @@
package org.onap.aaf.cadi.util;
-/*
+/*
* NetMask - a class to quickly validate whether a given IP is part of a mask, as defined by bytes or standard String format.
- *
- * Needs the IPV6 Mask Builder.
+ *
+ * Needs the IPV6 Mask Builder.
*/
public class NetMask {
private long mask;
@@ -32,16 +32,16 @@ public class NetMask {
public NetMask(byte[] inBytes) {
mask = derive(inBytes);
}
-
+
public NetMask(String string) throws MaskFormatException {
mask = derive(string,true);
}
-
+
public boolean isInNet(byte[] inBytes) {
long addr = derive(inBytes);
return (mask & addr) == addr;
}
-
+
public boolean isInNet(String str) {
long addr;
try {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java
index 156397b6..72d09bfe 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,7 +21,7 @@
/*
* Pool
- *
+ *
* Author: Jonathan
* 5/27/2011
*/
@@ -35,29 +35,29 @@ import org.onap.aaf.cadi.CadiException;
/**
* This Class pools on an As-Needed-Basis any particular kind of class, which is
* quite suitable for expensive operations.
- *
+ *
* The user calls "get" on a Pool, and if a waiting resource (T) is available,
* it will be returned. Otherwise, one will be created with the "Creator" class
* (must be defined for (T)).
- *
+ *
* You can Prime the instances to avoid huge startup costs
- *
+ *
* The returned "Pooled" object simply has to call "done()" and the object is
* returned to the pool. If the developer does not return the object, a memory
* leak does not occur. There are no references to the object once "get" is
* called. However, the developer who does not return the object when done
* obviates the point of the pool, as new Objects are created in place of the
* Object not returned when another call to "get" is made.
- *
+ *
* There is a cushion of extra objects, currently defaulted to MAX_RANGE. If the
* items returned become higher than the MAX_RANGE, the object is allowed to go
* out of scope, and be cleaned up. the default can be changed on a per-pool
* basis.
- *
+ *
* Class revamped for CadiExceptions and Access logging 10/4/2017
- *
+ *
* @author Jonathan
- *
+ *
* @param <T>
*/
public class Pool<T> {
@@ -69,7 +69,7 @@ public class Pool<T> {
/**
* only Simple List needed.
- *
+ *
* NOTE TO MAINTAINERS: THIS OBJECT DOES IT'S OWN SYNCHRONIZATION. All
* changes that touch list must account for correctly synchronizing list.
*/
@@ -101,7 +101,7 @@ public class Pool<T> {
/**
* Create a new Pool, given the implementation of Creator<T>, which must be
* able to create/destroy T objects at will.
- *
+ *
* @param creator
*/
public Pool(Creator<T> creator) {
@@ -110,7 +110,7 @@ public class Pool<T> {
list = new LinkedList<>();
logger = Log.NULL;
}
-
+
/**
* Attach Pool Logging activities to any other Logging Mechanism.
* @param logger
@@ -118,7 +118,7 @@ public class Pool<T> {
public void setLogger(Log logger) {
this.logger = logger;
}
-
+
public void log(Object ...objects) {
logger.log(objects);
}
@@ -126,10 +126,10 @@ public class Pool<T> {
/**
* Preallocate a certain number of T Objects. Useful for services so that
* the first transactions don't get hit with all the Object creation costs
- *
+ *
* @param lt
* @param prime
- * @throws CadiException
+ * @throws CadiException
*/
public void prime(int prime) throws CadiException {
for (int i = 0; i < prime; ++i) {
@@ -164,16 +164,16 @@ public class Pool<T> {
* This is the essential function for Pool. Get an Object "T" inside a
* "Pooled<T>" object. If there is a spare Object, then use it. If not, then
* create and pass back.
- *
+ *
* This one uses a Null LogTarget
- *
+ *
* IMPORTANT: When the use of this object is done (and the object is still
* in a valid state), then "done()" should be called immediately to allow
* the object to be reused. That is the point of the Pool...
- *
+ *
* If the Object is in an invalid state, then "toss()" should be used so the
* Pool doesn't pass on invalid objects to others.
- *
+ *
* @param lt
* @return
* @throws CadiException
@@ -205,7 +205,7 @@ public class Pool<T> {
* state. If not, they are tossed from the Pool. This is valuable to have
* when Remote Connections go down, and there is a question on whether the
* Pooled Objects are still functional.
- *
+ *
* @return
*/
public boolean validate() {
@@ -225,11 +225,11 @@ public class Pool<T> {
/**
* This is an internal method, used only by the Internal Pooled<T> class.
- *
+ *
* The Pooled<T> class "offers" it's Object back after use. It is an
* "offer", because Pool will simply destroy and remove the object if it has
* more than enough spares.
- *
+ *
* @param lt
* @param used
* @return
@@ -253,9 +253,9 @@ public class Pool<T> {
* The Creator Interface give the Pool the ability to Create, Destroy and
* Validate the Objects it is maintaining. Thus, it is a specially written
* Implementation for each type.
- *
+ *
* @author Jonathan
- *
+ *
* @param <T>
*/
public interface Creator<T> {
@@ -270,7 +270,7 @@ public class Pool<T> {
public interface Log {
public void log(Object ... o);
-
+
public final static Log NULL = new Log() {
@Override
public void log(Object ... o) {
@@ -281,7 +281,7 @@ public class Pool<T> {
* The "Pooled<T>" class is the transient class that wraps the actual Object
* T for API use/ It gives the ability to return ("done()", or "toss()") the
* Object to the Pool when processing is finished.
- *
+ *
* For Safety, i.e. to avoid memory leaks and invalid Object States, there
* is a "finalize" method. It is strictly for when coder forgets to return
* the object, or perhaps hasn't covered the case during Exceptions or
@@ -291,9 +291,9 @@ public class Pool<T> {
* However, we don't want Coding Mistakes to put the whole program in an
* invalid state, so if something happened such that "done()" or "toss()"
* were not called, the resource is still cleaned up as well as possible.
- *
+ *
* @author Jonathan
- *
+ *
* @param <T>
*/
public static class Pooled<T> {
@@ -302,7 +302,7 @@ public class Pool<T> {
/**
* Create the Wrapping Object Pooled<T>.
- *
+ *
* @param t
* @param pool
* @param logTarget
@@ -316,7 +316,7 @@ public class Pool<T> {
/**
* This is the key API for the Pool, as calling "done()" offers this
* object back to the Pool for reuse.
- *
+ *
* Do not use the Pooled<T> object again after calling "done()".
*/
public void done() {
@@ -329,12 +329,12 @@ public class Pool<T> {
* The user of the Object may discover that the Object t is no longer in
* a valid state. Don't put Garbage back in the Refrigerator... Toss it,
* if it's no longer valid.
- *
+ *
* toss() is also used for draining the Pool, etc.
- *
+ *
* toss() will attempt to destroy the Object by using the Creator
* Interface.
- *
+ *
*/
public void toss() {
if (pool != null) {
@@ -360,7 +360,7 @@ public class Pool<T> {
/**
* Get the maximum number of spare objects allowed at any moment
- *
+ *
* @return
*/
public int getMaxRange() {
@@ -369,9 +369,9 @@ public class Pool<T> {
/**
* Set a Max Range for numbers of spare objects waiting to be used.
- *
+ *
* No negative numbers are allowed
- *
+ *
* @return
*/
public void setMaxRange(int max_range) {
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
index 4f41629d..a6e52a44 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Split.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,7 +26,7 @@ package org.onap.aaf.cadi.util;
*
* Note: Copied from Inno to avoid linking issues.
* Note: I read the String split and Pattern split code, and we can do this more efficiently for a single Character
- *
+ *
* 8/20/2015
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java
index a85020ff..6fe56725 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/SubStandardConsole.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,12 +28,12 @@ import java.io.InputStreamReader;
// Substandard, because System.in doesn't do Passwords..
public class SubStandardConsole implements MyConsole {
private final static char[] BLANK = new char[0];
- private final BufferedReader br;
+ private final BufferedReader br;
public SubStandardConsole() {
br = new BufferedReader(new InputStreamReader(System.in));
}
-
+
@Override
public String readLine(String fmt, Object... args) {
String rv;
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java
index da99d06d..0ea1b0a3 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/TheConsole.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,7 +35,7 @@ public class TheConsole implements MyConsole {
public char[] readPassword(String fmt, Object... args) {
return System.console().readPassword(fmt, args);
}
-
+
public static boolean implemented() {
return System.console()!=null;
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java
index 529849de..3f9b9b4d 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Timing.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java
index d42aaf55..b9cee7fb 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/UserChainManip.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,11 +24,11 @@ package org.onap.aaf.cadi.util;
import org.onap.aaf.cadi.UserChain;
public class UserChainManip {
- /**
+ /**
Build an element in the correct format for UserChain.
Format:<APP>:<ID>:<protocol>[:AS][,<APP>:<ID>:<protocol>]*
@see UserChain
- */
+ */
public static StringBuilder build(StringBuilder sb, String app, String id, UserChain.Protocol proto, boolean as) {
boolean mayAs;
if (!(mayAs=sb.length()==0)) {
@@ -44,7 +44,7 @@ public class UserChainManip {
}
return sb;
}
-
+
public static String idToNS(String id) {
if (id==null) {
return "";
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java
index 417351f5..bf9ebc24 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Vars.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,11 +47,11 @@ public class Vars {
public static String convert(final StringBuilder holder, final String text, final Object ... vars) {
StringBuilder sb = null;
int idx,index=0,prev = 0;
-
+
if (text.contains("%s")) {
sb = new StringBuilder();
}
-
+
StringBuilder[] sbs = new StringBuilder[] {sb,holder};
boolean replace, clearIndex = false;
int c;
@@ -66,12 +66,12 @@ public class Vars {
if (holder!=null) {
holder.append(text,prev,idx);
}
-
+
boolean go = true;
while (go) {
if (text.length()>++idx) {
switch(c=text.charAt(idx)) {
- case '0': case '1': case '2': case '3': case '4':
+ case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
index *=10;
index +=(c-'0');
@@ -106,7 +106,7 @@ public class Vars {
}
}
}
-
+
if (sb!=null) {
sb.append(text,prev,text.length());
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java
index ebcfa9f7..5574eef5 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Action.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,11 +23,11 @@ package org.onap.aaf.cadi.wsse;
/**
* Interface to specify an action deep within a parsing tree on a local object
- *
+ *
* We use a Generic so as to be flexible on create what that object actually is. This is passed in at the
* root "parse" call of Match. Similar to a "Visitor" Pattern, this object is passed upon reaching the right
* point in a parse tree.
- *
+ *
* @author Jonathan
*
* @param <OUTPUT>
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java
index d0a7da47..e46d5a02 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/Match.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,18 +26,18 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
/**
- * Match Class allows you to build an automatic Tree of StAX (or StAX like)
+ * Match Class allows you to build an automatic Tree of StAX (or StAX like)
* Objects for frequent use.
- *
+ *
* OBJECT is a type which you which to do some end Actions on, similar to a Visitor pattern, see Action
- *
+ *
* Note: We have implemented with XReader and XEvent, rather than StAX for performance reasons.
- *
+ *
* @see Action
* @see Match
* @see XEvent
* @see XReader
- *
+ *
* @author Jonathan
*
* @param <OUTPUT>
@@ -50,7 +50,7 @@ public class Match<OUTPUT> {
private Action<OUTPUT> action = null;
private boolean stopAfter;
private boolean exclusive;
-
+
@SafeVarargs
public Match(String ns, String name, Match<OUTPUT> ... next) {
@@ -61,7 +61,7 @@ public class Match<OUTPUT> {
if (!m.stopAfter)m.prev = this;
}
}
-
+
public Match<OUTPUT> onMatch(OUTPUT output, XReader reader) throws XMLStreamException {
while (reader.hasNext()) {
XEvent event = reader.nextEvent();
@@ -111,10 +111,10 @@ public class Match<OUTPUT> {
stopAfter = true;
return this;
}
-
+
/**
* Mark that this Object MUST be matched at this level or stop parsing and end
- *
+ *
* @param action
* @return
*/
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java
index 787f1b4b..0c3cca40 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/WSSEParser.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,15 +30,15 @@ import org.onap.aaf.cadi.BasicCred;
/**
* WSSE Parser
- *
- * Read the User and Password from WSSE Formatted SOAP Messages
- *
+ *
+ * Read the User and Password from WSSE Formatted SOAP Messages
+ *
* This class uses StAX so that processing is stopped as soon as the Security User/Password are read into BasicCred, or the Header Ends
- *
+ *
* This class is intended to be created once (or very few times) and reused as much as possible.
- *
+ *
* It is as thread safe as StAX parsing is.
- *
+ *
* @author Jonathan
*/
public class WSSEParser {
@@ -71,7 +71,7 @@ public class WSSEParser {
).exclusive()// Envelope must match Header, and no other. FYI, Body comes after Header short circuits (see above), so it's ok
).exclusive(); // root must be Envelope
}
-
+
public XMLStreamException parse(BasicCred bc, InputStream is) {
try {
parseTree.onMatch(bc, new XReader(is));
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java
index 187d5b1e..d6918292 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XEvent.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,12 +26,12 @@ import javax.xml.stream.events.XMLEvent;
/**
* XEvent
- *
+ *
* This mechanism mimics a minimal portion of StAX "XMLEvent", enough to work with minimal XReader.
- *
+ *
* We implement the same interface, as much as minimally necessary, as XMLEvent for these small usages so as to
* be interchangeable in the future, if so desired
- *
+ *
* @author Jonathan
*
*/
@@ -58,7 +58,7 @@ public abstract class XEvent {
public NamedXEvent(QName qname) {
this.qname = qname;
}
-
+
public QName getName() {
return qname;
}
@@ -79,7 +79,7 @@ public abstract class XEvent {
public EndElement(String ns, String tag) {
super(new QName(ns,tag));
}
-
+
@Override
public int getEventType() {
return XMLEvent.END_ELEMENT;
@@ -101,14 +101,14 @@ public abstract class XEvent {
return data;
}
}
-
+
public static class StartDocument extends XEvent {
@Override
public int getEventType() {
return XMLEvent.START_DOCUMENT;
}
-
+
}
public static class EndDocument extends XEvent {
@@ -117,7 +117,7 @@ public abstract class XEvent {
public int getEventType() {
return XMLEvent.END_DOCUMENT;
}
-
+
}
public static class Comment extends XEvent {
public final String value;
@@ -129,7 +129,7 @@ public abstract class XEvent {
public int getEventType() {
return XMLEvent.COMMENT;
}
-
+
}
}
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java
index aa46bec5..e820197b 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,16 +34,16 @@ import javax.xml.stream.XMLStreamException;
/**
* XReader
- * This class works similarly as StAX, except StAX has more behavior than is needed. That would be ok, but
+ * This class works similarly as StAX, except StAX has more behavior than is needed. That would be ok, but
* StAX also was Buffering in their code in such as way as to read most if not all the incoming stream into memory,
* defeating the purpose of pre-reading only the Header
- *
+ *
* This Reader does no back-tracking, but is able to create events based on syntax and given state only, leaving the
* Read-ahead mode of the InputStream up to the other classes.
- *
- * At this time, we only implement the important events, though if this is good enough, it could be expanded, perhaps to
+ *
+ * At this time, we only implement the important events, though if this is good enough, it could be expanded, perhaps to
* replace the original XMLReader from StAX.
- *
+ *
* @author Jonathan
*
*/
@@ -53,18 +53,18 @@ public class XReader {
private InputStream is;
private ByteArrayOutputStream baos;
private int state, count, last;
-
+
private Stack<Map<String,String>> nsses;
-
+
public XReader(InputStream is) {
this.is = is;
curr = another = null;
baos = new ByteArrayOutputStream();
- state = BEGIN_DOC;
+ state = BEGIN_DOC;
count = 0;
nsses = new Stack<Map<String,String>>();
}
-
+
public boolean hasNext() throws XMLStreamException {
if (curr==null) {
curr = parse();
@@ -78,7 +78,7 @@ public class XReader {
return xe;
}
- //
+ //
// State Flags
//
// Note: The State of parsing XML can be complicated. There are too many to cleanly keep in "booleans". Additionally,
@@ -100,20 +100,20 @@ public class XReader {
// useful combined Comment states
private final static int IN_COMMENT=COMMENT|COMMENT_E|COMMENT_D1|COMMENT_D2;
private final static int COMPLETE_COMMENT = COMMENT|COMMENT_E|COMMENT_D1|COMMENT_D2|COMMENT_D3|COMMENT_D4;
-
-
+
+
private XEvent parse() throws XMLStreamException {
Map<String,String> nss = nsses.isEmpty()?null:nsses.peek();
XEvent rv;
- if ((rv=another)!=null) { // "another" is a tag that may have needed to be created, but not
+ if ((rv=another)!=null) { // "another" is a tag that may have needed to be created, but not
// immediately returned. Save for next parse. If necessary, this could be turned into
// a FIFO storage, but a single reference is enough for now.
another = null; // "rv" is now set for the Event, and will be returned. Set to Null.
} else {
boolean go = true;
int c=0;
-
+
try {
while (go && (c=is.read())>=0) {
++count;
@@ -134,9 +134,9 @@ public class XReader {
String ns;
switch(t.state&(START_TAG|END_TAG)) {
case START_TAG:
- nss = getNss(nss,t); // Only Start Tags might have NS Attributes
- // Get any NameSpace elements from tag. If there are, nss will become
- // a new Map with all the previous NSs plus the new. This provides
+ nss = getNss(nss,t); // Only Start Tags might have NS Attributes
+ // Get any NameSpace elements from tag. If there are, nss will become
+ // a new Map with all the previous NSs plus the new. This provides
// scoping behavior when used with the Stack
// drop through on purpose
case END_TAG:
@@ -148,8 +148,8 @@ public class XReader {
if (ns==null)
throw new XMLStreamException("Invalid Namespace Prefix at " + count);
go = false;
- switch(t.state) { // based on
- case DOC_TYPE:
+ switch(t.state) { // based on
+ case DOC_TYPE:
rv = new XEvent.StartDocument();
break;
case COMMENT:
@@ -168,14 +168,14 @@ public class XReader {
if (last=='/')another = new XEvent.EndElement(ns,t.name);
}
if (cxe!=null) { // if there is a Character Event, it actually should go first. ow.
- another = rv; // Make current Event the "another" or next event, and
+ another = rv; // Make current Event the "another" or next event, and
rv = cxe; // send Character Event now
}
break;
case ' ':
case '\t':
case '\n':
- if ((state&BEGIN_DOC)==BEGIN_DOC) { // if Whitespace before doc, just ignore
+ if ((state&BEGIN_DOC)==BEGIN_DOC) { // if Whitespace before doc, just ignore
break;
}
// fallthrough on purpose
@@ -190,17 +190,17 @@ public class XReader {
} catch (IOException e) {
throw new XMLStreamException(e); // all errors parsing will be treated as XMLStreamErrors (like StAX)
}
- if (c==-1 && (state&BEGIN_DOC)==BEGIN_DOC) { // Normally, end of stream is ok, however, we need to know if the
- throw new XMLStreamException("Premature End of File"); // document isn't an XML document, so we throw exception if it
+ if (c==-1 && (state&BEGIN_DOC)==BEGIN_DOC) { // Normally, end of stream is ok, however, we need to know if the
+ throw new XMLStreamException("Premature End of File"); // document isn't an XML document, so we throw exception if it
} // hasn't yet been determined to be an XML Doc
}
return rv;
}
-
+
/**
* parseTag
- *
- * Parsing a Tag is somewhat complicated, so it's helpful to separate this process from the
+ *
+ * Parsing a Tag is somewhat complicated, so it's helpful to separate this process from the
* higher level Parsing effort
* @return
* @throws IOException
@@ -213,7 +213,7 @@ public class XReader {
int c, quote=0; // If "quote" is 0, then we're not in a quote. We set ' (in pretag) or " in attribs accordingly to denote quoted
String prefix=null,name=null,value=null;
baos.reset();
-
+
while (go && (c=is.read())>=0) {
++count;
if (quote!=0) { // If we're in a quote, we only end if we hit another quote of the same time, not preceded by \
@@ -225,7 +225,7 @@ public class XReader {
} else if ((state&COMMENT)==COMMENT) { // similar to Quote is being in a comment
switch(c) {
case '-':
- switch(state) { // XML has a complicated Quote set... <!-- --> ... we keep track if each has been met with flags.
+ switch(state) { // XML has a complicated Quote set... <!-- --> ... we keep track if each has been met with flags.
case COMMENT|COMMENT_E:
state|=COMMENT_D1;
break;
@@ -259,7 +259,7 @@ public class XReader {
}
} else { // Normal Tag Processing loop
switch(c) {
- case '?':
+ case '?':
switch(state & (QUESTION_F|QUESTION)) { // Validate the state of Doc tag... <?xml ... ?>
case QUESTION_F:
state |= DOC_TYPE;
@@ -273,7 +273,7 @@ public class XReader {
}
break;
case '!':
- if (last=='<') {
+ if (last=='<') {
state|=COMMENT|COMMENT_E; // likely a comment, continue processing in Comment Loop
}
baos.write(c);
@@ -321,7 +321,7 @@ public class XReader {
// Fallthrough ok
default:
baos.write(c); // write any unprocessed bytes into buffer
-
+
}
}
last = c;
@@ -338,12 +338,12 @@ public class XReader {
/**
* getNSS
- *
+ *
* If the tag contains some Namespace attributes, create a new nss from the passed in one, copy all into it, then add
* This provides Scoping behavior
- *
+ *
* if Nss is null in the first place, create an new nss, so we don't have to deal with null Maps.
- *
+ *
* @param nss
* @param t
* @return
@@ -374,10 +374,10 @@ public class XReader {
/**
* The result of the parseTag method
- *
+ *
* Data is split up into prefix, name and value portions. "Tags" with Values that are inside a Tag are known in XLM
- * as Attributes.
- *
+ * as Attributes.
+ *
* @author Jonathan
*
*/
@@ -390,7 +390,7 @@ public class XReader {
this.prefix = prefix;
this.name = name;
this.value = value;
- attribs = null;
+ attribs = null;
}
/**
@@ -404,7 +404,7 @@ public class XReader {
}
attribs.add(attrib);
}
-
+
public String toString() {
StringBuffer sb = new StringBuffer();
if (prefix!=null) {
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java
index b275790c..270a4af5 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java
@@ -95,7 +95,7 @@ public class JU_Get {
@SuppressWarnings("unused")
private String thrower = null;
- public TestBean() { }
+ public TestBean() { }
public String getProperty1() { return property1; }
public void setProperty1(final String value) { this.property1 = value; }
public String getProperty2() { return property2; }
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java
index 2be51ece..7ea8e6fc 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MapBathConverter.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,7 +45,7 @@ import junit.framework.Assert;
/**
* Test a simple Migration conversion tool for CADI
- *
+ *
* @author Instrumental(Jonathan)
*
*/
@@ -62,19 +62,19 @@ public class JU_MapBathConverter {
public static void createFile() throws IOException {
// Note, you cate a "MapBathConverter" by access to a File.
// We will create that file now. Local is fine.
- csv = new CSV(access,"JU_MapBathConverter.csv");
+ csv = new CSV(access,"JU_MapBathConverter.csv");
}
-
+
@BeforeClass
public static void beforeClass() {
expected = new ArrayList<>();
}
-
+
@Before
public void before() {
expected.clear();
}
-
+
@Test
public void test() throws IOException, CadiException {
CSV.Writer cw = csv.writer();
@@ -88,14 +88,14 @@ public class JU_MapBathConverter {
// Style 1 - Incoming ID/pass, create new cred with NweID and same Pass
cw.row(exp(bath(OLD_ID,SHARED_PASS)), exp(NEW_USER_SOMETHING_ORG),sdf.format(gc.getTime()));
// the response should be Basic with NEW_ID and OLD_PASS
-
+
// Style 2
cw.row(exp(bath(OLD_ID,"OLD_PASS")), exp(bath(NEW_USER_SOMETHING_ORG,"NEW_PASS")),sdf.format(gc.getTime()));
} finally {
cw.close();
}
-
+
final Iterator<String> exp = expected.iterator();
csv.visit(new Visitor() {
@Override
@@ -120,7 +120,7 @@ public class JU_MapBathConverter {
}
}
});
-
+
MapBathConverter mbc = new MapBathConverter(access, csv);
// Check no lookup just returns the same
@@ -128,12 +128,12 @@ public class JU_MapBathConverter {
Iterator<String> exp1 = expected.iterator();
// there's no passwords in CSV
- String old = exp1.next();
+ String old = exp1.next();
String nw = exp1.next();
Assert.assertEquals(nw, mbc.convert(access,old));
-
+
Assert.assertEquals(bath(NEW_USER_SOMETHING_ORG,SHARED_PASS), mbc.convert(access,bath(OLD_ID,SHARED_PASS)));
-
+
// Style 1 (new cred, old password)
old = exp1.next();
nw = bath(exp1.next(),SHARED_PASS);
@@ -162,7 +162,7 @@ public class JU_MapBathConverter {
} finally {
cw.close();
}
-
+
try {
new MapBathConverter(access, csv);
Assert.fail("Invalid Data should throw Exception");
@@ -184,7 +184,7 @@ public class JU_MapBathConverter {
} finally {
cw.close();
}
-
+
try {
new MapBathConverter(access, csv);
Assert.fail("file with too few rows should throw exception");
@@ -205,7 +205,7 @@ public class JU_MapBathConverter {
Assert.assertTrue("Correctly thrown Exception",true);
}
}
-
+
@Test
public void testBadRows() throws IOException {
try {
@@ -215,7 +215,7 @@ public class JU_MapBathConverter {
} finally {
cw.close();
}
-
+
try {
new MapBathConverter(access,csv);
Assert.fail("Non Existent File should throw exception");
@@ -225,11 +225,11 @@ public class JU_MapBathConverter {
} finally {
csv.delete();
}
-
- // Check for deletion
+
+ // Check for deletion
Assert.assertFalse(csv.toString() + "should have been deleted",new File(csv.toString()).exists());
}
-
+
private String bath(String user, String password) throws IOException {
StringBuilder sb = new StringBuilder(user);
sb.append(':');
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java
index 1fe6a753..3b3461c1 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_RegistrationPropHolder.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,10 +46,10 @@ public class JU_RegistrationPropHolder {
rph = new RegistrationPropHolder(pa,20);
} catch (CadiException e) {
Assert.assertEquals(
- "\ncadi_latitude must be defined." +
+ "\ncadi_latitude must be defined." +
"\ncadi_longitude must be defined.",e.getMessage());
}
-
+
try {
pa.setProperty(Config.CADI_LATITUDE, "32.7");
rph = new RegistrationPropHolder(pa,20);
@@ -57,10 +57,10 @@ public class JU_RegistrationPropHolder {
Assert.assertEquals(
"\ncadi_longitude must be defined.",e.getMessage());
}
-
+
pa.setProperty(Config.CADI_LONGITUDE, "-72.0");
rph = new RegistrationPropHolder(pa,ju_port);
-
+
////////////////
// Validate Default Properties
////////////////
@@ -107,21 +107,21 @@ public class JU_RegistrationPropHolder {
final String url = "https://aaf.osaaf.org:8095/org.osaaf.aaf.service:2.1";
String name="theName";
assertEquals(url,rph.replacements(getClass().getSimpleName(),url, name, ""));
-
+
String alu = "aaf.osaaf.org:8095";
String curl = url.replace(alu, Config.AAF_LOCATE_URL_TAG);
pa.setProperty(Config.AAF_LOCATE_URL,"https://"+alu);
assertEquals(url.replace("8095","8095/locate"),rph.replacements(getClass().getSimpleName(),curl, name, ""));
-
+
String root_ns = "org.osaaf.aaf";
curl = url.replace(root_ns, "AAF_NS");
pa.setProperty(Config.AAF_ROOT_NS,root_ns);
assertEquals(url,rph.replacements(getClass().getSimpleName(),curl, name, ""));
-
+
curl = url.replace(root_ns, "%AAF_NS");
pa.setProperty(Config.AAF_ROOT_NS,root_ns);
assertEquals(url,rph.replacements(getClass().getSimpleName(),curl, name, ""));
-
+
final String fqdn = "%C.%CNS.%NS.%N";
String target = "myns.theName";
assertEquals(target,rph.replacements(getClass().getSimpleName(),fqdn, name, ""));
@@ -129,11 +129,11 @@ public class JU_RegistrationPropHolder {
pa.setProperty(Config.AAF_LOCATOR_CONTAINER_NS+".hello", "mycontns");
target = "mycontns.myns.theName";
assertEquals(target,rph.replacements(getClass().getSimpleName(),fqdn, name, ".hello"));
-
+
pa.setProperty(Config.AAF_LOCATOR_CONTAINER+".hello","helloC");
target = "helloC.mycontns.myns.theName";
assertEquals(target,rph.replacements(getClass().getSimpleName(),fqdn, name, ".hello"));
-
+
pa.setProperty(Config.AAF_LOCATOR_CONTAINER_NS,"c_ns");
target = "c_ns.myns.theName";
assertEquals(target,rph.replacements(getClass().getSimpleName(),fqdn, name, ""));
@@ -144,6 +144,6 @@ public class JU_RegistrationPropHolder {
Assert.fail();
}
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java
index 98c1a292..7d34aab7 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,16 +45,16 @@ import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.config.SecurityInfo;
public class JU_SecurityInfo {
-
+
private static PropAccess access;
-
+
private static final String keyStoreFileName = "src/test/resources/keystore.p12";
private static final String keyStorePassword = "Password for the keystore";
private static final String keyPassword = "Password for the key";
-
+
private static final String trustStoreFileName = "src/test/resources/truststore.jks";
private static final String trustStorePasswd = "Password for the truststore";
-
+
@BeforeClass
public static void setupOnce() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
@@ -65,7 +65,7 @@ public class JU_SecurityInfo {
trustStore.load(null, null);
trustStore.store(new FileOutputStream(trustStoreFileName), trustStorePasswd.toCharArray());
}
-
+
@Before
public void setup() throws IOException {
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
@@ -73,7 +73,7 @@ public class JU_SecurityInfo {
access.setProperty(Config.CADI_KEYSTORE, keyStoreFileName);
access.setProperty(Config.CADI_KEYSTORE_PASSWORD, access.encrypt(keyStorePassword));
access.setProperty(Config.CADI_KEY_PASSWORD, access.encrypt(keyPassword));
-
+
access.setProperty(Config.CADI_TRUSTSTORE, trustStoreFileName);
access.setProperty(Config.CADI_TRUSTSTORE_PASSWORD, access.encrypt(trustStorePasswd));
}
@@ -97,7 +97,7 @@ public class JU_SecurityInfo {
assertNotNull(si.getSSLSocketFactory());
assertNotNull(si.getSSLContext());
assertNotNull(si.getKeyManagers());
-
+
access.setProperty(Config.CADI_TRUST_MASKS, "123.123.123.123");
si = new SecurityInfo(access);
}
@@ -115,8 +115,8 @@ public class JU_SecurityInfo {
@SuppressWarnings("unused")
SecurityInfo si = new SecurityInfo(access);
}
-
-
+
+
@Test(expected = NumberFormatException.class)
public void badTrustMaskTest() throws CadiException {
access.setProperty(Config.CADI_TRUST_MASKS, "trustMask");
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java
index da99f9ac..6826c2fb 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java
@@ -75,7 +75,7 @@ public class JU_SecurityInfoC {
// SecurityInfoC<HttpURLConnection> siClone = SecurityInfoC.instance(new PropAccess(), HttpURLConnection.class);
// assertThat(siClone, is(si));
// }
-
+
@Test
public void setTest() throws MalformedURLException, CadiException {
SecurityInfoC<HttpURLConnectionStub> si = SecurityInfoC.instance(new PropAccess(), HttpURLConnectionStub.class);
@@ -95,9 +95,9 @@ public class JU_SecurityInfoC {
}
public static class HttpURLConnectionStub extends HttpURLConnection {
- public HttpURLConnectionStub() throws MalformedURLException { super(new URL("http://www.example.com")); }
- @Override public void disconnect() { }
- @Override public boolean usingProxy() { return false; }
+ public HttpURLConnectionStub() throws MalformedURLException { super(new URL("http://www.example.com")); }
+ @Override public void disconnect() { }
+ @Override public boolean usingProxy() { return false; }
@Override public void connect() throws IOException { }
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java b/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java
index 78b0fbc6..418fa1eb 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_PathFilter.java
@@ -48,16 +48,16 @@ import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.filter.PathFilter;
public class JU_PathFilter {
-
+
private PropAccess access;
-
+
@Mock private FilterConfig filterConfigMock;
@Mock private ServletContext contextMock;
@Mock private HttpServletRequest reqMock;
@Mock private HttpServletResponse respMock;
@Mock private FilterChain chainMock;
@Mock private Principal princMock;
-
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
@@ -77,28 +77,28 @@ public class JU_PathFilter {
} catch (ServletException e) {
assertThat(e.getMessage(), is("PathFilter - pathfilter_ns is not set"));
}
-
+
when(contextMock.getAttribute(Config.PATHFILTER_NS)).thenReturn(5);
when(contextMock.getAttribute(Config.PATHFILTER_STACK)).thenReturn(5);
when(contextMock.getAttribute(Config.PATHFILTER_URLPATTERN)).thenReturn(5);
when(contextMock.getAttribute(Config.PATHFILTER_NOT_AUTHORIZED_MSG)).thenReturn(5);
pathFilter.init(filterConfigMock);
-
+
pathFilter.doFilter(reqMock, respMock, chainMock);
when(reqMock.isUserInRole(anyString())).thenReturn(true);
pathFilter.doFilter(reqMock, respMock, chainMock);
-
+
pathFilter.destroy();
pathFilter = new PathFilter();
pathFilter.init(filterConfigMock);
-
+
pathFilter.doFilter(reqMock, respMock, chainMock);
when(reqMock.isUserInRole(anyString())).thenReturn(false);
pathFilter.doFilter(reqMock, respMock, chainMock);
-
+
pathFilter.destroy();
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java
index b37a38a1..22525419 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java
@@ -7,9 +7,9 @@
* * 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.
@@ -40,7 +40,7 @@ public class JU_ConfigPrincipal {
private final String b64encoded = "VXNlcjpwYXNz";
private Field content_field;
-
+
@Before
public void setup() throws NoSuchFieldException {
content_field = ConfigPrincipal.class.getDeclaredField("content");
@@ -50,7 +50,7 @@ public class JU_ConfigPrincipal {
@Test
public void testConfigPrincipalStringString() throws IOException, IllegalArgumentException, IllegalAccessException {
ConfigPrincipal p = new ConfigPrincipal(name, pass);
-
+
assertThat(p.getName(), is(name));
assertThat(p.toString(), is(name));
assertThat(p.getCred(), is(pass.getBytes()));
@@ -65,7 +65,7 @@ public class JU_ConfigPrincipal {
@Test
public void testConfigPrincipalStringByteArray() throws IOException, IllegalArgumentException, IllegalAccessException {
ConfigPrincipal p = new ConfigPrincipal(name, pass.getBytes());
-
+
assertThat(p.getName(), is(name));
assertThat(p.toString(), is(name));
assertThat(p.getCred(), is(pass.getBytes()));
@@ -76,5 +76,5 @@ public class JU_ConfigPrincipal {
// One more time for coverage purposes
assertThat(p.getAsBasicAuthHeader(), is("Basic " + b64encoded));
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
index 9ed5fd1e..c3e5cb67 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
@@ -104,14 +104,14 @@ public class JU_LocalLur {
info = lur.dumpInfo();
assertThat(info.size(), is(1));
assertThat(info.get(0).user, is("user1@domain"));
-
+
when(permMock.getKey()).thenReturn("groupA");
assertThat(lur.handlesExclusively(permMock), is(true));
when(permMock.getKey()).thenReturn("groupB");
assertThat(lur.handlesExclusively(permMock), is(false));
-
+
assertThat(lur.fish(null, null), is(false));
-
+
Principal princ = new ConfigPrincipal("user1@localized", encrypted);
lur = new LocalLur(access, "user1@localized%" + password + ":groupA", null);
@@ -124,9 +124,9 @@ public class JU_LocalLur {
princ = new ConfigPrincipal("user1@localized", "badpass");
assertThat(lur.fish(princ, lur.createPerm("groupB")), is(false));
-
+
assertThat(lur.handles(null), is(false));
-
+
lur.fishAll(null, null);
List<Permission> perms = new ArrayList<>();
@@ -136,7 +136,7 @@ public class JU_LocalLur {
lur.fishAll(princ, perms);
princ = new ConfigPrincipal("user1@localized", "badpass");
lur.fishAll(princ, perms);
-
+
assertThat(lur.validate(null, null, null, null), is(false));
assertThat(lur.validate("user", null, "badpass".getBytes(), null), is(false));
assertThat(lur.validate("user1@localized", null, encrypted.getBytes(), null), is(false));
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
index e67e096f..7356dbb7 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java
index 5b780c9a..eb96a168 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java
index 04b9367b..b69eb3ec 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java
index c9623fb9..6ca74e27 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java
index a76e01f7..4ea3694c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java
index 3dfe8d86..eb3afa35 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java
index ed1ae4c9..1162b0eb 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java
index 60fc88e2..efba241c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java
index ea45c128..6e02988b 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java
index 641545ca..35a27e45 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/basic/test/JU_BasicHttpTafResp.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
index 47d8f8d1..7154ab60 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
@@ -68,7 +68,7 @@ public class JU_DenialOfServiceTaf {
private File dosIDFile;
private File dosDir;
private final String dosDirName = "test";
-
+
private final String id1 = "id1";
private final String id2 = "id2";
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java
index b9b7b16d..034e974e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTafResp.java
@@ -1,5 +1,5 @@
/**
- *
+ *
* ============LICENSE_START====================================================
* org.onap.aaf
* ===========================================================================
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java
index 4dba8edb..86ecb903 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_AbsTafResp.java
@@ -7,9 +7,9 @@
* * 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.
@@ -39,15 +39,15 @@ import org.onap.aaf.cadi.taf.AbsTafResp;
import org.onap.aaf.cadi.taf.TafResp.RESP;
public class JU_AbsTafResp {
-
+
private static final String JUNIT = "Junit";
private static final String name = "name";
private static final String tag = "tag";
private static final String description = "description";
-
+
private Access access;
private TaggedPrincipal taggedPrinc;
-
+
@Before
public void setup() {
access = new PropAccess(new PrintStream(new ByteArrayOutputStream()), new String[0]);
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
index 8e103893..0e988f2d 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
@@ -7,9 +7,9 @@
* * 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.
@@ -71,16 +71,16 @@ public class JU_EpiTaf {
}
class TryAnotherTafResp implements TafResp {
- @Override public boolean isValid() { return false; }
- @Override public String desc() { return null; }
- @Override public RESP isAuthenticated() { return RESP.TRY_ANOTHER_TAF; }
- @Override public RESP authenticate() throws IOException { return null; }
- @Override public TaggedPrincipal getPrincipal() { return null; }
+ @Override public boolean isValid() { return false; }
+ @Override public String desc() { return null; }
+ @Override public RESP isAuthenticated() { return RESP.TRY_ANOTHER_TAF; }
+ @Override public RESP authenticate() throws IOException { return null; }
+ @Override public TaggedPrincipal getPrincipal() { return null; }
@Override public String getTarget() {return "unknown";}
- @Override public Access getAccess() { return null; }
+ @Override public Access getAccess() { return null; }
@Override public boolean isFailedAttempt() { return false; }
@Override public float timing() { return 0; }
- @Override public void timing(long start) {}
+ @Override public void timing(long start) {}
@Override public String taf() {return "JUnit";}
}
@@ -89,16 +89,16 @@ public class JU_EpiTaf {
}
class TryAuthenticatingResp implements TafResp {
- @Override public boolean isValid() { return false; }
- @Override public String desc() { return null; }
- @Override public RESP isAuthenticated() { return RESP.TRY_AUTHENTICATING; }
- @Override public RESP authenticate() throws IOException { return null; }
- @Override public TaggedPrincipal getPrincipal() { return null; }
+ @Override public boolean isValid() { return false; }
+ @Override public String desc() { return null; }
+ @Override public RESP isAuthenticated() { return RESP.TRY_AUTHENTICATING; }
+ @Override public RESP authenticate() throws IOException { return null; }
+ @Override public TaggedPrincipal getPrincipal() { return null; }
@Override public String getTarget() {return "unknown";}
- @Override public Access getAccess() { return null; }
- @Override public boolean isFailedAttempt() { return false; }
+ @Override public Access getAccess() { return null; }
+ @Override public boolean isFailedAttempt() { return false; }
@Override public float timing() { return 0; }
- @Override public void timing(long start) {}
+ @Override public void timing(long start) {}
@Override public String taf() {return "JUnit";}
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java
index fdb152c0..df9404af 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java
@@ -7,9 +7,9 @@
* * 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.
@@ -43,21 +43,21 @@ public class JU_NullTaf {
TafResp singleton1 = nt.validate(null);
TafResp singleton2 = nt.validate(null, null, null);
Resp singleton3 = nt.revalidate(null, null);
-
+
assertThat(singleton1, is(singleton2));
-
+
assertFalse(singleton1.isValid());
-
+
assertThat(singleton1.isAuthenticated(), is(RESP.NO_FURTHER_PROCESSING));
-
+
assertThat(singleton1.desc(), is("All Authentication denied"));
-
+
assertThat(singleton1.authenticate(), is(RESP.NO_FURTHER_PROCESSING));
-
+
assertThat(singleton1.getPrincipal(), is(nullValue()));
-
+
assertThat(singleton1.getAccess(), is(Access.NULL));
-
+
assertTrue(singleton1.isFailedAttempt());
assertThat(singleton3, is(Resp.NOT_MINE));
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
index 316678ec..8b918321 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java
index 4b28d6a4..770d8931 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java
index 5a23062d..7bbc950f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java
index a3e0db0d..72dfc3e8 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AES.java
@@ -86,7 +86,7 @@ public class JU_AES {
byte[] encrypted = aes.encrypt(orig.getBytes());
byte[] decrypted = aes.decrypt(encrypted);
assertThat(new String(decrypted), is(orig));
-
+
Field aeskeySpec_field = AES.class.getDeclaredField("aeskeySpec");
aeskeySpec_field.setAccessible(true);
aeskeySpec_field.set(aes, null);
@@ -122,7 +122,7 @@ public class JU_AES {
CipherInputStream cisEncrypt;
CipherInputStream cisDecrypt;
-
+
// Test CipherInputStream
baisEncrypt = new ByteArrayInputStream(orig.getBytes());
cisEncrypt = aes.inputStream(baisEncrypt, true);
@@ -157,7 +157,7 @@ public class JU_AES {
CipherOutputStream cosEncrypt;
CipherOutputStream cosDecrypt;
-
+
// Test CipherOutputStream
baisEncrypt = new ByteArrayInputStream(orig.getBytes());
baosEncrypt = new ByteArrayOutputStream();
@@ -191,5 +191,5 @@ public class JU_AES {
os.write(buffer, 0, len);
}
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java
index 2146205a..b0c0dca7 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_BufferedCadiWrap.java
@@ -31,7 +31,7 @@ import org.mockito.MockitoAnnotations;
public class JU_BufferedCadiWrap {
@Mock
private HttpServletRequest request;
-
+
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java
index 294bb867..2aff33de 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java
@@ -7,9 +7,9 @@
* * 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.
@@ -33,7 +33,7 @@ public class JU_CadiException {
@Test
public void testCadiException() {
CadiException exception = new CadiException();
-
+
assertNotNull(exception);
}
@@ -58,11 +58,11 @@ public class JU_CadiException {
assertThat(exception.getMessage(), is("New Exception"));
}
-
+
@Test
public void testCadiException1() {
CadiException exception = new CadiException();
-
+
assertNotNull(exception);
}
@@ -87,11 +87,11 @@ public class JU_CadiException {
assertThat(exception.getMessage(), is("New Exception"));
}
-
+
@Test
public void testCadiException2() {
CadiException exception = new CadiException();
-
+
assertNotNull(exception);
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java
index 4f31a8f4..5f97481f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiWrap.java
@@ -7,9 +7,9 @@
* * 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.
@@ -52,13 +52,13 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
import org.onap.aaf.cadi.taf.TafResp;
public class JU_CadiWrap {
-
+
@Mock
private HttpServletRequest request;
-
+
@Mock
private TafResp tafResp;
-
+
@Mock
private TaggedPrincipal principle;
@@ -82,35 +82,35 @@ public class JU_CadiWrap {
public void testInstantiate() throws CadiException {
Access a = new PropAccess();
when(tafResp.getAccess()).thenReturn(a);
-
+
lur.fishAll(isA(Principal.class), (List<Permission>)isA(List.class));
-
+
EpiLur lur1 = new EpiLur(lur);
-
+
CadiWrap wrap = new CadiWrap(request, tafResp, lur1);
-
+
assertNull(wrap.getUserPrincipal());
assertNull(wrap.getRemoteUser());
assertNull(wrap.getUser());
assertEquals(wrap.getPermissions(principle).size(), 0);
assertTrue(wrap.access() instanceof PropAccess);
-
+
byte[] arr = {'1','2'};
wrap.setCred(arr);
-
+
assertEquals(arr, wrap.getCred());
-
+
wrap.setUser("User1");
assertEquals("User1", wrap.getUser());
-
+
wrap.invalidate("1");
assertFalse(wrap.isUserInRole(null));
-
+
wrap.set(tafResp, lur);
-
+
wrap.invalidate("2");
-
+
assertFalse(wrap.isUserInRole("User1"));
}
@@ -119,7 +119,7 @@ public class JU_CadiWrap {
Access a = new PropAccess();
when(tafResp.getAccess()).thenReturn(a);
when(tafResp.getPrincipal()).thenReturn(principle);
-
+
// Anonymous object for testing purposes
CachingLur<Permission> lur1 = new CachingLur<Permission>() {
@Override public Permission createPerm(String p) { return null; }
@@ -133,29 +133,29 @@ public class JU_CadiWrap {
@Override public void setDebug(String commaDelimIDsOrNull) { }
@Override public void clear(Principal p, StringBuilder sb) { }
};
-
+
MapPermConverter pc = new MapPermConverter();
-
+
CadiWrap wrap = new CadiWrap(request, tafResp, lur1, pc);
-
+
assertNotNull(wrap.getUserPrincipal());
assertNull(wrap.getRemoteUser());
assertNull(wrap.getUser());
-
+
byte[] arr = {'1','2'};
wrap.setCred(arr);
-
+
assertEquals(arr, wrap.getCred());
-
+
wrap.setUser("User1");
assertEquals("User1", wrap.getUser());
-
+
wrap.invalidate("1");
wrap.setPermConverter(new MapPermConverter());
-
+
assertTrue(wrap.getLur() instanceof CachingLur);
assertTrue(wrap.isUserInRole("User1"));
-
+
wrap.set(tafResp, lur);
assertFalse(wrap.isUserInRole("Perm1"));
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java
index 4c842915..f03f2b6e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Capacitor.java
@@ -7,9 +7,9 @@
* * 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.
@@ -34,7 +34,7 @@ import java.lang.reflect.*;
public class JU_Capacitor {
private Capacitor cap;
- public final static String TEST_DATA =
+ public final static String TEST_DATA =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" +
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" +
@@ -122,7 +122,7 @@ public class JU_Capacitor {
for (int i = 0; i < c.length; i += read) {
read = cap.read(c, i, Math.min(3, c.length-i));
}
- assertEquals(b, new String(c));
+ assertEquals(b, new String(c));
}
@Test
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
index 859f9a25..56b5538f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
@@ -82,7 +82,7 @@ public class JU_CmdLine {
fis.close();
}
}
-
+
@After
public void restoreStreams() throws IOException {
System.setOut(System.out);
@@ -189,7 +189,7 @@ public class JU_CmdLine {
CmdLine.main(new String[]{"passgen", String.valueOf(length)});
output = outContent.toString().trim();
assertThat(output.length(), is(length));
-
+
length = 5;
outContent.reset();
CmdLine.main(new String[]{"passgen", String.valueOf(length)});
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java
index 86d647e3..05abc7ed 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Hash.java
@@ -7,9 +7,9 @@
* * 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.
@@ -208,11 +208,11 @@ public class JU_Hash {
assertEquals(new String(new byte[] {(byte)0x0A, (byte)0xB0}), new String(output));
assertNull(Hash.fromHexNo0x("~~"));
}
-//
+//
// @Test
// public void aaf_941() throws Exception {
// // User notes: From reported error "aaf" not coded right
-//
-//
+//
+//
// }
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java
index bf79d74d..aa52225e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_LocatorException.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java
index 9ab2c98d..abb3397b 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_PropAccess.java
@@ -7,9 +7,9 @@
* * 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.
@@ -39,10 +39,10 @@ import java.util.Properties;
@SuppressWarnings("unused")
public class JU_PropAccess {
- // Note: We can't actually get coverage of the protected constructor -
+ // Note: We can't actually get coverage of the protected constructor -
// that will be done later, when testing the child class "ServletContextAccess"
-
-
+
+
@Test
public void ConstructorTest() throws Exception {
PropAccess prop = new PropAccess();
@@ -82,7 +82,7 @@ public class JU_PropAccess {
ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
pa.load(bais);
}
-
+
@Test
public void specialConversionsTest() throws Exception {
// Coverage tests
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java
index 104923c7..827a86ed 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_ServletContextAccess.java
@@ -7,9 +7,9 @@
* * 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.
@@ -50,7 +50,7 @@ public class JU_ServletContextAccess {
private FilterConfig filter_mock;
Enumeration<String> enumeration;
-
+
private class CustomEnumeration implements Enumeration<String> {
private int idx = 0;
private final String[] elements = {"This", "is", "a", "test"};
@@ -70,7 +70,7 @@ public class JU_ServletContextAccess {
filter_mock = mock(FilterConfig.class);
when(filter_mock.getInitParameterNames()).thenReturn(enumeration);
}
-
+
@Test
public void logTest() throws Exception {
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java
index 5e6f69b8..110f1034 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_Symm.java
@@ -107,7 +107,7 @@ public class JU_Symm {
String orig = "I'm a password, really";
String b64encrypted;
String output;
-
+
ByteArrayOutputStream baosEncrypt = new ByteArrayOutputStream();
Symm.base64.encode(orig, baosEncrypt);
b64encrypted = new String(baosEncrypt.toByteArray());
@@ -126,7 +126,7 @@ public class JU_Symm {
String output;
byte[] prefix = "enc:".getBytes();
-
+
ByteArrayInputStream baisEncrypt = new ByteArrayInputStream(orig.getBytes());
ByteArrayOutputStream baosEncrypt = new ByteArrayOutputStream();
Symm.base64.encode(baisEncrypt, baosEncrypt, prefix);
@@ -209,5 +209,5 @@ public class JU_Symm {
assertTrue(e.getMessage().contains(" does not exist!"));
}
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java
index 3df12f80..2bb9882f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java
@@ -7,9 +7,9 @@
* * 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.
@@ -55,16 +55,16 @@ public class JU_User {
@Mock
private Principal principal;
-
+
@Mock
private LocalPermission permission;
@Mock
private LocalPermission permission2;
-
+
@Before
public void setup() throws NoSuchFieldException, SecurityException {
MockitoAnnotations.initMocks(this);
-
+
when(principal.getName()).thenReturn("Principal");
when(permission.getKey()).thenReturn("NewKey");
@@ -98,7 +98,7 @@ public class JU_User {
assertThat((int)count_field.get(user), is(0));
assertThat(user.getCred(), is(cred.getBytes()));
}
-
+
@Test
public void constructorPrincipalIntervalTest() throws IllegalArgumentException, IllegalAccessException {
User<Permission> user = new User<Permission>(principal, 61 * SECOND);
@@ -133,7 +133,7 @@ public class JU_User {
user.resetCount();
assertThat((int)count_field.get(user), is(0));
}
-
+
@Test
public void permTest() throws InterruptedException, IllegalArgumentException, IllegalAccessException {
User<Permission> user = new User<Permission>(principal);
@@ -155,32 +155,32 @@ public class JU_User {
assertTrue(user.permsUnloaded());
assertTrue(user.noPerms());
}
-
+
@Test
public void addValuesToNewMapTest() {
User<Permission> user = new User<Permission>(principal);
Map<String, Permission> newMap = new HashMap<>();
-
+
assertFalse(user.contains(permission));
-
+
user.add(newMap, permission);
user.setMap(newMap);
-
+
assertTrue(user.contains(permission));
-
+
List<Permission> sink = new ArrayList<>();
user.copyPermsTo(sink);
-
+
assertThat(sink.size(), is(1));
assertTrue(sink.contains(permission));
-
+
assertThat(user.toString(), is("Principal|:NewKey"));
user.add(newMap, permission2);
user.setMap(newMap);
assertFalse(user.contains(permission2));
-
+
assertThat(user.toString(), is("Principal|:NewKey2,NewKey"));
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java
index d4feac6f..1681f435 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_CSV.java
@@ -7,9 +7,9 @@
* 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.
@@ -52,7 +52,7 @@ public class JU_CSV {
filename = "Sample.csv";
file = new File(filename);
}
-
+
@After
public void end() {
if(file!=null) {
@@ -64,7 +64,7 @@ public class JU_CSV {
public static void before() {
expected = new ArrayList<>();
}
-
+
@Test
public void test() throws IOException, CadiException {
Access access = new PropAccess();
@@ -78,7 +78,7 @@ public class JU_CSV {
} catch(IOException e) {
Assert.assertTrue("CSV correctly created exception",true);
}
-
+
Writer writer = csv.writer();
try {
writer.row(add("\"hello\""));
@@ -89,7 +89,7 @@ public class JU_CSV {
} finally {
writer.close();
}
-
+
PrintStream garbage = new PrintStream(new FileOutputStream(file, true));
try {
garbage.println("# Ignore empty spaces, etc");
@@ -100,8 +100,8 @@ public class JU_CSV {
garbage.close();
}
-
- ////////////
+
+ ////////////
// Tests
////////////
final Holder<Integer> hi = new Holder<>(0);
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java
index 6e93cc53..148f2e5c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java
@@ -6,9 +6,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java
index 3daa6cb7..30a5f65c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java
index b3d7797c..2203b07f 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java
index ba03b6b1..41ca0715 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java
index b37d03ae..3676e12e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java
@@ -6,9 +6,9 @@
* * 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.
@@ -39,25 +39,25 @@ public class JU_NetMask {
String test = "1.2.3.4";
assertEquals(NetMask.derive(test.getBytes()), 0);
}
-
+
@Test
public void deriveTest3() {
String test = "1.2.4";
assertEquals(NetMask.derive(test.getBytes()), 0);
}
-
+
@Test
public void deriveTest4() {
String test = "1.3.4";
assertEquals(NetMask.derive(test.getBytes()), 0);
}
-
+
@Test
public void deriveTest5() {
String test = "2.3.4";
assertEquals(NetMask.derive(test.getBytes()), 0);
}
-
+
@Test
public void deriveTest6() {
String test = "3.4";
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java
index e4f1e013..230c6b3b 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java
@@ -6,9 +6,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java
index cbaa545b..fb2ed0ed 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java
@@ -6,9 +6,9 @@
* * 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.
@@ -104,7 +104,7 @@ public class JU_Split {
assertThat(Split.splitTrim('c', null, 0).length, is(0));
}
-
+
@Test
public void coverageTest() {
@SuppressWarnings("unused")
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java
index cff4b414..8c1597c0 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java
@@ -6,9 +6,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java
index da131255..ad63d5ad 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java
@@ -6,9 +6,9 @@
* * 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.
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java
index f9c4cf73..0ddbb479 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java
@@ -6,9 +6,9 @@
* * 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.
@@ -30,7 +30,7 @@ import org.junit.Test;
import org.onap.aaf.cadi.util.Vars;
public class JU_Vars {
-
+
@Test
public void coverage() {
@SuppressWarnings("unused")
@@ -70,7 +70,7 @@ public class JU_Vars {
assertEquals(str,Vars.convert(holder,bstr="set %s to %s", "a","b"));
assertEquals("set a to b",holder.toString());
assertEquals(str,Vars.convert(null,bstr, "a","b"));
-
+
holder.setLength(0);
assertEquals(str = "%1=%2",Vars.convert(holder,str, "a","b"));
assertEquals("a=b",holder.toString());
@@ -79,7 +79,7 @@ public class JU_Vars {
assertEquals(str,Vars.convert(holder,bstr="%s=%s", "a","b"));
assertEquals("a=b",holder.toString());
assertEquals(str,Vars.convert(null,bstr, "a","b"));
-
+
holder.setLength(0);
assertEquals(str = "%1%2",Vars.convert(holder,str, "a","b"));
assertEquals("ab",holder.toString());
@@ -107,7 +107,7 @@ public class JU_Vars {
assertEquals(str=" %1%2%3 ",Vars.convert(holder,bstr = " %s%s%s ", "a","b","c","d","e","f","g","h","i","j"));
assertEquals(" abc ",holder.toString());
assertEquals(str,Vars.convert(null,bstr, "a","b","c","d","e","f","g","h","i","j"));
-
+
holder.setLength(0);
assertEquals(str = "set %1 to %2",Vars.convert(holder,str, "Something much","larger"));
@@ -122,8 +122,8 @@ public class JU_Vars {
assertEquals(str = "Text without Vars",Vars.convert(holder,str));
assertEquals(str,holder.toString());
assertEquals(str = "Text without Vars",Vars.convert(null,str));
-
-
+
+
holder.setLength(0);
assertEquals(str = "Not %1 Enough %2 Vars %3",Vars.convert(holder,str, "a","b"));
assertEquals("Not a Enough b Vars ",holder.toString());
@@ -143,7 +143,7 @@ public class JU_Vars {
str = "%1 !@#$%^*()-+?/,:;.";
assertEquals(str,Vars.convert(holder,bstr, "Not Acceptable"));
assertEquals("Not Acceptable !@#$%^*()-+?/,:;.",holder.toString());
- assertEquals(str ,Vars.convert(null,bstr, "Not Acceptable"));
+ assertEquals(str ,Vars.convert(null,bstr, "Not Acceptable"));
}
-
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java
index 5f880403..b9bd1268 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSEParser.java
@@ -7,9 +7,9 @@
* * 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.
@@ -37,9 +37,9 @@ public class JU_WSSEParser {
// private String user;
// private byte[] password;
//
-// public void setUser(String user) { this.user = user; }
+// public void setUser(String user) { this.user = user; }
// public void setCred(byte[] passwd) { this.password = passwd; }
-// public String getUser() { return user; }
+// public String getUser() { return user; }
// public byte[] getCred() { return password; }
// };
@@ -58,7 +58,7 @@ public class JU_WSSEParser {
// System.out.println("CadiWrap credentials are: " + bc.getUser() + ", " + password);
// assertEquals("some_user", bc.getUser());
// assertEquals("some_password", password);
-//
+//
// } finally {
// fis.close();
// }
@@ -78,7 +78,7 @@ public class JU_WSSEParser {
// System.out.println("CadiWrap credentials are: " + bc.getUser() + ", " + password);
// assertEquals("none", bc.getUser());
// assertEquals("none", password);
-//
+//
// } finally {
// fis.close();
// }
@@ -121,8 +121,8 @@ public class JU_WSSEParser {
//
// e = wp.parse(bc, new ByteArrayInputStream("".getBytes())); // empty
// assertNotNull(e);
-//
-//
+//
+//
// long start, count = 0L;
// int iter = 30000;
// File f = new File("test/CBUSevent.xml");
@@ -146,9 +146,9 @@ public class JU_WSSEParser {
// }
// float ms = count/1000000f;
// System.out.println("Executed " + iter + " WSSE reads from Memory Stream in " + ms + "ms. " + ms/iter + "ms per trans");
-//
+//
// // SPECIFIC ISSUES
-//
+//
// fis = new FileInputStream("test/error2013_04_23.xml");
// try {
// bc.setCred(null);
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java
index 248f73b7..a88aecf5 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java
@@ -7,9 +7,9 @@
* * 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.
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java
index 2a1ecdeb..6bdda4e0 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/ClientFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,7 +41,7 @@ public class ClientFactory {
throw new CadiException(e);
}
}
-
+
public ClientFactory(String[] args) throws APIException, CadiException {
this(new PropAccess(args));
}
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java
index 107e1d89..2b1003cb 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/RESTException.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ import org.onap.aaf.cadi.client.Future;
public class RESTException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = -5232371598208651058L;
private Future<?> future;
@@ -32,11 +32,11 @@ public class RESTException extends Exception {
public RESTException(Future<?> future) {
this.future = future;
}
-
+
public int getCode() {
return future.code();
}
-
+
public String getMsg() {
return future.body();
}
@@ -61,6 +61,6 @@ public class RESTException extends Exception {
public String getLocalizedMessage() {
return errorString();
}
-
+
}
diff --git a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
index c2deb458..3b7ab032 100644
--- a/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
+++ b/cadi/oauth-enduser/src/main/java/org/onap/aaf/cadi/enduser/SimpleRESTClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,18 +56,18 @@ public class SimpleRESTClient {
public String[] headers() {
return EMPTY;
}};
-
+
public SimpleRESTClient(final TokenClientFactory tcf, final String tokenURL, final String endpoint, final String[] scope) throws CadiException, LocatorException, APIException {
callTimeout = Integer.parseInt(tcf.access.getProperty(Config.AAF_CALL_TIMEOUT,Config.AAF_CALL_TIMEOUT_DEF));
tokenClient = tcf.newClient(tokenURL);
Result<TimedToken> rtt = tokenClient.getToken(scope);
if (rtt.isOK()) {
restClient = tcf.newTzClient(endpoint);
-
+
if ((client_id = tcf.access.getProperty(Config.AAF_APPID, null))==null) {
if ((client_id = tcf.access.getProperty(Config.CADI_ALIAS, null))==null) {
throw new CadiException(Config.AAF_APPID + " or " + Config.CADI_ALIAS + " needs to be defined");
- }
+ }
}
try {
restClient.setToken(client_id,rtt.value);
@@ -78,7 +78,7 @@ public class SimpleRESTClient {
throw new CadiException(rtt.error);
}
}
-
+
public SimpleRESTClient timeout(int newTimeout) {
callTimeout = newTimeout;
return this;
@@ -98,7 +98,7 @@ public class SimpleRESTClient {
}
return this;
}
-
+
/**
* Single Threaded Class for building up content
* @author Instrumental
@@ -109,24 +109,24 @@ public class SimpleRESTClient {
private String content;
private StringBuilder sb;
-
+
public Input() {
content = null;
sb = null;
}
-
+
public Input(final String content) {
this.content = content;
}
-
+
public void set(final String content) {
this.content = content;
}
-
+
public PrintWriter writer() {
return new PrintWriter(new StringBuilderWriter(builder()));
}
-
+
public StringBuilder builder() {
if (sb==null) {
sb = new StringBuilder();
@@ -134,7 +134,7 @@ public class SimpleRESTClient {
}
return sb;
}
-
+
/**
* Reuse StringBuilder object
*/
@@ -144,7 +144,7 @@ public class SimpleRESTClient {
sb.setLength(0);
}
}
-
+
@Override
public String toString() {
if (content!=null) {
@@ -162,7 +162,7 @@ public class SimpleRESTClient {
if (sb==null) {
rv = EMPTY_STREAM_BYTES;
} else {
- rv = sb.toString().getBytes();
+ rv = sb.toString().getBytes();
}
} else {
rv = content.getBytes();
@@ -173,7 +173,7 @@ public class SimpleRESTClient {
}
/////////////////////////////////////////////////////////////
- //
+ //
// CREATE
//
/////////////////////////////////////////////////////////////
@@ -194,11 +194,11 @@ public class SimpleRESTClient {
});
if (!future.get(callTimeout)) {
throw new RESTException(future);
- }
+ }
}
/////////////////////////////////////////////////////////////
- //
+ //
// READ
//
/////////////////////////////////////////////////////////////
@@ -221,11 +221,11 @@ public class SimpleRESTClient {
return future.value;
} else {
throw new RESTException(future);
- }
+ }
}
-
+
/////////////////////////////////////////////////////////////
- //
+ //
// UPDATE
//
/////////////////////////////////////////////////////////////
@@ -249,18 +249,18 @@ public class SimpleRESTClient {
return future.value;
} else {
throw new RESTException(future);
- }
+ }
}
/////////////////////////////////////////////////////////////
- //
+ //
// DELETE
//
/////////////////////////////////////////////////////////////
public void delete(final String path) throws RESTException, CadiException, LocatorException, APIException {
delete(path,APPLICATION_JSON);
}
-
+
public void delete(final String path, final String contentType) throws RESTException, CadiException, LocatorException, APIException {
Future<Void> future = restClient.best(new Retryable<Future<Void>>() {
@Override
@@ -270,17 +270,17 @@ public class SimpleRESTClient {
});
if (!future.get(callTimeout)) {
throw new RESTException(future);
- }
+ }
}
/////////////////////////////////////////////////////////////
-
+
private static class ETransfer implements EClient.Transfer {
private Input input;
public ETransfer(final Input input) {
this.input = input;
}
-
+
@Override
public void transfer(OutputStream os) throws IOException, APIException {
os.write(input.getBytes());
@@ -290,7 +290,7 @@ public class SimpleRESTClient {
public interface Headers {
String[] headers();
}
-
+
public String[] headers() {
if (chain==null) {
return headers.headers();
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
index d0c800bf..0dec0999 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OAuthExample.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,14 +56,14 @@ public class OAuthExample {
public final static void main(final String args[]) {
// These Objects are expected to be Long-Lived... Construct once
-
+
// Property Access
- // This method will allow you to set "cadi_prop_files" (or any other property) on Command line
+ // This method will allow you to set "cadi_prop_files" (or any other property) on Command line
access = new PropAccess(args);
-
+
// access = PropAccess();
// Note: This style will load "cadi_prop_files" from VM Args
-
+
// Token aware Client Factory
try {
tcf = TokenClientFactory.instance(access);
@@ -71,8 +71,8 @@ public class OAuthExample {
access.log(e1, "Unable to setup OAuth Client Factory, Fail Fast");
System.exit(1);
}
-
-
+
+
// Obtain Endpoints for OAuth2 from Properties. Expected is "cadi.properties" file, pointed to by "cadi_prop_files"
try {
Map<String, String> aaf_urls = Agent.loadURLs(access);
@@ -81,9 +81,9 @@ public class OAuthExample {
String tokenIntrospectURL = access.getProperty(Config.AAF_OAUTH2_INTROSPECT_URL); // Default to AAF);
// Get Hello Service
final String endServicesURL = access.getProperty(Config.AAF_OAUTH2_HELLO_URL);
-
+
final int CALL_TIMEOUT = Integer.parseInt(access.getProperty(Config.AAF_CALL_TIMEOUT,Config.AAF_CALL_TIMEOUT_DEF));
-
+
//////////////////////////////////////////////////////////////////////
// Scenario 1:
// Get and use an OAuth Client, which understands Token Management
@@ -93,7 +93,7 @@ public class OAuthExample {
TokenClient tc = tcf.newClient(tokenServiceURL); // can set your own timeout here (url, timeoutMilliseconds)
// Set your Application (MicroService, whatever) Credentials here
- // These are how your Application is known, particularly to the OAuth Server.
+ // These are how your Application is known, particularly to the OAuth Server.
// If AAF Token server, then its just the same as your other AAF MechID creds
// If it is the Alternate OAUTH, you'll need THOSE credentials. See that tool's Onboarding procedures.
String client_id = access.getProperty(Config.AAF_APPID);
@@ -103,7 +103,7 @@ public class OAuthExample {
}
String client_secret = access.getProperty(Config.AAF_APPPASS);
tc.client_creds(client_id, client_secret);
-
+
// If you are working with Credentials the End User, set username/password as appropriate to the OAuth Server
// tc.password(end_user_id, end_user_password);
// IMPORTANT:
@@ -114,7 +114,7 @@ public class OAuthExample {
// With AAF, the Scopes you put in are the AAF Namespaces you want access to. Your Token will contain the
// AAF Permissions of the Namespaces (you can put in more than one), the user name (or client_id if no user_name),
// is allowed to see.
-
+
// Here's a trick to get the namespace out of a Fully Qualified AAF Identity (your MechID)
String ns = FQI.reverseDomain(client_id);
System.out.printf("\nNote: The AAF Namespace of FQI (Fully Qualified Identity) %s is %s\n\n",client_id, ns);
@@ -122,23 +122,23 @@ public class OAuthExample {
// Now, we can get a Token. Note: for "scope", use AAF Namespaces to get AAF Permissions embedded in
// Note: getToken checks if Token is expired, if so, then refreshes before handing back.
Result<TimedToken> rtt = tc.getToken(ns,"org.onap.test");
-
+
// Note: you can clear a Token's Disk/Memory presence by
// 1) removing the Token from the "token/outgoing" directory on the O/S
// 2) programmatically by calling "clearToken" with exact params as "getToken", when it has the same credentials set
// tc.clearToken("org.onap.aaf","org.onap.test");
-
+
// Result Object can be queried for success
if (rtt.isOK()) {
TimedToken token = rtt.value;
print(token); // Take a look at what's in a Token
-
+
// Use this Token in your client calls with "Tokenized Client" (TzClient)
// These should NOT be used cross thread.
TzClient helloClient = tcf.newTzClient(endServicesURL);
helloClient.setToken(client_id, token);
-
- // This client call style, "best" call with "Retryable" inner class covers finding an available Service
+
+ // This client call style, "best" call with "Retryable" inner class covers finding an available Service
// (when Multi-services exist) for the best service, based (currently) on distance.
//
// the "Generic" in Type gives a Return Value for the Code, which you can set on the "best" method
@@ -149,20 +149,20 @@ public class OAuthExample {
Future<String> future = client.read("hello","text/plain");
// The "future" calling method allows you to do other processing, such as call more than one backend
// client before picking up the result
- // If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
+ // If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
if (future.get(CALL_TIMEOUT)) {
// Client Returned expected value
return future.value;
} else {
throw new APIException(future.code() + future.body());
- }
+ }
}
});
-
+
// You want to do something with returned value. Here, we say "hello"
System.out.printf("\nPositive Response from Hello: %s\n",rv);
-
-
+
+
//////////////////////////////////////////////////////////////////////
// Scenario 2:
// As a Service, read Introspection information as proof of Authenticated Authorization
@@ -187,12 +187,12 @@ public class OAuthExample {
} else {
access.printf(Level.ERROR, "Unable to obtain OAuth Token: %d %s\n",rtt.code,rtt.error);
}
-
+
} catch (CadiException | LocatorException | APIException | IOException e) {
e.printStackTrace();
}
}
-
+
/////////////////////////////////////////////////////////////
// Examples of Object Access
/////////////////////////////////////////////////////////////
@@ -207,7 +207,7 @@ public class OAuthExample {
t.getScope(),
t.getRefreshToken());
}
-
+
private static void print(Introspect ti) {
if (ti==null || ti.getClientId()==null) {
System.out.println("Empty Introspect");
@@ -232,7 +232,7 @@ public class OAuthExample {
Chrono.timeStamp(exp),
ti.getScope(),
ti.getContent()==null?"":ti.getContent());
-
+
System.out.println();
}
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
index b8cce9e5..2d489f83 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/OnapClientExample.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,25 +56,25 @@ public class OnapClientExample {
public final static void main(final String args[]) {
// These Objects are expected to be Long-Lived... Construct once
-
+
// Property Access
- // This method will allow you to set "cadi_prop_files" (or any other property) on Command line
+ // This method will allow you to set "cadi_prop_files" (or any other property) on Command line
access = new PropAccess(args);
// Note: This style will load "cadi_prop_files" from VM Args
// access = PropAccess();
try {
Map<String, String> aaf_urls = Agent.loadURLs(access);
Agent.fillMissing(access, aaf_urls);
-
+
// Token aware Client Factory
tcf = TokenClientFactory.instance(access);
} catch (APIException | GeneralSecurityException | IOException | CadiException e1) {
access.log(e1, "Unable to setup OAuth Client Factory, Fail Fast");
System.exit(1);
}
-
+
final int CALL_TIMEOUT = Integer.parseInt(access.getProperty(Config.AAF_CALL_TIMEOUT,Config.AAF_CALL_TIMEOUT_DEF));
-
+
try {
//////////////////////////////////////////////////////////////////////
// Scenario 1:
@@ -84,7 +84,7 @@ public class OnapClientExample {
// In this example, it is AAF, but it can be the Alternate OAuth
TokenClient tc = tcf.newClient(Config.AAF_OAUTH2_TOKEN_URL); // can set your own timeout here (url, timeoutMilliseconds)
-
+
// Here's a trick to get the namespace out of a Fully Qualified AAF Identity (your MechID)
String ns = FQI.reverseDomain(tc.client_id());
System.out.printf("\nNote: The AAF Namespace of FQI (Fully Qualified Identity) %s is %s\n\n",tc.client_id(), ns);
@@ -92,17 +92,17 @@ public class OnapClientExample {
// Now, we can get a Token. Note: for "scope", use AAF Namespaces to get AAF Permissions embedded in
// Note: getToken checks if Token is expired, if so, then refreshes before handing back.
Result<TimedToken> rtt = tc.getToken(ns,"org.onap.test"); // get multiple scopes
-
+
// Note: you can clear a Token's Disk/Memory presence by
// 1) removing the Token from the "token/outgoing" directory on the O/S
// 2) programmatically by calling "clearToken" with exact params as "getToken", when it has the same credentials set
// tc.clearToken("org.onap.aaf","org.onap.test");
-
+
// Result Object can be queried for success
if (rtt.isOK()) {
TimedToken token = rtt.value;
print(token); // Take a look at what's in a Token
-
+
// Use this Token in your client calls with "Tokenized Client" (TzClient)
// These should NOT be used cross thread.
// Get Hello Service URL... roll your own in your own world.
@@ -111,8 +111,8 @@ public class OnapClientExample {
TzClient helloClient = tcf.newTzClient(endServicesURL);
helloClient.setToken(tc.client_id(), token);
-
- // This client call style, "best" call with "Retryable" inner class covers finding an available Service
+
+ // This client call style, "best" call with "Retryable" inner class covers finding an available Service
// (when Multi-services exist) for the best service, based (currently) on distance.
//
// the "Generic" in Type gives a Return Value for the Code, which you can set on the "best" method
@@ -123,20 +123,20 @@ public class OnapClientExample {
Future<String> future = client.read("hello","text/plain");
// The "future" calling method allows you to do other processing, such as call more than one backend
// client before picking up the result
- // If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
+ // If "get" matches the HTTP Code for the method (i.e. read HTTP Return value is 200), then
if (future.get(CALL_TIMEOUT)) {
// Client Returned expected value
return future.value;
} else {
throw new APIException(future.code() + future.body());
- }
+ }
}
});
-
+
// You want to do something with returned value. Here, we say "hello"
System.out.printf("\nPositive Response from Hello: %s\n",rv);
-
-
+
+
//////////////////////////////////////////////////////////////////////
// Scenario 2:
// As a Service, read Introspection information as proof of Authenticated Authorization
@@ -160,12 +160,12 @@ public class OnapClientExample {
} else {
access.printf(Level.ERROR, "Unable to obtain OAuth Token: %d %s\n",rtt.code,rtt.error);
}
-
+
} catch (CadiException | LocatorException | APIException | IOException e) {
e.printStackTrace();
}
}
-
+
/////////////////////////////////////////////////////////////
// Examples of Object Access
/////////////////////////////////////////////////////////////
@@ -180,7 +180,7 @@ public class OnapClientExample {
t.getScope(),
t.getRefreshToken());
}
-
+
private static void print(Introspect ti) {
if (ti==null || ti.getClientId()==null) {
System.out.println("Empty Introspect");
@@ -205,7 +205,7 @@ public class OnapClientExample {
Chrono.timeStamp(exp),
ti.getScope(),
ti.getContent()==null?"":ti.getContent());
-
+
System.out.println();
}
diff --git a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java
index dc1824fc..c15e434d 100644
--- a/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java
+++ b/cadi/oauth-enduser/src/test/java/org/onap/aaf/cadi/enduser/test/SimpleRestClientExample.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,29 +39,29 @@ public class SimpleRestClientExample {
try {
// Note: Expect ClientFactory to be long-lived... do NOT create more than once.
ClientFactory cf = new ClientFactory(args);
-
-
+
+
String urlString = cf.getAccess().getProperty("myurl", null);
if (urlString==null) {
System.out.println("Note: In your startup, add \"myurl=https://<aaf hello machine>:8130\" to command line\n\t"
- + "OR\n\t"
+ + "OR\n\t"
+ " add -Dmyurl=https://<aaf hello machine>:8130 to VM Args\n\t"
+ "where \"aaf hello machine\" is an aaf Installation you know about.");
} else {
-
+
SimpleRESTClient restClient = cf.simpleRESTClient(urlString,"org.osaaf.aaf");
/////////////////////////////////////////////////////////////
- //
+ //
// Creating Content for CREATE/UPDATE
//
/////////////////////////////////////////////////////////////
// Create an object that can be reusable IN THIS THREAD ONLY... Not Thread-safe on purpose
Input input = new SimpleRESTClient.Input();
-
+
// Note: alternate use is to set the input object to an already created String
// Input input = new SimpleRESTClient.Input(aString);
-
+
PrintWriter pw = input.writer();
pw.print("{\"something\": [");
for (int i=0;i<4;++i) {
@@ -73,16 +73,16 @@ public class SimpleRestClientExample {
pw.print('}');
}
pw.println("]}");
-
+
// You can check or log the content
String content = input.toString();
System.out.println(content);
-
- // Good form for Writers is that you should close it...
+
+ // Good form for Writers is that you should close it...
pw.close();
/////////////////////////////////////////////////////////////
- //
+ //
// CREATE/POST
//
/////////////////////////////////////////////////////////////
@@ -100,7 +100,7 @@ public class SimpleRestClientExample {
/////////////////////////////////////////////////////////////
- //
+ //
// READ/GET
//
/////////////////////////////////////////////////////////////
@@ -110,24 +110,24 @@ public class SimpleRestClientExample {
System.out.println("-------- START REST READ/GET --------");
boolean expectException = false;
try {
-
+
// Call with no Queries
String rv = restClient.get("resthello/rest_id");
System.out.println(rv);
-
+
// Same call with "read" style
rv = restClient.read("resthello/rest_id");
System.out.println(rv);
-
-
+
+
// Call with Queries
rv = restClient.get("resthello/rest_id?perm=org.osaaf.people|*|read");
System.out.println(rv);
-
+
// Call setting ID from principal coming from Trans
// Pretend Transaction
HRequest req = new HRequest("demo@people.osaaf.org"); // Pretend Trans has Jonathan as Identity
-
+
// Call with RESTException, which allows obtaining HTTPCode and any Error message sent
rv = restClient.endUser(req.userPrincipal()).get("resthello/rest_id?perm=org.osaaf.people|*|read");
System.out.println(rv);
@@ -150,17 +150,17 @@ public class SimpleRestClientExample {
}
/////////////////////////////////////////////////////////////
- //
+ //
// UPDATE/PUT
//
/////////////////////////////////////////////////////////////
-
+
// If you use "input" object again as a writer, you can clear it on the same thread, and go again
input.clear();
// Here we just set to a String, instead of Writing
input.set("{\"something\" : []}");
-
+
System.out.println("-------- END REST UPDATE/PUT --------");
try {
String rv = restClient.update("resthello/rest_id", input);
@@ -175,7 +175,7 @@ public class SimpleRestClientExample {
}
/////////////////////////////////////////////////////////////
- //
+ //
// DELETE
//
/////////////////////////////////////////////////////////////
@@ -191,14 +191,14 @@ public class SimpleRestClientExample {
} finally {
System.out.println("-------- END REST DELETE --------");
}
- }
+ }
} catch (CadiException | APIException e) {
e.printStackTrace();
}
}
-
- private static class HRequest {
-
+
+ private static class HRequest {
+
public HRequest(String fqi) {
name = fqi;
}
@@ -212,7 +212,7 @@ public class SimpleRestClientExample {
public String getName() {
return name;
}
-
+
};
}
}
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java
index adb95d9b..8c3a1336 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/MyServlet.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,15 +40,15 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
// @RolesAllowed({"com.att.aaf.myPerm|myInstance|myAction"})
public class MyServlet implements Servlet {
private ServletConfig servletConfig;
-
+
public void init(ServletConfig config) throws ServletException {
servletConfig = config;
}
-
+
public ServletConfig getServletConfig() {
return servletConfig;
}
-
+
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
HttpServletRequest request;
try {
@@ -56,27 +56,27 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
} catch (ClassCastException e) {
throw new ServletException("Only serving HTTP today",e);
}
-
+
res.getOutputStream().println("<html><header><title>CSP Servlet Test</title></header><body><h1>You're good to go!</h1><pre>" +
request.getUserPrincipal());
-
+
String perm = request.getParameter("PERM");
if (perm!=null) {
if (request.isUserInRole(perm)) {
- if (perm.indexOf('|')<0) {
+ if (perm.indexOf('|')<0) {
res.getOutputStream().println("\nCongrats!, You are in Role " + perm);
- } else {
+ } else {
res.getOutputStream().println("\nCongrats!, You have Permission " + perm);
}
} else {
- if (perm.indexOf('|')<0) {
+ if (perm.indexOf('|')<0) {
res.getOutputStream().println("\nSorry, you are NOT in Role " + perm);
} else {
res.getOutputStream().println("\nSorry, you do NOT have Permission " + perm);
}
}
}
-
+
// You can get the working AAFCon from Trans
AAFCon<?> aafcon = AAFCon.obtain(req);
if (aafcon!=null) {
@@ -115,13 +115,13 @@ import org.onap.aaf.cadi.principal.TaggedPrincipal;
res.getOutputStream().println("No AAFCon instantiated");
}
res.getOutputStream().print("</pre></body></html>");
-
+
}
-
+
public String getServletInfo() {
return "MyServlet";
}
-
+
public void destroy() {
}
} \ No newline at end of file
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java
index a45725d7..9f1c450f 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/Config.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,13 +33,13 @@ import org.onap.aaf.cadi.filter.CadiFilter;
public class Config {
/**
* Method to make jetty configurations (others?) with more complex function possible
- *
+ *
* @param sc
*/
public static final void addToContext(WebAppContext sc, String propFile) {
sc.addFilter(CadiFilter.class,"/*",EnumSet.of(DispatcherType.REQUEST));
sc.setInitParameter(org.onap.aaf.cadi.config.Config.CADI_PROP_FILES, propFile);
}
-
+
}
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java
index 165acffb..4800e133 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyServletServer.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,7 +43,7 @@ import org.onap.aaf.cadi.config.SecurityInfo;
import org.onap.aaf.cadi.filter.CadiFilter;
public abstract class JettyServletServer implements Servlet {
-
+
public static Server run(PropAccess access, String context, Class<? extends Servlet> servletCls, int port, String ...args) throws Exception {
// Defaults:
int blockingQueueSize = 10;
@@ -54,12 +54,12 @@ public abstract class JettyServletServer implements Servlet {
if (hostname==null) {
hostname = Inet4Address.getLocalHost().getHostName();
}
-
+
// Add your own Properties to override defaults
ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(blockingQueueSize);
QueuedThreadPool pool = new QueuedThreadPool(maxPoolSize,corePoolSize,keepAliveTime,queue);
- Server server = new Server(pool);
+ Server server = new Server(pool);
String protocol;
if (access.getProperty(Config.CADI_KEYSTORE_PASSWORD,null)==null) {
@@ -74,26 +74,26 @@ public abstract class JettyServletServer implements Servlet {
SslContextFactory scf = new SslContextFactory();
scf.setSslContext(securityInfo.getSSLContext());
scf.setWantClientAuth(true);
- ServerConnector sslConnector = new ServerConnector(server,scf);
+ ServerConnector sslConnector = new ServerConnector(server,scf);
sslConnector.setHost(hostname);
sslConnector.setPort(port);
server.addConnector(sslConnector);
protocol = "https";
}
-
+
// Setup Sample Servlet
CadiFilter cf = new CadiFilter(true,access);
FilterHolder cfh = new FilterHolder(cf);
-
+
ServletHandler shand = new ServletHandler();
shand.addFilterWithMapping(cfh, "/*", FilterMapping.ALL);
// To use normal Servlets, just add the class here... Actually, bug in Jetty... need to add with ServletHolder
ServletHolder sh = new ServletHolder();
sh.setServlet(servletCls.newInstance());
shand.addServletWithMapping(sh,"/*");
-
+
// To use JASPI Authorization Style to protect the servlet, wrap the Servlet
- // with the "MiniJSAPIWrap class, as shown here. Then add "@RolesAllowed" on your
+ // with the "MiniJSAPIWrap class, as shown here. Then add "@RolesAllowed" on your
// servlet (see sample). Use Pipe delimited Permissions, not AAF Roles in the line
// shand.addServletWithMapping(new MiniJASPIWrap(MyServlet.class),"/*");
// call initialize after start
@@ -104,7 +104,7 @@ public abstract class JettyServletServer implements Servlet {
// Startup the Server
server.setStopAtShutdown(true);
server.start();
-
+
access.log(Level.INFO,"TestServlet is running at " + protocol + "://"+hostname+':'+port+context);
return server;
}
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java
index 6edd6f5b..81b8f20b 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/JettyStandalone.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,7 +40,7 @@ public class JettyStandalone {
} finally {
access.log(Level.INFO,"Stopping Service");
}
-
- }
+
+ }
}
diff --git a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java
index 4d170f3f..2d34fa4c 100644
--- a/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java
+++ b/cadi/servlet-sample/src/main/java/org/onap/aaf/sample/cadi/jetty/MiniJASPIWrap.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,11 +39,11 @@ import org.onap.aaf.cadi.filter.RolesAllowed;
/**
* MiniJASPIWrap
- *
+ *
* Support the ability to check JASPI Annotation Style Authorizations.
- *
+ *
* This can be a clean way to enforce API Authorization without mistakes in code.
- *
+ *
* @author JonathanGathman
*
*/
@@ -67,9 +67,9 @@ public class MiniJASPIWrap extends ServletHolder {
/**
* handle
- *
+ *
* When utilized, this class authorizes the transaction by first calling the standard J2EE API call
- * "isUserInRole" with the role(s) found in the class Annotations (JASPI Style)
+ * "isUserInRole" with the role(s) found in the class Annotations (JASPI Style)
*/
@Override
public void handle(Request baseRequest, ServletRequest request, ServletResponse response) throws ServletException, UnavailableException, IOException {
@@ -77,7 +77,7 @@ public class MiniJASPIWrap extends ServletHolder {
super.handle(baseRequest, request, response);
} else { // Validate
try {
-
+
HttpServletRequest hreq = (HttpServletRequest)request;
boolean proceed = false;
for (String role : rolesAllowed.value()) {
@@ -95,7 +95,7 @@ public class MiniJASPIWrap extends ServletHolder {
} catch (ClassCastException e) {
throw new ServletException("JASPIWrap only supports HTTPServletRequest/HttpServletResponse");
}
- }
+ }
}
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java
index f5de5d7d..e6c95db8 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java
@@ -38,7 +38,13 @@ import javax.xml.datatype.XMLGregorianCalendar;
public class Chrono {
private static final long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH = 0x01b21dd213814000L;
- public final static DateFormat dateFmt, dateOnlyFmt, niceDateFmt, utcFmt, niceUTCDateFmt, iso8601Fmt;
+ public final static DateFormat dateFmt;
+ public final static DateFormat dateOnlyFmt;
+ public final static DateFormat niceDateFmt;
+ public final static DateFormat utcFmt;
+ public final static DateFormat niceUTCDateFmt;
+ public final static DateFormat iso8601Fmt;
+ public final static DateFormat batchFmt;
// Give general access to XML DataType Factory, since it's pretty common
public static final DatatypeFactory xmlDatatypeFactory;
@@ -56,6 +62,7 @@ public class Chrono {
niceUTCDateFmt = new SimpleDateFormat("yyyy/MM/dd HH:mm zzz");
niceUTCDateFmt.setTimeZone(TimeZone.getTimeZone("UTC"));
iso8601Fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
+ batchFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS");
}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java b/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java
index 688e11b8..d9cda923 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java
@@ -7,9 +7,9 @@
* 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.
@@ -19,10 +19,10 @@
*
*/
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2018.12.09 at 10:14:23 PM IST
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2018.12.09 at 10:14:23 PM IST
//
@@ -39,9 +39,9 @@ import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
- *
+ *
* <p>The following schema fragment specifies the expected content contained within this class.
- *
+ *
* <pre>
* &lt;complexType>
* &lt;complexContent>
@@ -70,8 +70,8 @@ import javax.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
- *
- *
+ *
+ *
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
@@ -84,25 +84,25 @@ public class Api {
/**
* Gets the value of the route property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the route property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getRoute().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link Api.Route }
- *
- *
+ *
+ *
*/
public List<Api.Route> getRoute() {
if (route == null) {
@@ -114,9 +114,9 @@ public class Api {
/**
* <p>Java class for anonymous complex type.
- *
+ *
* <p>The following schema fragment specifies the expected content contained within this class.
- *
+ *
* <pre>
* &lt;complexType>
* &lt;complexContent>
@@ -135,8 +135,8 @@ public class Api {
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
- *
- *
+ *
+ *
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
@@ -166,11 +166,11 @@ public class Api {
/**
* Gets the value of the meth property.
- *
+ *
* @return
* possible object is
* {@link String }
- *
+ *
*/
public String getMeth() {
return meth;
@@ -178,11 +178,11 @@ public class Api {
/**
* Sets the value of the meth property.
- *
+ *
* @param value
* allowed object is
* {@link String }
- *
+ *
*/
public void setMeth(String value) {
this.meth = value;
@@ -190,11 +190,11 @@ public class Api {
/**
* Gets the value of the path property.
- *
+ *
* @return
* possible object is
* {@link String }
- *
+ *
*/
public String getPath() {
return path;
@@ -202,11 +202,11 @@ public class Api {
/**
* Sets the value of the path property.
- *
+ *
* @param value
* allowed object is
* {@link String }
- *
+ *
*/
public void setPath(String value) {
this.path = value;
@@ -214,25 +214,25 @@ public class Api {
/**
* Gets the value of the param property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the param property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getParam().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link String }
- *
- *
+ *
+ *
*/
public List<String> getParam() {
if (param == null) {
@@ -243,11 +243,11 @@ public class Api {
/**
* Gets the value of the desc property.
- *
+ *
* @return
* possible object is
* {@link String }
- *
+ *
*/
public String getDesc() {
return desc;
@@ -255,11 +255,11 @@ public class Api {
/**
* Sets the value of the desc property.
- *
+ *
* @param value
* allowed object is
* {@link String }
- *
+ *
*/
public void setDesc(String value) {
this.desc = value;
@@ -267,25 +267,25 @@ public class Api {
/**
* Gets the value of the comments property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the comments property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getComments().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link String }
- *
- *
+ *
+ *
*/
public List<String> getComments() {
if (comments == null) {
@@ -296,25 +296,25 @@ public class Api {
/**
* Gets the value of the contentType property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the contentType property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getContentType().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link String }
- *
- *
+ *
+ *
*/
public List<String> getContentType() {
if (contentType == null) {
@@ -325,7 +325,7 @@ public class Api {
/**
* Gets the value of the expected property.
- *
+ *
*/
public int getExpected() {
return expected;
@@ -333,7 +333,7 @@ public class Api {
/**
* Sets the value of the expected property.
- *
+ *
*/
public void setExpected(int value) {
this.expected = value;
@@ -341,25 +341,25 @@ public class Api {
/**
* Gets the value of the explicitErr property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the explicitErr property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getExplicitErr().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link Integer }
- *
- *
+ *
+ *
*/
public List<Integer> getExplicitErr() {
if (explicitErr == null) {
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java
index 15049dcd..e7ae3a35 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,7 +34,7 @@ public class JU_BaseDataFactory {
public void setUp() throws Exception {
initMocks(this);
}
-
+
@Test
public void testGenSchemaException() {
Store env = Mockito.mock(Store.class);
@@ -45,7 +45,7 @@ public class JU_BaseDataFactory {
assertTrue(e.getLocalizedMessage().contains("does not exist. You can set this with"));
}
}
-
+
@Test
public void testGenSchemaXsdException() {
Store env = Mockito.mock(Store.class);
@@ -57,7 +57,7 @@ public class JU_BaseDataFactory {
assertTrue(e.getLocalizedMessage().contains("for schema validation"));
}
}
-
+
@Test
public void testGenSchemaNoException() {
Store env = Mockito.mock(Store.class);
@@ -69,7 +69,7 @@ public class JU_BaseDataFactory {
e.printStackTrace();
}
}
-
+
@Test
public void testGetQName() {
String[] schemaFIles = new String[] {"../../auth-client/src/main/xsd/aaf_2_0.xsd"};
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java
index a3063f73..a1c684f0 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,7 +50,7 @@ public class JU_JavaUtilLogTarget {
public void testLoggable() {
JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level);
boolean retVal = logObj.isLoggable();
-
+
assertFalse(retVal);
}
@@ -61,22 +61,22 @@ public class JU_JavaUtilLogTarget {
logObj.log(new Object[] {"test","test2",""});
Mockito.doReturn(true).when(log).isLoggable(level);
logObj.log(new Object[] {"test","test2",""});
-
+
}
-
+
@Test
public void testLogThrowable() {
JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level);
-
+
Mockito.doReturn(true).when(log).isLoggable(level);
logObj.log(new Throwable("test exception"), new Object[] {"test","test2",""});
logObj.log(new Throwable(), new Object[] {"test","test2",""});
}
-
+
@Test
public void testPrintf() {
JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level);
-
+
Mockito.doReturn(true).when(log).isLoggable(level);
logObj.printf("test", new Object[] {"test","test2",""});
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java
index ed75f4cb..1d0b29d7 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,8 +36,8 @@ public class JU_NullLifeCycle {
lifeCycleObj.threadPrestart(null);
lifeCycleObj.refresh(null);
}catch(APIException a) {
-
+
}
}
-
+
} \ No newline at end of file
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java
index e1e7d0e9..df54f0e4 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,25 +41,25 @@ public class JU_AbsTrans {
@Mock
Env delegate;
-
+
@Mock
BasicEnv delegate1;
-
+
@Mock
LogTarget lt;
-
+
@Before
public void setUp() {
initMocks(this);
}
-
+
class AbsTransImpl extends AbsTrans{
public AbsTransImpl(Env delegate) {
super(delegate);
// TODO Auto-generated constructor stub
}
-
+
public AbsTransImpl(BasicEnv delegate) {
super(delegate);
// TODO Auto-generated constructor stub
@@ -111,17 +111,17 @@ public class JU_AbsTrans {
protected TimeTaken newTimeTaken(String name, int flag, Object ... values) {
// TODO Auto-generated method stub
return new TimeTaken("nameTest", Env.XML) {
-
+
@Override
public void output(StringBuilder sb) {
// TODO Auto-generated method stub
-
+
}
};
}
-
+
}
-
+
@Test
public void testFatal() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -129,7 +129,7 @@ public class JU_AbsTrans {
LogTarget lt = absTransObj.fatal();
assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testError() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -137,7 +137,7 @@ public class JU_AbsTrans {
LogTarget lt = absTransObj.error();
assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testAudit() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -145,7 +145,7 @@ public class JU_AbsTrans {
LogTarget lt = absTransObj.audit();
assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testInit() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -153,7 +153,7 @@ public class JU_AbsTrans {
LogTarget lt = absTransObj.init();
assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testWarn() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -161,7 +161,7 @@ public class JU_AbsTrans {
LogTarget lt = absTransObj.warn();
assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testInfo() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -169,7 +169,7 @@ public class JU_AbsTrans {
LogTarget lt = absTransObj.info();
assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testDebug() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -177,7 +177,7 @@ public class JU_AbsTrans {
LogTarget lt = absTransObj.debug();
assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testTrace() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -185,28 +185,28 @@ public class JU_AbsTrans {
LogTarget lt = absTransObj.trace();
assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testStart() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
TimeTaken lt = absTransObj.start("test",1);
assertEquals("nameTest", lt.name);
}
-
+
@Test
public void testCheckpint() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
absTransObj.checkpoint("test");
assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name);
}
-
+
@Test
public void testCheckpintAddFlag() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
absTransObj.checkpoint("test",1);
assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name);
}
-
+
@Test
public void testAuditTrailWithEmptyTrail() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -215,7 +215,7 @@ public class JU_AbsTrans {
absTransObj.auditTrail(1, new StringBuilder(), 1);
//assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name);
}
-
+
@Test
public void testAuditTrail() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -228,7 +228,7 @@ public class JU_AbsTrans {
absTransObj.auditTrail(1, new StringBuilder(), 2);
//assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name);
}
-
+
@Test
public void testAuditTrailLoggableFalse() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -241,7 +241,7 @@ public class JU_AbsTrans {
absTransObj.auditTrail(1, new StringBuilder(), 1);
//assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name);
}
-
+
@Test
public void testAuditTrailNullSB() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -254,7 +254,7 @@ public class JU_AbsTrans {
absTransObj.auditTrail(1, null, 1);
//assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name);
}
-
+
@Test
public void testAuditTrailEmpptyFlag() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate);
@@ -267,7 +267,7 @@ public class JU_AbsTrans {
absTransObj.auditTrail(1, null, new int[] {});
//assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name);
}
-
+
@Test
public void testPut() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate1);
@@ -277,7 +277,7 @@ public class JU_AbsTrans {
assertTrue(e instanceof NullPointerException);
}
}
-
+
@Test
public void testGet() {
AbsTransImpl absTransObj = new AbsTransImpl(delegate1);
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java
index f8b32451..727673f9 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,15 +44,15 @@ public class JU_AbsTransJaxb {
@Mock
EnvJAXB delegate;
-
+
@Mock
LogTarget lt;
-
+
@Before
public void setUp() {
initMocks(this);
}
-
+
class AbsTransJAXBImpl extends AbsTransJAXB{
public AbsTransJAXBImpl(EnvJAXB env) {
@@ -108,10 +108,10 @@ public class JU_AbsTransJaxb {
return null;
}
-
+
}
-
-
+
+
@Test
public void testNewDataFactory() {
AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate);
@@ -126,7 +126,7 @@ public class JU_AbsTransJaxb {
}
//assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testNewDataFactorySchema() {
AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate);
@@ -141,7 +141,7 @@ public class JU_AbsTransJaxb {
}
//assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testNewDataFactoryQname() {
AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate);
@@ -156,7 +156,7 @@ public class JU_AbsTransJaxb {
}
//assertTrue(lt instanceof LogTarget);
}
-
+
@Test
public void testNewDataFactorySchemaQname() {
AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate);
@@ -172,6 +172,6 @@ public class JU_AbsTransJaxb {
}
//assertTrue(lt instanceof LogTarget);
}
-
-
+
+
} \ No newline at end of file
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java
index b5101158..4c4db5c7 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java
@@ -47,8 +47,8 @@ public class JU_Log4JLogTargetTest {
@Test
public void testLoggable() {
- Logger l4jLogger = Logger.getLogger("testLogger");
- l4jLogger.setLevel(Level.DEBUG);
+ Logger l4jLogger = Logger.getLogger("testLogger");
+ l4jLogger.setLevel(Level.DEBUG);
Log4JLogTarget logObj = null;
try {
logObj = new Log4JLogTarget( "testLogger", Level.DEBUG);
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java
index 7952740b..30f42567 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,16 +50,16 @@ public class JU_JAXBDF {
@Mock
EnvJAXB primaryEnv;
-
+
@Mock
JAXBumar jumar;
-
+
@Mock
JAXBmar jmar;
-
+
@Mock
Env env;
-
+
TimeTaken tt,ttObjectify;
@Before
@@ -89,9 +89,9 @@ public class JU_JAXBDF {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
}
-
+
@Test
public void testNewInstanceNoException() {
JAXBDF<?> bdfObj = null;
@@ -101,10 +101,10 @@ public class JU_JAXBDF {
assertTrue(retVal instanceof JU_JAXBDF);
} catch (APIException e) {
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void testPrettyNoException() {
JAXBDF<?> bdfObj = null;
@@ -114,7 +114,7 @@ public class JU_JAXBDF {
assertTrue(retVal instanceof JAXBDF);
} catch (APIException e) {
e.printStackTrace();
- }
+ }
}
@Test
@@ -131,10 +131,10 @@ public class JU_JAXBDF {
bdfObj.serviceDestroy(null);
} catch (APIException e) {
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void testNewData() {
JAXBDF<?> bdfObj = null;
@@ -144,9 +144,9 @@ public class JU_JAXBDF {
assertTrue(retVal instanceof JAXBData);
} catch (APIException e) {
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testNewDataENV() {
JAXBDF<?> bdfObj = null;
@@ -156,9 +156,9 @@ public class JU_JAXBDF {
assertTrue(retVal instanceof JAXBData);
} catch (APIException e) {
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testNewDataType() {
JAXBDF<JAXBumar> bdfObj = null;
@@ -171,9 +171,9 @@ public class JU_JAXBDF {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testNewDataStream() {
JAXBDF<?> bdfObj = null;
@@ -191,9 +191,9 @@ public class JU_JAXBDF {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testNewDataStreamException() {
JAXBDF<?> bdfObj = null;
@@ -210,9 +210,9 @@ public class JU_JAXBDF {
} catch (JAXBException e) {
// TODO Auto-generated catch block
assertTrue(e.getMessage().contains("test"));
- }
+ }
}
-
+
@Test
public void testNewDataFromString() {
JAXBDF<?> bdfObj = null;
@@ -222,9 +222,9 @@ public class JU_JAXBDF {
assertTrue(retVal instanceof JAXBData);
} catch (APIException e) {
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testStringify() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -243,9 +243,9 @@ public class JU_JAXBDF {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testStringifyException() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -263,9 +263,9 @@ public class JU_JAXBDF {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
+ }
}
-
+
@Test
public void testStringifyWriter() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -283,9 +283,9 @@ public class JU_JAXBDF {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testStringifyWriterException() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -303,9 +303,9 @@ public class JU_JAXBDF {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
+ }
}
-
+
@Test
public void testStringifyOS() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -323,9 +323,9 @@ public class JU_JAXBDF {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testStringifyOsException() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -343,9 +343,9 @@ public class JU_JAXBDF {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
+ }
}
-
+
@Test
public void testStringifyOptions() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -363,9 +363,9 @@ public class JU_JAXBDF {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testStringifyOSOptions() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -383,9 +383,9 @@ public class JU_JAXBDF {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testStringifyOsOptionsException() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -403,7 +403,7 @@ public class JU_JAXBDF {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
+ }
}
@Test
public void testStringifySWOptions() {
@@ -422,9 +422,9 @@ public class JU_JAXBDF {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
+ }
}
-
+
@Test
public void testStringifySWOptionsException() {
JAXBDF<JAXBmar> bdfObj = null;
@@ -442,9 +442,9 @@ public class JU_JAXBDF {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
+ }
}
-
+
@Test
public void testObjectifyEnv() {
JAXBDF<JAXBumar> bdfObj = null;
@@ -456,14 +456,14 @@ public class JU_JAXBDF {
LogTarget logT = Mockito.mock(LogTarget.class);
Mockito.doReturn(logT).when(env).debug();
Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class));
-
+
bdfObj.objectify(env, Mockito.mock(StringReader.class));
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
@Test
public void testObjectifyEnvException() {
@@ -477,16 +477,16 @@ public class JU_JAXBDF {
Mockito.doReturn(logT).when(env).debug();
StringReader sr = Mockito.mock(StringReader.class);
Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr);
-
+
bdfObj.objectify(env, sr);
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyRdr() {
JAXBDF<JAXBumar> bdfObj = null;
@@ -498,14 +498,14 @@ public class JU_JAXBDF {
LogTarget logT = Mockito.mock(LogTarget.class);
Mockito.doReturn(logT).when(env).debug();
Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class));
-
+
bdfObj.objectify( Mockito.mock(StringReader.class));
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
@Test
public void testObjectifyRdrException() {
@@ -519,16 +519,16 @@ public class JU_JAXBDF {
Mockito.doReturn(logT).when(envJaxb).debug();
StringReader sr = Mockito.mock(StringReader.class);
Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr);
-
+
bdfObj.objectify(sr);
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyEnvIS() {
JAXBDF<JAXBumar> bdfObj = null;
@@ -540,14 +540,14 @@ public class JU_JAXBDF {
LogTarget logT = Mockito.mock(LogTarget.class);
Mockito.doReturn(logT).when(env).debug();
Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class));
-
+
bdfObj.objectify(env, Mockito.mock(InputStream.class));
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
@Test
public void testObjectifyEnvISException() {
@@ -561,16 +561,16 @@ public class JU_JAXBDF {
Mockito.doReturn(logT).when(env).debug();
InputStream sr = Mockito.mock(InputStream.class);
Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr);
-
+
bdfObj.objectify(env, sr);
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyIs() {
JAXBDF<JAXBumar> bdfObj = null;
@@ -582,14 +582,14 @@ public class JU_JAXBDF {
LogTarget logT = Mockito.mock(LogTarget.class);
Mockito.doReturn(logT).when(env).debug();
Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class));
-
+
bdfObj.objectify( Mockito.mock(InputStream.class));
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
@Test
public void testObjectifyIsException() {
@@ -603,16 +603,16 @@ public class JU_JAXBDF {
Mockito.doReturn(logT).when(envJaxb).debug();
InputStream sr = Mockito.mock(InputStream.class);
Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr);
-
+
bdfObj.objectify(sr);
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyEnvStr() {
JAXBDF<JAXBumar> bdfObj = null;
@@ -624,14 +624,14 @@ public class JU_JAXBDF {
LogTarget logT = Mockito.mock(LogTarget.class);
Mockito.doReturn(logT).when(env).debug();
Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test");
-
+
bdfObj.objectify(env, "test");
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
@Test
public void testObjectifyEnvStrException() {
@@ -645,16 +645,16 @@ public class JU_JAXBDF {
Mockito.doReturn(logT).when(env).debug();
InputStream sr = Mockito.mock(InputStream.class);
Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test");
-
+
bdfObj.objectify(env, "test");
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyStr() {
JAXBDF<JAXBumar> bdfObj = null;
@@ -666,14 +666,14 @@ public class JU_JAXBDF {
LogTarget logT = Mockito.mock(LogTarget.class);
Mockito.doReturn(logT).when(env).debug();
Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test");
-
+
bdfObj.objectify( "test");
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
@Test
public void testObjectifyStrException() {
@@ -687,28 +687,28 @@ public class JU_JAXBDF {
Mockito.doReturn(logT).when(envJaxb).debug();
InputStream sr = Mockito.mock(InputStream.class);
Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test");
-
+
bdfObj.objectify("test");
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
} catch (JAXBException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
-
+
@Test
public void testTypeClass() {
JAXBDF<JAXBumar> bdfObj = null;
try {
EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class);
bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()});
-
+
Object obj = bdfObj.getTypeClass();
assertFalse(obj instanceof JU_JAXBDF);
} catch (APIException e) {
assertTrue(e.getMessage().contains("test"));
- }
-
+ }
+
}
}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java
index 9330f18b..2c082c7d 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,17 +43,17 @@ public class JU_JAXBObjectifierTest {
@Mock
JAXBumar jumar;
-
+
@Mock
Schema schema;
-
+
@Mock
Env env;
-
+
TimeTaken tt,ttObjectify;
-
+
LogTarget logT;
-
+
@Before
public void setUp() {
initMocks(this);
@@ -77,10 +77,10 @@ public class JU_JAXBObjectifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyException() {
JAXBObjectifier<?> bdfObj = null;
@@ -93,10 +93,10 @@ public class JU_JAXBObjectifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyRdr() {
JAXBObjectifier<?> bdfObj = null;
@@ -110,10 +110,10 @@ public class JU_JAXBObjectifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyRdrException() {
JAXBObjectifier<?> bdfObj = null;
@@ -127,10 +127,10 @@ public class JU_JAXBObjectifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyIs() {
JAXBObjectifier<?> bdfObj = null;
@@ -143,10 +143,10 @@ public class JU_JAXBObjectifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void testObjectifyIsException() {
JAXBObjectifier<?> bdfObj = null;
@@ -160,10 +160,10 @@ public class JU_JAXBObjectifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void testEmptyMethods() {
JAXBObjectifier<?> bdfObj = null;
@@ -176,10 +176,10 @@ public class JU_JAXBObjectifierTest {
bdfObj.refresh(env);
} catch (APIException e) {
assertTrue(e.getMessage().contains("Test Exception"));
- }
-
+ }
+
}
-
+
@Test
public void testNewInstance() {
JAXBObjectifier<?> bdfObj = null;
@@ -187,7 +187,7 @@ public class JU_JAXBObjectifierTest {
bdfObj = new JAXBObjectifier(jumar);
Object retVal = bdfObj.newInstance();
Mockito.doThrow(new IllegalAccessException("Test Exception")).when(jumar).newInstance();
-
+
} catch (IllegalAccessException e) {
assertEquals("Test Exception", e.getLocalizedMessage());
} catch (APIException e) {
@@ -197,7 +197,7 @@ public class JU_JAXBObjectifierTest {
e.printStackTrace();
}
}
-
+
@Test
public void testNewInstanceException() {
JAXBObjectifier<?> bdfObj = null;
@@ -213,6 +213,6 @@ public class JU_JAXBObjectifierTest {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
}
}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java
index 84415fdb..86ef59b3 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,6 +18,7 @@
* ============LICENSE_END====================================================
*
*/
+
package org.onap.aaf.misc.env.jaxb;
import static org.junit.Assert.assertEquals;
@@ -44,17 +45,17 @@ public class JU_JAXBStringifierTest {
@Mock
JAXBmar jumar;
-
+
@Mock
QName qname;
-
+
@Mock
Env env;
-
+
TimeTaken tt,ttstringify;
-
+
LogTarget logT;
-
+
@Before
public void setUp() {
initMocks(this);
@@ -78,10 +79,10 @@ public class JU_JAXBStringifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void teststringifyWriter() {
JAXBStringifier<JAXBmar> bdfObj = null;
@@ -95,10 +96,10 @@ public class JU_JAXBStringifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void teststringifyWriterException() {
JAXBStringifier<JAXBmar> bdfObj = null;
@@ -112,10 +113,10 @@ public class JU_JAXBStringifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void teststringifyOs() {
JAXBStringifier<JAXBmar> bdfObj = null;
@@ -128,10 +129,10 @@ public class JU_JAXBStringifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void teststringifyOsException() {
JAXBStringifier<JAXBmar> bdfObj = null;
@@ -145,10 +146,10 @@ public class JU_JAXBStringifierTest {
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- }
-
+ }
+
}
-
+
@Test
public void testEmptyMethods() {
JAXBStringifier<JAXBmar> bdfObj = null;
@@ -161,10 +162,10 @@ public class JU_JAXBStringifierTest {
bdfObj.refresh(env);
} catch (APIException e) {
assertTrue(e.getMessage().contains("Test Exception"));
- }
-
+ }
+
}
-
+
@Test
public void testPretty() {
JAXBStringifier<JAXBmar> bdfObj = null;
@@ -173,7 +174,7 @@ public class JU_JAXBStringifierTest {
Object retVal = bdfObj.pretty(true);
assertTrue(retVal instanceof JAXBStringifier);
}
-
+
@Test
public void testNewInstanceException() {
JAXBStringifier<JAXBmar> bdfObj = null;
@@ -181,6 +182,6 @@ public class JU_JAXBStringifierTest {
Mockito.doReturn(jumar).when(jumar).asFragment(true);
Object retVal = bdfObj.asFragment(true);
assertTrue(retVal instanceof JAXBStringifier);
-
+
}
}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java
index 22c209c2..3623625a 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,19 +43,19 @@ import org.onap.aaf.misc.env.StaticSlot;
import org.onap.aaf.misc.env.StoreImpl;
import org.onap.aaf.misc.env.TimeTaken;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.class)
public class JU_StoreImplTest {
-
+
@Mock
QName qname;
-
+
@Mock
Env env;
-
+
TimeTaken tt,ttstringify;
-
+
LogTarget logT;
-
+
@Before
public void setUp() {
initMocks(this);
@@ -72,36 +72,36 @@ public class JU_StoreImplTest {
bdfObj = new StoreImpl("");
bdfObj.propsFromArgs(null, new String[] {"test"});
bdfObj.propsFromArgs("test", new String[] {"test","te=st","test=1"});
-
+
}
-
+
@Test
public void testMorePropsConstructor() {
Properties props = Mockito.mock(Properties.class);
new StoreImpl(null,props);
StoreImpl bdfObj = new StoreImpl("test",props);
}
-
+
@Test
public void testMorePropsFileNOtExists() {
Properties props = Mockito.mock(Properties.class);
Mockito.doReturn("test").when(props).getProperty("test");
StoreImpl bdfObj = new StoreImpl("test",props);
}
-
+
@Test
public void testMorePropsExists() {
Properties props = Mockito.mock(Properties.class);
Mockito.doReturn(System.getProperty("user.dir")+"/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java").when(props).getProperty("test");
StoreImpl bdfObj = new StoreImpl("test",props);
}
-
+
@Test
public void testNewTransState() {
StoreImpl bdfObj = new StoreImpl(null, new String[] {});
bdfObj.newTransState();
}
-
+
@Test
public void testSlot() {
StoreImpl bdfObj = new StoreImpl("test", new String[] {});
@@ -110,35 +110,35 @@ public class JU_StoreImplTest {
slot = bdfObj.slot("test");
assertEquals(slot.toString(),"test=1");
}
-
+
@Test
public void testExistingSlot() {
StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
Slot retVal = bdfObj.existingSlot("test");
assertNull(retVal);
}
-
+
@Test
public void testExistingSlotNames() {
StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
List<String> retVal = bdfObj.existingSlotNames();
assertTrue(retVal.size()==0);
}
-
+
@Test
public void testGet() {
StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
Object retVal = bdfObj.get(new StaticSlot(1,"test"),qname);
assertTrue(retVal instanceof QName);
}
-
+
@Test
public void testGetSlot() {
StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
Object retVal = bdfObj.get(new StaticSlot(1,"test"));
assertNull(retVal);
}
-
+
@Test
public void testExistingStaticSlotNames() {
StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"});
diff --git a/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java b/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java
index 1aaeb7fb..1aca545e 100644
--- a/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java
+++ b/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java
@@ -57,11 +57,11 @@ public class JU_LogFileNamerTest {
try {
LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), "log");
assertEquals(logFileNamer, logFileNamer.noPID());
-
+
logFileNamer.setAppender(name);
assertEquals(System.getProperty("LOG4J_FILENAME_Append"),
dir.getCanonicalFile() + File.separator + "log-" + name + ".log");
-
+
logFileNamer.setAppender(name);
assertEquals(System.getProperty("LOG4J_FILENAME_Append"),
dir.getCanonicalFile() + File.separator + "log-" + name + ".0.log");
@@ -76,11 +76,11 @@ public class JU_LogFileNamerTest {
try {
LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), "");
assertEquals(logFileNamer, logFileNamer.noPID());
-
+
logFileNamer.setAppender(name);
assertEquals(System.getProperty("LOG4J_FILENAME_Different"),
dir.getCanonicalPath() + File.separator + name + ".log");
-
+
logFileNamer.setAppender(name);
assertEquals(System.getProperty("LOG4J_FILENAME_Different"),
dir.getCanonicalPath() + File.separator + name + ".0.log");
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java
index 582c750c..ab33c2af 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ public class InJson implements Parse<Reader, State> {
state.unsent = 0;
return parsed;
}
-
+
int ch;
char c;
StringBuilder sb = parsed.sb;
@@ -48,7 +48,7 @@ public class InJson implements Parse<Reader, State> {
while (go && (ch=r.read())>=0) {
if (state.braces>=0 || ch==Parse.START_OBJ) { // ignore garbage/whitespace before content
c=(char)ch;
- // Character is a quote.
+ // Character is a quote.
if (c=='"') {
if (inQuotes) {
if (escaped) { // if escaped Quote, add to data.
@@ -112,7 +112,7 @@ public class InJson implements Parse<Reader, State> {
parsed.event = c;
go = false;
break;
-
+
// The Escape Sequence, for Quote marks within Quotes
case '\\':
// Ignore these, unless within quotes, at which point data-gather
@@ -141,7 +141,7 @@ public class InJson implements Parse<Reader, State> {
public int braces = 0;
public char unsent = 0;
}
-
+
// @Override
public Parsed<State> newParsed() {
return new Parsed<State>(new State()); // no State needed
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java
index 175a2aa2..5cd2b1a5 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,7 +40,7 @@ public class InXML implements Parse<Reader, State> {
public InXML(JaxInfo jaxInfo) {
this.jaxInfo = jaxInfo;
}
-
+
public InXML(Class<?> cls, String ... rootNs) throws SecurityException, NoSuchFieldException, ClassNotFoundException, ParseException {
jaxInfo = JaxInfo.build(cls,rootNs);
}
@@ -49,7 +49,7 @@ public class InXML implements Parse<Reader, State> {
// @Override
public Parsed<State> parse(Reader r, Parsed<State> parsed) throws ParseException {
State state = parsed.state;
-
+
// OK, before anything else, see if there is leftover processing, if so, do it!
if (state.unevaluated!=null) {
DerTag dt = state.unevaluated;
@@ -71,7 +71,7 @@ public class InXML implements Parse<Reader, State> {
StringBuilder sb = parsed.sb, tempSB = new StringBuilder();
boolean go = true;
-
+
try {
while (go && (ch=r.read())>=0) {
c = (char)ch;
@@ -108,7 +108,7 @@ public class InXML implements Parse<Reader, State> {
// don't add Whitespace to start of SB... saves removing later
if (sb.length()>0) {
sb.append(c);
- } else if (!Character.isWhitespace(c)) {
+ } else if (!Character.isWhitespace(c)) {
sb.append(c);
}
}
@@ -119,28 +119,28 @@ public class InXML implements Parse<Reader, State> {
throw new ParseException(e);
}
}
-
+
public static final class DerTag {
public String name;
public boolean isEndTag;
public List<Prop> props;
private boolean isXmlInfo;
- //private String ns;
-
+ //private String ns;
+
public DerTag() {
name=null;
isEndTag = false;
props = null;
isXmlInfo = false;
}
-
+
public DerTag parse(Reader r, StringBuilder sb) throws ParseException {
int ch;
char c;
boolean inQuotes = false, escaped = false;
boolean go = true;
String tag = null;
-
+
try {
if ((ch = r.read())<0) throw new ParseException("Reader content ended before complete");
if (ch=='?') {
@@ -210,7 +210,7 @@ public class InXML implements Parse<Reader, State> {
}
}
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(isEndTag?"End":"Start");
@@ -227,7 +227,7 @@ public class InXML implements Parse<Reader, State> {
return sb.toString();
}
}
-
+
private static class ArrayState {
public boolean firstObj = true;
public boolean didNext = false;
@@ -244,7 +244,7 @@ public class InXML implements Parse<Reader, State> {
unevaluated = null;
attribs = null;;
}
-
+
public boolean hasAttributes() {
return attribs!=null && idx<attribs.size();
}
@@ -256,7 +256,7 @@ public class InXML implements Parse<Reader, State> {
}
attribs.add(prop);
}
-
+
public Prop pop() {
Prop rv = null;
if (attribs!=null) {
@@ -266,18 +266,18 @@ public class InXML implements Parse<Reader, State> {
return rv;
}
}
-
+
private static abstract class GreatExpectations {
protected JaxInfo ji;
protected GreatExpectations prev;
private Map<String,String> ns;
-
+
public GreatExpectations(State state, JaxInfo curr, GreatExpectations prev, DerTag derTag) throws ParseException {
this.prev = prev;
ns = null;
ji = getDerived(state, curr,derTag);
}
-
+
public abstract boolean eval(Parsed<State> parsed, DerTag derTag) throws ParseException;
// Recursively look back for any namespaces
@@ -301,9 +301,9 @@ public class InXML implements Parse<Reader, State> {
private JaxInfo getDerived(State state, JaxInfo ji, DerTag derTag) throws ParseException {
if (derTag==null)return ji;
-
+
List<Prop> props = derTag.props;
-
+
Prop derived = null;
if (props!=null) {
// Load Namespaces (if any)
@@ -339,13 +339,13 @@ public class InXML implements Parse<Reader, State> {
return derived==null?ji:ji.getDerived(derived.value);
}
}
-
+
private static class RootExpectations extends GreatExpectations {
-
+
public RootExpectations(State state, JaxInfo curr, GreatExpectations prev) throws ParseException {
super(state,curr,prev, null);
}
-
+
// @Override
public boolean eval(Parsed<State> parsed, DerTag derTag) throws ParseException {
if (derTag.isXmlInfo) {
@@ -357,13 +357,13 @@ public class InXML implements Parse<Reader, State> {
} else {
//parsed.name = derTag.name;
parsed.event = START_OBJ;
- parsed.state.greatExp = new ObjectExpectations(parsed.state,ji, this, false, derTag);
+ parsed.state.greatExp = new ObjectExpectations(parsed.state,ji, this, false, derTag);
}
}
return false;
}
}
-
+
private static class ObjectExpectations extends GreatExpectations {
private boolean printName;
@@ -413,7 +413,7 @@ public class InXML implements Parse<Reader, State> {
return false;
}
}
-
+
private static class LeafExpectations extends GreatExpectations {
public LeafExpectations(State state, JaxInfo curr, GreatExpectations prev) throws ParseException {
super(state, curr, prev, null);
@@ -429,7 +429,7 @@ public class InXML implements Parse<Reader, State> {
throw new ParseException("Expected </" + ji.name + '>');
}
return false;
- }
+ }
}
private static class ArrayExpectations extends GreatExpectations {
@@ -445,7 +445,7 @@ public class InXML implements Parse<Reader, State> {
if (derTag.isEndTag) {
throw new ParseException("Unexpected End Tag </" + derTag.name + '>');
} else {
- ArrayState ai = parsed.state.arrayInfo.peek();
+ ArrayState ai = parsed.state.arrayInfo.peek();
if (ai.firstObj || ai.didNext) {
ai.firstObj = false;
ai.didNext = false;
@@ -473,7 +473,7 @@ public class InXML implements Parse<Reader, State> {
parsed.state.arrayInfo.pop();
}
return false;
- }
+ }
}
// @Override
public Parsed<State> newParsed() throws ParseException {
@@ -484,5 +484,5 @@ public class InXML implements Parse<Reader, State> {
public TimeTaken start(Env env) {
return env.start("Rosetta XML In", Env.XML);
}
-
+
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxEval.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxEval.java
index cb6d2f8c..7e4617be 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxEval.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxEval.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java
index d209f02f..b4d5782a 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,7 +39,7 @@ public class JaxInfo {
public static final int DATA = 0;
public static final int ARRAY = 1;
public static final int OBJECT = 2;
-
+
public final String name;
public final Class<?> clss;
public Map<String, JaxInfo> extensions; // Classes, which might be found at runtime, that extend this class. Lazy Instantiation
@@ -50,7 +50,7 @@ public class JaxInfo {
public final boolean nillable;
public String ns;
public boolean isObject() {return members!=null;}
-
+
private JaxInfo(String n, String ns, Class<?> c, JaxInfo[] members, boolean string, boolean array, boolean required, boolean nillable) {
name = n;
this.ns = ns;
@@ -62,14 +62,14 @@ public class JaxInfo {
this.nillable = nillable;
extensions = null;
}
-
+
public int getType() {
if (isArray)return ARRAY;
else if (members!=null)return OBJECT;
return DATA;
}
-
+
public JaxInfo getDerived(String derivedName) {
JaxInfo derived;
// Lazy Instantiation
@@ -79,7 +79,7 @@ public class JaxInfo {
} else {
derived = extensions.get(derivedName);
}
-
+
if (derived == null) {
//TODO for the moment, Classes are in same package
Package pkg = clss.getPackage();
@@ -103,7 +103,7 @@ public class JaxInfo {
/**
* Build up JAXB Information (recursively)
- *
+ *
* @param cls
* @param rootNns
* @return
@@ -117,7 +117,7 @@ public class JaxInfo {
}
/**
* Build up JAXB Information (recursively)
- *
+ *
* @param cls
* @param rootNns
* @return
@@ -151,10 +151,10 @@ public class JaxInfo {
}
}
}
-
+
return new JaxInfo(name,defaultNS, cls,buildFields(cls,defaultNS),false,false,false,false);
}
-
+
// Build up the name and members of this particular class
// This is recursive, if a member is a JAXB Object as well.
private static JaxInfo[] buildFields(Class<?> clazz, String defaultNS) throws SecurityException, NoSuchFieldException, ClassNotFoundException {
@@ -168,12 +168,12 @@ public class JaxInfo {
if ("".equals(field)) break; // odd bug. "" returned when no fields exist, rather than empty array
Field rf = cls.getDeclaredField(field);
Class<?> ft = rf.getType();
-
+
boolean required = false;
boolean nillable = false;
String xmlName = field;
String namespace = defaultNS;
-
+
XmlElement xe = rf.getAnnotation(XmlElement.class);
if (xe!=null) {
xmlName=xe.name();
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java
index 2d7af059..e480b79d 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,9 +30,9 @@ import javax.xml.bind.annotation.XmlType;
/**
* For specific XML class, quickly find a Setter Method which will load the object
- *
+ *
* Object type of Setter must match String at this time.
- *
+ *
* @author Jonathan
*
* @param <T>
@@ -65,7 +65,7 @@ public class JaxSet<T> {
}
}
}
-
+
public static abstract class Setter<O> {
protected final Method meth;
public Setter(Method meth) {
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java
index 6ff627b9..6a0a7252 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,9 +25,9 @@ package org.onap.aaf.misc.rosetta;
/**
* A Ladder is a Stack like Storage Class, but where you can ascend and descend while
* the elements exists.
- *
+ *
* Like an extension ladder, you can make taller as you go
- *
+ *
* @author Jonathan
*
*/
@@ -52,16 +52,16 @@ public class Ladder<T> {
public void bottom() {
rung = 0;
}
-
+
public void top() {
rung = struts.length-1;
while (rung>0 && struts[rung]==null)--rung;
}
-
+
public int howHigh() {
return rung;
}
-
+
public void jumpTo(int rung) {
if (rung>=struts.length) {
Object[] temp = new Object[init_size*((rung/init_size)+1)];
@@ -70,17 +70,17 @@ public class Ladder<T> {
}
this.rung = rung;
}
-
+
public int height() {
return struts.length;
}
-
+
public void cutTo(int rungs) {
Object[] temp = new Object[rungs];
System.arraycopy(struts, 0, temp, 0, Math.min(rungs, struts.length));
struts = temp;
}
-
+
public void ascend() {
++rung;
if (rung>=struts.length) {
@@ -89,20 +89,20 @@ public class Ladder<T> {
struts = temp;
}
}
-
+
public void descend() {
--rung;
}
-
+
@SuppressWarnings("unchecked")
public T peek() {
return (T)struts[rung];
}
-
+
public void push(T t) {
struts[rung]=t;
}
-
+
@SuppressWarnings("unchecked")
public T pop() {
T t = (T)struts[rung];
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java
index 3729d1e3..933df4aa 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java
@@ -7,9 +7,9 @@
* 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.
@@ -72,9 +72,9 @@ public abstract class Marshal<T> implements Parse<T, Marshal.State> {
/**
* Typical definition of Done is when Iterator in Ladder is "DONE_ITERATOR"
- *
+ *
* It is important, however, that the "Ladder Rung" is set to the right level.
- *
+ *
* @param state
* @return
*/
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Nulls.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Nulls.java
index d36c07ec..51221bc5 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Nulls.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Nulls.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,9 +48,9 @@ public class Nulls {
public TimeTaken start(Env env) {
return env.start("IN", Env.SUB);
}
-
+
};
-
+
public static final Out OUT = new Out() {
// @Override
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Out.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Out.java
index aa2b2992..660af000 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Out.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Out.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,7 +28,7 @@ import java.io.Writer;
public abstract class Out {
public abstract<IN,S> void extract(IN in, Writer writer, Parse<IN, S> parse, boolean ... options) throws IOException, ParseException;
-
+
public<IN,S> void extract(IN in, OutputStream os, Parse<IN, S> parse, boolean ... options) throws IOException, ParseException {
Writer w = new OutputStreamWriter(os);
try {
@@ -37,7 +37,7 @@ public abstract class Out {
w.flush();
}
}
-
+
public abstract String logName();
-
+
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java
index 4fb52d86..9f78c2c7 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,9 +39,9 @@ public class OutJax extends Out {
if (je==null)throw new ParseException("Incomplete content");
je = je.eval(p);
}
-
+
}
-
+
@Override
public String logName() {
return "Rosetta JAX";
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java
index 2d93bb49..e2f45d1e 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java
@@ -7,9 +7,9 @@
* 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.
@@ -50,7 +50,7 @@ public class OutJson extends Out {
while ((p = prs.parse(in,p.reuse())).valid()) {
++count;
switch(p.event) {
- case 1:
+ case 1:
continue;
case 2:
if (count==2) { // it's empty, write open/close on it's own
@@ -64,7 +64,7 @@ public class OutJson extends Out {
if (jsonLevel.peek().printObjectName) {
print = true;
} else { // don't print names on first
- print=false;
+ print=false;
}
maybe=jsonLevel.peek().listItem();
jsonLevel.push(new LevelStack(true));
@@ -72,9 +72,9 @@ public class OutJson extends Out {
case '}':
if (p.hasData()) { // if we have data, we print that, so may need to prepend a comma.
maybe = jsonLevel.peek().listItem();
- } else { // No data means just print,
+ } else { // No data means just print,
p.name = ""; // XML tags come through with names, but no data
- }
+ }
print = true;
jsonLevel.pop();
afterName = p.event;
@@ -94,7 +94,7 @@ public class OutJson extends Out {
else maybe = jsonLevel.peek().listItem();
} else {
p.name = ""; // XML tags come through with names, but no data
- }
+ }
jsonLevel.pop();
print = true;
@@ -114,7 +114,7 @@ public class OutJson extends Out {
}
if (maybe!=0) {
- if (ipw==null)writer.append(maybe);
+ if (ipw==null)writer.append(maybe);
else ipw.println(maybe);
maybe = 0;
}
@@ -132,7 +132,7 @@ public class OutJson extends Out {
if (p.event==3)writer.append("__");
writer.append(p.name);
writer.append("\":");
- }
+ }
if (p.hasData()) {
if (p.isString) {
writer.append('"');
@@ -171,7 +171,7 @@ public class OutJson extends Out {
}
afterName = 0;
}
-
+
if (ipw!=null) {
switch(p.event) {
case '[':
@@ -206,7 +206,7 @@ public class OutJson extends Out {
}
}
-
+
}
@Override
@@ -217,11 +217,11 @@ public class OutJson extends Out {
private static class LevelStack {
public boolean printObjectName=false;
private boolean first_n_List=true;
-
+
public LevelStack(boolean printObjectName) {
this.printObjectName = printObjectName;
}
-
+
public char listItem() {
if (first_n_List) {
first_n_List=false;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java
index f07498b3..fbdf631d 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,13 +29,13 @@ public class OutRaw extends Out{
@Override
public<IN,S> void extract(IN in, Writer writer, Parse<IN,S> prs, boolean ... options) throws IOException, ParseException {
Parsed<S> p = prs.newParsed();
-
- while ((p = prs.parse(in,p.reuse())).valid()) {
+
+ while ((p = prs.parse(in,p.reuse())).valid()) {
writer.append(p.toString());
writer.append('\n');
}
}
-
+
@Override
public String logName() {
return "Rosetta RAW";
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java
index 6472c88e..1004da6e 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,9 +34,9 @@ import org.onap.aaf.misc.env.util.StringBuilderWriter;
public class OutXML extends Out{
private static final String XMLNS_XSI = "xmlns:xsi";
- public static final String XML_INFO = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
+ public static final String XML_INFO = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
public static final String XML_SCHEMA_INSTANCE = "http://www.w3.org/2001/XMLSchema-instance";
-
+
private String root;
private List<Prop> props;
@@ -49,27 +49,27 @@ public class OutXML extends Out{
props.add(new Prop(tv[0],tv[1]));
}
}
-
+
public OutXML(JaxInfo jaxInfo) {
this(jaxInfo.name,genNS(jaxInfo));
}
-
+
public OutXML(InXML inXML) {
this(inXML.jaxInfo.name,genNS(inXML.jaxInfo));
}
-
+
private static String[] genNS(JaxInfo jaxInfo) {
return new String[] {"xmlns=" + jaxInfo.ns};
}
-
-
+
+
@Override
public<IN,S> void extract(IN in, Writer writer, Parse<IN,S> prs, boolean ... options) throws IOException, ParseException {
Parsed<S> p = prs.newParsed();
Stack<Level> stack = new Stack<Level>();
// If it's an IndentPrintWriter, it is pretty printing.
boolean pretty = (options.length>0&&options[0]);
-
+
IndentPrintWriter ipw;
if (pretty) {
if (writer instanceof IndentPrintWriter) {
@@ -114,22 +114,22 @@ public class OutXML extends Out{
if (pretty)ipw.inc();
break;
case Parse.END_OBJ:
- if (p.hasData())
+ if (p.hasData())
closeTag = tag(writer,writer,pretty,false,p.name, XmlEscape.convert(p.sb));
if (pretty)ipw.dec();
writer.append(level.sbw.getBuffer());
level = stack.pop();
break;
- case Parse.START_ARRAY:
+ case Parse.START_ARRAY:
level.multi = p.name;
break;
case Parse.END_ARRAY:
- if (p.hasData())
+ if (p.hasData())
closeTag = tag(writer,writer,pretty,false, p.name, XmlEscape.convert(p.sb));
level.multi=null;
break;
case Parse.ATTRIB:
- if (p.hasData())
+ if (p.hasData())
attrib(writer,pretty,p.name, XmlEscape.convert(p.sb), level);
break;
case Parse.NEXT:
@@ -141,13 +141,13 @@ public class OutXML extends Out{
writer.append(level.sbw.getBuffer());
writer.flush();
}
-
+
private class Level {
public final StringBuilderWriter sbw;
public String multi;
private Level prev;
private Map<String,String> nses;
-
+
public Level(Level level) {
sbw = new StringBuilderWriter();
multi = null;
@@ -162,18 +162,18 @@ public class OutXML extends Out{
String v = nses.get(ns);
return value.equals(v); // note: accomodates not finding NS as well
}
-
+
if (create && !rv) {
if (nses == null) nses = new HashMap<>();
nses.put(ns, value);
}
return rv;
}
-
-
-
+
+
+
}
-
+
private boolean tag(Writer fore, Writer aft, boolean pretty, boolean returns, String tag, String data) throws IOException {
fore.append('<');
fore.append(tag);
@@ -188,7 +188,7 @@ public class OutXML extends Out{
if (pretty)aft.append('\n');
return data==null;
}
-
+
private void attrib(Writer fore, boolean pretty, String tag, String value, Level level) throws IOException {
String realTag = tag.startsWith("__")?tag.substring(2):tag; // remove __
if (realTag.equals(Parsed.EXTENSION_TAG)) { // Convert Derived name into XML defined Inheritance
@@ -209,7 +209,7 @@ public class OutXML extends Out{
}
}
fore.append(' ');
- fore.append(realTag);
+ fore.append(realTag);
fore.append("=\"");
fore.append(value);
fore.append('"');
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parse.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parse.java
index d068530c..fe2dd3e2 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parse.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parse.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,20 +26,20 @@ import org.onap.aaf.misc.env.TimeTaken;
public interface Parse<IN, S> {
public Parsed<S> parse(IN in, Parsed<S> parsed) throws ParseException;
-
+
// EVENTS
public static final char NONE = 0;
public static final char START_DOC = 1;
public static final char END_DOC = 2;
public static final char ATTRIB = 3;
-
+
public static final char NEXT = ',';
public static final char START_OBJ = '{';
public static final char END_OBJ = '}';
public static final char START_ARRAY = '[';
public static final char END_ARRAY = ']';
-
+
public Parsed<S> newParsed() throws ParseException;
- public TimeTaken start(Env env);
-
+ public TimeTaken start(Env env);
+
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/ParseException.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/ParseException.java
index 38ea956a..8b1dd8fe 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/ParseException.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/ParseException.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java
index 29a86de8..739d8e52 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,9 +24,9 @@ package org.onap.aaf.misc.rosetta;
public class Parsed<S> {
public static final String EXTENSION_TAG="extension";
-
+
public boolean isString;
-
+
public StringBuilder sb;
public char event;
public String name;
@@ -48,7 +48,7 @@ public class Parsed<S> {
public boolean valid() {
return event!=Parse.NONE;
}
-
+
public Parsed<S> reuse() {
isString=false;
sb.setLength(0);
@@ -70,7 +70,7 @@ public class Parsed<S> {
public boolean hasData() {
return sb.length()>0;
}
-
+
public String toString() {
StringBuilder sb2 = new StringBuilder();
if (event<40)sb2.append((int)event);
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java
index d46fc8be..4d414c3c 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,13 +28,13 @@ class Prop {
tag = t;
value =v;
}
-
+
public Prop(String t_equals_v) {
String[] tv = t_equals_v.split("=");
if (tv.length>1) {
tag = tv[0];
value = tv[1];
- }
+ }
}
public String toString() {
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java
index efb4ce4b..5e88e3a3 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,9 +31,9 @@ import org.onap.aaf.misc.env.TimeTaken;
import org.onap.aaf.misc.rosetta.Saved.State;
/**
- * An Out Object that will save off produced Parsed Stream and
+ * An Out Object that will save off produced Parsed Stream and
* a Parse (In) Object that will reproduce Parsed Stream on demand
- *
+ *
* @author Jonathan
*
*/
@@ -43,7 +43,7 @@ public class Saved extends Out implements Parse<Reader, State>{
private Content content[];
private int idx;
private boolean append = false;
-
+
/**
* Read from Parsed Stream and save
*/
@@ -59,7 +59,7 @@ public class Saved extends Out implements Parse<Reader, State>{
content[idx]=null;
} while (--idx>=0);
}
-
+
// Note: idx needs to be -1 on initialization and no appendages
while ((p = parser.parse(in,p.reuse())).valid()) {
if (!(append && (p.event==START_DOC || p.event==END_DOC))) { // skip any start/end of document in appendages
@@ -72,14 +72,14 @@ public class Saved extends Out implements Parse<Reader, State>{
}
}
}
-
+
// @Override
public Parsed<State> parse(Reader ignore, Parsed<State> parsed) throws ParseException {
int i;
- if ((i=parsed.state.count++)<=idx)
+ if ((i=parsed.state.count++)<=idx)
content[i].load(parsed);
- else
- parsed.event = Parse.NONE;
+ else
+ parsed.event = Parse.NONE;
return parsed;
}
@@ -113,14 +113,14 @@ public class Saved extends Out implements Parse<Reader, State>{
public static class State {
public int count = 0;
}
-
+
public static class Content {
private boolean isString;
private char event;
private String name;
private List<Prop> props;
private String str;
-
+
public Content(Parsed<?> p) {
isString = p.isString;
event = p.event;
@@ -137,7 +137,7 @@ public class Saved extends Out implements Parse<Reader, State>{
if (str!=null)
p.sb.append(str);
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(event);
@@ -161,7 +161,7 @@ public class Saved extends Out implements Parse<Reader, State>{
return sb.toString();
}
}
-
+
//// @Override
public Parsed<State> newParsed() {
Parsed<State> ps = new Parsed<State>(new State());
@@ -184,7 +184,7 @@ public class Saved extends Out implements Parse<Reader, State>{
public TimeTaken start(Env env) {
return env.start(ROSETTA_SAVED, 0);
}
-
+
@Override
public String logName() {
return ROSETTA_SAVED;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java
index 3007ea95..15f42050 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,7 +28,7 @@ import java.util.TreeMap;
public class XmlEscape {
private XmlEscape() {}
-
+
private static final TreeMap<String,Integer> charMap; // see initialization at end
private static final TreeMap<Integer,String> intMap; // see initialization at end
@@ -38,7 +38,7 @@ public class XmlEscape {
StringBuilder esc = new StringBuilder();
for (int cnt = 0;cnt<9 /*max*/; ++cnt) {
if ((c=r.read())<0)throw new ParseException("Invalid Data: Unfinished Escape Sequence");
- if (c!=';') {
+ if (c!=';') {
esc.append((char)c);
} else { // evaluate
Integer i = charMap.get(esc.toString());
@@ -53,19 +53,19 @@ public class XmlEscape {
break;
}
}
-
-
+
+
} catch (IOException e) {
throw new ParseException(e);
}
}
-
+
public static void xmlEscape(StringBuilder sb, int chr) {
sb.append('&');
sb.append(intMap.get(chr));
sb.append(';');
}
-
+
public static String convert(StringBuilder insb) {
int idx, ch;
StringBuilder sb=null;
@@ -77,9 +77,9 @@ public class XmlEscape {
break;
}
}
-
+
if (sb==null)return insb.toString();
-
+
for (int i=idx;i<insb.length();++i) {
ch = insb.charAt(i);
if (ch<160) {
@@ -361,7 +361,7 @@ public class XmlEscape {
charMap.put("clubs",9827);
charMap.put("hearts",9829);
charMap.put("diams",9830);
-
+
for ( Entry<String, Integer> es: charMap.entrySet()) {
if (es.getValue()>=160); // save small space... note that no longer has amp, etc.
intMap.put(es.getValue(), es.getKey());
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java
index a95da8ea..b12cce02 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java
@@ -7,9 +7,9 @@
* 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.
@@ -56,18 +56,18 @@ import org.onap.aaf.misc.rosetta.ParseException;
import org.onap.aaf.misc.rosetta.marshal.DocMarshal;
public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
-
+
static InJson inJSON = new InJson();
InXML inXML;
static OutJson outJSON = new OutJson();
OutXML outXML;
static OutRaw outRAW = new OutRaw();
-
+
// Temporary until we write JAXB impl...
JAXBmar jaxMar;
JAXBumar jaxUmar;
-
+
private Parse<Reader,?> defaultIn;
private Out defaultOut;
private RosettaEnv env;
@@ -75,7 +75,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
private TYPE outType;
private int defOption;
Marshal<T> marshal = null;
-
+
/**
* Private constructor to setup Type specific data manipulators
@@ -92,13 +92,13 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
RosettaDF(RosettaEnv env, Schema schema, String rootNs, Class<T> cls) throws APIException {
this.env = env;
try {
- // Note: rootNs can be null, in order to derive content from Class.
+ // Note: rootNs can be null, in order to derive content from Class.
JaxInfo ji = rootNs==null?JaxInfo.build(cls):JaxInfo.build(cls,rootNs);
// Note: JAXBmar sets qname to null if not exists
jaxMar = new JAXBmar(rootNs==null?null:new QName("xmlns",rootNs),cls);
// Note: JAXBumar sets schema to null if not exists
jaxUmar = new JAXBumar(schema, cls);
-
+
defaultIn = inXML = new InXML(ji);
defaultOut = outXML = new OutXML(ji);
inType=outType=Data.TYPE.XML;
@@ -107,11 +107,11 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
throw new APIException(e);
}
}
-
+
// @Override
public RosettaData<T> newData() {
- RosettaData<T> data = new RosettaData<T>(env, this)
+ RosettaData<T> data = new RosettaData<T>(env, this)
.in(inType)
.out(outType)
.option(defOption);
@@ -141,7 +141,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
/**
* If exists, first option is "Pretty", second is "Fragment"
- *
+ *
* @param options
* @return
*/
@@ -150,7 +150,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
defaultOut = getOut(type==Data.TYPE.DEFAULT?Data.TYPE.JSON:type);
return this;
}
-
+
public Parse<Reader,?> getIn(Data.TYPE type) {
switch(type) {
case DEFAULT:
@@ -163,7 +163,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
return defaultIn;
}
}
-
+
public Out getOut(Data.TYPE type) {
switch(type) {
case DEFAULT:
@@ -178,7 +178,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
return defaultOut;
}
}
-
+
public int logType(org.onap.aaf.misc.env.Data.TYPE ot) {
switch(ot) {
case JSON:
@@ -204,15 +204,15 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
public RosettaDF<T> option(int option) {
defOption = option;
-
+
return this;
}
/**
* Assigning Root Marshal Object
- *
+ *
* Will wrap with DocMarshal Object if not already
- *
+ *
* @param marshal
* @return
*/
@@ -224,7 +224,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> {
}
return this;
}
-
+
public void direct(Trans trans, T t, OutputStream os, boolean ... options) throws APIException, IOException {
Out out = getOut(outType);
TimeTaken tt = trans.start(out.logName(),logType(outType)); // determine from Out.. without dependency on Env?
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java
index 36ebde68..006e8133 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,7 +48,7 @@ public class RosettaData<T> implements Data<T>{
private boolean options[] = new boolean[] {false, false};
// Temp Storage of XML. Only when we must use JAXB to read in Objects
private String xml,json;
-
+
// package on purpose
RosettaData(Env env, RosettaDF<T> rosettaDF) {
df = rosettaDF;
@@ -57,7 +57,7 @@ public class RosettaData<T> implements Data<T>{
inType = df.getInType();
outType = df.getOutType(); // take defaults
}
-
+
//Added for junits
void setSaved(Saved saved) {
this.saved = saved;
@@ -68,7 +68,7 @@ public class RosettaData<T> implements Data<T>{
inType = rosettaType;
return this;
}
-
+
// // @Override
public RosettaData<T> out(TYPE rosettaType) {
outType = rosettaType;
@@ -89,7 +89,7 @@ public class RosettaData<T> implements Data<T>{
}
return this;
}
-
+
// @Override
public RosettaData<T> load(InputStream is) throws APIException {
Parse<Reader,?> in = df.getIn(inType);
@@ -119,7 +119,7 @@ public class RosettaData<T> implements Data<T>{
json = str;
break;
default:
-
+
}
} catch (Exception e) {
throw new APIException(e);
@@ -152,7 +152,7 @@ public class RosettaData<T> implements Data<T>{
public Saved getEvents() {
return saved;
}
-
+
// @Override
public T asObject() throws APIException {
Out out = df.getOut(TYPE.XML);
@@ -206,7 +206,7 @@ public class RosettaData<T> implements Data<T>{
os.write(xml.getBytes());
} else if (outType==TYPE.JSON && json!=null) {
os.write(json.getBytes());
- } else {
+ } else {
out.extract(null, os, saved, options);
}
} catch (Exception e) {
@@ -226,7 +226,7 @@ public class RosettaData<T> implements Data<T>{
writer.append(xml);
} else if (outType==TYPE.JSON && json!=null) {
writer.append(json);
- } else {
+ } else {
out.extract(null, writer, saved, options);
}
} catch (Exception e) {
@@ -236,18 +236,18 @@ public class RosettaData<T> implements Data<T>{
}
return this;
}
-
+
// @Override
public Class<T> getTypeClass() {
return df.getTypeClass();
}
private static final boolean[] emptyOption = new boolean[0];
-
+
public void direct(InputStream is, OutputStream os) throws APIException, IOException {
direct(is,os,emptyOption);
}
-
+
public void direct(Reader reader, Writer writer, boolean ... options) throws APIException, IOException {
Parse<Reader,?> in = df.getIn(inType);
Out out = df.getOut(outType);
@@ -302,7 +302,7 @@ public class RosettaData<T> implements Data<T>{
}
}
-
+
public void direct(InputStream is, OutputStream os, boolean ... options) throws APIException, IOException {
direct(new InputStreamReader(is),new OutputStreamWriter(os), options);
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaEnv.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaEnv.java
index 43855d6c..62d7bc1b 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaEnv.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaEnv.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,7 @@ import org.onap.aaf.misc.env.APIException;
/**
* An essential Implementation of Env, which will fully function, without any sort
* of configuration.
- *
+ *
* Use as a basis for Group level Env, just overriding where needed.
* @author Jonathan
*
@@ -62,7 +62,7 @@ public class RosettaEnv extends org.onap.aaf.misc.env.impl.BasicEnv {
public RosettaEnv(Properties props) {
super(props);
}
-
+
@SuppressWarnings("unchecked")
@Override
public <T> RosettaDF<T> newDataFactory(Class<?>... classes) throws APIException {
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java
index 0617e01d..e546d6dc 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,38 +26,38 @@ import javax.xml.datatype.XMLGregorianCalendar;
import org.onap.aaf.misc.env.util.Chrono;
/**
- * We make these objects instead of static functions so they can be passed into
+ * We make these objects instead of static functions so they can be passed into
* FieldArray.
- *
+ *
* @author Jonathan
*
* @param <T>
*/
public abstract class DataWriter<T> {
public abstract boolean write(T t, StringBuilder sb);
-
+
public final static DataWriter<String> STRING = new DataWriter<String>() {
@Override
public boolean write(String s, StringBuilder sb) {
sb.append(s);
return true;
- }
+ }
};
-
+
public final static DataWriter<Integer> INTEGER = new DataWriter<Integer>() {
@Override
public boolean write(Integer i, StringBuilder sb) {
sb.append(i);
return false;
- }
+ }
};
-
+
public final static DataWriter<Long> LONG = new DataWriter<Long>() {
@Override
public boolean write(Long t, StringBuilder sb) {
sb.append(t);
return false;
- }
+ }
};
public final static DataWriter<Byte> BYTE = new DataWriter<Byte>() {
@@ -65,7 +65,7 @@ public abstract class DataWriter<T> {
public boolean write(Byte t, StringBuilder sb) {
sb.append(t);
return false;
- }
+ }
};
public final static DataWriter<Character> CHAR = new DataWriter<Character>() {
@@ -73,7 +73,7 @@ public abstract class DataWriter<T> {
public boolean write(Character t, StringBuilder sb) {
sb.append(t);
return true;
- }
+ }
};
public final static DataWriter<Boolean> BOOL = new DataWriter<Boolean>() {
@@ -81,7 +81,7 @@ public abstract class DataWriter<T> {
public boolean write(Boolean t, StringBuilder sb) {
sb.append(t);
return true;
- }
+ }
};
@@ -99,7 +99,7 @@ public abstract class DataWriter<T> {
// }
return true;
}
-
+
};
*/
@@ -110,7 +110,7 @@ public abstract class DataWriter<T> {
return true;
}
};
-
+
public final static DataWriter<XMLGregorianCalendar> DATE_TIME = new DataWriter<XMLGregorianCalendar>() {
@Override
public boolean write(XMLGregorianCalendar t, StringBuilder sb) {
@@ -123,7 +123,7 @@ public abstract class DataWriter<T> {
public final static DataWriter<byte[]> HEX_BINARY = new DataWriter<byte[]>() {
@Override
public boolean write(byte[] ba, StringBuilder sb) {
- // FYI, doing this because don't want intermediate
+ // FYI, doing this because don't want intermediate
// String in "HexString" or the processing in
// "String.format"
//sb.append("0x");
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java
index 1fa17010..1a7ec972 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,11 +31,11 @@ import org.onap.aaf.misc.rosetta.Parsed;
public class DocMarshal<T> extends Marshal<T> {
private Marshal<T> root;
-
+
public DocMarshal(Marshal<T> root) {
this.root = root;
}
-
+
@Override
public Parsed<State> parse(T t, Parsed<State> parsed) throws ParseException {
Ladder<Iterator<?>> ladder = parsed.state.ladder;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java
index abc19b26..d91286af 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,7 +38,7 @@ public abstract class FieldArray<T,S> extends Marshal<T> {
this.name = name;
dataWriter = dw;
}
-
+
@SuppressWarnings("unchecked")
@Override
public Parsed<State> parse(T t, Parsed<State> parsed) throws ParseException {
@@ -69,7 +69,7 @@ public abstract class FieldArray<T,S> extends Marshal<T> {
} else {
mem=null;
}
-
+
if (mem!=null) {
parsed.isString=dataWriter.write(mem, parsed.sb);
parsed.event = NEXT;
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldBlob.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldBlob.java
index 34fa5dd6..9849bf43 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldBlob.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldBlob.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,12 +26,12 @@ public abstract class FieldBlob<T> extends FieldMarshal<T>{
super(name);
}
- protected abstract byte[] data(T t);
+ protected abstract byte[] data(T t);
@Override
protected boolean data(T t, StringBuilder sb) {
return false;
- // unimplemented
+ // unimplemented
//return DataWriter.BYTE_ARRAY.write(data(t),sb);
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDate.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDate.java
index 2418d7af..e0f837a7 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDate.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDate.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,5 +33,5 @@ public abstract class FieldDate<T> extends FieldMarshal<T> {
return DataWriter.DATE.write(data(t), sb);
}
- protected abstract XMLGregorianCalendar data(T t);
+ protected abstract XMLGregorianCalendar data(T t);
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDateTime.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDateTime.java
index ae125617..aa7623cf 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDateTime.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDateTime.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,5 +33,5 @@ public abstract class FieldDateTime<T> extends FieldMarshal<T> {
return DataWriter.DATE_TIME.write(data(t), sb);
}
- protected abstract XMLGregorianCalendar data(T t);
+ protected abstract XMLGregorianCalendar data(T t);
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldHexBinary.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldHexBinary.java
index fa9e6323..668aede6 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldHexBinary.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldHexBinary.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,7 +26,7 @@ public abstract class FieldHexBinary<T> extends FieldMarshal<T>{
super(name);
}
- protected abstract byte[] data(T t);
+ protected abstract byte[] data(T t);
@Override
protected boolean data(T t, StringBuilder sb) {
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldMarshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldMarshal.java
index 2e77618b..d76c65a2 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldMarshal.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldMarshal.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,11 +32,11 @@ public abstract class FieldMarshal<T> extends Marshal<T> {
public FieldMarshal(String name) {
this.name = name;
}
-
+
public String getName() {
return name;
}
-
+
@Override
public Parsed<State> parse(T t, Parsed<State> parsed) {
parsed.state.ladder.push(DONE_ITERATOR);
@@ -55,5 +55,5 @@ public abstract class FieldMarshal<T> extends Marshal<T> {
* @return
*/
protected abstract boolean data(T t, StringBuilder sb);
-
+
} \ No newline at end of file
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldNumeric.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldNumeric.java
index 0a5c28ad..072775bc 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldNumeric.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldNumeric.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,5 +32,5 @@ public abstract class FieldNumeric<N,T> extends FieldMarshal<T> {
return false;
}
- protected abstract N data(T t);
+ protected abstract N data(T t);
}
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldString.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldString.java
index e96b6967..d0b1e486 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldString.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldString.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,7 +26,7 @@ public abstract class FieldString<T> extends FieldMarshal<T> {
super(name);
}
- protected abstract String data(T t);
+ protected abstract String data(T t);
@Override
final protected boolean data(T t, StringBuilder sb) {
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ListIterator.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ListIterator.java
index ed8b98c4..4bc23449 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ListIterator.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ListIterator.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,7 +35,7 @@ final class ListIterator<T> implements Iterator<T> {
private Iterator<T> delg;
public ListIterator(List<T> list) {
curr = null;
- delg = list.iterator();
+ delg = list.iterator();
}
@Override
public boolean hasNext() {
@@ -46,7 +46,7 @@ final class ListIterator<T> implements Iterator<T> {
public T next() {
return curr = delg.hasNext()?delg.next():null;
}
-
+
public T peek() {
return curr==null?next():curr;
}
@@ -55,5 +55,5 @@ final class ListIterator<T> implements Iterator<T> {
public void remove() {
delg.remove();
}
-
+
} \ No newline at end of file
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java
index 9c64e83d..f6685234 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java
index d96a44d0..3f5d3732 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java
@@ -7,9 +7,9 @@
* 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.
@@ -41,23 +41,23 @@ public abstract class ObjMarshal<T> extends Marshal<T> {
// Note: Not Using List or ArrayList, because there is no "Peek" concept in their iterator.
private Marshal<T>[] pml;
private int end=0;
-
+
/**
* @param pm
*/
@SuppressWarnings("unchecked")
protected void add(Marshal<T> pm) {
if (pml==null) {
- pml = new Marshal[Ladder.DEFAULT_INIT_SIZE];
+ pml = new Marshal[Ladder.DEFAULT_INIT_SIZE];
} else if (end>pml.length) {
- Object temp[] = pml;
+ Object temp[] = pml;
pml = new Marshal[pml.length+Ladder.DEFAULT_INIT_SIZE];
System.arraycopy(temp, 0, pml, 0, pml.length);
}
pml[end]=pm;
++end;
}
-
+
/* (non-Javadoc)
* @see org.onap.aaf.misc.rosetta.Parse#parse(java.lang.Object, org.onap.aaf.misc.rosetta.Parsed)
*/
@@ -120,12 +120,12 @@ public abstract class ObjMarshal<T> extends Marshal<T> {
public Marshal<T> peek() {
return idx<0?null:pml[idx];
}
-
+
@Override
public void remove() {
pml[idx]=null;
}
-
+
}
}
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java
index 1a31b0fb..83972f96 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,7 +43,7 @@ public class JU_ParseException {
ParseException pe = new ParseException("exception",new NullPointerException("exception"));
}
-
-
+
+
}
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java
index 20744355..e7d07406 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java
@@ -7,9 +7,9 @@
* 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.
@@ -19,10 +19,10 @@
*
*/
//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2018.12.09 at 10:14:23 PM IST
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2018.12.09 at 10:14:23 PM IST
//
@@ -39,9 +39,9 @@ import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
- *
+ *
* <p>The following schema fragment specifies the expected content contained within this class.
- *
+ *
* <pre>
* &lt;complexType>
* &lt;complexContent>
@@ -70,8 +70,8 @@ import javax.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
- *
- *
+ *
+ *
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
@@ -84,25 +84,25 @@ public class Api {
/**
* Gets the value of the route property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the route property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getRoute().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link Api.Route }
- *
- *
+ *
+ *
*/
public List<Api.Route> getRoute() {
if (route == null) {
@@ -114,9 +114,9 @@ public class Api {
/**
* <p>Java class for anonymous complex type.
- *
+ *
* <p>The following schema fragment specifies the expected content contained within this class.
- *
+ *
* <pre>
* &lt;complexType>
* &lt;complexContent>
@@ -135,8 +135,8 @@ public class Api {
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
- *
- *
+ *
+ *
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
@@ -166,11 +166,11 @@ public class Api {
/**
* Gets the value of the meth property.
- *
+ *
* @return
* possible object is
* {@link String }
- *
+ *
*/
public String getMeth() {
return meth;
@@ -178,11 +178,11 @@ public class Api {
/**
* Sets the value of the meth property.
- *
+ *
* @param value
* allowed object is
* {@link String }
- *
+ *
*/
public void setMeth(String value) {
this.meth = value;
@@ -190,11 +190,11 @@ public class Api {
/**
* Gets the value of the path property.
- *
+ *
* @return
* possible object is
* {@link String }
- *
+ *
*/
public String getPath() {
return path;
@@ -202,11 +202,11 @@ public class Api {
/**
* Sets the value of the path property.
- *
+ *
* @param value
* allowed object is
* {@link String }
- *
+ *
*/
public void setPath(String value) {
this.path = value;
@@ -214,25 +214,25 @@ public class Api {
/**
* Gets the value of the param property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the param property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getParam().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link String }
- *
- *
+ *
+ *
*/
public List<String> getParam() {
if (param == null) {
@@ -243,11 +243,11 @@ public class Api {
/**
* Gets the value of the desc property.
- *
+ *
* @return
* possible object is
* {@link String }
- *
+ *
*/
public String getDesc() {
return desc;
@@ -255,11 +255,11 @@ public class Api {
/**
* Sets the value of the desc property.
- *
+ *
* @param value
* allowed object is
* {@link String }
- *
+ *
*/
public void setDesc(String value) {
this.desc = value;
@@ -267,25 +267,25 @@ public class Api {
/**
* Gets the value of the comments property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the comments property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getComments().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link String }
- *
- *
+ *
+ *
*/
public List<String> getComments() {
if (comments == null) {
@@ -296,25 +296,25 @@ public class Api {
/**
* Gets the value of the contentType property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the contentType property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getContentType().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link String }
- *
- *
+ *
+ *
*/
public List<String> getContentType() {
if (contentType == null) {
@@ -325,7 +325,7 @@ public class Api {
/**
* Gets the value of the expected property.
- *
+ *
*/
public int getExpected() {
return expected;
@@ -333,7 +333,7 @@ public class Api {
/**
* Sets the value of the expected property.
- *
+ *
*/
public void setExpected(int value) {
this.expected = value;
@@ -341,25 +341,25 @@ public class Api {
/**
* Gets the value of the explicitErr property.
- *
- * <p>
+ *
+ *
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the explicitErr property.
- *
- * <p>
+ *
+ *
* For example, to add a new item, do as follows:
* <pre>
* getExplicitErr().add(newItem);
* </pre>
- *
- *
- * <p>
+ *
+ *
+ *
* Objects of the following type(s) are allowed in the list
* {@link Integer }
- *
- *
+ *
+ *
*/
public List<Integer> getExplicitErr() {
if (explicitErr == null) {
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java
index 9ab3b258..0d942e09 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java
@@ -7,9 +7,9 @@
* 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.
@@ -58,21 +58,21 @@ public class JU_RosettaData {
@Mock
Env env;
-
+
@Mock
RosettaDF df;
-
+
@Mock
JAXBmar bmar;
-
+
@Mock
Saved saved;
-
+
@Before
public void setUp() {
initMocks(this);
}
-
+
@Test
public void testLoad() {
RosettaData rosettaObj = new RosettaData(env, df);
@@ -84,14 +84,14 @@ public class JU_RosettaData {
Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
Mockito.doNothing().when(saved).extract(sr,(Writer)null,inxml);
-
+
rosettaObj = rosettaObj.load(sr);
} catch (APIException | IOException | ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
@Test
public void testLoadException() {
RosettaData rosettaObj = new RosettaData(env, df);
@@ -105,7 +105,7 @@ public class JU_RosettaData {
assertTrue(e.getMessage().contains("NullPointerException"));
}
}
-
+
@Test
public void testLoadIs() {
RosettaData rosettaObj = new RosettaData(env, df);
@@ -117,14 +117,14 @@ public class JU_RosettaData {
Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
Mockito.doNothing().when(saved).extract(new InputStreamReader(sr),(Writer)null,inxml);
-
+
rosettaObj = rosettaObj.load(sr);
} catch (APIException | IOException | ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
@Test
public void testLoadIsException() {
RosettaData rosettaObj = new RosettaData(env, df);
@@ -138,7 +138,7 @@ public class JU_RosettaData {
assertTrue(e.getMessage().contains("NullPointerException"));
}
}
-
+
@Test
public void testLoadStr() {
RosettaData rosettaObj = new RosettaData(env, df);
@@ -149,7 +149,7 @@ public class JU_RosettaData {
Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
+
rosettaObj = rosettaObj.load("test");
} catch (APIException | IOException | ParseException e) {
// TODO Auto-generated catch block
@@ -166,7 +166,7 @@ public class JU_RosettaData {
Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON);
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
+
rosettaObj = rosettaObj.load("test");
} catch (APIException | IOException | ParseException e) {
// TODO Auto-generated catch block
@@ -186,7 +186,7 @@ public class JU_RosettaData {
assertTrue(e.getMessage().contains("NullPointerException"));
}
}
-
+
@Test
public void testLoadT() {
RosettaData rosettaObj = new RosettaData(env, df);
@@ -198,7 +198,7 @@ public class JU_RosettaData {
df.jaxMar = Mockito.mock(JAXBmar.class);
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
+
rosettaObj = rosettaObj.load(bmar);
df.marshal = null;
rosettaObj = rosettaObj.load(bmar);
@@ -207,7 +207,7 @@ public class JU_RosettaData {
e.printStackTrace();
}
}
-
+
@Test
public void testLoadTMarshalNull() {
RosettaData rosettaObj = new RosettaData(env, df);
@@ -226,7 +226,7 @@ public class JU_RosettaData {
e.printStackTrace();
}
}
-
+
@Test
public void testLoadTException() {
RosettaData rosettaObj = new RosettaData(env, df);
@@ -240,14 +240,14 @@ public class JU_RosettaData {
assertTrue(e.getMessage().contains("NullPointerException"));
}
}
-
+
@Test
public void testGetEvents() {
RosettaData rosettaObj = new RosettaData(env, df);
Saved saved = rosettaObj.getEvents();
assertEquals("Rosetta Saved", saved.logName());
}
-
+
@Test
public void testAsObject() {
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
@@ -265,15 +265,15 @@ public class JU_RosettaData {
Mockito.doReturn( lt).when(env).debug();
Mockito.doNothing().when(saved).extract(null,new StringWriter(),saved);
Mockito.doReturn(bmar).when(df.jaxUmar).unmarshal(lt,"");
-
+
bmar = rosettaObj.asObject();
-
+
} catch (APIException | IOException | ParseException | JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
@Test
public void testAsObjectException() {
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
@@ -291,9 +291,9 @@ public class JU_RosettaData {
Mockito.doReturn( lt).when(env).debug();
Mockito.doThrow(new IOException("test Exception")).when(saved).extract(null,new StringWriter(),saved);
Mockito.doThrow(new JAXBException("test Exception")).when(df.jaxUmar).unmarshal(lt,"");
-
+
bmar = rosettaObj.asObject();
-
+
} catch (APIException | IOException | ParseException | JAXBException e) {
assertTrue(e.getMessage().contains("test Exception"));
}
@@ -308,12 +308,12 @@ public class JU_RosettaData {
rosettaObj.setSaved(saved);
try {
Out outxml = Mockito.mock(OutXML.class);
-
+
Mockito.doReturn(outxml).when(df).getOut(type);
Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
Mockito.doReturn("test").when(outxml).logName();
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
-
+
String retVal = rosettaObj.asString();
assertTrue("".equals(retVal));
} catch (APIException e) {
@@ -321,7 +321,7 @@ public class JU_RosettaData {
e.printStackTrace();
}
}
-
+
@Test
public void testAsStringJson() {
TYPE type = TYPE.JSON;
@@ -331,12 +331,12 @@ public class JU_RosettaData {
rosettaObj.setSaved(saved);
try {
Out outxml = Mockito.mock(OutXML.class);
-
+
Mockito.doReturn(outxml).when(df).getOut(type);
Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
Mockito.doReturn("test").when(outxml).logName();
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
-
+
String retVal = rosettaObj.asString();
assertTrue("".equals(retVal));
} catch (APIException e) {
@@ -351,34 +351,34 @@ public class JU_RosettaData {
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
rosettaObj = rosettaObj.in(Data.TYPE.XML);
rosettaObj.setSaved(saved);
-
+
try {
InXML inxml = Mockito.mock(InXML.class);
Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
+
rosettaObj = rosettaObj.load("test");
} catch (APIException | IOException | ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
try {
Out outxml = Mockito.mock(OutXML.class);
-
+
Mockito.doReturn(outxml).when(df).getOut(type);
Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
Mockito.doReturn("test").when(outxml).logName();
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class));
-
+
} catch (APIException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
@Test
public void testToJson() {
TYPE type = TYPE.JSON;
@@ -386,34 +386,34 @@ public class JU_RosettaData {
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
rosettaObj = rosettaObj.in(Data.TYPE.JSON);
rosettaObj.setSaved(saved);
-
+
try {
InXML inxml = Mockito.mock(InXML.class);
Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON);
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
+
rosettaObj = rosettaObj.load("test");
} catch (APIException | IOException | ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
try {
Out outxml = Mockito.mock(OutXML.class);
-
+
Mockito.doReturn(outxml).when(df).getOut(type);
Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
Mockito.doReturn("test").when(outxml).logName();
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class));
-
+
} catch (APIException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
@Test
public void testTo() {
TYPE type = TYPE.XML;
@@ -421,22 +421,22 @@ public class JU_RosettaData {
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
rosettaObj = rosettaObj.in(Data.TYPE.XML);
rosettaObj.setSaved(saved);
-
+
try {
Out outxml = Mockito.mock(OutXML.class);
-
+
Mockito.doReturn(outxml).when(df).getOut(type);
Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
Mockito.doReturn("test").when(outxml).logName();
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class));
-
+
} catch (APIException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
@Test
public void testToWriterXml() {
TYPE type = TYPE.XML;
@@ -444,34 +444,34 @@ public class JU_RosettaData {
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
rosettaObj = rosettaObj.in(Data.TYPE.XML);
rosettaObj.setSaved(saved);
-
+
try {
InXML inxml = Mockito.mock(InXML.class);
Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
+
rosettaObj = rosettaObj.load("test");
} catch (APIException | IOException | ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
try {
Out outxml = Mockito.mock(OutXML.class);
-
+
Mockito.doReturn(outxml).when(df).getOut(type);
Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
Mockito.doReturn("test").when(outxml).logName();
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class));
-
+
} catch (APIException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
@Test
public void testToWriterJson() {
TYPE type = TYPE.JSON;
@@ -479,34 +479,34 @@ public class JU_RosettaData {
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
rosettaObj = rosettaObj.in(Data.TYPE.JSON);
rosettaObj.setSaved(saved);
-
+
try {
InXML inxml = Mockito.mock(InXML.class);
Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON);
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
+
rosettaObj = rosettaObj.load("test");
} catch (APIException | IOException | ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
try {
Out outxml = Mockito.mock(OutXML.class);
-
+
Mockito.doReturn(outxml).when(df).getOut(type);
Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
Mockito.doReturn("test").when(outxml).logName();
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class));
-
+
} catch (APIException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
@Test
public void testToWriter() {
TYPE type = TYPE.XML;
@@ -514,28 +514,28 @@ public class JU_RosettaData {
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
rosettaObj = rosettaObj.in(Data.TYPE.XML);
rosettaObj.setSaved(saved);
-
+
try {
Out outxml = Mockito.mock(OutXML.class);
-
+
Mockito.doReturn(outxml).when(df).getOut(type);
Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
Mockito.doReturn("test").when(outxml).logName();
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class));
-
+
} catch (APIException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
@Test
public void testGetTypeClass() {
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
rosettaObj.getTypeClass();
}
-
+
@Test
public void testDirect() {
TYPE type = TYPE.XML;
@@ -553,7 +553,7 @@ public class JU_RosettaData {
e.printStackTrace();
}
}
-
+
@Test
public void testDirectException() {
TYPE type = TYPE.XML;
@@ -561,11 +561,11 @@ public class JU_RosettaData {
Mockito.doReturn(type).when(df).getInType();
RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
InXML inxml = null;
-
+
inxml = Mockito.mock(InXML.class);
Mockito.doReturn(inxml).when(df).getIn(type);
-
-
+
+
StringReader is = Mockito.mock(StringReader.class);
StringWriter os= Mockito.mock(StringWriter.class);
try {
@@ -575,14 +575,14 @@ public class JU_RosettaData {
Mockito.doReturn("test").when(outxml).logName();
Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
Mockito.doThrow( new IOException("testException")).when(outxml).extract(is, os, inxml, true);
-
+
rosettaObj.direct(is,os, true);
} catch (APIException | IOException | ParseException e) {
// TODO Auto-generated catch block
assertTrue(e.getMessage().contains("testException"));
}
}
-
+
@Test
public void testDirectT() {
TYPE type = TYPE.XML;
@@ -599,7 +599,7 @@ public class JU_RosettaData {
LogTarget lt = Mockito.mock(LogTarget.class);
Mockito.doReturn( lt).when(env).debug();
Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true);
-
+
rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true);
df.marshal =Mockito.mock(Marshal.class);;
rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true);
@@ -608,7 +608,7 @@ public class JU_RosettaData {
e.printStackTrace();
}
}
-
+
@Test
public void testDirectTOS() {
TYPE type = TYPE.XML;
@@ -625,7 +625,7 @@ public class JU_RosettaData {
LogTarget lt = Mockito.mock(LogTarget.class);
Mockito.doReturn( lt).when(env).debug();
Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true);
-
+
rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true);
df.marshal =Mockito.mock(Marshal.class);;
rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true);
@@ -634,7 +634,7 @@ public class JU_RosettaData {
e.printStackTrace();
}
}
-
+
@Test
public void testDirectTOSJson() {
TYPE type = TYPE.JSON;
@@ -651,13 +651,13 @@ public class JU_RosettaData {
LogTarget lt = Mockito.mock(LogTarget.class);
Mockito.doReturn( lt).when(env).debug();
Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true);
-
+
rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true);
} catch (APIException | IOException | JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
+
}
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java
index c8771519..631abc00 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,7 +45,7 @@ public class JU_RosettaEnv {
public void setUp() {
initMocks(this);
}
-
+
@Test
public void testNewDataFactoryClass() {
RosettaEnv rosettaObj = new RosettaEnv();
@@ -57,7 +57,7 @@ public class JU_RosettaEnv {
e.printStackTrace();
}
}
-
+
@Test
public void testNewDataFactorySchema() {
RosettaEnv rosettaObj = new RosettaEnv(Mockito.mock(Applet.class),"test");
@@ -69,7 +69,7 @@ public class JU_RosettaEnv {
e.printStackTrace();
}
}
-
+
@Test
public void testNewDataFactoryQname() {
RosettaEnv rosettaObj = new RosettaEnv(new String[] {"test"});
@@ -82,7 +82,7 @@ public class JU_RosettaEnv {
e.printStackTrace();
}
}
-
+
@Test
public void testNewDataFactoryQnameSchema() {
RosettaEnv rosettaObj = new RosettaEnv("test", new String[] {"test"});
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java
index 5b7875f7..a7f8f115 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,7 +38,7 @@ public class JU_FieldBlob {
// TODO Auto-generated method stub
return null;
}
-
+
}
@Test
public void testData() {
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java
index 67565122..d36862e8 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java
@@ -7,9 +7,9 @@
* 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.
@@ -58,18 +58,18 @@ public class JU_FromJSON {
new OutRaw().extract(new StringReader(str),sbw,inJSON);
System.out.println(sbw.getBuffer());
}
-
+
@Test
public void parseJSON2Dump() throws Exception {
System.out.println("*** PARSE JSON -> Dump ***");
System.out.println(str);
StringBuilderWriter sbw = new StringBuilderWriter(1024);
-
+
new OutDump().extract(new StringReader(str), sbw, inJSON);
-
+
System.out.println(sbw.getBuffer());
}
-
+
@Test
public void nonprettyJSON() throws Exception {
System.out.println("*** JSON -> (Intermediate Stream) -> Non-pretty JSON ***");
@@ -91,21 +91,21 @@ public class JU_FromJSON {
}
report.glean(trans,Env.JSON);
} while (report.go());
-
+
String result = sbw.toString();
System.out.println(result);
Assert.assertEquals(result, str);
report.report(sbw);
System.out.println(sbw.toString());
}
-
+
@Test
public void parseJSON2JSON() throws Exception {
System.out.println("*** JSON -> (Intermediate Stream) -> Pretty JSON ***");
System.out.println(str);
StringBuilderWriter sbw = new StringBuilderWriter(1024);
-
+
Out jout = new OutJson();
Trans trans;
Report report = new Report(ITERATIONS,"JSON");
@@ -121,7 +121,7 @@ public class JU_FromJSON {
}
report.glean(trans,Env.JSON);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw.toString());
}
@@ -132,7 +132,7 @@ public class JU_FromJSON {
System.out.println(str);
StringBuilderWriter sbw = new StringBuilderWriter(1024);
-
+
Out xout = new OutXML("LargerData","xmlns=urn:s:xsd");
Trans trans;
Report report = new Report(ITERATIONS,"JSON");
@@ -148,7 +148,7 @@ public class JU_FromJSON {
}
report.glean(trans,Env.JSON);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw.toString());
}
@@ -160,7 +160,7 @@ public class JU_FromJSON {
StringBuilderWriter sbw = new StringBuilderWriter(1024);
IndentPrintWriter ipw = new IndentPrintWriter(sbw);
-
+
Out xout = new OutXML("LargerData","xmlns=urn:s:xsd");
Trans trans;
Report report = new Report(ITERATIONS,"JSON");
@@ -176,12 +176,12 @@ public class JU_FromJSON {
}
report.glean(trans,Env.JSON);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw.toString());
}
-
-
+
+
@Test
public void jaxbObj2XML() throws Exception {
System.out.println("*** JAXB Object -> XML ***");
@@ -200,7 +200,7 @@ public class JU_FromJSON {
sd.getItem().add("Item 2.2");
ld.getSampleData().add(sd);
ld.setFluff("MyFluff");
-
+
JAXBmar jaxBmar = new JAXBmar(LargerData.class);
//jaxBmar.asFragment(true);
//jaxBmar.pretty(true);
@@ -219,7 +219,7 @@ public class JU_FromJSON {
}
report.glean(trans,Env.XML);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw.toString());
}
@@ -242,7 +242,7 @@ public class JU_FromJSON {
sd.getItem().add("Item 2.2");
ld.getSampleData().add(sd);
ld.setFluff("MyFluff");
-
+
JAXBmar jaxBmar = new JAXBmar(LargerData.class);
//jaxBmar.asFragment(true);
jaxBmar.pretty(true);
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java
index 4fefe622..1a10779b 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,8 +45,8 @@ import s.xsd.LargerData;
public class JU_FromXML {
private static int ITERATIONS = 1;
;
-
- private final static String xml =
+
+ private final static String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
"<LargerData xmlns=\"urn:s:xsd\">\n" +
" <SampleData>\n" +
@@ -63,21 +63,21 @@ public class JU_FromXML {
" </SampleData>\n" +
" <fluff>MyFluff</fluff>\n" +
"</LargerData>\n";
-
-
+
+
@Test
public void test() throws Exception {
InXML inXML = new InXML(LargerData.class);
-
+
System.out.println(xml);
StringBuilderWriter sbw = new StringBuilderWriter(1024);
-
+
Reader rdr = new StringReader(xml);
-
+
new OutRaw().extract(rdr, sbw, inXML);
System.out.println(sbw.getBuffer());
}
-
+
@Test
public void xml2JSON() throws Exception {
@@ -86,7 +86,7 @@ public class JU_FromXML {
InXML inXML = new InXML(LargerData.class);
StringBuilderWriter sbw = new StringBuilderWriter(1024);
-
+
Trans trans;
Report report = new Report(ITERATIONS,"XML");
do {
@@ -101,7 +101,7 @@ public class JU_FromXML {
}
report.glean(trans,Env.XML);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw.toString());
}
@@ -113,7 +113,7 @@ public class JU_FromXML {
InXML inXML = new InXML(LargerData.class);
StringBuilderWriter sbw = new StringBuilderWriter(1024);
-
+
Trans trans;
Report report = new Report(ITERATIONS,"XML");
do {
@@ -128,23 +128,23 @@ public class JU_FromXML {
}
report.glean(trans,Env.XML);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw.toString());
}
-
-
+
+
@Test
public void warmup() throws Exception {
if (ITERATIONS>20) {
System.out.println("*** Warmup JAXB ***");
-
+
JAXBumar jaxbUmar = new JAXBumar(LargerData.class);
JAXBmar jaxBmar = new JAXBmar(LargerData.class);
//jaxBmar.asFragment(true);
//jaxBmar.pretty(true);
StringBuilderWriter sbw = new StringBuilderWriter(1024);
-
+
LargerData ld;
Trans trans;
@@ -171,7 +171,7 @@ public class JU_FromXML {
}
report.glean(trans,Env.XML);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw.toString());
}
@@ -210,7 +210,7 @@ public class JU_FromXML {
}
report.glean(trans,Env.XML);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw.toString()); }
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java
index af58ea57..4e9bfdc5 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,7 +44,7 @@ public class JU_JSON {
Out jout = new OutJson();
go(jin, jout, "{\"id\":\"Me, Myself\",\"date\":1353094689100}");
-
+
go(jin, jout, "{\"id\":\"My ID 1\",\"desc\":\"My Description 1\",\"comment\":[\"My Comment 1\"],\"utc\":1360418381310}");
go(jin, jout, "{\"id\":\"My ID 1\",\"desc\":\"My Description 1\",\"comment\":[\"My Comment 1\",\"My Comment 2\"],\"utc\":1360418381310}");
@@ -52,16 +52,16 @@ public class JU_JSON {
"{\"id\":\"sd object \\\"1\\\"\",\"date\":1316084944213,\"item\":[\"Item 1.1\",\"Item 1.2\"]}," +
"{\"id\":\"sd object \\\"2\\\"\",\"date\":1316084945343,\"item\":[\"Item 2.1\",\"Item 2.2\"]}],\"fluff\":\"MyFluff\"}"
);
-
+
go(jin, jout, "{\"SampleData\":[{\"date\":1316084945343}],\"fluff\":\"MyFluff\"}");
-
+
go(jin, jout, "{\"id\":\"Me,[}[eg[)(:x,\\\" Myself\",\"date\":1353094689100}");
-
+
// TODO: Clean out AT&T specific data
go(jin,jout, "{\"userid\":\"xk3233\",\"timestamp\":1353097388531,\"item\":[{\"tag\":\"color\",\"value\":\"Mauve\"},{\"tag\":\"shirtsize\",\"value\":\"Xtra Large\"}]}");
//go()
//"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><vote xmlns=\"urn:poll.att.com\"><userid>xk3233</userid><timestamp>1353082669667</timestamp></vote>");
-
+
// 3/11/2015 Jonathan found a case with missing comma
go(jin,jout, "{\"start\":\"2015-03-11T18:18:05.580-05:00\",\"end\":\"2015-09-11-05:00\",\"force\":\"false\",\"perm\":{\"type\":\"org.osaaf.myns.mytype\",\"instance\":\"myInstance\",\"action\":\"myAction\"}"
+ ",\"role\":\"org.osaaf.myns.myrole\"}");
@@ -74,8 +74,8 @@ public class JU_JSON {
go(jin,jout, "{\"meth\":\"GET\",\"path\":\"/authz/perms/:type\",\"desc\":\"GetPermsByType\",\"comments\":[\"List All Permissions that match :type listed\"],"
+ "\"contentType\":[\"application/Permissions+json;q=1.0;charset=utf-8;version=1.1,application/json;q=1.0;version=1.1\""
+ ",\"application/Perms+xml;q=1.0;charset=utf-8;version=2.0,text/xml;q=1.0;version=2.0\",\"application/Perms+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*/*;q=1.0\""
- + ",\"application/Permissions+xml;q=1.0;charset=utf-8;version=1.1,text/xml;q=1.0;version=1.1\"]}");
-
+ + ",\"application/Permissions+xml;q=1.0;charset=utf-8;version=1.1,text/xml;q=1.0;version=1.1\"]}");
+
// Test a Windoze "Pretty Print", validate skipping of Windoze characters as well as other odd control characters listed
// in json.org
@@ -87,8 +87,8 @@ public class JU_JSON {
),sw,jin);
Assert.assertEquals("{\"id\":\"Me, \b\f\n\r\tMyself\",\"date\":1353094689100}",sw.toString());
System.out.println(sw.toString());
-
- // 10/01/2015 Jonathan AAF-703 Ron Gallagher, this response is ok
+
+ // 10/01/2015 Jonathan AAF-703 Ron Gallagher, this response is ok
go(jin,jout, "{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":\"myAction\",\"description\":\"something\"}]}");
// but when description:"" causes extra comma at end
go(jin,jout, "{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":\"myAction\",\"description\":\"\"}]}","{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":\"myAction\"}]}");
@@ -96,33 +96,33 @@ public class JU_JSON {
go(jin,jout, "{\"perm\":[{\"type\":\"\",\"action\":\"\",\"description\":\"\"}]}","{\"perm\":[{}]}");
go(jin,jout, "{\"perm\":[{\"type\":\"\",\"action\":\"\",\"description\":\"hi\"}]}","{\"perm\":[{\"description\":\"hi\"}]}");
go(jin,jout, "{\"perm\":[{\"type\":\"\",\"action\":\"myAction\",\"description\":\"\"}]}","{\"perm\":[{\"action\":\"myAction\"}]}");
-
-
+
+
go(jin,jout, "{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":,\"description\":\"something\"}]}","{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"description\":\"something\"}]}");
-
+
go(jin, jout, "{\"name\":\"\\\"hello\\\"\"}");
-
+
go(jin, jout, "{\"name\":\"\\\\\"}");
go(jin, jout, "{\"role\":\"org.osaaf.scamper.UserStory0152 7_IT-00323-a-admin\",\"perm\":{\"type\":\"org.osaaf.scamper.application\",\"instance\":\"_()`!@#\\\\$%^=+][{}<>/.-valid.app.name-is_good\",\"action\":\"Administrator\"}}");
-
-
+
+
}
-
-
+
+
private void go(Parse<Reader,?> in, Out out, String str) throws IOException, ParseException {
go(in,out,str,str);
}
private void go(Parse<Reader, ?> in, Out out, String str, String cmp) throws IOException, ParseException {
-
+
System.out.println(str);
StringWriter sw = new StringWriter(1024);
out.extract(new StringReader(str), sw, in);
System.out.println(sw);
String result = sw.toString();
-
+
if (!result.equals(cmp)) {
sw.getBuffer().setLength(0);
new OutRaw().extract(new StringReader(str), sw, in);
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java
index fd6142b1..335d87ad 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,7 +31,7 @@ public class JU_Ladder {
@Test
public void test() {
Ladder<String> ladder = new Ladder<String>();
-
+
for (int i=0;i<30;++i) {
for (int j=0;j<i;++j)ladder.ascend();
String str = "Rung " + i;
@@ -43,10 +43,10 @@ public class JU_Ladder {
for (int j=0;j<i;++j)ladder.descend();
}
assertEquals(ladder.height(),32); // Sizing, when naturally created is by 8
-
+
ladder.cutTo(8);
- assertEquals(ladder.height(),8);
-
+ assertEquals(ladder.height(),8);
+
for (int i=0;i<30;++i) {
ladder.jumpTo(i);
String str = "Rung " + i;
@@ -56,16 +56,16 @@ public class JU_Ladder {
}
ladder.bottom();
-
+
for (int i=0;i<30;++i) {
assertEquals("Rung " + i,ladder.peek());
ladder.ascend();
}
-
+
ladder.bottom();
ladder.top();
assertEquals("Rung 29",ladder.peek());
-
+
for (int i=0;i<30;++i) {
ladder.jumpTo(i);
assertEquals("Rung " + i,ladder.peek());
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java
index a1e94c51..2cb8a177 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java
@@ -7,9 +7,9 @@
* 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.
@@ -58,13 +58,13 @@ public class JU_Nulls {
data.load(urr);
System.out.println(data.asString());
Assert.assertEquals("{\"SampleData\":[{\"date\":1444125487798}]}", data.asString());
-
+
System.out.println(data.out(Data.TYPE.RAW).asString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
}
}
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java
index ccc29317..287c2563 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java
@@ -7,9 +7,9 @@
* 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.
@@ -78,16 +78,16 @@ public class JU_RosettaDF {
tt.done();
}
sbw.append('\n');
-
+
tt = trans.start("To XML from Cache",4);
try {
data.out(Data.TYPE.XML).to(sbw);
} finally {
tt.done();
}
-
+
sbw.append('\n');
-
+
tt = trans.start("To JSON from Cache",5);
try {
data.out(Data.TYPE.JSON).to(sbw);
@@ -96,10 +96,10 @@ public class JU_RosettaDF {
}
report.glean(trans, 1,2,3,4,5);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw);
-
+
}
@Test
@@ -118,12 +118,12 @@ public class JU_RosettaDF {
data.direct(new StringReader(JU_FromJSON.str), sbw);
report.glean(trans);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw);
-
+
}
-
+
@Test
public void testMulti() throws Exception {
RosettaEnv env = new RosettaEnv();
@@ -135,10 +135,10 @@ public class JU_RosettaDF {
Multi m = new Multi();
m.getF1().add("String1");
m.getF2().add("String2");
-
+
System.out.println(df.newData().load(m).out(TYPE.RAW).asString());
System.out.println(df.newData().load(m).out(TYPE.JSON).asString());
-
+
}
@Test
@@ -154,7 +154,7 @@ public class JU_RosettaDF {
Assert.assertEquals(
"{\"id\":\"\\\"AT&T Services, Inc.\\\"\",\"date\":0}",
out);
-
+
SampleData sd2 = df.newData().in(TYPE.JSON).load(out).asObject();
System.out.println(sd2.getId());
Assert.assertEquals(sd.getId(),sd2.getId());
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java
index a0847f4c..43a202f5 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java
@@ -7,9 +7,9 @@
* 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.
@@ -47,11 +47,11 @@ public class JU_Saved<b> {
JaxInfo ji = JaxInfo.build(LargerData.class);
OutXML xml = new OutXML(ji);;
OutJson json = new OutJson();
-
+
Saved saved = new Saved();
-
+
StringBuilderWriter sbw = new StringBuilderWriter(1024);
-
+
Trans trans;
Report report = new Report(ITERATIONS,"Save","Dump","XML ","JSON");
do {
@@ -67,7 +67,7 @@ public class JU_Saved<b> {
// sbw.append("==== Start Direct Raw =====\n");
// new OutRaw().extract(new StringReader(JU_FromJSON.str), sbw, inJSON);
-//
+//
// sbw.append("==== Start Raw from Saved =====\n");
// new OutRaw().extract(null,sbw,saved);
@@ -78,7 +78,7 @@ public class JU_Saved<b> {
} finally {
tt.done();
}
-
+
sbw.append("\n==== Start XML =====\n");
tt = trans.start("XML", 3);
try {
@@ -86,7 +86,7 @@ public class JU_Saved<b> {
} finally {
tt.done();
}
-
+
sbw.append("\n==== Start JSON =====\n");
tt = trans.start("JSON", 4);
try {
@@ -96,7 +96,7 @@ public class JU_Saved<b> {
}
report.glean(trans,1,2,3,4);
} while (report.go());
-
+
report.report(sbw);
System.out.println(sbw.toString());
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java
index b0fc29a2..a3c4f181 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java
@@ -7,9 +7,9 @@
* 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.
@@ -57,7 +57,7 @@ public class JU_Stream2Obj {
<value>value_2</value>
</base>
</root>
-
+
{"base":[{"__extension":"derivedA","name":"myDerivedA_1","num":1432,"shortName":"mda_1","value":["value_1","value_2"]}]}
*/
@@ -69,7 +69,7 @@ public class JU_Stream2Obj {
da.setShortName("mda_1");
da.getValue().add("value_1");
da.getValue().add("value_2");
-
+
Root root = new Root();
root.getBase().add(da);
@@ -80,10 +80,10 @@ public class JU_Stream2Obj {
da.getValue().add("value_2.1");
da.getValue().add("value_2.2");
root.getBase().add(da);
-
+
EnvJAXB env = new BasicEnv();
DataFactory<Root> rootDF = env.newDataFactory(Root.class);
-
+
String xml = rootDF.newData(env).out(Data.TYPE.XML).load(root).option(Data.PRETTY).asString();
System.out.println(xml);
@@ -95,21 +95,21 @@ public class JU_Stream2Obj {
out.extract(new StringReader(xml), sw, in);
System.out.println(sw.toString());
-
+
out = new OutJson();
sw = new StringWriter();
out.extract(new StringReader(xml), sw, in);
String json;
System.out.println(json = sw.toString());
-
+
in = new InJson();
out = new OutRaw();
sw = new StringWriter();
out.extract(new StringReader(json), sw, in);
System.out.println(sw.toString());
-
+
out = new OutXML(inXML);
sw = new StringWriter();
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java
index 40c41596..1a366fa0 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java
@@ -7,9 +7,9 @@
* 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.
@@ -42,7 +42,7 @@ public class JU_Struct {
"</SampleData>\n" +
"<fluff>MyFluff</fluff>\n" +
"</LargerData>\n";
-
+
// @Test
// public void test2() throws Exception {
//
@@ -50,20 +50,20 @@ public class JU_Struct {
// sd.setDate(new Date().getTime());
// sd.setId("myId");
// sd.getItem().add("Item 1.1");
-//
+//
// InObj<SampleData> inObj = new InObj<SampleData>(SampleData.class);
//
// JaxSet<SampleData> jaxSet = JaxSet.get(SampleData.class);
// Setter<SampleData> setter = jaxSet.setter("id");
// setter.set(sd, "Your ID");
-//
+//
// for (Entry<String, Getter<SampleData>> es : jaxSet.getters()) {
// System.out.print(es.getKey());
// System.out.print(' ');
// System.out.println(es.getValue().get(sd));
// }
// }
-
+
@Test
public void test() throws Exception {
JaxInfo ji = JaxInfo.build(LargerData.class);
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java
index 2aca5f52..550e2566 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java
@@ -7,9 +7,9 @@
* 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.
@@ -55,18 +55,18 @@ public class JU_Types {
public void single() throws Exception {
Single single = setSData();
SingleMarshal psingle = new SingleMarshal();
-
+
OutRaw raw = new OutRaw();
OutJson json = new OutJson();
OutXML xml = new OutXML("Single","xmlns=urn:types:xsd");
-
-
+
+
System.out.println("===== RAW =====");
raw.extract(single, System.out, psingle);
System.out.println("\n===== JSON =====");
json.extract(single, System.out, psingle);
-
+
System.out.println("\n\n===== Pretty JSON =====");
json.extract(single, System.out, psingle, true);
@@ -92,7 +92,7 @@ public class JU_Types {
// xml.extract(single, sw, psingle, true);
news = jumar.unmarshal(env.info(), sw.toString());
System.out.println(sw.toString());
-
+
String sample = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
+ "\n<ns2:urn.types.xsd xmlns:ns2=\"Single\" xmlns=\"urn:types:xsd\">"
+ "\n<str>MyString</str>"
@@ -110,7 +110,7 @@ public class JU_Types {
System.out.println(news.getDatetime());
}
-
+
@Test
public void multi() throws Exception {
OutRaw raw = new OutRaw();
@@ -119,7 +119,7 @@ public class JU_Types {
Multi multi = new Multi();
MultiMarshal pmulti = new MultiMarshal();
-
+
for (int i=0;i<10;++i) {
System.out.println("===== Multi Iteration " + i + " =====");
if (i>0) {
@@ -127,16 +127,16 @@ public class JU_Types {
}
System.out.println(" ===== RAW =====");
raw.extract(multi, System.out, pmulti);
-
+
System.out.println("\n ===== JSON =====");
json.extract(multi, System.out, pmulti);
-
+
System.out.println("\n\n ===== Pretty JSON =====");
json.extract(multi, System.out, pmulti, true);
-
+
System.out.println("\n\n ===== XML =====");
xml.extract(multi, System.out, pmulti,false);
-
+
System.out.println("\n\n ===== Pretty XML =====");
xml.extract(multi, System.out, pmulti, true);
}
@@ -150,7 +150,7 @@ public class JU_Types {
Multi multi = new Multi();
DocMarshal<Multi> doc = DocMarshal.root(new MultiMarshal());
-
+
for (int i=0;i<3;++i) {
System.out.println("===== Multi Iteration " + i + " =====");
if (i>0) {
@@ -158,16 +158,16 @@ public class JU_Types {
}
System.out.println(" ===== RAW =====");
raw.extract(multi, System.out, doc);
-
+
System.out.println("\n ===== JSON =====");
json.extract(multi, System.out, doc);
-
+
System.out.println("\n\n ===== Pretty JSON =====");
json.extract(multi, System.out, doc, true);
-
+
System.out.println("\n\n ===== XML =====");
xml.extract(multi, System.out, doc,false);
-
+
System.out.println("\n\n ===== Pretty XML =====");
xml.extract(multi, System.out, doc, true);
}
@@ -179,16 +179,16 @@ public class JU_Types {
// Saved saved = new Saved();
// saved.extract(in, ignore, parser, options);
// }
-
+
@Test
public void df() throws Exception {
RosettaEnv env = new RosettaEnv();
RosettaDF<Multi> df = env.newDataFactory(Multi.class);
df.out(TYPE.JSON).option(Data.PRETTY);
-
+
Multi multi = new Multi();
multi.getSingle().add(setSData());
-
+
System.out.println("========== Original loading");
Trans trans = env.newTrans();
@@ -199,7 +199,7 @@ public class JU_Types {
}
trans = env.newTrans();
data = df.newData(trans);
-
+
int iters = 10000;
for (int i=0;i<iters;++i) {
data.load(multi);
@@ -220,14 +220,14 @@ public class JU_Types {
}
trans = env.newTrans();
data = df.newData(trans);
-
+
for (int i=0;i<iters;++i) {
data.load(multi);
}
metrics = trans.auditTrail(0, null,Env.JSON,Env.XML);
System.out.println(data.asString());
System.out.println(metrics.total/iters + "ms avg");
-
+
// Assert.assertEquals(first, second);
System.out.println("========== Direct Object to JSON String");
@@ -246,13 +246,13 @@ public class JU_Types {
sbw.reset();
data.direct(multi, sbw, true);
}
-
+
metrics = trans.auditTrail(0, null,Env.JSON,Env.XML);
System.out.println(sbw.toString());
System.out.println(metrics.total/iters + "ms avg");
-
+
}
-
+
private Single setSData() {
Single s = new Single();
s.setStr("MyString");
@@ -274,19 +274,19 @@ public class JU_Types {
// Out jout = new OutJson();
//
//// go(jin, jout, "{\"id\":\"Me, Myself\",\"date\":1353094689100}");
-//
+//
// }
-
-
+
+
/*
private void go(Parse<Reader,?> in, Out out, String str) throws IOException, ParseException {
-
+
System.out.println(str);
StringWriter sw = new StringWriter(1024);
out.extract(new StringReader(str), sw, in);
System.out.println(sw);
String result = sw.toString();
-
+
if (!result.equals(str)) {
sw.getBuffer().setLength(0);
new OutRaw().extract(new StringReader(str), sw, in);
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java
index 7e230822..e5035dbf 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,7 +37,7 @@ public class OutDump extends Out{
IndentPrintWriter ipw = writer instanceof IndentPrintWriter?(IndentPrintWriter)writer:new IndentPrintWriter(writer);
Parsed<S> p = prs.newParsed();
-
+
while ((p = prs.parse(in,p.reuse())).valid()) {
switch(p.event) {
case Parse.START_OBJ:
@@ -45,7 +45,7 @@ public class OutDump extends Out{
ipw.append(p.name);
ipw.inc();
break;
- case Parse.END_OBJ:
+ case Parse.END_OBJ:
printData(ipw,p);
ipw.dec();
ipw.append("End Object ");
@@ -57,7 +57,7 @@ public class OutDump extends Out{
ipw.append(p.name);
ipw.append('\n');
break;
- case Parse.END_ARRAY:
+ case Parse.END_ARRAY:
printData(ipw,p);
ipw.dec();
ipw.append("End Array ");
@@ -69,13 +69,13 @@ public class OutDump extends Out{
}
}
}
-
+
private void printData(IndentPrintWriter ipw, Parsed<?> parsed) {
if (parsed.hasData()) {
ipw.append("Data:[");
if (parsed.hasName()) {
ipw.append(parsed.name);
- ipw.append(" : ");
+ ipw.append(" : ");
}
ipw.append(parsed.sb);
ipw.append("]");
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java
index acb33010..dc07ae63 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,7 +33,7 @@ public class Report {
String[] names;
private int iterations;
private int count;
-
+
public Report(int iters, String ... names) {
iterations = iters;
buckets = new float[names.length];
@@ -41,7 +41,7 @@ public class Report {
total=0;
count = 0;
}
-
+
public void glean(Trans trans, int ... type) {
Metric m = trans.auditTrail(0, null, type);
total+=m.total;
@@ -50,12 +50,12 @@ public class Report {
buckets[b]+=m.buckets[b];
}
}
-
+
public boolean go() {
return ++count<iterations;
}
-
-
+
+
public void report(Writer sbw) throws IOException {
sbw.append("\n"+count + " entries, Total Time: " + total + "ms, Avg Time: " + total/count + "ms\n");
int min = Math.min(buckets.length, names.length);
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java
index b28ca766..3c8433ec 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java
index bde91c9e..ddbeb6cf 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java
@@ -7,9 +7,9 @@
* 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.
@@ -44,14 +44,14 @@ public class SingleMarshal extends ObjMarshal<Single> {
return t.getStr();
}
});
-
+
add(new FieldNumeric<Integer, Single>("int") {
@Override
protected Integer data(Single t) {
return t.getInt();
}
});
-
+
add(new FieldNumeric<Long,Single>("long") {
@Override
protected Long data(Single t) {
@@ -72,14 +72,14 @@ public class SingleMarshal extends ObjMarshal<Single> {
return t.getDate();
}
});
-
+
add(new FieldHexBinary<Single>("binary") {
@Override
protected byte[] data(Single t) {
return t.getBinary();
}
});
-
+
add(new FieldArray<Single,String>("array", DataWriter.STRING) {
@Override
protected List<String> data(Single t) {