You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2026/05/09 22:23:05 UTC
(airavata-custos) branch master updated: Removed deprecated modules
This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
The following commit(s) were added to refs/heads/master by this push:
new 590e1bb54 Removed deprecated modules
590e1bb54 is described below
commit 590e1bb54ac63555e3338977a4133815d2888929
Author: lahiruj <la...@gmail.com>
AuthorDate: Sat May 9 18:10:55 2026 -0400
Removed deprecated modules
---
.travis.yml | 36 -
README.md | 46 +-
allocations/access-ci-service/pom.xml | 202 -
.../assembly/access-ci-service-bin-assembly.xml | 89 -
.../access/ci/service/AccessCiApplication.java | 34 -
.../custos/access/ci/service/AmiePoller.java | 144 -
.../access/ci/service/client/amie/AmieClient.java | 156 -
.../access/ci/service/config/AmieProperties.java | 116 -
.../custos/access/ci/service/config/AppConfig.java | 38 -
.../handler/amie/DataAccountCreateHandler.java | 103 -
.../handler/amie/DataProjectCreateHandler.java | 100 -
.../amie/InformTransactionCompleteHandler.java | 64 -
.../ci/service/handler/amie/NoOpHandler.java | 45 -
.../ci/service/handler/amie/PacketHandler.java | 44 -
.../ci/service/handler/amie/PacketRouter.java | 62 -
.../handler/amie/RequestAccountCreateHandler.java | 135 -
.../amie/RequestAccountInactivateHandler.java | 108 -
.../amie/RequestAccountReactivateHandler.java | 107 -
.../handler/amie/RequestPersonMergeHandler.java | 107 -
.../handler/amie/RequestProjectCreateHandler.java | 165 -
.../amie/RequestProjectInactivateHandler.java | 105 -
.../amie/RequestProjectReactivateHandler.java | 109 -
.../handler/amie/RequestUserModifyHandler.java | 106 -
.../ci/service/metrics/AmieHealthIndicator.java | 78 -
.../access/ci/service/metrics/AmieMetrics.java | 124 -
.../ci/service/model/ClusterAccountEntity.java | 131 -
.../access/ci/service/model/PersonDnsEntity.java | 87 -
.../access/ci/service/model/PersonEntity.java | 192 -
.../access/ci/service/model/ProjectEntity.java | 125 -
.../ci/service/model/ProjectMembershipEntity.java | 125 -
.../access/ci/service/model/amie/AuditAction.java | 39 -
.../ci/service/model/amie/AuditLogEntity.java | 130 -
.../access/ci/service/model/amie/PacketEntity.java | 152 -
.../access/ci/service/model/amie/PacketStatus.java | 39 -
.../service/model/amie/ProcessingErrorEntity.java | 107 -
.../service/model/amie/ProcessingEventEntity.java | 168 -
.../ci/service/model/amie/ProcessingEventType.java | 23 -
.../ci/service/model/amie/ProcessingStatus.java | 48 -
.../ci/service/repo/ClusterAccountRepository.java | 36 -
.../ci/service/repo/PersonDnsRepository.java | 33 -
.../access/ci/service/repo/PersonRepository.java | 38 -
.../service/repo/ProjectMembershipRepository.java | 41 -
.../access/ci/service/repo/ProjectRepository.java | 28 -
.../ci/service/repo/amie/AuditLogRepository.java | 31 -
.../ci/service/repo/amie/PacketRepository.java | 35 -
.../repo/amie/ProcessingErrorRepository.java | 27 -
.../repo/amie/ProcessingEventRepository.java | 45 -
.../access/ci/service/service/AuditService.java | 86 -
.../access/ci/service/service/PersonService.java | 235 -
.../service/service/ProjectMembershipService.java | 172 -
.../access/ci/service/service/ProjectService.java | 94 -
.../ci/service/service/UserAccountService.java | 102 -
.../custos/access/ci/service/util/ProtoUtils.java | 76 -
.../service/worker/amie/ProcessingEventWorker.java | 249 -
.../src/main/proto/amie_packets.proto | 183 -
.../src/main/proto/internal_events.proto | 159 -
.../src/main/resources/application.yml | 77 -
.../db/migration/V1__initial_migration.sql | 200 -
.../V2__add_next_retry_at_to_processing_events.sql | 5 -
.../db/migration/V3__create_audit_log.sql | 36 -
.../resources/distribution/bin/amie-decoder.sh | 70 -
.../resources/distribution/bin/custos-daemon.sh | 112 -
.../src/main/resources/distribution/bin/setenv.sh | 46 -
.../resources/distribution/conf/application.yml | 77 -
.../resources/distribution/conf/logback-spring.xml | 99 -
.../src/main/resources/logback-spring.xml | 99 -
.../handler/amie/DataAccountCreateHandlerTest.java | 207 -
.../handler/amie/DataProjectCreateHandlerTest.java | 205 -
.../amie/InformTransactionCompleteHandlerTest.java | 109 -
.../ci/service/handler/amie/NoOpHandlerTest.java | 77 -
.../ci/service/handler/amie/PacketRouterTest.java | 108 -
.../amie/RequestAccountCreateHandlerTest.java | 206 -
.../amie/RequestAccountInactivateHandlerTest.java | 194 -
.../amie/RequestAccountReactivateHandlerTest.java | 180 -
.../amie/RequestPersonMergeHandlerTest.java | 196 -
.../amie/RequestProjectCreateHandlerTest.java | 230 -
.../amie/RequestProjectInactivateHandlerTest.java | 171 -
.../amie/RequestProjectReactivateHandlerTest.java | 171 -
.../handler/amie/RequestUserModifyHandlerTest.java | 228 -
.../service/metrics/AmieHealthIndicatorTest.java | 118 -
.../access/ci/service/metrics/AmieMetricsTest.java | 129 -
.../ci/service/service/AuditServiceTest.java | 152 -
.../ci/service/service/PersonServiceTest.java | 474 -
.../service/ProjectMembershipServiceTest.java | 309 -
.../ci/service/service/ProjectServiceTest.java | 110 -
.../ci/service/service/UserAccountServiceTest.java | 194 -
.../access/ci/service/util/JsonTestUtils.java | 52 -
.../access/ci/service/util/ProtoUtilsTest.java | 137 -
.../worker/amie/ProcessingEventWorkerTest.java | 313 -
.../src/test/resources/application-test.yml | 31 -
.../src/test/resources/logback-test.xml | 38 -
.../data_account_create/incoming-data.json | 35 -
.../data_account_create/outgoing-inform.json | 25 -
.../data_project_create/incoming-data.json | 35 -
.../data_project_create/outgoing-inform.json | 25 -
.../incoming-inform.json | 25 -
.../request_account_create/incoming-request.json | 44 -
.../request_account_create/outgoing-notify.json | 35 -
.../incoming-request.json | 39 -
.../outgoing-notify.json | 32 -
.../incoming-request.json | 19 -
.../outgoing-notify.json | 18 -
.../request_person_merge/incoming-request.json | 35 -
.../request_person_merge/outgoing-inform.json | 25 -
.../request_project_create/incoming-request.json | 103 -
.../request_project_create/outgoing-notify.json | 78 -
.../incoming-request.json | 39 -
.../outgoing-notify.json | 33 -
.../incoming-request.json | 39 -
.../outgoing-notify.json | 33 -
.../incoming-request.json | 45 -
.../outgoing-inform.json | 25 -
.../incoming-request.json | 45 -
.../outgoing-inform.json | 25 -
identity/README.md | 157 -
identity/api/pom.xml | 51 -
.../org/apache/custos/api/CustosAppController.java | 37 -
.../apache/custos/api/GlobalExceptionHandler.java | 85 -
.../api/ProtobufJsonHttpMessageConverter.java | 67 -
.../api/exception/ProtobufConversionException.java | 27 -
.../api/group/GroupManagementController.java | 1128 --
.../api/identity/IdentityManagementController.java | 618 -
.../api/tenant/TenantManagementController.java | 467 -
.../custos/api/user/UserManagementController.java | 841 --
.../apache/custos/api/util/ProtobufJsonUtil.java | 64 -
.../TenantManagementControllerSecurityTest.java | 488 -
identity/application/pom.xml | 99 -
.../src/main/assembly/custos-bin-assembly.xml | 90 -
.../java/org/apache/custos/CustosApplication.java | 36 -
.../java/org/apache/custos/config/CacheConfig.java | 49 -
.../org/apache/custos/config/OpenAPIConfig.java | 71 -
.../custos/config/ProtobufJsonOpenAPIConfig.java | 45 -
.../config/ProtobufMessageConverterConfig.java | 43 -
.../custos/config/ProtobufPropertiesModule.java | 183 -
.../java/org/apache/custos/config/WebConfig.java | 65 -
.../application/src/main/resources/application.yml | 118 -
.../resources/distribution/bin/custos-daemon.sh | 112 -
.../src/main/resources/distribution/bin/custos.sh | 70 -
.../src/main/resources/distribution/bin/setenv.sh | 46 -
.../resources/distribution/conf/application.yml | 105 -
.../resources/distribution/conf/logback-spring.xml | 60 -
.../src/main/resources/logback-spring.xml | 60 -
.../src/main/resources/static/favicon.ico | Bin 3084 -> 0 bytes
identity/core/pom.xml | 90 -
.../apache/custos/core/commons/StatusUpdater.java | 62 -
.../apache/custos/core/constants/Constants.java | 45 -
.../core/exception/UnauthorizedException.java | 34 -
.../core/identity/authzcache/AuthzCache.java | 49 -
.../core/identity/authzcache/AuthzCacheEntry.java | 63 -
.../core/identity/authzcache/AuthzCacheIndex.java | 77 -
.../identity/authzcache/AuthzCacheManager.java | 81 -
.../identity/authzcache/AuthzCachedStatus.java | 34 -
.../authzcache/DefaultAuthzCacheManager.java | 81 -
.../identity/exceptions/AuthSecurityException.java | 27 -
.../core/mapper/federated/InstitutionMapper.java | 49 -
.../tenant/AttributeUpdateMetadataMapper.java | 188 -
.../mapper/tenant/StatusUpdateMetadataMapper.java | 65 -
.../custos/core/mapper/tenant/TenantMapper.java | 177 -
.../mapper/user/AttributeUpdateMetadataMapper.java | 110 -
.../custos/core/mapper/user/GroupMapper.java | 191 -
.../mapper/user/StatusUpdateMetadataMapper.java | 70 -
.../custos/core/mapper/user/UserProfileMapper.java | 222 -
.../custos/core/model/commons/OperationStatus.java | 26 -
.../custos/core/model/commons/StatusEntity.java | 113 -
.../credential/store/AgentCredentialEntity.java | 126 -
.../model/credential/store/CredentialEntity.java | 109 -
.../core/model/federated/CILogonInstitution.java | 123 -
.../apache/custos/core/model/tenant/Contact.java | 82 -
.../custos/core/model/tenant/RedirectURI.java | 84 -
.../apache/custos/core/model/tenant/Tenant.java | 346 -
.../tenant/TenantAttributeUpdateMetadata.java | 114 -
.../model/tenant/TenantStatusUpdateMetadata.java | 101 -
.../core/model/user/AttributeUpdateMetadata.java | 117 -
.../org/apache/custos/core/model/user/Group.java | 179 -
.../custos/core/model/user/GroupAttribute.java | 80 -
.../apache/custos/core/model/user/GroupRole.java | 81 -
.../core/model/user/GroupToGroupMembership.java | 114 -
.../core/model/user/StatusUpdateMetadata.java | 105 -
.../custos/core/model/user/UserAttribute.java | 102 -
.../core/model/user/UserGroupMembership.java | 127 -
.../core/model/user/UserGroupMembershipType.java | 88 -
.../apache/custos/core/model/user/UserProfile.java | 229 -
.../apache/custos/core/model/user/UserRole.java | 102 -
.../core/repo/commons/StatusUpdaterRepository.java | 32 -
.../store/AgentCredentialRepository.java | 30 -
.../credential/store/CredentialRepository.java | 35 -
.../CiLogonInstitutionCacheRepository.java | 31 -
.../custos/core/repo/tenant/ContactRepository.java | 30 -
.../core/repo/tenant/RedirectURIRepository.java | 30 -
.../core/repo/tenant/SearchTenantRepository.java | 29 -
.../repo/tenant/SearchTenantRepositoryImpl.java | 91 -
.../TenantAttributeUpdateMetadataRepository.java | 30 -
.../custos/core/repo/tenant/TenantRepository.java | 32 -
.../TenantStatusUpdateMetadataRepository.java | 30 -
.../user/AttributeUpdateMetadataRepository.java | 30 -
.../core/repo/user/GroupAttributeRepository.java | 26 -
.../core/repo/user/GroupMembershipRepository.java | 43 -
.../repo/user/GroupMembershipTypeRepository.java | 26 -
.../custos/core/repo/user/GroupRepository.java | 32 -
.../custos/core/repo/user/GroupRoleRepository.java | 26 -
.../user/GroupToGroupMembershipRepository.java | 34 -
.../core/repo/user/SearchGroupsRepository.java | 30 -
.../core/repo/user/SearchGroupsRepositoryImpl.java | 101 -
.../repo/user/StatusUpdateMetadataRepository.java | 30 -
.../core/repo/user/UserAttributeRepository.java | 36 -
.../core/repo/user/UserProfileRepository.java | 35 -
.../custos/core/repo/user/UserRoleRepository.java | 30 -
.../apache/custos/core/task/ServiceCallback.java | 32 -
.../org/apache/custos/core/task/ServiceChain.java | 73 -
.../apache/custos/core/task/ServiceException.java | 37 -
.../org/apache/custos/core/task/ServiceTask.java | 41 -
.../apache/custos/core/task/ServiceTaskImpl.java | 60 -
identity/core/src/main/proto/CredentialStore.proto | 116 -
.../src/main/proto/FederatedAuthentication.proto | 127 -
identity/core/src/main/proto/IamAdmin.proto | 434 -
identity/core/src/main/proto/Identity.proto | 175 -
.../core/src/main/proto/IdentityManagement.proto | 65 -
.../core/src/main/proto/TenantManagement.proto | 115 -
identity/core/src/main/proto/TenantProfile.proto | 162 -
identity/core/src/main/proto/UserManagement.proto | 84 -
identity/core/src/main/proto/UserProfile.proto | 194 -
identity/pom.xml | 42 -
identity/services/pom.xml | 114 -
.../org/apache/custos/service/auth/AuthClaim.java | 206 -
.../org/apache/custos/service/auth/KeyService.java | 121 -
.../custos/service/auth/TokenAuthorizer.java | 427 -
.../apache/custos/service/auth/TokenService.java | 145 -
.../service/credential/store/Credential.java | 98 -
.../credential/store/CredentialManager.java | 219 -
.../credential/store/CredentialStoreService.java | 636 -
.../service/credential/store/CredentialTypes.java | 29 -
.../service/credential/store/Operations.java | 26 -
.../exceptions/AuthenticationException.java | 31 -
.../FederatedAuthenticationServiceException.java | 30 -
.../exceptions/InternalServerException.java | 31 -
.../store/CredentialGenerationException.java | 34 -
.../store/CredentialsAuthenticationException.java | 29 -
.../store/MissingParameterException.java | 30 -
.../cilogon/FederatedAuthenticationService.java | 357 -
.../service/federated/cilogon/Operations.java | 31 -
.../federated/client/cilogon/CILogonClient.java | 148 -
.../client/cilogon/CILogonInstitution.java | 70 -
.../federated/client/cilogon/CILogonRequest.java | 96 -
.../federated/client/cilogon/CILogonResponse.java | 160 -
.../federated/client/keycloak/KeycloakClient.java | 1858 ---
.../client/keycloak/KeycloakClientSecret.java | 23 -
.../federated/client/keycloak/KeycloakUtils.java | 97 -
.../client/keycloak/auth/KeycloakAuthClient.java | 462 -
.../federated/client/keycloak/auth/User.java | 95 -
.../apache/custos/service/iam/IAMOperations.java | 62 -
.../apache/custos/service/iam/IamAdminService.java | 2004 ----
.../java/org/apache/custos/service/iam/Status.java | 27 -
.../custos/service/identity/IdentityService.java | 486 -
.../management/ClientConfigurationOptions.java | 145 -
.../service/management/GroupManagementService.java | 491 -
.../management/IdentityManagementService.java | 380 -
.../management/SuperTenantBootstrapper.java | 212 -
.../service/management/SuperTenantProperties.java | 47 -
.../service/management/TenantActivationTask.java | 248 -
.../management/TenantManagementService.java | 778 --
.../service/management/UserManagementService.java | 1331 --
.../service/profile/TenantProfileService.java | 341 -
.../custos/service/profile/UserProfileService.java | 1276 --
.../custos/service/auth/TokenAuthorizerTest.java | 273 -
.../keycloak/KeycloakClientConfigureTest.java | 160 -
.../custos/service/iam/IamAdminServiceTest.java | 176 -
.../management/ClientConfigurationOptionsTest.java | 159 -
.../management/SuperTenantBootstrapperTest.java | 410 -
.../agent-management-client/pom.xml | 139 -
.../management/client/AgentManagementClient.java | 350 -
.../custos-clients-core/pom.xml | 91 -
.../apache/custos/clients/core/AbstractClient.java | 82 -
.../apache/custos/clients/core/ClientUtils.java | 152 -
.../group-management-client/pom.xml | 134 -
.../management/client/GroupManagementClient.java | 453 -
.../identity-management-client/pom.xml | 137 -
.../client/IdentityManagementClient.java | 224 -
.../custos-client-sdks/custos-java-clients/pom.xml | 44 -
.../resource-secret-management-client/pom.xml | 144 -
.../ResourceSecretManagementAgentClient.java | 169 -
.../client/ResourceSecretManagementClient.java | 752 --
.../sharing-management-client/pom.xml | 135 -
.../management/client/SharingManagementClient.java | 281 -
.../tenant-management-client/pom.xml | 137 -
.../client/SuperAdminOperationsClient.java | 174 -
.../manamgement/client/TenantManagementClient.java | 289 -
.../user-management-client/pom.xml | 138 -
.../management/client/UserManagementClient.java | 596 -
legacy/custos-client-sdks/custos-java-sdk/pom.xml | 116 -
.../custos/clients/CustosClientProvider.java | 148 -
.../clients/ResourceManagementClient.js | 49 -
.../custos-js-sdk/clients/test.html | 30 -
.../custos-js-sdk/package-lock.json | 4183 -------
.../custos-client-sdks/custos-js-sdk/package.json | 13 -
.../AgentProfileService_pb.js | 986 --
.../ClusterManagementService_pb.js | 367 -
.../CredentialStoreService_pb.js | 3015 -----
.../FederatedAuthenticationService_pb.js | 2341 ----
.../iam-admin-service/IamAdminService_pb.js | 12009 -------------------
.../identity-service/IdentityService_pb.js | 3274 -----
.../ResourceSecretService_pb.js | 2694 -----
.../sharing-service/SharingService_pb.js | 3885 ------
.../tenant-profile/TenantProfileService_pb.js | 4252 -------
.../user-profile/UserProfileService_pb.js | 3958 ------
.../AgentManagementService_grpc_web_pb.js | 1139 --
.../agent-management/AgentManagementService_pb.js | 704 --
.../GroupManagementService_grpc_web_pb.js | 1302 --
.../group-management/GroupManagementService_pb.js | 38 -
.../IdentityManagementService_grpc_web_pb.js | 988 --
.../IdentityManagementService_pb.js | 1295 --
.../ResourceSecretManagementService_grpc_web_pb.js | 1149 --
.../ResourceSecretManagementService_pb.js | 50 -
.../TenantManagementService_grpc_web_pb.js | 1147 --
.../TenantManagementService_pb.js | 2890 -----
.../UserManagementService_grpc_web_pb.js | 1942 ---
.../user-management/UserManagementService_pb.js | 1972 ---
.../custos-python-sdk/.gitignore | 3 -
.../custos-client-sdks/custos-python-sdk/LICENSE | 201 -
.../custos-client-sdks/custos-python-sdk/README.md | 173 -
.../custos-python-sdk/__init__.py | 15 -
.../custos-python-sdk/build/lib/custos/__init__.py | 15 -
.../build/lib/custos/clients/__init__.py | 15 -
.../lib/custos/clients/agent_management_client.py | 294 -
.../lib/custos/clients/group_management_client.py | 169 -
.../custos/clients/identity_management_client.py | 240 -
.../clients/resource_secret_management_client.py | 260 -
.../custos/clients/sharing_management_client.py | 136 -
.../clients/super_tenant_management_client.py | 80 -
.../lib/custos/clients/tenant_management_client.py | 269 -
.../lib/custos/clients/user_management_client.py | 387 -
.../build/lib/custos/clients/utils/__init__.py | 15 -
.../utils/certificate_fetching_rest_client.py | 79 -
.../clients/utils/exceptions/CustosExceptions.py | 36 -
.../custos/clients/utils/exceptions/__init__.py | 15 -
.../build/lib/custos/clients/utils/utilities.py | 24 -
.../build/lib/custos/samples/__init__.py | 15 -
.../lib/custos/samples/agent_management_samples.py | 49 -
.../lib/custos/samples/group_management_samples.py | 63 -
.../custos/samples/identity_management_samples.py | 70 -
.../custos/samples/resource_secert_management.py | 82 -
.../build/lib/custos/samples/resources/__init__.py | 15 -
.../build/lib/custos/samples/resources/cert.pem | 31 -
.../custos/samples/tenant_management_samples.py | 95 -
.../lib/custos/samples/user_management_samples.py | 109 -
.../build/lib/custos/server/__init__.py | 15 -
.../custos/server/core/AgentProfileService_pb2.py | 361 -
.../server/core/AgentProfileService_pb2_grpc.py | 182 -
.../server/core/ClusterManagementService_pb2.py | 156 -
.../core/ClusterManagementService_pb2_grpc.py | 63 -
.../server/core/CredentialStoreService_pb2.py | 1056 --
.../server/core/CredentialStoreService_pb2_grpc.py | 677 --
.../core/FederatedAuthenticationService_pb2.py | 1007 --
.../FederatedAuthenticationService_pb2_grpc.py | 347 -
.../lib/custos/server/core/IamAdminService_pb2.py | 3689 ------
.../custos/server/core/IamAdminService_pb2_grpc.py | 1635 ---
.../lib/custos/server/core/IdentityService_pb2.py | 990 --
.../custos/server/core/IdentityService_pb2_grpc.py | 414 -
.../lib/custos/server/core/LoggingService_pb2.py | 419 -
.../custos/server/core/LoggingService_pb2_grpc.py | 181 -
.../lib/custos/server/core/MessagingService_pb2.py | 351 -
.../server/core/MessagingService_pb2_grpc.py | 115 -
.../server/core/ResourceSecretService_pb2.py | 1377 ---
.../server/core/ResourceSecretService_pb2_grpc.py | 676 --
.../lib/custos/server/core/SharingService_pb2.py | 1569 ---
.../custos/server/core/SharingService_pb2_grpc.py | 907 --
.../custos/server/core/TenantProfileService_pb2.py | 1346 ---
.../server/core/TenantProfileService_pb2_grpc.py | 346 -
.../custos/server/core/UserProfileService_pb2.py | 1471 ---
.../server/core/UserProfileService_pb2_grpc.py | 841 --
.../build/lib/custos/server/core/__init__.py | 15 -
.../integration/AgentManagementService_pb2.py | 389 -
.../integration/AgentManagementService_pb2_grpc.py | 546 -
.../integration/ClusterManagementService_pb2.py | 162 -
.../ClusterManagementService_pb2_grpc.py | 83 -
.../integration/GroupManagementService_pb2.py | 309 -
.../integration/GroupManagementService_pb2_grpc.py | 843 --
.../integration/IdentityManagementService_pb2.py | 498 -
.../IdentityManagementService_pb2_grpc.py | 449 -
.../server/integration/LogManagementService_pb2.py | 100 -
.../integration/LogManagementService_pb2_grpc.py | 149 -
.../ResourceSecretManagementService_pb2.py | 281 -
.../ResourceSecretManagementService_pb2_grpc.py | 745 --
.../integration/SharingManagementService_pb2.py | 328 -
.../SharingManagementService_pb2_grpc.py | 908 --
.../integration/TenantManagementService_pb2.py | 1048 --
.../TenantManagementService_pb2_grpc.py | 748 --
.../integration/UserManagementService_pb2.py | 764 --
.../integration/UserManagementService_pb2_grpc.py | 811 --
.../lib/custos/server/integration/__init__.py | 15 -
.../build/lib/custos/transport/__init__.py | 15 -
.../build/lib/custos/transport/certificate.pem | 58 -
.../build/lib/custos/transport/settings.py | 52 -
.../custos-python-sdk/custos/__init__.py | 15 -
.../custos-python-sdk/custos/clients/__init__.py | 15 -
.../custos/clients/agent_management_client.py | 294 -
.../custos/clients/group_management_client.py | 169 -
.../custos/clients/identity_management_client.py | 240 -
.../clients/resource_secret_management_client.py | 260 -
.../custos/clients/sharing_management_client.py | 136 -
.../clients/super_tenant_management_client.py | 80 -
.../custos/clients/tenant_management_client.py | 269 -
.../custos/clients/user_management_client.py | 387 -
.../custos/clients/utils/__init__.py | 15 -
.../utils/certificate_fetching_rest_client.py | 79 -
.../clients/utils/exceptions/CustosExceptions.py | 36 -
.../custos/clients/utils/exceptions/__init__.py | 15 -
.../custos/clients/utils/utilities.py | 24 -
.../custos-python-sdk/custos/samples/__init__.py | 15 -
.../custos/samples/agent_management_samples.py | 49 -
.../custos/samples/group_management_samples.py | 63 -
.../custos/samples/identity_management_samples.py | 70 -
.../custos/samples/resource_secert_management.py | 82 -
.../custos/samples/resources/__init__.py | 15 -
.../custos/samples/resources/cert.pem | 31 -
.../custos/samples/tenant_management_samples.py | 95 -
.../custos/samples/user_management_samples.py | 109 -
.../custos-python-sdk/custos/server/__init__.py | 15 -
.../custos/server/core/AgentProfileService_pb2.py | 361 -
.../server/core/AgentProfileService_pb2_grpc.py | 182 -
.../server/core/ClusterManagementService_pb2.py | 156 -
.../core/ClusterManagementService_pb2_grpc.py | 62 -
.../server/core/CredentialStoreService_pb2.py | 1056 --
.../server/core/CredentialStoreService_pb2_grpc.py | 677 --
.../core/FederatedAuthenticationService_pb2.py | 1007 --
.../FederatedAuthenticationService_pb2_grpc.py | 347 -
.../custos/server/core/IamAdminService_pb2.py | 3689 ------
.../custos/server/core/IamAdminService_pb2_grpc.py | 1635 ---
.../custos/server/core/IdentityService_pb2.py | 990 --
.../custos/server/core/IdentityService_pb2_grpc.py | 414 -
.../custos/server/core/LoggingService_pb2.py | 419 -
.../custos/server/core/LoggingService_pb2_grpc.py | 181 -
.../custos/server/core/MessagingService_pb2.py | 351 -
.../server/core/MessagingService_pb2_grpc.py | 115 -
.../server/core/ResourceSecretService_pb2.py | 1377 ---
.../server/core/ResourceSecretService_pb2_grpc.py | 676 --
.../custos/server/core/SharingService_pb2.py | 1569 ---
.../custos/server/core/SharingService_pb2_grpc.py | 907 --
.../custos/server/core/TenantProfileService_pb2.py | 1346 ---
.../server/core/TenantProfileService_pb2_grpc.py | 346 -
.../custos/server/core/UserProfileService_pb2.py | 1471 ---
.../server/core/UserProfileService_pb2_grpc.py | 841 --
.../custos/server/core/__init__.py | 15 -
.../integration/AgentManagementService_pb2.py | 389 -
.../integration/AgentManagementService_pb2_grpc.py | 546 -
.../integration/ClusterManagementService_pb2.py | 162 -
.../ClusterManagementService_pb2_grpc.py | 83 -
.../integration/GroupManagementService_pb2.py | 309 -
.../integration/GroupManagementService_pb2_grpc.py | 843 --
.../integration/IdentityManagementService_pb2.py | 498 -
.../IdentityManagementService_pb2_grpc.py | 449 -
.../server/integration/LogManagementService_pb2.py | 100 -
.../integration/LogManagementService_pb2_grpc.py | 149 -
.../ResourceSecretManagementService_pb2.py | 281 -
.../ResourceSecretManagementService_pb2_grpc.py | 745 --
.../integration/SharingManagementService_pb2.py | 328 -
.../SharingManagementService_pb2_grpc.py | 908 --
.../integration/TenantManagementService_pb2.py | 1048 --
.../TenantManagementService_pb2_grpc.py | 748 --
.../integration/UserManagementService_pb2.py | 764 --
.../integration/UserManagementService_pb2_grpc.py | 811 --
.../custos/server/integration/__init__.py | 15 -
.../custos-python-sdk/custos/transport/__init__.py | 15 -
.../custos/transport/certificate.pem | 58 -
.../custos/transport/settings.ini | 21 -
.../custos-python-sdk/custos/transport/settings.py | 52 -
.../custos_python_sdk.egg-info/PKG-INFO | 26 -
.../custos_python_sdk.egg-info/SOURCES.txt | 95 -
.../dependency_links.txt | 15 -
.../custos_python_sdk.egg-info/requires.txt | 26 -
.../custos_python_sdk.egg-info/top_level.txt | 17 -
.../custos-python-sdk/custos_sdk.egg-info/PKG-INFO | 183 -
.../custos_sdk.egg-info/SOURCES.txt | 95 -
.../custos_sdk.egg-info/dependency_links.txt | 15 -
.../custos_sdk.egg-info/requires.txt | 26 -
.../custos_sdk.egg-info/top_level.txt | 17 -
.../custos-python-sdk/requirements.txt | 26 -
.../custos-client-sdks/custos-python-sdk/setup.cfg | 15 -
.../custos-client-sdks/custos-python-sdk/setup.py | 53 -
.../custos-client-sdks/custos-samples/__init__.py | 17 -
.../custos-samples/configs/settings.ini | 24 -
.../custos-samples/samples/__init__.py | 15 -
.../samples/group_management_samples.py | 74 -
.../samples/identity_management_samples.py | 56 -
.../samples/secret_management_samples.py | 78 -
.../secure_resources_with_custos_simulation.py | 377 -
.../samples/sharing_management_samples.py | 105 -
.../samples/user_management_samples.py | 82 -
.../custos_jupyterhub_authenticator/.gitignore | 3 -
.../custos_jupyterhub_authenticator/LICENSE | 201 -
.../custos_jupyterhub_authenticator/MANIFEST.in | 17 -
.../custos_jupyterhub_authenticator/README.md | 65 -
.../custos_jupyterhub_authenticator/__init__.py | 15 -
.../build/lib/custosauthenticator/__init__.py | 15 -
.../build/lib/custosauthenticator/custos.py | 196 -
.../PKG-INFO | 75 -
.../SOURCES.txt | 29 -
.../dependency_links.txt | 15 -
.../requires.txt | 17 -
.../top_level.txt | 17 -
.../custosauthenticator/__init__.py | 15 -
.../custosauthenticator/custos.py | 199 -
.../requirements.txt | 19 -
.../custos_jupyterhub_authenticator/setup.cfg | 15 -
.../custos_jupyterhub_authenticator/setup.py | 46 -
legacy/custos-client-sdks/pom.xml | 49 -
.../proto/SharingModel.proto | 117 -
.../proto/SharingService.proto | 165 -
legacy/custos-portal/.gitignore | 24 -
legacy/custos-portal/README.md | 69 -
legacy/custos-portal/eslint.config.js | 47 -
legacy/custos-portal/index.html | 35 -
legacy/custos-portal/package-lock.json | 3966 ------
legacy/custos-portal/package.json | 42 -
legacy/custos-portal/public/vite.svg | 37 -
legacy/custos-portal/src/App.tsx | 68 -
.../custos-portal/src/components/ActionButton.tsx | 52 -
.../src/components/Groups/AddGroupMemberModal.tsx | 141 -
.../src/components/Groups/CreateGroupModal.tsx | 250 -
.../src/components/Groups/GroupDetails.tsx | 99 -
.../src/components/Groups/GroupMembers.tsx | 268 -
.../src/components/Groups/GroupSettings.tsx | 353 -
.../components/Groups/TransferOwnershipModal.tsx | 162 -
.../custos-portal/src/components/Groups/index.tsx | 158 -
.../src/components/LeftRightLayout.tsx | 16 -
.../custos-portal/src/components/Login/index.tsx | 86 -
.../custos-portal/src/components/NavContainer.tsx | 288 -
legacy/custos-portal/src/components/PageTitle.tsx | 33 -
.../src/components/ProtectedComponent.tsx | 41 -
.../src/components/StackedBorderBox.tsx | 23 -
.../src/components/Users/UserSettings.tsx | 235 -
.../custos-portal/src/components/Users/index.tsx | 124 -
legacy/custos-portal/src/hooks/useApi.tsx | 72 -
legacy/custos-portal/src/index.tsx | 111 -
legacy/custos-portal/src/interfaces/Groups.tsx | 58 -
legacy/custos-portal/src/interfaces/Users.tsx | 10 -
legacy/custos-portal/src/lib/constants.ts | 28 -
legacy/custos-portal/src/lib/localOidcConfig.json | 279 -
legacy/custos-portal/src/lib/prodOidcConfig.json | 285 -
legacy/custos-portal/src/lib/util.ts | 61 -
legacy/custos-portal/src/public/airavata.png | Bin 14892 -> 0 bytes
legacy/custos-portal/src/public/cuate.png | Bin 23330 -> 0 bytes
legacy/custos-portal/src/public/otherLogo.svg | 33 -
legacy/custos-portal/src/vite-env.d.ts | 20 -
legacy/custos-portal/tsconfig.app.json | 24 -
legacy/custos-portal/tsconfig.json | 7 -
legacy/custos-portal/tsconfig.node.json | 22 -
legacy/custos-portal/vite.config.ts | 26 -
legacy/custos-tests/pom.xml | 113 -
.../integration/tests/AgentManagementTests.java | 260 -
.../integration/tests/TenantManagementTests.java | 213 -
.../integration/tests/UserManagementTests.java | 275 -
legacy/custos-tests/src/test/resources/logback.xml | 35 -
legacy/custos-tests/src/test/resources/testng.xml | 56 -
pom.xml | 229 -
554 files changed, 17 insertions(+), 174919 deletions(-)
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 17d1570fa..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-language: java
-
-sudo: false
-
-notifications:
- email:
- on_success: change
- on_failure: always
-
-jdk:
- - oraclejdk11
-
-script: mvn clean install
-
-# Git-describe Maven plugin needs the full history
-git:
- depth: false
\ No newline at end of file
diff --git a/README.md b/README.md
index b0e023e46..f98530fe0 100644
--- a/README.md
+++ b/README.md
@@ -21,54 +21,40 @@
[](https://apache.org/licenses/LICENSE-2.0)
[](https://github.com/apache/airavata-custos/pulls?q=is%3Apr+is%3Aclosed)
-[](https://travis-ci.org/github/apache/airavata-custos)
-Custos is a multi-tenant security middleware for science gateways, developed under the [Apache Airavata](https://airavata.apache.org/) umbrella. It provides identity and access management, credential storage, federated authentication, and resource allocation services to science gateway frameworks through a language-independent API. Custos is designed as a set of composable product components that can be deployed independently or together, built on a scalable architecture to deliver highl [...]
+Custos is a security middleware for science gateways and HPC research computing, developed under the [Apache Airavata](https://airavata.apache.org/) umbrella. It provides identity and access management, credential storage, federated authentication, and resource allocation services through a language-independent API.
+
+The project is currently being rebuilt around an HPC allocation management focus.
**[Project website](https://airavata.apache.org/custos/)**
## Components
-### Identity Server (`identity/`)
-
-The Identity Server is the core IAM component of Custos. It handles user identity and access management, tenant profile management, resource secrets management, and groups and sharing management. Built with Java 17 and Spring Boot, it integrates with Keycloak for federated authentication, HashiCorp Vault for secrets management, and MariaDB for persistence.
-
-| Module | Description |
-|--------|-------------|
-| `identity/core` | Domain entities, repositories, protobuf definitions, mappers |
-| `identity/services` | Business logic, Keycloak and Vault integrations |
-| `identity/api` | REST API controllers |
-| `identity/application` | Spring Boot entry point |
-
-See [`identity/README.md`](identity/README.md) for setup and development instructions.
-
### Allocations (`allocations/`)
The Allocations component provides meta-allocation authority services for HPC and cloud resources. It acts as a bridge between Custos-managed tenants and external resource allocation providers.
| Module | Description |
|--------|-------------|
-| `allocations/access-ci-service` | ACCESS CI AMIE packet adapter |
-
-Additional allocation adapters for other resource providers are planned. See `allocations/README.md` for details as they become available.
+| `allocations/access-amie/` | ACCESS-CI AMIE packet processing adapter |
+| `allocations/domain/` | Shared domain models, sqlx stores, and DB migrations |
+| `allocations/provisioner/` | Shared `Provisioner` interface for HPC cluster provisioning |
+| `allocations/devtools/amie/` | Local mock AMIE server and k6 load test |
## Repository Layout
```
airavata-custos/
-├── identity/ # Identity Server
-├── allocations/ # Allocation management and usage
+├── allocations/ # Allocation management platform
├── compose/ # Docker Compose for local development
-├── deployment/ # Terraform configurations (AWS)
-├── legacy/ # Archived modules (not actively maintained)
-└── pom.xml # Root Maven reactor
+└── deployment/ # Terraform configurations
```
## Prerequisites
-* Java 17
-* Maven 3.6+
+* Go 1.24+
* Docker and Docker Compose
+* MariaDB (run via the Compose stack)
## Quick Start
@@ -79,20 +65,22 @@ git clone https://github.com/apache/airavata-custos.git
cd airavata-custos
```
-Start the backing services (Keycloak, MariaDB, Vault, Adminer):
+Start the backing services (MariaDB, Prometheus, Grafana, Vault):
```sh
cd compose
docker compose up -d
```
-Build all components:
+Build and test the Go modules:
```sh
-mvn clean install
+cd allocations/access-amie
+go build ./...
+go test ./...
```
-Refer to each component's README for detailed configuration and run instructions.
+See [`allocations/README.md`](allocations/README.md) and [`allocations/access-amie/README.md`](allocations/access-amie/README.md) for run and configuration instructions.
## Questions or Need Help?
diff --git a/allocations/access-ci-service/pom.xml b/allocations/access-ci-service/pom.xml
deleted file mode 100644
index 528083099..000000000
--- a/allocations/access-ci-service/pom.xml
+++ /dev/null
@@ -1,202 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.custos</groupId>
- <artifactId>custos</artifactId>
- <version>1.2-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <artifactId>access-ci-service</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-to-slf4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>jul-to-slf4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-to-slf4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jul-to-slf4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.flywaydb</groupId>
- <artifactId>flyway-core</artifactId>
- <version>${flyway.version}</version>
- </dependency>
- <dependency>
- <groupId>org.flywaydb</groupId>
- <artifactId>flyway-mysql</artifactId>
- <version>${flyway.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- <dependency>
- <groupId>io.micrometer</groupId>
- <artifactId>micrometer-registry-prometheus</artifactId>
- </dependency>
- <dependency>
- <groupId>net.logstash.logback</groupId>
- <artifactId>logstash-logback-encoder</artifactId>
- </dependency>
-
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy</artifactId>
- </dependency>
- <dependency>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy-agent</artifactId>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>mock</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <properties>
- <spring.profiles.active>mock</spring.profiles.active>
- </properties>
- </profile>
- </profiles>
-
- <build>
- <extensions>
- <extension>
- <groupId>kr.motd.maven</groupId>
- <artifactId>os-maven-plugin</artifactId>
- <version>1.7.0</version>
- </extension>
- </extensions>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>${maven.assembly.plugin}</version>
- <executions>
- <execution>
- <id>signer-distribution-package</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <tarLongFileMode>posix</tarLongFileMode>
- <finalName>${access.service.dist.name}</finalName>
- <descriptors>
- <descriptor>src/main/assembly/access-ci-service-bin-assembly.xml</descriptor>
- </descriptors>
- <attach>false</attach>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.xolstice.maven.plugins</groupId>
- <artifactId>protobuf-maven-plugin</artifactId>
- <version>${protobuf.maven.plugin}</version>
- <configuration>
- <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
- <pluginId>grpc-java</pluginId>
- <pluginArtifact>io.grpc:protoc-gen-grpc-java:${io.grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
- <includeDependenciesInDescriptorSet>true</includeDependenciesInDescriptorSet>
- </configuration>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>compile</goal>
- <goal>compile-custom</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>${maven.build.helper.plugin}</version>
- <executions>
- <execution>
- <id>add-generated-sources</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${project.build.directory}/generated-sources/protobuf/java</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <groups>unit</groups>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
diff --git a/allocations/access-ci-service/src/main/assembly/access-ci-service-bin-assembly.xml b/allocations/access-ci-service/src/main/assembly/access-ci-service-bin-assembly.xml
deleted file mode 100644
index 0ff1667d9..000000000
--- a/allocations/access-ci-service/src/main/assembly/access-ci-service-bin-assembly.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<!DOCTYPE assembly [
- <!ELEMENT assembly (id|includeBaseDirectory|baseDirectory|formats|fileSets|dependencySets)*>
- <!ELEMENT id (#PCDATA)>
- <!ELEMENT includeBaseDirectory (#PCDATA)>
- <!ELEMENT baseDirectory (#PCDATA)>
- <!ELEMENT formats (format)*>
- <!ELEMENT format (#PCDATA)>
- <!ELEMENT fileSets (fileSet)*>
- <!ELEMENT fileSet (directory|outputDirectory|fileMode|includes)*>
- <!ELEMENT directory (#PCDATA)>
- <!ELEMENT outputDirectory (#PCDATA)>
- <!ELEMENT includes (include)*>
- <!ELEMENT include (#PCDATA)>
- <!ELEMENT dependencySets (dependencySet)*>
- <!ELEMENT dependencySet (outputDirectory|outputFileNameMapping|includes)*>
- ]>
-<assembly>
- <id>bin</id>
- <includeBaseDirectory>true</includeBaseDirectory>
- <baseDirectory>${custos.dist.name}</baseDirectory>
- <formats>
- <format>tar.gz</format>
- <format>zip</format>
- </formats>
-
- <fileSets>
- <fileSet>
- <directory>src/main/resources/distribution/bin</directory>
- <outputDirectory>bin</outputDirectory>
- <fileMode>777</fileMode>
- <includes>
- <include>*.sh</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>src/main/resources/distribution/conf</directory>
- <outputDirectory>conf</outputDirectory>
- <includes>
- <include>application.yml</include>
- <include>logback-spring.xml</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>./</directory>
- <outputDirectory>logs</outputDirectory>
- <excludes>
- <exclude>*/**</exclude>
- </excludes>
- </fileSet>
- <fileSet>
- <directory>target</directory>
- <outputDirectory>lib</outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- </fileSet>
- </fileSets>
-
- <dependencySets>
- <dependencySet>
- <useProjectArtifact>false</useProjectArtifact>
- <outputDirectory>lib</outputDirectory>
- <includes>
- <include>*</include>
- </includes>
- </dependencySet>
- </dependencySets>
-
-</assembly>
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/AccessCiApplication.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/AccessCiApplication.java
deleted file mode 100644
index 9f2b70428..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/AccessCiApplication.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.custos.access.ci.service;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
-import org.springframework.scheduling.annotation.EnableScheduling;
-
-@SpringBootApplication
-@EnableJpaAuditing
-@EnableScheduling
-public class AccessCiApplication {
- public static void main(String[] args) {
- SpringApplication.run(AccessCiApplication.class, args);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/AmiePoller.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/AmiePoller.java
deleted file mode 100644
index ca3d07e50..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/AmiePoller.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.metrics.AmieMetrics;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.model.amie.PacketStatus;
-import org.apache.custos.access.ci.service.model.amie.ProcessingEventEntity;
-import org.apache.custos.access.ci.service.model.amie.ProcessingEventType;
-import org.apache.custos.access.ci.service.model.amie.ProcessingStatus;
-import org.apache.custos.access.ci.service.repo.amie.PacketRepository;
-import org.apache.custos.access.ci.service.repo.amie.ProcessingEventRepository;
-import org.apache.custos.access.ci.service.util.ProtoUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.time.Instant;
-import java.util.List;
-
-/**
- * A scheduled service that polls the AMIE API for new packets,
- * persists them to the database, and later for processing.
- */
-@Component
-@ConditionalOnProperty(name = "access.amie.poller.enabled", havingValue = "true", matchIfMissing = true)
-public class AmiePoller {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AmiePoller.class);
-
- private final AmieClient client;
- private final PacketRepository packetRepo;
- private final ProcessingEventRepository eventRepo;
- private final AmieMetrics amieMetrics;
-
- public AmiePoller(AmieClient client, PacketRepository packetRepo, ProcessingEventRepository eventRepo,
- AmieMetrics amieMetrics) {
- this.client = client;
- this.packetRepo = packetRepo;
- this.eventRepo = eventRepo;
- this.amieMetrics = amieMetrics;
- }
-
-
- @Scheduled(fixedDelayString = "#{T(org.springframework.boot.convert.DurationStyle).detectAndParse('${access.amie.scheduler.poll-delay}').toMillis()}")
- @Transactional
- public void pollForPackets() {
- LOGGER.info("Polling for new AMIE packets...");
- List<JsonNode> packets = client.fetchInProgressPackets();
-
- if (packets.isEmpty()) {
- LOGGER.info("No new packets found.");
- return;
- }
-
- LOGGER.info("Found {} packets to process.", packets.size());
- amieMetrics.recordPollerFetch(packets.size());
-
- for (JsonNode packetNode : packets) {
- String packetType = packetNode.path("type").asText(null);
- long amiePacketRecId = packetNode.at("/header/packet_rec_id").asLong(-1);
-
- MDC.put("amieId", String.valueOf(amiePacketRecId));
- if (packetType != null) {
- MDC.put("packetType", packetType);
- }
- try {
- processIndividualPacket(packetNode);
- } catch (Exception e) {
- // If a malformed packet is found
- LOGGER.error("An unexpected error occurred while processing a packet. Raw packet: {}", packetNode.toString(), e);
- } finally {
- MDC.remove("amieId");
- MDC.remove("packetType");
- }
- }
- }
-
- /**
- * Processes a single packet from the AMIE API. Only persists new packets.
- *
- * @param packetNode The raw packet
- */
- private void processIndividualPacket(JsonNode packetNode) {
- long amiePacketRecId = packetNode.at("/header/packet_rec_id").asLong(-1);
- String packetType = packetNode.path("type").asText(null);
-
- if (amiePacketRecId < 0 || packetType == null) {
- LOGGER.warn("Skipping packet with missing or invalid 'packet_rec_id' or 'type'. Packet: {}", packetNode);
- return;
- }
-
- // Only process if this packetRecId is new
- packetRepo.findByAmieId(amiePacketRecId).ifPresentOrElse(
- (existingPacket) -> LOGGER.debug("Packet with amie_packet_rec_id {} already exists. Skip the processing.", amiePacketRecId),
- () -> {
- LOGGER.info("Persisting new packet with amie_packet_rec_id {} and type '{}'.", amiePacketRecId, packetType);
-
- PacketEntity newPacket = new PacketEntity();
- newPacket.setAmieId(amiePacketRecId);
- newPacket.setType(packetType);
- newPacket.setStatus(PacketStatus.NEW);
- newPacket.setRawJson(packetNode.toString());
- newPacket.setReceivedAt(Instant.now());
- packetRepo.save(newPacket);
-
- amieMetrics.recordPacketReceived(packetType);
-
- ProcessingEventEntity decodeEvent = new ProcessingEventEntity();
- decodeEvent.setPacket(newPacket);
- decodeEvent.setType(ProcessingEventType.DECODE_PACKET);
- decodeEvent.setStatus(ProcessingStatus.NEW);
-
- byte[] payload = ProtoUtils.createDecodeStartedEvent(decodeEvent.getId(), newPacket.getId(), amiePacketRecId);
- decodeEvent.setPayload(payload);
- eventRepo.save(decodeEvent);
-
- LOGGER.info("Successfully enqueued DECODE_PACKET event for packet {}.", amiePacketRecId);
- }
- );
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/client/amie/AmieClient.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/client/amie/AmieClient.java
deleted file mode 100644
index 8634524c7..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/client/amie/AmieClient.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.client.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.custos.access.ci.service.config.AmieProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Component;
-import org.springframework.web.client.HttpClientErrorException;
-import org.springframework.web.client.RestClientException;
-import org.springframework.web.client.RestTemplate;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A client for Access CI AMIE REST API
- */
-@Component
-public class AmieClient {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AmieClient.class);
- private static final String PACKETS_PATH = "%s/packets/%s";
- private static final String HEADER_XA_SITE = "XA-SITE";
- private static final String HEADER_XA_API_KEY = "XA-API-KEY";
-
- private final RestTemplate restTemplate;
- private final AmieProperties properties;
- private final ObjectMapper objectMapper = new ObjectMapper();
-
- public AmieClient(@Qualifier("amieRestTemplate") RestTemplate restTemplate, AmieProperties properties) {
- this.restTemplate = restTemplate;
- this.properties = properties;
- }
-
- /**
- * Fetches all in-progress packets from the AMIE API.
- *
- * @return A list of packets. Returns an empty list if the call fails or no packets are found.
- */
- public List<JsonNode> fetchInProgressPackets() {
- String url = String.format(PACKETS_PATH, properties.getBaseUrl(), properties.getSiteCode());
- LOGGER.info("Polling for AMIE packets at URL: {}", url);
-
- HttpHeaders headers = createAmieHeaders();
- HttpEntity<String> entity = new HttpEntity<>(headers);
-
- try {
- ResponseEntity<String> response = restTemplate.exchange(URI.create(url), HttpMethod.GET, entity, String.class);
-
- if (!response.getStatusCode().is2xxSuccessful() || response.getBody() == null) {
- LOGGER.warn("Received a non-successful response from AMIE API: {} {}", response.getStatusCode(), response.getBody());
- return Collections.emptyList();
- }
-
- return parsePacketsFromResponse(response.getBody());
-
- } catch (RestClientException e) {
- LOGGER.error("An unexpected error occurred while fetching packets.", e);
- return Collections.emptyList();
- }
- }
-
- /**
- * Sends a reply packet to the AMIE API to continue a transaction.
- * For example, sending a 'notify_project_create' in response to a 'request_project_create'.
- *
- * @param packetRecId The ID of the packet this reply is for.
- * @param replyBody A Map representing the JSON body of the reply packet.
- */
- public void replyToPacket(long packetRecId, Map<String, Object> replyBody) {
- String url = String.format("%s/packets/%s/%d/reply", properties.getBaseUrl(), properties.getSiteCode(), packetRecId);
- LOGGER.info("Sending reply to URL: {}", url);
-
- HttpHeaders headers = createAmieHeaders();
- headers.setContentType(MediaType.APPLICATION_JSON);
-
- HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(replyBody, headers);
-
- try {
- ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
- if (response.getStatusCode().is2xxSuccessful()) {
- LOGGER.info("Successfully sent reply for packet_rec_id [{}].", packetRecId);
- } else {
- LOGGER.error("Failed to send reply for packet_rec_id [{}]. Status: {}, Body: {}", packetRecId, response.getStatusCode(), response.getBody());
- }
- } catch (HttpClientErrorException e) {
- LOGGER.error("HTTP error sending reply for packet_rec_id [{}]: {} {}", packetRecId, e.getStatusCode(), e.getResponseBodyAsString(), e);
- throw e;
- }
- }
-
- private HttpHeaders createAmieHeaders() {
- HttpHeaders headers = new HttpHeaders();
- headers.set(HEADER_XA_SITE, properties.getSiteCode());
- headers.set(HEADER_XA_API_KEY, properties.getApiKey());
- headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
- return headers;
- }
-
- private List<JsonNode> parsePacketsFromResponse(String responseBody) {
- List<JsonNode> packets = new ArrayList<>();
- try {
- JsonNode root = objectMapper.readTree(responseBody);
-
- // According to AMIE documentation, the response might be a direct array or an object
- // containing a "result" key which holds the data.
- if (root.isArray()) {
- root.forEach(packets::add);
- } else if (root.has("result")) {
- JsonNode resultNode = root.get("result");
- if (resultNode.isArray()) {
- resultNode.forEach(packets::add);
- } else {
- packets.add(resultNode);
- }
- } else {
- // Handle cases when the response is a single packet object not in an array
- packets.add(root);
- }
- LOGGER.info("Successfully fetched and parsed {} packets from AMIE API.", packets.size());
- return packets;
-
- } catch (Exception e) {
- LOGGER.error("Failed to parse JSON response from AMIE API. Response body: {}", responseBody, e);
- return Collections.emptyList();
- }
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/config/AmieProperties.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/config/AmieProperties.java
deleted file mode 100644
index d4e08eee9..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/config/AmieProperties.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.config;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import java.time.Duration;
-
-@ConfigurationProperties(prefix = "access.amie")
-public class AmieProperties {
-
- private final Scheduler scheduler = new Scheduler();
- private final Client client = new Client();
- /**
- * The base URL for the AMIE Client API.
- */
- private String baseUrl;
- /**
- * ACCESS CI provided site code (e.g., "NEXUS") for the XA-SITE header
- */
- private String siteCode;
- /**
- * ACCESS CI provided API key for the XA-API-KEY header
- */
- private String apiKey;
-
- public String getBaseUrl() {
- return baseUrl;
- }
-
- public void setBaseUrl(String baseUrl) {
- this.baseUrl = baseUrl;
- }
-
- public String getSiteCode() {
- return siteCode;
- }
-
- public void setSiteCode(String siteCode) {
- this.siteCode = siteCode;
- }
-
- public String getApiKey() {
- return apiKey;
- }
-
- public void setApiKey(String apiKey) {
- this.apiKey = apiKey;
- }
-
- public Scheduler getScheduler() {
- return scheduler;
- }
-
- public Client getClient() {
- return client;
- }
-
- public static class Scheduler {
- private Duration pollDelay = Duration.ofSeconds(30);
- private Duration workerDelay = Duration.ofSeconds(5);
-
- public Duration getPollDelay() {
- return pollDelay;
- }
-
- public void setPollDelay(Duration pollDelay) {
- this.pollDelay = pollDelay;
- }
-
- public Duration getWorkerDelay() {
- return workerDelay;
- }
-
- public void setWorkerDelay(Duration workerDelay) {
- this.workerDelay = workerDelay;
- }
- }
-
- public static class Client {
- private Duration connectTimeout = Duration.ofSeconds(5);
- private Duration readTimeout = Duration.ofSeconds(20);
-
- public Duration getConnectTimeout() {
- return connectTimeout;
- }
-
- public void setConnectTimeout(Duration connectTimeout) {
- this.connectTimeout = connectTimeout;
- }
-
- public Duration getReadTimeout() {
- return readTimeout;
- }
-
- public void setReadTimeout(Duration readTimeout) {
- this.readTimeout = readTimeout;
- }
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/config/AppConfig.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/config/AppConfig.java
deleted file mode 100644
index 740890ac2..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/config/AppConfig.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.config;
-
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.boot.web.client.RestTemplateBuilder;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.client.RestTemplate;
-
-@Configuration
-@EnableConfigurationProperties(AmieProperties.class)
-public class AppConfig {
-
- @Bean("amieRestTemplate")
- public RestTemplate amieRestTemplate(AmieProperties properties) {
- return new RestTemplateBuilder()
- .setConnectTimeout(properties.getClient().getConnectTimeout())
- .setReadTimeout(properties.getClient().getReadTimeout())
- .build();
- }
-}
\ No newline at end of file
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/DataAccountCreateHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/DataAccountCreateHandler.java
deleted file mode 100644
index d50d1e45b..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/DataAccountCreateHandler.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Handles the 'data_account_create' packet.
- * <p>
- * This packet is the third step in the account creation transaction.
- */
-@Component
-public class DataAccountCreateHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(DataAccountCreateHandler.class);
-
- private final AmieClient amieClient;
- private final PersonService personService;
- private final AuditService auditService;
-
- public DataAccountCreateHandler(AmieClient amieClient, PersonService personService, AuditService auditService) {
- this.amieClient = amieClient;
- this.personService = personService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "data_account_create";
- }
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) {
- LOGGER.info("Starting 'data_account_create' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- JsonNode body = packetJson.path("body");
- String projectId = body.path("ProjectID").asText();
- String personId = body.path("PersonID").asText();
- JsonNode dnList = body.path("DnList");
-
- Assert.hasText(projectId, "'ProjectID' must not be empty.");
- Assert.hasText(personId, "'PersonID' must not be empty.");
- LOGGER.info("Packet validated. ProjectID: [{}], PersonID: [{}].", projectId, personId);
-
- if (dnList.isArray() && !dnList.isEmpty()) {
- LOGGER.info("Persisting DnList for person [{}] from data_account_create.", personId);
- personService.persistDnsForPerson(personId, dnList);
- auditService.log(packetEntity.getId(), eventId, AuditAction.PERSIST_DNS,
- "person", personId,
- "Persisted " + dnList.size() + " DN(s) for person " + personId + " from data_account_create");
- }
-
- // Send the 'inform_transaction_complete' reply to close the transaction.
- sendSuccessReply(packetEntity.getAmieId());
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent inform_transaction_complete reply for data_account_create");
- }
-
- private void sendSuccessReply(long packetRecId) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> itcBody = new HashMap<>();
-
- itcBody.put("StatusCode", "Success");
- itcBody.put("DetailCode", 1);
- itcBody.put("Message", "Transaction completed successfully by handler.");
-
- reply.put("type", "inform_transaction_complete");
- reply.put("body", itcBody);
-
- amieClient.replyToPacket(packetRecId, reply);
-
- LOGGER.info("Successfully sent 'inform_transaction_complete' for data_account_create packet_rec_id [{}].", packetRecId);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/DataProjectCreateHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/DataProjectCreateHandler.java
deleted file mode 100644
index 6ea5db41e..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/DataProjectCreateHandler.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Handles 'data_project_create' (DPC) and sends 'inform_transaction_complete' (ITC).
- */
-@Component
-public class DataProjectCreateHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(DataProjectCreateHandler.class);
-
- private final AmieClient amieClient;
- private final PersonService personService;
- private final AuditService auditService;
-
- public DataProjectCreateHandler(AmieClient amieClient, PersonService personService, AuditService auditService) {
- this.amieClient = amieClient;
- this.personService = personService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "data_project_create";
- }
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) {
- LOGGER.info("Starting 'data_project_create' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- JsonNode body = packetJson.path("body");
- String projectId = body.path("ProjectID").asText();
- String personId = body.path("PersonID").asText();
- JsonNode dnList = body.path("DnList");
-
- Assert.hasText(projectId, "'ProjectID' must not be empty.");
- Assert.hasText(personId, "'PersonID' must not be empty.");
- LOGGER.info("Packet validated. ProjectID: [{}], PersonID: [{}].", projectId, personId);
-
- if (dnList.isArray() && !dnList.isEmpty()) {
- LOGGER.info("Persisting DnList for person [{}] from data_project_create.", personId);
- personService.persistDnsForPerson(personId, dnList);
- auditService.log(packetEntity.getId(), eventId, AuditAction.PERSIST_DNS,
- "person", personId,
- "Persisted " + dnList.size() + " DN(s) for person " + personId + " from data_project_create");
- }
-
- sendSuccessReply(packetEntity.getAmieId());
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent inform_transaction_complete reply for data_project_create");
- }
-
- private void sendSuccessReply(long packetRecId) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> itcBody = new HashMap<>();
-
- itcBody.put("StatusCode", "Success");
- itcBody.put("DetailCode", 1);
- itcBody.put("Message", "Transaction completed successfully by handler.");
-
- reply.put("type", "inform_transaction_complete");
- reply.put("body", itcBody);
-
- amieClient.replyToPacket(packetRecId, reply);
-
- LOGGER.info("Successfully sent 'inform_transaction_complete' for packet_rec_id [{}].", packetRecId);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/InformTransactionCompleteHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/InformTransactionCompleteHandler.java
deleted file mode 100644
index 8300c2be7..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/InformTransactionCompleteHandler.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * Handles the 'inform_transaction_complete' packet.
- * <p>
- * This is a terminal packet that declares the end of a transaction. This requires no reply.
- */
-@Component
-public class InformTransactionCompleteHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(InformTransactionCompleteHandler.class);
-
- private final AuditService auditService;
-
- public InformTransactionCompleteHandler(AuditService auditService) {
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "inform_transaction_complete";
- }
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) {
- // This packet is purely informational and completes the transaction
- JsonNode body = packetJson.path("body");
- String statusCode = body.path("StatusCode").asText("Unknown");
- String message = body.path("Message").asText("");
-
- LOGGER.info("Received 'inform_transaction_complete' for packet amie_id [{}]. Status: [{}], Message: [{}]. Transaction is now closed.",
- packetEntity.getAmieId(), statusCode, message);
-
- auditService.log(packetEntity.getId(), eventId, AuditAction.TRANSACTION_COMPLETE,
- "packet", packetEntity.getId(),
- "Transaction complete received. Status: " + statusCode);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/NoOpHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/NoOpHandler.java
deleted file mode 100644
index bf0ce659f..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/NoOpHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * A default PacketHandler that performs no action.
- */
-@Component
-public class NoOpHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(NoOpHandler.class);
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) {
- LOGGER.info("NoOpHandler executed for packet with amie_packet_rec_id [{}] and type [{}]. No action taken.", packetEntity.getAmieId(), packetEntity.getType());
- // No operations
- }
-
- @Override
- public String supportsType() {
- return "*";
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/PacketHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/PacketHandler.java
deleted file mode 100644
index a984204ab..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/PacketHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-
-public interface PacketHandler {
-
- /**
- * Executes the business logic for a given AMIE packet
- *
- * @param packetJson The raw packet content
- * @param packetEntity The entity for the packet
- * @param eventId The processing event ID for audit logging
- * @throws Exception if processing fails
- */
- void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) throws Exception;
-
- /**
- * Define which packet type this handler is responsible for.
- * For example, "request_account_create". "*" indicates a default handler.
- *
- * @return The AMIE packet type this handler supports
- */
- String supportsType();
-
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/PacketRouter.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/PacketRouter.java
deleted file mode 100644
index 8b9255ea4..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/PacketRouter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.slf4j.MDC;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * A service that routes an incoming packet to the appropriate PacketHandler.
- */
-@Component
-public class PacketRouter {
-
- private final List<PacketHandler> handlers;
- private final PacketHandler defaultHandler;
-
- public PacketRouter(List<PacketHandler> handlers) {
- this.handlers = handlers;
- this.defaultHandler = new NoOpHandler();
- }
-
- /**
- * Routes the packet to the correct handler and executes it.
- *
- * @param packetJson The raw packet content
- * @param packetEntity The Packet entity
- * @param eventId The processing event ID for audit logging
- * @throws Exception if the handler logic fails
- */
- public void route(JsonNode packetJson, PacketEntity packetEntity, String eventId) throws Exception {
- PacketHandler handler = findHandlerFor(packetEntity.getType());
- MDC.put("handler", handler.getClass().getSimpleName());
- handler.handle(packetJson, packetEntity, eventId);
- }
-
- private PacketHandler findHandlerFor(String packetType) {
- return handlers.stream()
- .filter(h -> h.supportsType().equalsIgnoreCase(packetType))
- .findFirst()
- .orElse(defaultHandler);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountCreateHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountCreateHandler.java
deleted file mode 100644
index a43017720..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountCreateHandler.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.ClusterAccountEntity;
-import org.apache.custos.access.ci.service.model.PersonEntity;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.service.ProjectService;
-import org.apache.custos.access.ci.service.service.UserAccountService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Handles the 'request_account_create' (RAC) AMIE packet.
- * <p>
- * This transaction asks the local site to create an account for a user on a project.
- * This includes creating a local user account with the specified project (a Unix account) if one does not exist.
- * Upon successful processing sends a 'notify_account_create' (NAC) reply back to AMIE.
- */
-@Component
-public class RequestAccountCreateHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RequestAccountCreateHandler.class);
-
- private final AmieClient amieClient;
- private final PersonService personService;
- private final UserAccountService userAccountService;
- private final ProjectService projectService;
- private final ProjectMembershipService membershipService;
- private final AuditService auditService;
-
- public RequestAccountCreateHandler(AmieClient amieClient, PersonService personService,
- UserAccountService userAccountService, ProjectService projectService,
- ProjectMembershipService membershipService, AuditService auditService) {
- this.amieClient = amieClient;
- this.personService = personService;
- this.userAccountService = userAccountService;
- this.projectService = projectService;
- this.membershipService = membershipService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "request_account_create";
- }
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) throws Exception {
- LOGGER.info("Starting 'request_account_create' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- JsonNode body = packetJson.path("body");
- String projectId = body.path("ProjectID").asText();
- String grantNumber = body.path("GrantNumber").asText();
- String userGlobalId = body.path("UserGlobalID").asText();
-
- Assert.hasText(projectId, "'ProjectID' (the local project ID) must not be empty.");
- Assert.hasText(grantNumber, "'GrantNumber' must not be empty.");
- Assert.hasText(userGlobalId, "'UserGlobalID' must not be empty.");
- LOGGER.info("Packet validated for UserGlobalID [{}] on project [{}].", userGlobalId, projectId);
-
- PersonEntity person = personService.findOrCreatePersonFromPacket(body);
- LOGGER.info("Ensured person record exists with local ID [{}].", person.getId());
- auditService.log(packetEntity.getId(), eventId, AuditAction.CREATE_PERSON,
- "person", person.getId(),
- "Created person '" + person.getFirstName() + " " + person.getLastName() + "'");
-
- ClusterAccountEntity clusterAccount = userAccountService.provisionClusterAccount(person);
- LOGGER.info("Provisioned new cluster account [{}] with username [{}].", clusterAccount.getId(), clusterAccount.getUsername());
- auditService.log(packetEntity.getId(), eventId, AuditAction.CREATE_ACCOUNT,
- "account", clusterAccount.getId(),
- "Created cluster account '" + clusterAccount.getUsername() + "' for person " + person.getId());
-
- projectService.createOrFindProject(projectId, grantNumber);
- LOGGER.info("Ensured project [{}] exists.", projectId);
-
- membershipService.createMembership(projectId, clusterAccount.getId(), "USER");
- LOGGER.info("Created 'USER' membership for cluster account [{}] on project [{}].", clusterAccount.getId(), projectId);
- auditService.log(packetEntity.getId(), eventId, AuditAction.CREATE_MEMBERSHIP,
- "membership", clusterAccount.getId(),
- "Created USER membership for account " + clusterAccount.getId() + " on project " + projectId);
-
- sendSuccessReply(packetEntity.getAmieId(), body, person.getId(), clusterAccount.getUsername());
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent notify_account_create reply for project " + projectId);
-
- LOGGER.info("Successfully completed 'request_account_create' handler and sent reply for packet amie_id [{}].", packetEntity.getAmieId());
- }
-
- private void sendSuccessReply(long packetRecId, JsonNode originalBody, String localPersonId, String localUsername) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> bodyContent = new HashMap<>();
-
- bodyContent.put("ProjectID", originalBody.path("ProjectID").asText());
- bodyContent.put("GrantNumber", originalBody.path("GrantNumber").asText());
- bodyContent.put("UserPersonID", localPersonId);
- bodyContent.put("UserRemoteSiteLogin", localUsername);
-
- bodyContent.put("UserOrgCode", originalBody.path("UserOrgCode").asText(null));
- bodyContent.put("ResourceList", originalBody.path("ResourceList"));
-
- reply.put("type", "notify_account_create");
- reply.put("body", bodyContent);
-
- amieClient.replyToPacket(packetRecId, reply);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountInactivateHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountInactivateHandler.java
deleted file mode 100644
index 842036cd0..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountInactivateHandler.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Handles the 'request_account_inactivate' AMIE packet.
- * <p>
- * This transaction asks the local site to inactivate a user's association with a specific project.
- * Upon successful local processing, it sends a 'notify_account_inactivate' reply.
- */
-@Component
-public class RequestAccountInactivateHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RequestAccountInactivateHandler.class);
-
- private final AmieClient amieClient;
- private final ProjectMembershipService membershipService;
- private final AuditService auditService;
-
- public RequestAccountInactivateHandler(AmieClient amieClient, ProjectMembershipService membershipService,
- AuditService auditService) {
- this.amieClient = amieClient;
- this.membershipService = membershipService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "request_account_inactivate";
- }
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) {
- LOGGER.info("Starting 'request_account_inactivate' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- JsonNode body = packetJson.path("body");
- String projectId = body.path("ProjectID").asText();
- String personId = body.path("PersonID").asText();
-
- Assert.hasText(projectId, "'ProjectID' must not be empty.");
- Assert.hasText(personId, "'PersonID' must not be empty.");
- LOGGER.info("Packet validated. Inactivating account for user [{}] on project [{}].", personId, projectId);
-
- membershipService.inactivateMembershipsByPersonAndProject(projectId, personId);
- auditService.log(packetEntity.getId(), eventId, AuditAction.INACTIVATE_MEMBERSHIP,
- "person", personId,
- "Inactivated membership for person " + personId + " on project " + projectId);
-
- sendSuccessReply(packetEntity.getAmieId(), body);
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent notify_account_inactivate reply for person " + personId + " on project " + projectId);
-
- LOGGER.info("Successfully completed 'request_account_inactivate' handler and sent reply for packet amie_id [{}].", packetEntity.getAmieId());
- }
-
- private void sendSuccessReply(long packetRecId, JsonNode body) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> bodyContent = new HashMap<>();
-
- bodyContent.put("ProjectID", body.path("ProjectID").asText());
- bodyContent.put("PersonID", body.path("PersonID").asText());
-
- List<String> resourceList = new ArrayList<>();
- JsonNode rlNode = body.path("ResourceList");
- if (rlNode.isArray()) {
- rlNode.forEach(node -> resourceList.add(node.asText()));
- }
- bodyContent.put("ResourceList", resourceList);
-
- reply.put("type", "notify_account_inactivate");
- reply.put("body", bodyContent);
-
- amieClient.replyToPacket(packetRecId, reply);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountReactivateHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountReactivateHandler.java
deleted file mode 100644
index ecd87b557..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountReactivateHandler.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Handles the 'request_account_reactivate' AMIE packet.
- * <p>
- * This transaction asks the local site to reactivate a user's association with a specific project.
- * Upon successful local processing, it sends a 'notify_account_reactivate' reply.
- */
-@Component
-public class RequestAccountReactivateHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RequestAccountReactivateHandler.class);
-
- private final AmieClient amieClient;
- private final ProjectMembershipService membershipService;
- private final AuditService auditService;
-
- public RequestAccountReactivateHandler(AmieClient amieClient, ProjectMembershipService membershipService,
- AuditService auditService) {
- this.amieClient = amieClient;
- this.membershipService = membershipService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "request_account_reactivate";
- }
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) {
- LOGGER.info("Starting 'request_account_reactivate' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- JsonNode body = packetJson.path("body");
- String projectId = body.path("ProjectID").asText();
- String personId = body.path("PersonID").asText();
-
- Assert.hasText(projectId, "'ProjectID' must not be empty.");
- Assert.hasText(personId, "'PersonID' must not be empty.");
- LOGGER.info("Packet validated. Reactivating account for user [{}] on project [{}].", personId, projectId);
-
- membershipService.reactivateMembershipsByPersonAndProject(projectId, personId);
- auditService.log(packetEntity.getId(), eventId, AuditAction.REACTIVATE_MEMBERSHIP,
- "person", personId,
- "Reactivated membership for person " + personId + " on project " + projectId);
-
- sendSuccessReply(packetEntity.getAmieId(), body);
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent notify_account_reactivate reply for person " + personId + " on project " + projectId);
-
- LOGGER.info("Successfully completed 'request_account_reactivate' handler and sent reply for packet amie_id [{}].", packetEntity.getAmieId());
- }
-
- private void sendSuccessReply(long packetRecId, JsonNode body) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> bodyContent = new HashMap<>();
-
- bodyContent.put("ProjectID", body.path("ProjectID").asText());
- bodyContent.put("PersonID", body.path("PersonID").asText());
-
- List<String> resourceList = new ArrayList<>();
- JsonNode rlNode = body.path("ResourceList");
- if (rlNode.isArray()) {
- rlNode.forEach(node -> resourceList.add(node.asText()));
- }
- bodyContent.put("ResourceList", resourceList);
-
- reply.put("type", "notify_account_reactivate");
- reply.put("body", bodyContent);
-
- amieClient.replyToPacket(packetRecId, reply);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestPersonMergeHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestPersonMergeHandler.java
deleted file mode 100644
index 9e1240baa..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestPersonMergeHandler.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.Assert;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Handles the 'request_person_merge' AMIE packet.
- * <p>
- * This transaction is to merge two local user identities into one.
- * This identifies a "surviving" user and a "retiring" user. The handler must
- * re-associate all resources from the retiring user to the surviving user and then
- * disable the retiring user's account.
- * Upon successful processing, this handler sends an 'inform_transaction_complete' reply to close the transaction.
- */
-@Component
-public class RequestPersonMergeHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RequestPersonMergeHandler.class);
-
- private final AmieClient amieClient;
- private final PersonService personService;
- private final AuditService auditService;
-
- public RequestPersonMergeHandler(AmieClient amieClient, PersonService personService, AuditService auditService) {
- this.amieClient = amieClient;
- this.personService = personService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "request_person_merge";
- }
-
- @Override
- @Transactional
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) {
- LOGGER.info("Starting 'request_person_merge' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- JsonNode body = packetJson.path("body");
- String survivingPersonLocalId = body.path("KeepPersonID").asText();
- String survivingPersonGlobalId = body.path("KeepGlobalID").asText();
- String retiringPersonLocalId = body.path("DeletePersonID").asText();
- String retiringPersonGlobalId = body.path("DeleteGlobalID").asText();
-
- Assert.hasText(survivingPersonLocalId, "'KeepPersonID' (the surviving user's local ID) must not be empty.");
- Assert.hasText(retiringPersonLocalId, "'DeletePersonID' (the retiring user's local ID) must not be empty.");
- LOGGER.info("Packet validated. Merging user with local ID [{}], global ID [{}] into user with local ID [{}], global ID [{}].",
- retiringPersonLocalId, retiringPersonGlobalId, survivingPersonLocalId, survivingPersonGlobalId);
-
- personService.mergePersons(survivingPersonLocalId, retiringPersonLocalId);
- auditService.log(packetEntity.getId(), eventId, AuditAction.MERGE_PERSONS,
- "person", survivingPersonLocalId,
- "Merged person " + retiringPersonLocalId + " into " + survivingPersonLocalId);
-
- sendSuccessReply(packetEntity.getAmieId());
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent inform_transaction_complete reply for person merge");
- }
-
- private void sendSuccessReply(long packetRecId) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> itcBody = new HashMap<>();
-
- itcBody.put("StatusCode", "Success");
- itcBody.put("DetailCode", 1);
- itcBody.put("Message", "Person merge transaction completed successfully.");
-
- reply.put("type", "inform_transaction_complete");
- reply.put("body", itcBody);
-
- amieClient.replyToPacket(packetRecId, reply);
-
- LOGGER.info("Successfully sent 'inform_transaction_complete' for person_merge packet_rec_id [{}].", packetRecId);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectCreateHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectCreateHandler.java
deleted file mode 100644
index d312db3f4..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectCreateHandler.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.ClusterAccountEntity;
-import org.apache.custos.access.ci.service.model.PersonEntity;
-import org.apache.custos.access.ci.service.model.ProjectEntity;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.service.ProjectService;
-import org.apache.custos.access.ci.service.service.UserAccountService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Handles 'request_project_create' (RPC) by replying with 'notify_project_create' (NPC).
- */
-@Component
-public class RequestProjectCreateHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RequestProjectCreateHandler.class);
-
- private final AmieClient amieClient;
- private final PersonService personService;
- private final UserAccountService userAccountService;
- private final ProjectService projectService;
- private final ProjectMembershipService membershipService;
- private final AuditService auditService;
-
- public RequestProjectCreateHandler(AmieClient amieClient, PersonService personService, UserAccountService userAccountService,
- ProjectService projectService, ProjectMembershipService membershipService,
- AuditService auditService) {
- this.amieClient = amieClient;
- this.personService = personService;
- this.userAccountService = userAccountService;
- this.projectService = projectService;
- this.membershipService = membershipService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "request_project_create";
- }
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) throws Exception {
- LOGGER.info("Starting 'request_project_create' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- // TODO - refactor the sanity checks into Packet Router (if all the packets follow the same style)
- if (packetJson == null) {
- LOGGER.error("packet json is null");
- throw new IllegalArgumentException("packetJson is null");
- }
-
- JsonNode body = packetJson.path("body");
- if (body.isMissingNode()) {
- LOGGER.error("body is null");
- throw new IllegalArgumentException("packetJson.body is missing");
- }
-
- String grantNumber = body.path("GrantNumber").asText();
- String piGlobalId = body.path("PiGlobalID").asText();
- String piFirstName = body.path("PiFirstName").asText();
- String piLastName = body.path("PiLastName").asText();
-
- Assert.hasText(grantNumber, "'GrantNumber' must not be empty.");
- Assert.hasText(piGlobalId, "'PiGlobalID' must not be empty.");
- Assert.hasText(piFirstName, "'PiFirstName' must not be empty.");
- Assert.hasText(piLastName, "'PiLastName' must not be empty.");
- LOGGER.info("Packet validated for GrantNumber [{}] and PI Global ID [{}].", grantNumber, piGlobalId);
-
- // Find or Create Person record for the PI
- ObjectNode piAsUserNode = createPiAsUserNode(body);
- PersonEntity piPerson = personService.findOrCreatePersonFromPacket(piAsUserNode);
- LOGGER.info("PI person record exists with local ID [{}].", piPerson.getId());
- auditService.log(packetEntity.getId(), eventId, AuditAction.CREATE_PERSON,
- "person", piPerson.getId(),
- "Created person '" + piPerson.getFirstName() + " " + piPerson.getLastName() + "'");
-
- ClusterAccountEntity piClusterAccount = userAccountService.provisionClusterAccount(piPerson);
- LOGGER.info("Provisioned cluster account for PI [{}] with username [{}].", piPerson.getId(), piClusterAccount.getUsername());
- auditService.log(packetEntity.getId(), eventId, AuditAction.CREATE_ACCOUNT,
- "account", piClusterAccount.getId(),
- "Created cluster account '" + piClusterAccount.getUsername() + "' for person " + piPerson.getId());
-
- String localProjectId = "PRJ-" + grantNumber;
- ProjectEntity project = projectService.createOrFindProject(localProjectId, grantNumber);
- LOGGER.info("Project [{}] exists.", project.getId());
- auditService.log(packetEntity.getId(), eventId, AuditAction.CREATE_PROJECT,
- "project", project.getId(),
- "Created project '" + project.getId() + "' for grant " + grantNumber);
-
- membershipService.createMembership(project.getId(), piClusterAccount.getId(), "PI");
- LOGGER.info("Created 'PI' membership for cluster account [{}] on project [{}].", piClusterAccount.getId(), project.getId());
- auditService.log(packetEntity.getId(), eventId, AuditAction.CREATE_MEMBERSHIP,
- "membership", piClusterAccount.getId(),
- "Created PI membership for account " + piClusterAccount.getId() + " on project " + project.getId());
-
- sendSuccessReply(packetEntity.getAmieId(), body, project.getId(), piPerson.getId(), piClusterAccount.getUsername());
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent notify_project_create reply for grant " + grantNumber);
-
- LOGGER.info("Successfully completed 'request_project_create' handler and sent reply for packet amie_id [{}].", packetEntity.getAmieId());
- }
-
- private void sendSuccessReply(long packetRecId, JsonNode originalBody, String localProjectId, String localPiPersonId, String localPiUsername) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> npcBody = new HashMap<>();
-
- npcBody.put("ProjectID", localProjectId);
- npcBody.put("GrantNumber", originalBody.path("GrantNumber").asText());
- npcBody.put("PiPersonID", localPiPersonId);
- npcBody.put("PiRemoteSiteLogin", localPiUsername);
- npcBody.put("PiGlobalID", originalBody.path("PiGlobalID").asText());
- npcBody.put("ProjectTitle", originalBody.path("ProjectTitle").asText(null));
- npcBody.put("ResourceList", originalBody.path("ResourceList"));
-
- reply.put("type", "notify_project_create");
- reply.put("body", npcBody);
-
- amieClient.replyToPacket(packetRecId, reply);
- }
-
- private ObjectNode createPiAsUserNode(JsonNode rpcBody) {
- ObjectNode userNode = rpcBody.deepCopy();
- userNode.put("UserGlobalID", rpcBody.path("PiGlobalID").asText());
- userNode.put("UserFirstName", rpcBody.path("PiFirstName").asText());
- userNode.put("UserLastName", rpcBody.path("PiLastName").asText());
- userNode.put("UserEmail", rpcBody.path("PiEmail").asText());
- userNode.put("UserOrganization", rpcBody.path("PiOrganization").asText());
- userNode.put("UserOrgCode", rpcBody.path("PiOrgCode").asText());
- userNode.put("NsfStatusCode", rpcBody.path("NsfStatusCode").asText());
- userNode.set("UserDnList", rpcBody.path("PiDnList"));
- return userNode;
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectInactivateHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectInactivateHandler.java
deleted file mode 100644
index 710170329..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectInactivateHandler.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.service.ProjectService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Handles the 'request_project_inactivate' AMIE packet
- */
-@Component
-public class RequestProjectInactivateHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RequestProjectInactivateHandler.class);
-
- private final AmieClient amieClient;
- private final ProjectService projectService;
- private final ProjectMembershipService membershipService;
- private final AuditService auditService;
-
- public RequestProjectInactivateHandler(AmieClient amieClient, ProjectService projectService,
- ProjectMembershipService membershipService, AuditService auditService) {
- this.amieClient = amieClient;
- this.projectService = projectService;
- this.membershipService = membershipService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "request_project_inactivate";
- }
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) {
- LOGGER.info("Starting 'request_project_inactivate' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- JsonNode body = packetJson.path("body");
- String projectId = body.path("ProjectID").asText();
-
- Assert.hasText(projectId, "'ProjectID' must not be empty.");
- LOGGER.info("Packet validated. ProjectID to inactivate: [{}].", projectId);
-
- projectService.inactivateProject(projectId);
- LOGGER.info("Inactivated project [{}].", projectId);
- auditService.log(packetEntity.getId(), eventId, AuditAction.INACTIVATE_PROJECT,
- "project", projectId,
- "Inactivated project " + projectId);
-
- membershipService.inactivateAllMembershipsForProject(projectId);
- LOGGER.info("Inactivated all memberships for project [{}].", projectId);
- auditService.log(packetEntity.getId(), eventId, AuditAction.INACTIVATE_MEMBERSHIP,
- "project", projectId,
- "Inactivated all memberships for project " + projectId);
-
- sendSuccessReply(packetEntity.getAmieId(), body);
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent notify_project_inactivate reply for project " + projectId);
-
- LOGGER.info("Successfully completed 'request_project_inactivate' handler and sent reply for packet amie_id [{}].", packetEntity.getAmieId());
- }
-
- private void sendSuccessReply(long packetRecId, JsonNode originalBody) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> bodyContent = new HashMap<>();
-
- bodyContent.put("ProjectID", originalBody.path("ProjectID").asText());
- bodyContent.put("PersonID", originalBody.path("PersonID").asText(null));
- bodyContent.put("ResourceList", originalBody.path("ResourceList"));
-
- reply.put("type", "notify_project_inactivate");
- reply.put("body", bodyContent);
-
- amieClient.replyToPacket(packetRecId, reply);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectReactivateHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectReactivateHandler.java
deleted file mode 100644
index c2ec02b68..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectReactivateHandler.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.service.ProjectService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Handles the 'request_project_reactivate' AMIE packet.
- * <p>
- * This transaction asks the local site to reactivate a project that was previously inactivated.
- * This should only reactivate the PI's account on the project and send a 'notify_project_reactivate' reply upon completion.
- */
-@Component
-public class RequestProjectReactivateHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RequestProjectReactivateHandler.class);
-
- private final AmieClient amieClient;
- private final ProjectService projectService;
- private final ProjectMembershipService membershipService;
- private final AuditService auditService;
-
- public RequestProjectReactivateHandler(AmieClient amieClient, ProjectService projectService,
- ProjectMembershipService membershipService, AuditService auditService) {
- this.amieClient = amieClient;
- this.projectService = projectService;
- this.membershipService = membershipService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "request_project_reactivate";
- }
-
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) {
- LOGGER.info("Starting 'request_project_reactivate' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- JsonNode body = packetJson.path("body");
- String projectId = body.path("ProjectID").asText();
-
- Assert.hasText(projectId, "'ProjectID' must not be empty.");
- LOGGER.info("Packet validated. ProjectID to reactivate: [{}].", projectId);
-
- projectService.reactivateProject(projectId);
- LOGGER.info("Reactivated project [{}].", projectId);
- auditService.log(packetEntity.getId(), eventId, AuditAction.REACTIVATE_PROJECT,
- "project", projectId,
- "Reactivated project " + projectId);
-
- membershipService.reactivatePiMembership(projectId);
- LOGGER.info("Reactivated PI membership(s) for project [{}].", projectId);
- auditService.log(packetEntity.getId(), eventId, AuditAction.REACTIVATE_MEMBERSHIP,
- "project", projectId,
- "Reactivated PI membership(s) for project " + projectId);
-
- sendSuccessReply(packetEntity.getAmieId(), body);
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent notify_project_reactivate reply for project " + projectId);
-
- LOGGER.info("Successfully completed 'request_project_reactivate' handler and sent reply for packet amie_id [{}].", packetEntity.getAmieId());
- }
-
- private void sendSuccessReply(long packetRecId, JsonNode originalBody) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> bodyContent = new HashMap<>();
-
- bodyContent.put("ProjectID", originalBody.path("ProjectID").asText());
- bodyContent.put("PersonID", originalBody.path("PersonID").asText(null));
- bodyContent.put("ResourceList", originalBody.path("ResourceList"));
-
- reply.put("type", "notify_project_reactivate");
- reply.put("body", bodyContent);
-
- amieClient.replyToPacket(packetRecId, reply);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestUserModifyHandler.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestUserModifyHandler.java
deleted file mode 100644
index 397e248ad..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/handler/amie/RequestUserModifyHandler.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.util.Assert;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Handles the 'request_user_modify' AMIE packet (ActionType replace | delete).
- */
-@Component
-public class RequestUserModifyHandler implements PacketHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RequestUserModifyHandler.class);
-
- private final AmieClient amieClient;
- private final PersonService personService;
- private final AuditService auditService;
-
- public RequestUserModifyHandler(AmieClient amieClient, PersonService personService, AuditService auditService) {
- this.amieClient = amieClient;
- this.personService = personService;
- this.auditService = auditService;
- }
-
- @Override
- public String supportsType() {
- return "request_user_modify";
- }
-
- @Override
- public void handle(JsonNode packetJson, PacketEntity packetEntity, String eventId) throws Exception {
- LOGGER.info("Starting 'request_user_modify' handler for packet amie_id [{}].", packetEntity.getAmieId());
-
- JsonNode body = packetJson.path("body");
- String actionType = body.path("ActionType").asText(null);
- Assert.hasText(actionType, "'ActionType' must not be empty (replace|delete).");
-
- switch (actionType.toLowerCase()) {
- case "replace":
- personService.replaceFromModifyPacket(body);
- auditService.log(packetEntity.getId(), eventId, AuditAction.UPDATE_PERSON,
- "person", body.path("UserGlobalID").asText(null),
- "Updated person via request_user_modify (replace)");
- break;
- case "delete":
- personService.deleteFromModifyPacket(body);
- auditService.log(packetEntity.getId(), eventId, AuditAction.DELETE_PERSON,
- "person", body.path("UserGlobalID").asText(null),
- "Deleted person via request_user_modify (delete)");
- break;
- default:
- throw new IllegalArgumentException("Unsupported ActionType: " + actionType);
- }
-
- sendSuccessReply(packetEntity.getAmieId());
- auditService.log(packetEntity.getId(), eventId, AuditAction.REPLY_SENT,
- "packet", packetEntity.getId(),
- "Sent inform_transaction_complete reply for request_user_modify (" + actionType + ")");
- }
-
- private void sendSuccessReply(long packetRecId) {
- Map<String, Object> reply = new HashMap<>();
- Map<String, Object> itcBody = new HashMap<>();
-
- itcBody.put("StatusCode", "Success");
- itcBody.put("DetailCode", 1);
- itcBody.put("Message", "Transaction completed successfully");
-
- reply.put("type", "inform_transaction_complete");
- reply.put("body", itcBody);
-
- amieClient.replyToPacket(packetRecId, reply);
-
- LOGGER.info("Successfully sent 'inform_transaction_complete' for 'request_user_modify' packet_rec_id [{}].", packetRecId);
- }
-}
-
-
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/metrics/AmieHealthIndicator.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/metrics/AmieHealthIndicator.java
deleted file mode 100644
index cb97d28b8..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/metrics/AmieHealthIndicator.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.metrics;
-
-import org.apache.custos.access.ci.service.config.AmieProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.actuate.health.AbstractHealthIndicator;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Component;
-import org.springframework.web.client.RestClientException;
-import org.springframework.web.client.RestTemplate;
-
-/**
- * Actuator health indicator for the upstream AMIE API.
- *
- * <p>Performs an HTTP GET to the configured AMIE base URL and reports
- * {@link Health#up()} when the endpoint responds, or {@link Health#down()} when
- * a network or HTTP error occurs.
- */
-@Component
-public class AmieHealthIndicator extends AbstractHealthIndicator {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AmieHealthIndicator.class);
-
- private final AmieProperties amieProperties;
- private final RestTemplate restTemplate;
-
- public AmieHealthIndicator(AmieProperties amieProperties,
- @Qualifier("amieRestTemplate") RestTemplate restTemplate) {
- super("AMIE API health check failed");
- this.amieProperties = amieProperties;
- this.restTemplate = restTemplate;
- }
-
- @Override
- protected void doHealthCheck(Health.Builder builder) {
- String baseUrl = amieProperties.getBaseUrl();
- String siteCode = amieProperties.getSiteCode();
- try {
- ResponseEntity<String> response = restTemplate.getForEntity(baseUrl, String.class);
- if (response.getStatusCode().is2xxSuccessful() || response.getStatusCode().is3xxRedirection()) {
- builder.up()
- .withDetail("url", baseUrl)
- .withDetail("siteCode", siteCode)
- .withDetail("httpStatus", response.getStatusCode().value());
- } else {
- builder.down()
- .withDetail("url", baseUrl)
- .withDetail("siteCode", siteCode)
- .withDetail("httpStatus", response.getStatusCode().value());
- }
- } catch (RestClientException ex) {
- LOGGER.warn("AMIE API health check failed for URL [{}]: {}", baseUrl, ex.getMessage());
- builder.down(ex)
- .withDetail("url", baseUrl)
- .withDetail("siteCode", siteCode);
- }
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/metrics/AmieMetrics.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/metrics/AmieMetrics.java
deleted file mode 100644
index 981775687..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/metrics/AmieMetrics.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.metrics;
-
-import io.micrometer.core.instrument.Counter;
-import io.micrometer.core.instrument.MeterRegistry;
-import io.micrometer.core.instrument.Timer;
-import org.springframework.stereotype.Component;
-
-/**
- * Metrics for the AMIE packet processing pipeline.
- *
- * <p>All metric names follow the Prometheus naming convention:
- * {@code amie_<subsystem>_<measurement>_<unit>}.
- */
-@Component
-public class AmieMetrics {
-
- private static final String PACKETS_RECEIVED_TOTAL = "amie_packets_received_total";
- private static final String PACKETS_PROCESSED_TOTAL = "amie_packets_processed_total";
- private static final String EVENTS_RETRY_TOTAL = "amie_events_retry_total";
- private static final String PROCESSING_DURATION_SECONDS = "amie_packet_processing_duration_seconds";
- private static final String POLLER_PACKETS_FETCHED = "amie_poller_packets_fetched";
-
- private static final String TAG_TYPE = "type";
- private static final String TAG_OUTCOME = "outcome";
- private static final String TAG_HANDLER = "handler";
-
- private final MeterRegistry meterRegistry;
-
- public AmieMetrics(MeterRegistry meterRegistry) {
- this.meterRegistry = meterRegistry;
- }
-
- /**
- * Increments the counter tracking raw packets received from the AMIE API, tagged by packet type.
- *
- * @param packetType the AMIE packet type (e.g., "request_project_create")
- */
- public void recordPacketReceived(String packetType) {
- Counter.builder(PACKETS_RECEIVED_TOTAL)
- .tag(TAG_TYPE, packetType)
- .description("Total number of AMIE packets received from the API")
- .register(meterRegistry)
- .increment();
- }
-
- /**
- * Increments the counter tracking processed packets, tagged by packet type and outcome.
- *
- * @param packetType the AMIE packet type (e.g., "request_project_create")
- * @param outcome the processing outcome (e.g., "success", "failure")
- */
- public void recordPacketProcessed(String packetType, String outcome) {
- Counter.builder(PACKETS_PROCESSED_TOTAL)
- .tag(TAG_TYPE, packetType)
- .tag(TAG_OUTCOME, outcome)
- .description("Total number of AMIE packets that completed processing")
- .register(meterRegistry)
- .increment();
- }
-
- /**
- * Increments the counter tracking event retry attempts.
- */
- public void recordRetry() {
- Counter.builder(EVENTS_RETRY_TOTAL)
- .description("Total number of AMIE processing event retry attempts")
- .register(meterRegistry)
- .increment();
- }
-
- /**
- * Starts a timer sample for measuring packet processing duration.
- *
- * @return a {@link Timer.Sample} that must be stopped via {@link #stopProcessingTimer}
- */
- public Timer.Sample startProcessingTimer() {
- return Timer.start(meterRegistry);
- }
-
- /**
- * Stops a previously started timer sample and records the duration against the
- * {@code amie_packet_processing_duration_seconds} timer, tagged by handler type.
- *
- * @param sample the sample returned by {@link #startProcessingTimer()}
- * @param handlerType the name of the handler that processed the packet
- */
- public void stopProcessingTimer(Timer.Sample sample, String handlerType) {
- Timer timer = Timer.builder(PROCESSING_DURATION_SECONDS)
- .tag(TAG_HANDLER, handlerType)
- .description("Time taken to process an AMIE packet by handler type")
- .register(meterRegistry);
- sample.stop(timer);
- }
-
- /**
- * Increments the counter tracking the number of packets fetched during a poller run.
- *
- * @param count the number of packets fetched
- */
- public void recordPollerFetch(int count) {
- Counter.builder(POLLER_PACKETS_FETCHED)
- .description("Total number of AMIE packets fetched by the poller")
- .register(meterRegistry)
- .increment(count);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/ClusterAccountEntity.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/ClusterAccountEntity.java
deleted file mode 100644
index 81d906d5e..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/ClusterAccountEntity.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model;
-
-import jakarta.persistence.CascadeType;
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.OneToMany;
-import jakarta.persistence.Table;
-import org.hibernate.annotations.CreationTimestamp;
-import org.hibernate.annotations.UpdateTimestamp;
-
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Maps to the 'cluster_accounts' table. Stores a provisioned username on the cluster.
- */
-@Entity
-@Table(name = "cluster_accounts")
-public class ClusterAccountEntity {
-
- @Id
- @GeneratedValue(strategy = GenerationType.UUID)
- @Column(name = "id")
- private String id;
-
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @JoinColumn(name = "person_id", nullable = false)
- private PersonEntity person;
-
- @Column(name = "username", nullable = false, unique = true)
- private String username;
-
- @OneToMany(mappedBy = "clusterAccount", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
- private List<ProjectMembershipEntity> projectMemberships = new ArrayList<>();
-
- @CreationTimestamp
- @Column(name = "created_at", nullable = false, updatable = false)
- private Instant createdAt;
-
- @UpdateTimestamp
- @Column(name = "updated_at", nullable = false)
- private Instant updatedAt;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public PersonEntity getPerson() {
- return person;
- }
-
- public void setPerson(PersonEntity person) {
- this.person = person;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public List<ProjectMembershipEntity> getProjectMemberships() {
- return projectMemberships;
- }
-
- public void setProjectMemberships(List<ProjectMembershipEntity> projectMemberships) {
- this.projectMemberships = projectMemberships;
- }
-
- public Instant getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Instant createdAt) {
- this.createdAt = createdAt;
- }
-
- public Instant getUpdatedAt() {
- return updatedAt;
- }
-
- public void setUpdatedAt(Instant updatedAt) {
- this.updatedAt = updatedAt;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == null || getClass() != o.getClass()) return false;
-
- ClusterAccountEntity that = (ClusterAccountEntity) o;
- return id.equals(that.id) && username.equals(that.username);
- }
-
- @Override
- public int hashCode() {
- int result = id.hashCode();
- result = 31 * result + username.hashCode();
- return result;
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/PersonDnsEntity.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/PersonDnsEntity.java
deleted file mode 100644
index ef4f61297..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/PersonDnsEntity.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-import jakarta.persistence.UniqueConstraint;
-
-/**
- * Maps to the 'person_dns' table. Stores a Distinguished Name (DN) for a person.
- */
-@Entity
-@Table(name = "person_dns", uniqueConstraints = {@UniqueConstraint(columnNames = {"person_id", "dn"})})
-public class PersonDnsEntity {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private Long id;
-
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @JoinColumn(name = "person_id", nullable = false)
- private PersonEntity person;
-
- @Column(name = "dn", nullable = false, length = 512)
- private String dn;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public PersonEntity getPerson() {
- return person;
- }
-
- public void setPerson(PersonEntity person) {
- this.person = person;
- }
-
- public String getDn() {
- return dn;
- }
-
- public void setDn(String dn) {
- this.dn = dn;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == null || getClass() != o.getClass()) return false;
-
- PersonDnsEntity that = (PersonDnsEntity) o;
- return id.equals(that.id);
- }
-
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/PersonEntity.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/PersonEntity.java
deleted file mode 100644
index ab8642f46..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/PersonEntity.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model;
-
-import jakarta.persistence.CascadeType;
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.Id;
-import jakarta.persistence.OneToMany;
-import jakarta.persistence.Table;
-import org.hibernate.annotations.CreationTimestamp;
-import org.hibernate.annotations.UpdateTimestamp;
-
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Maps to the 'persons' table. Stores a unique record for each person received from AMIE.
- */
-@Entity
-@Table(name = "persons")
-public class PersonEntity {
-
- @Id
- @Column(name = "id")
- private String id;
-
- @Column(name = "access_global_id", nullable = false, unique = true)
- private String accessGlobalId;
-
- @Column(name = "first_name", nullable = false)
- private String firstName;
-
- @Column(name = "last_name", nullable = false)
- private String lastName;
-
- @Column(name = "email", nullable = false)
- private String email;
-
- @Column(name = "organization")
- private String organization;
-
- @Column(name = "org_code")
- private String orgCode;
-
- @Column(name = "nsf_status_code", length = 32)
- private String nsfStatusCode;
-
- @CreationTimestamp
- @Column(name = "created_at", nullable = false, updatable = false)
- private Instant createdAt;
-
- @UpdateTimestamp
- @Column(name = "updated_at", nullable = false)
- private Instant updatedAt;
-
- @OneToMany(mappedBy = "person", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
- private List<PersonDnsEntity> dnsEntries = new ArrayList<>();
-
- @OneToMany(mappedBy = "person", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
- private List<ClusterAccountEntity> clusterAccounts = new ArrayList<>();
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getAccessGlobalId() {
- return accessGlobalId;
- }
-
- public void setAccessGlobalId(String accessGlobalId) {
- this.accessGlobalId = accessGlobalId;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getOrganization() {
- return organization;
- }
-
- public void setOrganization(String organization) {
- this.organization = organization;
- }
-
- public String getOrgCode() {
- return orgCode;
- }
-
- public void setOrgCode(String orgCode) {
- this.orgCode = orgCode;
- }
-
- public String getNsfStatusCode() {
- return nsfStatusCode;
- }
-
- public void setNsfStatusCode(String nsfStatusCode) {
- this.nsfStatusCode = nsfStatusCode;
- }
-
- public Instant getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Instant createdAt) {
- this.createdAt = createdAt;
- }
-
- public Instant getUpdatedAt() {
- return updatedAt;
- }
-
- public void setUpdatedAt(Instant updatedAt) {
- this.updatedAt = updatedAt;
- }
-
- public List<PersonDnsEntity> getDnsEntries() {
- return dnsEntries;
- }
-
- public void setDnsEntries(List<PersonDnsEntity> dnsEntries) {
- this.dnsEntries = dnsEntries;
- }
-
- public List<ClusterAccountEntity> getClusterAccounts() {
- return clusterAccounts;
- }
-
- public void setClusterAccounts(List<ClusterAccountEntity> clusterAccounts) {
- this.clusterAccounts = clusterAccounts;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == null || getClass() != o.getClass()) return false;
-
- PersonEntity that = (PersonEntity) o;
- return id.equals(that.id) && accessGlobalId.equals(that.accessGlobalId);
- }
-
- @Override
- public int hashCode() {
- int result = id.hashCode();
- result = 31 * result + accessGlobalId.hashCode();
- return result;
- }
-}
-
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/ProjectEntity.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/ProjectEntity.java
deleted file mode 100644
index e5c52dd44..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/ProjectEntity.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model;
-
-import jakarta.persistence.CascadeType;
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.Id;
-import jakarta.persistence.OneToMany;
-import jakarta.persistence.Table;
-import org.hibernate.annotations.CreationTimestamp;
-import org.hibernate.annotations.UpdateTimestamp;
-
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Maps to the 'projects' table. Stores unique information about each project/allocation.
- */
-@Entity
-@Table(name = "projects")
-public class ProjectEntity {
-
- @Id
- @Column(name = "id")
- private String id;
-
- @Column(name = "grant_number", nullable = false)
- private String grantNumber;
-
- @Column(name = "is_active", nullable = false)
- private boolean isActive = true;
-
- @CreationTimestamp
- @Column(name = "created_at", nullable = false, updatable = false)
- private Instant createdAt;
-
- @UpdateTimestamp
- @Column(name = "updated_at", nullable = false)
- private Instant updatedAt;
-
- @OneToMany(mappedBy = "project", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
- private List<ProjectMembershipEntity> memberships = new ArrayList<>();
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getGrantNumber() {
- return grantNumber;
- }
-
- public void setGrantNumber(String grantNumber) {
- this.grantNumber = grantNumber;
- }
-
- public boolean isActive() {
- return isActive;
- }
-
- public void setActive(boolean active) {
- isActive = active;
- }
-
- public Instant getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Instant createdAt) {
- this.createdAt = createdAt;
- }
-
- public Instant getUpdatedAt() {
- return updatedAt;
- }
-
- public void setUpdatedAt(Instant updatedAt) {
- this.updatedAt = updatedAt;
- }
-
- public List<ProjectMembershipEntity> getMemberships() {
- return memberships;
- }
-
- public void setMemberships(List<ProjectMembershipEntity> memberships) {
- this.memberships = memberships;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == null || getClass() != o.getClass()) return false;
-
- ProjectEntity that = (ProjectEntity) o;
- return id.equals(that.id) && grantNumber.equals(that.grantNumber);
- }
-
- @Override
- public int hashCode() {
- int result = id.hashCode();
- result = 31 * result + grantNumber.hashCode();
- return result;
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/ProjectMembershipEntity.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/ProjectMembershipEntity.java
deleted file mode 100644
index a64e6faa8..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/ProjectMembershipEntity.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-import jakarta.persistence.UniqueConstraint;
-import org.hibernate.annotations.CreationTimestamp;
-import org.hibernate.annotations.UpdateTimestamp;
-
-import java.time.Instant;
-
-/**
- * Maps to the 'project_memberships' table. Links cluster accounts to projects with roles.
- */
-@Entity
-@Table(name = "project_memberships", uniqueConstraints = {@UniqueConstraint(columnNames = {"project_id", "cluster_account_id"})})
-public class ProjectMembershipEntity {
-
- @Id
- @GeneratedValue(strategy = GenerationType.UUID)
- @Column(name = "id")
- private String id;
-
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @JoinColumn(name = "project_id", nullable = false)
- private ProjectEntity project;
-
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @JoinColumn(name = "cluster_account_id", nullable = false)
- private ClusterAccountEntity clusterAccount;
-
- @Column(name = "role", length = 32)
- private String role;
-
- @Column(name = "is_active", nullable = false)
- private boolean isActive = true;
-
- @CreationTimestamp
- @Column(name = "created_at", nullable = false, updatable = false)
- private Instant createdAt;
-
- @UpdateTimestamp
- @Column(name = "updated_at", nullable = false)
- private Instant updatedAt;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public ProjectEntity getProject() {
- return project;
- }
-
- public void setProject(ProjectEntity project) {
- this.project = project;
- }
-
- public ClusterAccountEntity getClusterAccount() {
- return clusterAccount;
- }
-
- public void setClusterAccount(ClusterAccountEntity clusterAccount) {
- this.clusterAccount = clusterAccount;
- }
-
- public String getRole() {
- return role;
- }
-
- public void setRole(String role) {
- this.role = role;
- }
-
- public boolean isActive() {
- return isActive;
- }
-
- public void setActive(boolean active) {
- isActive = active;
- }
-
- public Instant getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Instant createdAt) {
- this.createdAt = createdAt;
- }
-
- public Instant getUpdatedAt() {
- return updatedAt;
- }
-
- public void setUpdatedAt(Instant updatedAt) {
- this.updatedAt = updatedAt;
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/AuditAction.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/AuditAction.java
deleted file mode 100644
index 81f18674a..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/AuditAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model.amie;
-
-/**
- * Enum of auditable actions performed during AMIE packet processing.
- */
-public enum AuditAction {
- CREATE_PERSON,
- UPDATE_PERSON,
- DELETE_PERSON,
- MERGE_PERSONS,
- CREATE_ACCOUNT,
- CREATE_PROJECT,
- INACTIVATE_PROJECT,
- REACTIVATE_PROJECT,
- CREATE_MEMBERSHIP,
- INACTIVATE_MEMBERSHIP,
- REACTIVATE_MEMBERSHIP,
- PERSIST_DNS,
- REPLY_SENT,
- TRANSACTION_COMPLETE
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/AuditLogEntity.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/AuditLogEntity.java
deleted file mode 100644
index 4f6b27929..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/AuditLogEntity.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model.amie;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.EnumType;
-import jakarta.persistence.Enumerated;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-
-import java.time.Instant;
-
-@Entity
-@Table(name = "amie_audit_log")
-public class AuditLogEntity {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @JoinColumn(name = "packet_id", nullable = false)
- private PacketEntity packet;
-
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "event_id")
- private ProcessingEventEntity event;
-
- @Enumerated(EnumType.STRING)
- @Column(name = "action", columnDefinition = "VARCHAR(64)", nullable = false)
- private AuditAction action;
-
- @Column(name = "entity_type", nullable = false, length = 64)
- private String entityType;
-
- @Column(name = "entity_id", length = 255)
- private String entityId;
-
- @Column(name = "summary", columnDefinition = "TEXT")
- private String summary;
-
- @Column(name = "created_at", nullable = false)
- private Instant createdAt = Instant.now();
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public PacketEntity getPacket() {
- return packet;
- }
-
- public void setPacket(PacketEntity packet) {
- this.packet = packet;
- }
-
- public ProcessingEventEntity getEvent() {
- return event;
- }
-
- public void setEvent(ProcessingEventEntity event) {
- this.event = event;
- }
-
- public AuditAction getAction() {
- return action;
- }
-
- public void setAction(AuditAction action) {
- this.action = action;
- }
-
- public String getEntityType() {
- return entityType;
- }
-
- public void setEntityType(String entityType) {
- this.entityType = entityType;
- }
-
- public String getEntityId() {
- return entityId;
- }
-
- public void setEntityId(String entityId) {
- this.entityId = entityId;
- }
-
- public String getSummary() {
- return summary;
- }
-
- public void setSummary(String summary) {
- this.summary = summary;
- }
-
- public Instant getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Instant createdAt) {
- this.createdAt = createdAt;
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/PacketEntity.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/PacketEntity.java
deleted file mode 100644
index 0cdad79e0..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/PacketEntity.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model.amie;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.EnumType;
-import jakarta.persistence.Enumerated;
-import jakarta.persistence.Id;
-import jakarta.persistence.Lob;
-import jakarta.persistence.Table;
-
-import java.time.Instant;
-import java.util.UUID;
-
-@Entity
-@Table(name = "amie_packets")
-public class PacketEntity {
-
- @Id
- private String id;
-
- @Column(name = "amie_id", nullable = false, unique = true)
- private Long amieId;
-
- @Column(name = "type", nullable = false, length = 64)
- private String type;
-
- @Enumerated(EnumType.STRING)
- @Column(name = "status", columnDefinition = "VARCHAR", nullable = false, length = 32)
- private PacketStatus status = PacketStatus.NEW;
-
- @Lob
- @Column(name = "raw_json", columnDefinition = "TEXT", nullable = false)
- private String rawJson;
-
- @Column(name = "received_at", nullable = false)
- private Instant receivedAt = Instant.now();
-
- @Column(name = "decoded_at")
- private Instant decodedAt;
-
- @Column(name = "processed_at")
- private Instant processedAt;
-
- @Column(name = "retries", nullable = false)
- private int retries = 0;
-
- @Lob
- @Column(name = "last_error", columnDefinition = "TEXT")
- private String lastError;
-
- public PacketEntity() {
- this.id = UUID.randomUUID().toString();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Long getAmieId() {
- return amieId;
- }
-
- public void setAmieId(Long amieId) {
- this.amieId = amieId;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public PacketStatus getStatus() {
- return status;
- }
-
- public void setStatus(PacketStatus status) {
- this.status = status;
- }
-
- public String getRawJson() {
- return rawJson;
- }
-
- public void setRawJson(String rawJson) {
- this.rawJson = rawJson;
- }
-
- public Instant getReceivedAt() {
- return receivedAt;
- }
-
- public void setReceivedAt(Instant receivedAt) {
- this.receivedAt = receivedAt;
- }
-
- public Instant getDecodedAt() {
- return decodedAt;
- }
-
- public void setDecodedAt(Instant decodedAt) {
- this.decodedAt = decodedAt;
- }
-
- public Instant getProcessedAt() {
- return processedAt;
- }
-
- public void setProcessedAt(Instant processedAt) {
- this.processedAt = processedAt;
- }
-
- public int getRetries() {
- return retries;
- }
-
- public void setRetries(int retries) {
- this.retries = retries;
- }
-
- public String getLastError() {
- return lastError;
- }
-
- public void setLastError(String lastError) {
- this.lastError = lastError;
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/PacketStatus.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/PacketStatus.java
deleted file mode 100644
index 079bb1fb1..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/PacketStatus.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model.amie;
-
-public enum PacketStatus {
-
- /**
- * Packet has been received from the AMIE API and persisted but has not yet been processed.
- */
- NEW,
- /**
- * The packet's raw JSON content has been successfully parsed, and the initial processing event has been created.
- */
- DECODED,
- /**
- * All required processing events have been completed successfully.
- */
- PROCESSED,
- /**
- * The processing of this packet failed and will not be automatically retried.
- */
- FAILED
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingErrorEntity.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingErrorEntity.java
deleted file mode 100644
index abb5b8002..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingErrorEntity.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model.amie;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.Lob;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-
-import java.time.Instant;
-
-@Entity
-@Table(name = "amie_processing_errors")
-public class ProcessingErrorEntity {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "packet_id")
- private PacketEntity packet;
-
- @ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "event_id")
- private ProcessingEventEntity event;
-
- @Column(name = "occurred_at", nullable = false)
- private Instant occurredAt = Instant.now();
-
- @Column(name = "summary", columnDefinition = "TEXT", nullable = false)
- private String summary;
-
- @Lob
- @Column(name = "detail", columnDefinition = "TEXT")
- private String detail;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public PacketEntity getPacket() {
- return packet;
- }
-
- public void setPacket(PacketEntity packet) {
- this.packet = packet;
- }
-
- public ProcessingEventEntity getEvent() {
- return event;
- }
-
- public void setEvent(ProcessingEventEntity event) {
- this.event = event;
- }
-
- public Instant getOccurredAt() {
- return occurredAt;
- }
-
- public void setOccurredAt(Instant occurredAt) {
- this.occurredAt = occurredAt;
- }
-
- public String getSummary() {
- return summary;
- }
-
- public void setSummary(String summary) {
- this.summary = summary;
- }
-
- public String getDetail() {
- return detail;
- }
-
- public void setDetail(String detail) {
- this.detail = detail;
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingEventEntity.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingEventEntity.java
deleted file mode 100644
index 66c8a163d..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingEventEntity.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model.amie;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.EnumType;
-import jakarta.persistence.Enumerated;
-import jakarta.persistence.FetchType;
-import jakarta.persistence.Id;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.Lob;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-
-import java.time.Instant;
-import java.util.UUID;
-
-@Entity
-@Table(name = "amie_processing_events")
-public class ProcessingEventEntity {
-
- @Id
- private String id;
-
- @ManyToOne(fetch = FetchType.LAZY, optional = false)
- @JoinColumn(name = "packet_id", nullable = false)
- private PacketEntity packet;
-
- @Enumerated(EnumType.STRING)
- @Column(name = "type", columnDefinition = "VARCHAR", nullable = false, length = 64)
- private ProcessingEventType type;
-
- @Enumerated(EnumType.STRING)
- @Column(name = "status", columnDefinition = "VARCHAR", nullable = false, length = 32)
- private ProcessingStatus status = ProcessingStatus.NEW;
-
- @Column(name = "attempts", nullable = false)
- private int attempts = 0;
-
- @Lob
- @Column(name = "payload", columnDefinition = "LONGBLOB", nullable = false)
- private byte[] payload;
-
- @Column(name = "created_at", nullable = false)
- private Instant createdAt = Instant.now();
-
- @Column(name = "started_at")
- private Instant startedAt;
-
- @Column(name = "finished_at")
- private Instant finishedAt;
-
- @Lob
- @Column(name = "last_error", columnDefinition = "TEXT")
- private String lastError;
-
- @Column(name = "next_retry_at")
- private Instant nextRetryAt;
-
- public ProcessingEventEntity() {
- this.id = UUID.randomUUID().toString();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public PacketEntity getPacket() {
- return packet;
- }
-
- public void setPacket(PacketEntity packet) {
- this.packet = packet;
- }
-
- public ProcessingEventType getType() {
- return type;
- }
-
- public void setType(ProcessingEventType type) {
- this.type = type;
- }
-
- public ProcessingStatus getStatus() {
- return status;
- }
-
- public void setStatus(ProcessingStatus status) {
- this.status = status;
- }
-
- public int getAttempts() {
- return attempts;
- }
-
- public void setAttempts(int attempts) {
- this.attempts = attempts;
- }
-
- public byte[] getPayload() {
- return payload;
- }
-
- public void setPayload(byte[] payload) {
- this.payload = payload;
- }
-
- public Instant getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Instant createdAt) {
- this.createdAt = createdAt;
- }
-
- public Instant getStartedAt() {
- return startedAt;
- }
-
- public void setStartedAt(Instant startedAt) {
- this.startedAt = startedAt;
- }
-
- public Instant getFinishedAt() {
- return finishedAt;
- }
-
- public void setFinishedAt(Instant finishedAt) {
- this.finishedAt = finishedAt;
- }
-
- public String getLastError() {
- return lastError;
- }
-
- public void setLastError(String lastError) {
- this.lastError = lastError;
- }
-
- public Instant getNextRetryAt() {
- return nextRetryAt;
- }
-
- public void setNextRetryAt(Instant nextRetryAt) {
- this.nextRetryAt = nextRetryAt;
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingEventType.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingEventType.java
deleted file mode 100644
index 63b005e76..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingEventType.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model.amie;
-
-public enum ProcessingEventType {
- DECODE_PACKET
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingStatus.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingStatus.java
deleted file mode 100644
index f4a9290ea..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/model/amie/ProcessingStatus.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.model.amie;
-
-public enum ProcessingStatus {
-
- /**
- * The event has been created and is waiting to be processed by a worker.
- */
- NEW,
- /**
- * A worker has picked up the event and is actively processing it.
- */
- RUNNING,
- /**
- * The event was processed successfully.
- */
- SUCCEEDED,
- /**
- * The event failed processing and will not be automatically retried.
- */
- FAILED,
- /**
- * The event failed a previous attempt and is waiting to be retried.
- */
- RETRY_SCHEDULED,
- /**
- * The event has exhausted all retry attempts and will never be retried automatically.
- * Manual intervention is required.
- */
- PERMANENTLY_FAILED
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/ClusterAccountRepository.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/ClusterAccountRepository.java
deleted file mode 100644
index a4771cb98..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/ClusterAccountRepository.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.repo;
-
-import org.apache.custos.access.ci.service.model.ClusterAccountEntity;
-import org.apache.custos.access.ci.service.model.PersonEntity;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-import java.util.Optional;
-
-@Repository
-public interface ClusterAccountRepository extends JpaRepository<ClusterAccountEntity, String> {
-
- Optional<ClusterAccountEntity> findByUsername(String username);
-
- List<ClusterAccountEntity> findByPerson(PersonEntity person);
-
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/PersonDnsRepository.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/PersonDnsRepository.java
deleted file mode 100644
index eda7b5125..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/PersonDnsRepository.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.repo;
-
-import org.apache.custos.access.ci.service.model.PersonDnsEntity;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface PersonDnsRepository extends JpaRepository<PersonDnsEntity, Long> {
-
- boolean existsByPerson_IdAndDn(String personId, String dn);
-
- void deleteByPerson_Id(String personId);
-
- void deleteByPerson_IdAndDnNotIn(String personId, java.util.Collection<String> dnsToKeep);
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/PersonRepository.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/PersonRepository.java
deleted file mode 100644
index d9dacb723..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/PersonRepository.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.repo;
-
-import org.apache.custos.access.ci.service.model.PersonEntity;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.Optional;
-
-@Repository
-public interface PersonRepository extends JpaRepository<PersonEntity, String> {
-
- /**
- * Finds a person by their unique AMIE Global ID.
- *
- * @param accessGlobalId The UserGlobalID from an AMIE packet.
- * @return An Optional containing the PersonEntity if found.
- */
- Optional<PersonEntity> findByAccessGlobalId(String accessGlobalId);
-
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/ProjectMembershipRepository.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/ProjectMembershipRepository.java
deleted file mode 100644
index 262de9bc3..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/ProjectMembershipRepository.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.repo;
-
-import org.apache.custos.access.ci.service.model.ProjectMembershipEntity;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-import java.util.Optional;
-
-@Repository
-public interface ProjectMembershipRepository extends JpaRepository<ProjectMembershipEntity, String> {
-
- Optional<ProjectMembershipEntity> findByProjectIdAndClusterAccountId(String projectId, String clusterAccountId);
-
- List<ProjectMembershipEntity> findByProjectId(String projectId);
-
- List<ProjectMembershipEntity> findByProjectIdAndRole(String projectId, String role);
-
- List<ProjectMembershipEntity> findByProjectIdAndClusterAccount_Person_Id(String projectId, String personId);
-
- List<ProjectMembershipEntity> findByClusterAccount_Person_IdAndProjectIdAndRole(String personId, String projectId, String role);
-
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/ProjectRepository.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/ProjectRepository.java
deleted file mode 100644
index eb4b3a928..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/ProjectRepository.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.repo;
-
-import org.apache.custos.access.ci.service.model.ProjectEntity;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface ProjectRepository extends JpaRepository<ProjectEntity, String> {
-
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/AuditLogRepository.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/AuditLogRepository.java
deleted file mode 100644
index f7d8e3a31..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/AuditLogRepository.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.repo.amie;
-
-import org.apache.custos.access.ci.service.model.amie.AuditLogEntity;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface AuditLogRepository extends JpaRepository<AuditLogEntity, Long> {
-
- List<AuditLogEntity> findByPacketIdOrderByCreatedAtAsc(String packetId);
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/PacketRepository.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/PacketRepository.java
deleted file mode 100644
index 58bdacf79..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/PacketRepository.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.repo.amie;
-
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.model.amie.PacketStatus;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.Optional;
-import java.util.stream.Stream;
-
-@Repository
-public interface PacketRepository extends JpaRepository<PacketEntity, String> {
-
- Optional<PacketEntity> findByAmieId(Long amieId);
-
- Stream<PacketEntity> findTop50ByStatusOrderByReceivedAtAsc(PacketStatus status);
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/ProcessingErrorRepository.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/ProcessingErrorRepository.java
deleted file mode 100644
index 407c287f6..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/ProcessingErrorRepository.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.repo.amie;
-
-import org.apache.custos.access.ci.service.model.amie.ProcessingErrorEntity;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface ProcessingErrorRepository extends JpaRepository<ProcessingErrorEntity, Long> {
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/ProcessingEventRepository.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/ProcessingEventRepository.java
deleted file mode 100644
index eee5034db..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/repo/amie/ProcessingEventRepository.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.repo.amie;
-
-import org.apache.custos.access.ci.service.model.amie.ProcessingEventEntity;
-import org.apache.custos.access.ci.service.model.amie.ProcessingStatus;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import java.time.Instant;
-import java.util.Collection;
-import java.util.List;
-
-@Repository
-public interface ProcessingEventRepository extends JpaRepository<ProcessingEventEntity, String> {
-
- @Query("""
- SELECT e FROM ProcessingEventEntity e JOIN FETCH e.packet
- WHERE e.status IN :statuses
- AND (e.nextRetryAt IS NULL OR e.nextRetryAt <= :now)
- ORDER BY e.createdAt ASC
- LIMIT 50
- """)
- List<ProcessingEventEntity> findTop50EventsToProcess(
- @Param("statuses") Collection<ProcessingStatus> statuses,
- @Param("now") Instant now);
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/AuditService.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/AuditService.java
deleted file mode 100644
index 670ce4c0e..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/AuditService.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.service;
-
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.AuditLogEntity;
-import org.apache.custos.access.ci.service.repo.amie.AuditLogRepository;
-import org.apache.custos.access.ci.service.repo.amie.PacketRepository;
-import org.apache.custos.access.ci.service.repo.amie.ProcessingEventRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-/**
- * Service for recording audit log entries during AMIE packet processing.
- *
- * <p>This service is not annotated with {@code @Transactional},
- * so that this be in the caller's active transaction without introducing a new one.
- * There must be an active transaction when invoking {@link #log}.
- */
-@Service
-public class AuditService {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AuditService.class);
-
- private final AuditLogRepository auditLogRepository;
- private final PacketRepository packetRepository;
- private final ProcessingEventRepository processingEventRepository;
-
- public AuditService(AuditLogRepository auditLogRepository,
- PacketRepository packetRepository,
- ProcessingEventRepository processingEventRepository) {
- this.auditLogRepository = auditLogRepository;
- this.packetRepository = packetRepository;
- this.processingEventRepository = processingEventRepository;
- }
-
- /**
- * Records an audit log entry for an AMIE packet processing action.
- *
- * @param packetId the ID of the packet being processed (not null)
- * @param eventId the ID of the processing event, or null if not associated with an event
- * @param action the auditable action performed
- * @param entityType a label describing the type of entity affected (e.g., "Person", "Project")
- * @param entityId the ID of the affected entity, or null if not applicable
- * @param summary a human-readable description of what happened, or null
- */
- public void log(String packetId,
- String eventId,
- AuditAction action,
- String entityType,
- String entityId,
- String summary) {
-
- AuditLogEntity entry = new AuditLogEntity();
- entry.setPacket(packetRepository.getReferenceById(packetId));
- if (eventId != null) {
- entry.setEvent(processingEventRepository.getReferenceById(eventId));
- }
- entry.setAction(action);
- entry.setEntityType(entityType);
- entry.setEntityId(entityId);
- entry.setSummary(summary);
-
- auditLogRepository.save(entry);
-
- LOGGER.debug("Audit entry recorded: packetId={}, eventId={}, action={}, entityType={}, entityId={}",
- packetId, eventId, action, entityType, entityId);
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/PersonService.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/PersonService.java
deleted file mode 100644
index ea588f993..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/PersonService.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.service;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.custos.access.ci.service.model.ClusterAccountEntity;
-import org.apache.custos.access.ci.service.model.PersonDnsEntity;
-import org.apache.custos.access.ci.service.model.PersonEntity;
-import org.apache.custos.access.ci.service.repo.ClusterAccountRepository;
-import org.apache.custos.access.ci.service.repo.PersonDnsRepository;
-import org.apache.custos.access.ci.service.repo.PersonRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.dao.DataIntegrityViolationException;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.Assert;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Optional;
-import java.util.Set;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-/**
- * Service responsible for managing the lifecycle of Person entities and their associated DNs.
- */
-@Service
-public class PersonService {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(PersonService.class);
-
- private final PersonRepository personRepository;
- private final PersonDnsRepository personDnsRepository;
- private final ClusterAccountRepository clusterAccountRepository;
-
- public PersonService(PersonRepository personRepository, PersonDnsRepository personDnsRepository, ClusterAccountRepository clusterAccountRepository) {
- this.personRepository = personRepository;
- this.personDnsRepository = personDnsRepository;
- this.clusterAccountRepository = clusterAccountRepository;
- }
-
- /**
- * Finds a Person by their AMIE Global ID or creates a new one if not found.
- *
- * @param packetBody The "body" of the AMIE packet containing user details.
- * @return The existing or newly created PersonEntity.
- */
- @Transactional
- public PersonEntity findOrCreatePersonFromPacket(JsonNode packetBody) {
- String accessGlobalId = packetBody.path("UserGlobalID").asText();
- Assert.hasText(accessGlobalId, "Packet body must contain a 'UserGlobalID'.");
-
- Optional<PersonEntity> existingPerson = personRepository.findByAccessGlobalId(accessGlobalId);
- if (existingPerson.isPresent()) {
- LOGGER.info("Found existing person with local ID [{}] for access_global_id [{}]", existingPerson.get().getId(), accessGlobalId);
- return existingPerson.get();
- }
-
- // If not found, create a new person
- LOGGER.info("No person found for access_global_id [{}]. Creating a new person record.", accessGlobalId);
- PersonEntity newPerson = new PersonEntity();
- newPerson.setId(UUID.randomUUID().toString());
- newPerson.setAccessGlobalId(accessGlobalId);
- newPerson.setFirstName(packetBody.path("UserFirstName").asText(""));
- newPerson.setLastName(packetBody.path("UserLastName").asText(""));
- newPerson.setEmail(packetBody.path("UserEmail").asText(""));
- newPerson.setOrganization(packetBody.path("UserOrganization").asText(null));
- newPerson.setOrgCode(packetBody.path("UserOrgCode").asText(null));
- newPerson.setNsfStatusCode(packetBody.path("NsfStatusCode").asText(null));
- personRepository.save(newPerson);
-
- // Save their associated DNs
- JsonNode dnList = packetBody.path("UserDnList");
- if (dnList.isArray()) {
- for (JsonNode dnNode : dnList) {
- String dn = dnNode.asText(null);
- if (dn != null && !dn.isBlank()) {
- PersonDnsEntity pde = new PersonDnsEntity();
- pde.setPerson(newPerson);
- pde.setDn(dn);
- personDnsRepository.save(pde);
- }
- }
- }
- return newPerson;
- }
-
-
- @Transactional
- public void replaceFromModifyPacket(JsonNode body) {
- String personId = body.path("PersonID").asText(null);
- Assert.hasText(personId, "Missing required 'PersonID' in request_user_modify replace body");
-
- PersonEntity person = personRepository.findById(personId)
- .orElseThrow(() -> new IllegalArgumentException("Unknown local PersonID: " + personId));
-
- if (body.has("UserFirstName")) person.setFirstName(body.path("UserFirstName").asText(person.getFirstName()));
- if (body.has("UserLastName")) person.setLastName(body.path("UserLastName").asText(person.getLastName()));
- if (body.has("UserEmail")) person.setEmail(body.path("UserEmail").asText(person.getEmail()));
- if (body.has("UserOrganization")) person.setOrganization(body.path("UserOrganization").asText(null));
- if (body.has("UserOrgCode")) person.setOrgCode(body.path("UserOrgCode").asText(null));
- if (body.has("NsfStatusCode")) person.setNsfStatusCode(body.path("NsfStatusCode").asText(null));
- personRepository.save(person);
-
- Set<String> newDns = new HashSet<>();
- JsonNode dnList = body.path("UserDnList");
- if (dnList != null && dnList.isArray()) {
- for (JsonNode dnNode : dnList) {
- String dn = dnNode.asText(null);
- if (dn != null && !dn.isBlank()) newDns.add(dn);
- }
- }
-
- if (newDns.isEmpty()) {
- if (body.has("UserDnList")) {
- personDnsRepository.deleteByPerson_Id(personId);
- }
- } else {
- personDnsRepository.deleteByPerson_IdAndDnNotIn(personId, new ArrayList<>(newDns));
- for (String dn : newDns) {
- if (!personDnsRepository.existsByPerson_IdAndDn(personId, dn)) {
- PersonDnsEntity p = new PersonDnsEntity();
- p.setPerson(person);
- p.setDn(dn);
- personDnsRepository.save(p);
- }
- }
- }
- }
-
- @Transactional
- public void persistDnsForPerson(String personId, JsonNode dnList) {
- Assert.hasText(personId, "personId must not be blank");
-
- if (dnList == null || !dnList.isArray() || dnList.isEmpty()) {
- return;
- }
-
- PersonEntity person = personRepository.findById(personId)
- .orElseThrow(() -> new IllegalArgumentException("Unknown local PersonID: " + personId));
-
- Set<String> incomingDns = new HashSet<>();
- for (JsonNode dnNode : dnList) {
- String dn = dnNode.asText(null);
- if (dn != null && !dn.isBlank()) {
- incomingDns.add(dn);
- }
- }
-
- if (incomingDns.isEmpty()) {
- return;
- }
-
- for (String dn : incomingDns) {
- if (!personDnsRepository.existsByPerson_IdAndDn(personId, dn)) {
- PersonDnsEntity pde = new PersonDnsEntity();
- pde.setPerson(person);
- pde.setDn(dn);
- try {
- personDnsRepository.save(pde);
- LOGGER.info("Persisted new DN for person [{}].", personId);
- LOGGER.debug("Persisted DN [{}] for person [{}].", dn, personId);
- } catch (DataIntegrityViolationException ex) {
- LOGGER.debug("DN already exists for person [{}] (concurrent insert), skipping.", personId);
- }
- } else {
- LOGGER.debug("DN [{}] already exists for person [{}], skipping.", dn, personId);
- }
- }
- }
-
- @Transactional
- public void deleteFromModifyPacket(JsonNode body) {
- String personId = body.path("PersonID").asText(null);
- Assert.hasText(personId, "Missing required 'PersonID' in request_user_modify delete body");
-
- // Cascades will remove DNs and cluster accounts
- personRepository.deleteById(personId);
- }
-
- @Transactional
- public void mergePersons(String survivingPersonId, String retiringPersonId) {
- LOGGER.info("Merging person {} into {}", retiringPersonId, survivingPersonId);
-
- PersonEntity survivingPerson = personRepository.findById(survivingPersonId)
- .orElseThrow(() -> new IllegalStateException("Could not find surviving person with local ID: " + survivingPersonId));
-
- PersonEntity retiringPerson = personRepository.findById(retiringPersonId)
- .orElseThrow(() -> new IllegalStateException("Could not find retiring person with local ID: " + retiringPersonId));
-
- // Re-associate all cluster accounts
- for (ClusterAccountEntity account : retiringPerson.getClusterAccounts()) {
- LOGGER.info("Moving cluster account '{}' from retiring person to surviving person", account.getUsername());
- account.setPerson(survivingPerson);
- clusterAccountRepository.save(account);
- }
-
- // Merge DNs, avoiding duplicates
- Set<String> survivingDns = survivingPerson.getDnsEntries().stream()
- .map(PersonDnsEntity::getDn)
- .collect(Collectors.toSet());
-
- for (PersonDnsEntity retiringDn : retiringPerson.getDnsEntries()) {
- if (!survivingDns.contains(retiringDn.getDn())) {
- LOGGER.info("Moving DN '{}' from retiring person to surviving person", retiringDn.getDn());
- retiringDn.setPerson(survivingPerson);
- personDnsRepository.save(retiringDn);
- } else {
- personDnsRepository.delete(retiringDn);
- }
- }
-
- // The CASCADE constraint will clean up any remaining associations
- personRepository.delete(retiringPerson);
- LOGGER.info("Successfully merged and deleted retiring person record {}", retiringPersonId);
- }
-}
\ No newline at end of file
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/ProjectMembershipService.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/ProjectMembershipService.java
deleted file mode 100644
index 3726e636a..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/ProjectMembershipService.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.service;
-
-import org.apache.custos.access.ci.service.model.ClusterAccountEntity;
-import org.apache.custos.access.ci.service.model.ProjectEntity;
-import org.apache.custos.access.ci.service.model.ProjectMembershipEntity;
-import org.apache.custos.access.ci.service.repo.ClusterAccountRepository;
-import org.apache.custos.access.ci.service.repo.ProjectMembershipRepository;
-import org.apache.custos.access.ci.service.repo.ProjectRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-import java.util.Optional;
-
-@Service
-public class ProjectMembershipService {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ProjectMembershipService.class);
-
- private final ProjectMembershipRepository membershipRepository;
- private final ProjectRepository projectRepository;
- private final ClusterAccountRepository clusterAccountRepository;
-
- public ProjectMembershipService(ProjectMembershipRepository membershipRepository, ProjectRepository projectRepository, ClusterAccountRepository clusterAccountRepository) {
- this.membershipRepository = membershipRepository;
- this.projectRepository = projectRepository;
- this.clusterAccountRepository = clusterAccountRepository;
- }
-
- /**
- * Creates a membership linking a cluster account to a project with a role.
- *
- * @param projectId The project ID.
- * @param clusterAccountId The cluster account ID.
- * @param role The role (PI, USER).
- * @return The created membership entity.
- */
- @Transactional
- public ProjectMembershipEntity createMembership(String projectId, String clusterAccountId, String role) {
- Optional<ProjectMembershipEntity> existing = membershipRepository.findByProjectIdAndClusterAccountId(projectId, clusterAccountId);
-
- if (existing.isPresent()) {
- ProjectMembershipEntity membership = existing.get();
- if (membership.isActive()) {
- LOGGER.info("Active membership already exists for project [{}] and cluster account [{}], returning existing record",
- projectId, clusterAccountId);
- return membership;
- }
- LOGGER.info("Reactivating inactive membership for project [{}] and cluster account [{}] with role [{}]",
- projectId, clusterAccountId, role);
- membership.setActive(true);
- membership.setRole(role);
- membershipRepository.save(membership);
- return membership;
- }
-
- ProjectEntity project = projectRepository.findById(projectId)
- .orElseThrow(() -> new IllegalArgumentException("Project not found: " + projectId));
-
- ClusterAccountEntity clusterAccount = clusterAccountRepository.findById(clusterAccountId)
- .orElseThrow(() -> new IllegalArgumentException("Cluster account not found: " + clusterAccountId));
-
- ProjectMembershipEntity membership = new ProjectMembershipEntity();
- membership.setProject(project);
- membership.setClusterAccount(clusterAccount);
- membership.setRole(role);
- membership.setActive(true);
-
- membershipRepository.save(membership);
- LOGGER.info("Created membership for project [{}], cluster account [{}] with role [{}]", projectId, clusterAccountId, role);
-
- return membership;
- }
-
- /**
- * Inactivates a specific membership (user removed from project).
- *
- * @param projectId The project ID.
- * @param personId Person ID
- */
- @Transactional
- public int inactivateMembershipsByPersonAndProject(String projectId, String personId) {
- // TODO - If the user is a PI of a project?
- // - right now only the membership is turned inactive, no changes to the project
- List<ProjectMembershipEntity> memberships = membershipRepository.findByProjectIdAndClusterAccount_Person_Id(projectId, personId);
-
- if (memberships.isEmpty()) {
- LOGGER.warn("No memberships found for person [{}] on project [{}]. Inactivation had no effect.", personId, projectId);
- return 0;
- }
-
- memberships.forEach(membership -> membership.setActive(false));
- membershipRepository.saveAll(memberships);
- LOGGER.info("Inactivated {} membership(s) for person [{}] on project [{}]", memberships.size(), personId, projectId);
- return memberships.size();
- }
-
- /**
- * Inactivates all memberships for a project.
- *
- * @param projectId The project ID.
- */
- @Transactional
- public void inactivateAllMembershipsForProject(String projectId) {
- List<ProjectMembershipEntity> projectMemberships = membershipRepository.findByProjectId(projectId);
-
- if (projectMemberships.isEmpty()) {
- LOGGER.info("No memberships to inactivate for project [{}]", projectId);
- return;
- }
-
- projectMemberships.forEach(membership -> membership.setActive(false));
- membershipRepository.saveAll(projectMemberships);
-
- LOGGER.info("Inactivated {} memberships for project [{}]", projectMemberships.size(), projectId);
- }
-
- /**
- * Reactivates PI membership for a project.
- *
- * @param projectId The project ID.
- */
- @Transactional
- public void reactivatePiMembership(String projectId) {
- List<ProjectMembershipEntity> piMemberships = membershipRepository.findByProjectIdAndRole(projectId, "PI");
- piMemberships.forEach(membership -> membership.setActive(true));
- membershipRepository.saveAll(piMemberships);
- LOGGER.info("Reactivated {} PI memberships for project [{}]", piMemberships.size(), projectId);
- }
-
- /**
- * Reactivates memberships for a specific person on a project.
- *
- * @param projectId The project ID.
- * @param personId Person ID
- */
- @Transactional
- public int reactivateMembershipsByPersonAndProject(String projectId, String personId) {
- List<ProjectMembershipEntity> memberships = membershipRepository.findByProjectIdAndClusterAccount_Person_Id(projectId, personId);
-
- if (memberships.isEmpty()) {
- LOGGER.warn("No memberships found for person [{}] on project [{}]. Reactivation had no effect.", personId, projectId);
- return 0;
- }
-
- memberships.forEach(membership -> membership.setActive(true));
- membershipRepository.saveAll(memberships);
- LOGGER.info("Reactivated {} membership(s) for person [{}] on project [{}]", memberships.size(), personId, projectId);
- return memberships.size();
- }
-
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/ProjectService.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/ProjectService.java
deleted file mode 100644
index 03d9f3c33..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/ProjectService.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.service;
-
-import org.apache.custos.access.ci.service.model.ProjectEntity;
-import org.apache.custos.access.ci.service.repo.ProjectRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Optional;
-
-@Service
-public class ProjectService {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ProjectService.class);
-
- private final ProjectRepository projectRepository;
-
- public ProjectService(ProjectRepository projectRepository) {
- this.projectRepository = projectRepository;
- }
-
- /**
- * Creates a new project or returns an existing one if found.
- *
- * @param projectId The project ID from AMIE.
- * @param grantNumber The grant number from AMIE.
- * @return The project entity (created or existing).
- */
- @Transactional
- public ProjectEntity createOrFindProject(String projectId, String grantNumber) {
- Optional<ProjectEntity> existing = projectRepository.findById(projectId);
- if (existing.isPresent()) {
- LOGGER.info("Project [{}] already exists with grant number [{}]", projectId, existing.get().getGrantNumber());
- return existing.get();
- }
-
- ProjectEntity project = new ProjectEntity();
- project.setId(projectId);
- project.setGrantNumber(grantNumber);
- project.setActive(true);
- projectRepository.save(project);
-
- LOGGER.info("Created new project [{}] with grant number [{}]", projectId, grantNumber);
- return project;
- }
-
- /**
- * Inactivates a project.
- *
- * @param projectId The project ID to inactivate.
- */
- @Transactional
- public void inactivateProject(String projectId) {
- ProjectEntity project = projectRepository.findById(projectId).orElseThrow(() -> new IllegalArgumentException("Project not found: " + projectId));
-
- project.setActive(false);
- projectRepository.save(project);
- LOGGER.info("Inactivated project [{}]", projectId);
- }
-
- /**
- * Reactivates a project.
- *
- * @param projectId The project ID to reactivate.
- */
- @Transactional
- public void reactivateProject(String projectId) {
- ProjectEntity project = projectRepository.findById(projectId).orElseThrow(() -> new IllegalArgumentException("Project not found: " + projectId));
-
- project.setActive(true);
- projectRepository.save(project);
- LOGGER.info("Reactivated project [{}]", projectId);
- }
-
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/UserAccountService.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/UserAccountService.java
deleted file mode 100644
index 5672014de..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/service/UserAccountService.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.service;
-
-import org.apache.custos.access.ci.service.model.ClusterAccountEntity;
-import org.apache.custos.access.ci.service.model.PersonEntity;
-import org.apache.custos.access.ci.service.repo.ClusterAccountRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.dao.DataIntegrityViolationException;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Service for provisioning and managing Cluster Accounts (usernames).
- */
-@Service
-public class UserAccountService {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(UserAccountService.class);
-
- private final ClusterAccountRepository clusterAccountRepository;
-
- public UserAccountService(ClusterAccountRepository clusterAccountRepository) {
- this.clusterAccountRepository = clusterAccountRepository;
- }
-
- /**
- * Provisions a new, unique cluster account for a given person.
- *
- * @param person The PersonEntity that the user account should be created
- * @return The newly created and saved ClusterAccountEntity
- */
- @Transactional
- public ClusterAccountEntity provisionClusterAccount(PersonEntity person) {
- // TODO Replace with external source of truth (e.g., COmanage) lookup for PersonID and username
-
- List<ClusterAccountEntity> existing = clusterAccountRepository.findByPerson(person);
- if (!existing.isEmpty()) {
- ClusterAccountEntity account = existing.get(0);
- LOGGER.info("Cluster account already exists for person [{}], returning existing account with username [{}]",
- person.getId(), account.getUsername());
- return account;
- }
-
- String proposedUsername = (person.getFirstName().trim().charAt(0) + person.getLastName().trim().replace(" ", "-")).toLowerCase();
- String uniqueUsername = ensureUniqueUsername(proposedUsername);
-
- LOGGER.info("Provisioning new cluster account with username [{}] for person [{}]", uniqueUsername, person.getId());
-
- ClusterAccountEntity newClusterAccount = new ClusterAccountEntity();
- newClusterAccount.setId(UUID.randomUUID().toString());
- newClusterAccount.setPerson(person);
- newClusterAccount.setUsername(uniqueUsername);
-
- ClusterAccountEntity account;
- try {
- account = clusterAccountRepository.save(newClusterAccount);
- } catch (DataIntegrityViolationException e) {
- List<ClusterAccountEntity> retryLookup = clusterAccountRepository.findByPerson(person);
- if (!retryLookup.isEmpty()) {
- LOGGER.warn("Concurrent account creation detected for person [{}]; returning existing account.", person.getId());
- return retryLookup.get(0);
- }
- throw e; // Re-throw if it was a different constraint violation
- }
-
- return account;
- }
-
- private String ensureUniqueUsername(String baseUsername) {
- String candidate = baseUsername;
- int suffix = 0;
- while (clusterAccountRepository.findByUsername(candidate).isPresent()) {
- suffix++;
- candidate = baseUsername + suffix;
- }
- if (suffix > 0) {
- LOGGER.warn("Base username '{}' was already taken. Generated unique username '{}'.", baseUsername, candidate);
- }
- return candidate;
- }
-}
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/util/ProtoUtils.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/util/ProtoUtils.java
deleted file mode 100644
index ef0689397..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/util/ProtoUtils.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.util;
-
-import com.google.protobuf.Timestamp;
-import org.apache.custos.access.ci.service.internal.events.v1.DecodeStartedPayload;
-import org.apache.custos.access.ci.service.internal.events.v1.EventType;
-import org.apache.custos.access.ci.service.internal.events.v1.ProcessingEvent;
-import org.apache.custos.access.ci.service.internal.events.v1.ProcessingStatus;
-
-import java.time.Instant;
-
-public final class ProtoUtils {
-
- private ProtoUtils() {
- }
-
- /**
- * Creates the serialized payload for a DECODE_STARTED event.
- * <p>
- * This method builds the full {@link ProcessingEvent} envelope with its payload
- * set to a {@link DecodeStartedPayload}. The resulting byte array is what will be
- * stored in the {@code payload} column of the {@code processing_events} table.
- *
- * @param eventId ID of the event entity
- * @param packetId ID of the parent packet entity
- * @param amiePacketRecId The unique record ID from the original AMIE packet header
- * @return A byte array containing the serialized Protobuf message
- */
- public static byte[] createDecodeStartedEvent(String eventId, String packetId, long amiePacketRecId) {
- DecodeStartedPayload payload = DecodeStartedPayload.newBuilder()
- .setPacketDbId(packetId)
- .setAmiePacketRecId(amiePacketRecId)
- .build();
-
- ProcessingEvent event = ProcessingEvent.newBuilder()
- .setId(eventId)
- .setPacketDbId(packetId)
- .setAmiePacketRecId(amiePacketRecId)
- .setType(EventType.DECODE_STARTED)
- .setStatus(ProcessingStatus.PENDING)
- .setAttempts(0)
- .setCreatedAt(instantToTimestamp(Instant.now()))
- .setDecodeStarted(payload)
- .build();
-
- return event.toByteArray();
- }
-
- private static Timestamp instantToTimestamp(Instant instant) {
- if (instant == null) {
- return Timestamp.getDefaultInstance();
- }
- return Timestamp.newBuilder()
- .setSeconds(instant.getEpochSecond())
- .setNanos(instant.getNano())
- .build();
- }
-}
-
diff --git a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/worker/amie/ProcessingEventWorker.java b/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/worker/amie/ProcessingEventWorker.java
deleted file mode 100644
index 9e5b5d268..000000000
--- a/allocations/access-ci-service/src/main/java/org/apache/custos/access/ci/service/worker/amie/ProcessingEventWorker.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.worker.amie;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.micrometer.core.instrument.Timer;
-import org.apache.custos.access.ci.service.handler.amie.PacketRouter;
-import org.apache.custos.access.ci.service.metrics.AmieMetrics;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.model.amie.PacketStatus;
-import org.apache.custos.access.ci.service.model.amie.ProcessingErrorEntity;
-import org.apache.custos.access.ci.service.model.amie.ProcessingEventEntity;
-import org.apache.custos.access.ci.service.model.amie.ProcessingEventType;
-import org.apache.custos.access.ci.service.model.amie.ProcessingStatus;
-import org.apache.custos.access.ci.service.repo.amie.PacketRepository;
-import org.apache.custos.access.ci.service.repo.amie.ProcessingErrorRepository;
-import org.apache.custos.access.ci.service.repo.amie.ProcessingEventRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.time.Instant;
-import java.util.List;
-
-/**
- * Scheduled worker that polls for pending AMIE processing events and executes them.
- * Failures are recorded in a separate transaction to prevent infinite retry loops.
- *
- * <pre>
- * NEW → RUNNING → SUCCEEDED
- * → RETRY_SCHEDULED → (backoff) → RUNNING → ...
- * → PERMANENTLY_FAILED (after MAX_ATTEMPTS)
- * </pre>
- */
-@Component
-public class ProcessingEventWorker {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ProcessingEventWorker.class);
-
- /**
- * Maximum number of execution attempts before an event is permanently failed.
- */
- static final int MAX_ATTEMPTS = 3;
-
- /**
- * Base delay in seconds for exponential backoff between retry attempts.
- */
- private static final long BASE_BACKOFF_SECONDS = 30L;
-
- /**
- * Upper bound on the computed backoff delay (10 minutes).
- */
- private static final long MAX_BACKOFF_SECONDS = 600L;
-
- private final ProcessingEventRepository eventRepo;
- private final PacketRepository packetRepo;
- private final ProcessingErrorRepository errorRepo;
- private final PacketRouter router;
- private final AmieMetrics amieMetrics;
- private final ObjectMapper objectMapper = new ObjectMapper();
- private final ProcessingEventWorker self;
-
- public ProcessingEventWorker(ProcessingEventRepository eventRepo,
- PacketRepository packetRepo,
- ProcessingErrorRepository errorRepo,
- PacketRouter router,
- AmieMetrics amieMetrics,
- @Lazy ProcessingEventWorker self) {
- this.eventRepo = eventRepo;
- this.packetRepo = packetRepo;
- this.errorRepo = errorRepo;
- this.router = router;
- this.amieMetrics = amieMetrics;
- this.self = self;
- }
-
- /**
- * Polls for due events and processes each in its own transaction.
- */
- @Scheduled(fixedDelayString = "#{T(org.springframework.boot.convert.DurationStyle).detectAndParse('${access.amie.scheduler.worker-delay}').toMillis()}")
- public void processPendingEvents() {
- List<ProcessingEventEntity> eventsToProcess =
- eventRepo.findTop50EventsToProcess(
- List.of(ProcessingStatus.NEW, ProcessingStatus.RETRY_SCHEDULED),
- Instant.now());
-
- if (eventsToProcess.isEmpty()) {
- return;
- }
-
- LOGGER.info("Found {} event(s) to process.", eventsToProcess.size());
-
- for (ProcessingEventEntity event : eventsToProcess) {
- String eventId = event.getId();
- PacketEntity packet = event.getPacket();
-
- MDC.put("packetId", packet.getId());
- MDC.put("amieId", String.valueOf(packet.getAmieId()));
- MDC.put("packetType", packet.getType());
-
- Timer.Sample timerSample = amieMetrics.startProcessingTimer();
- try {
- self.executeEventInTransaction(event);
- } catch (Exception e) {
- LOGGER.error("Transaction failed for eventId [{}]. Opening recovery transaction to record failure.",
- eventId, e);
- amieMetrics.stopProcessingTimer(timerSample, packet.getType());
- try {
- self.recordFailureInNewTransaction(eventId, e);
- } catch (Exception recoveryEx) {
- LOGGER.error("CRITICAL: Recovery transaction also failed for eventId [{}]. " +
- "Event may remain stuck until the next worker cycle.", eventId, recoveryEx);
- }
- continue;
- } finally {
- MDC.remove("packetId");
- MDC.remove("amieId");
- MDC.remove("packetType");
- MDC.remove("handler");
- }
- amieMetrics.stopProcessingTimer(timerSample, packet.getType());
- }
- }
-
- @Transactional(propagation = Propagation.REQUIRES_NEW)
- public void executeEventInTransaction(ProcessingEventEntity event) throws Exception {
- PacketEntity packet = event.getPacket();
- LOGGER.info("Processing event [{}] for packet amie_id [{}]. Attempt: {}",
- event.getType(), packet.getAmieId(), event.getAttempts() + 1);
-
- event.setStatus(ProcessingStatus.RUNNING);
- event.setStartedAt(Instant.now());
- event.setAttempts(event.getAttempts() + 1);
- eventRepo.saveAndFlush(event);
-
- var packetJson = objectMapper.readTree(packet.getRawJson());
- router.route(packetJson, packet, event.getId());
-
- handleSuccess(event, packet);
- }
-
- @Transactional(propagation = Propagation.REQUIRES_NEW)
- public void recordFailureInNewTransaction(String eventId, Exception cause) {
- ProcessingEventEntity event = eventRepo.findById(eventId).orElse(null);
- if (event == null) {
- LOGGER.error("Cannot record failure: event [{}] not found in the database.", eventId);
- return;
- }
-
- PacketEntity packet = event.getPacket();
-
- int effectiveAttempts = event.getAttempts() + 1;
- event.setAttempts(effectiveAttempts);
-
- boolean isRetryable = effectiveAttempts < MAX_ATTEMPTS;
- ProcessingStatus newStatus = isRetryable
- ? ProcessingStatus.RETRY_SCHEDULED
- : ProcessingStatus.PERMANENTLY_FAILED;
-
- event.setStatus(newStatus);
- event.setLastError(cause.getMessage());
- event.setFinishedAt(Instant.now());
-
- if (isRetryable) {
- Instant nextRetryAt = computeNextRetryAt(effectiveAttempts);
- event.setNextRetryAt(nextRetryAt);
- amieMetrics.recordRetry();
- amieMetrics.recordPacketProcessed(packet.getType(), "retry_scheduled");
- LOGGER.warn("Event [{}] for packet amie_id [{}] failed on attempt {}/{}. Scheduled for retry after [{}].",
- eventId, packet.getAmieId(), effectiveAttempts, MAX_ATTEMPTS, nextRetryAt);
- } else {
- event.setNextRetryAt(null);
- amieMetrics.recordPacketProcessed(packet.getType(), "permanently_failed");
- LOGGER.error("Event [{}] for packet amie_id [{}] is PERMANENTLY_FAILED after {} attempt(s). Manual intervention required.",
- eventId, packet.getAmieId(), effectiveAttempts);
- packet.setStatus(PacketStatus.FAILED);
- packet.setLastError(cause.getMessage());
- packetRepo.save(packet);
- }
-
- eventRepo.save(event);
-
- ProcessingErrorEntity error = new ProcessingErrorEntity();
- error.setPacket(packet);
- error.setEvent(event);
- error.setSummary(cause.getClass().getSimpleName() + ": " + cause.getMessage());
- String stackTrace = getStackTraceAsString(cause);
- if (stackTrace.length() > 8000) {
- stackTrace = stackTrace.substring(0, 8000) + "\n... [truncated]";
- }
- error.setDetail(stackTrace);
- errorRepo.save(error);
- }
-
- private void handleSuccess(ProcessingEventEntity event, PacketEntity packet) {
- event.setStatus(ProcessingStatus.SUCCEEDED);
- event.setFinishedAt(Instant.now());
- event.setNextRetryAt(null);
- eventRepo.save(event);
-
- if (event.getType() == ProcessingEventType.DECODE_PACKET) {
- packet.setStatus(PacketStatus.DECODED);
- packet.setDecodedAt(Instant.now());
- packetRepo.save(packet);
- }
-
- amieMetrics.recordPacketProcessed(packet.getType(), "succeeded");
-
- LOGGER.info("Successfully processed event [{}] for packet amie_id [{}].",
- event.getType(), packet.getAmieId());
- }
-
- // Exponential backoff: BASE * 2^(attempt-1), capped at MAX_BACKOFF_SECONDS.
- static Instant computeNextRetryAt(int attemptNumber) {
- long exponent = Math.max(0, attemptNumber - 1);
- long delaySec = BASE_BACKOFF_SECONDS * (1L << exponent);
- delaySec = Math.min(delaySec, MAX_BACKOFF_SECONDS);
- return Instant.now().plusSeconds(delaySec);
- }
-
- private String getStackTraceAsString(Exception e) {
- StringWriter sw = new StringWriter();
- e.printStackTrace(new PrintWriter(sw));
- return sw.toString();
- }
-}
diff --git a/allocations/access-ci-service/src/main/proto/amie_packets.proto b/allocations/access-ci-service/src/main/proto/amie_packets.proto
deleted file mode 100644
index bfbb98758..000000000
--- a/allocations/access-ci-service/src/main/proto/amie_packets.proto
+++ /dev/null
@@ -1,183 +0,0 @@
-syntax = "proto3";
-
-option java_multiple_files = true;
-package org.apache.custos.access.ci.service.v1;
-
-import "google/protobuf/struct.proto";
-import "google/protobuf/timestamp.proto";
-
-// AMIE packet types that the service must handle from the Client API
-enum PacketType {
- PACKET_TYPE_UNSPECIFIED = 0;
- REQUEST_PROJECT_CREATE = 1;
- REQUEST_PROJECT_INACTIVATE = 2;
- REQUEST_PROJECT_REACTIVATE = 3;
- REQUEST_ACCOUNT_CREATE = 4;
- REQUEST_ACCOUNT_INACTIVATE = 5;
- REQUEST_ACCOUNT_REACTIVATE = 6;
- REQUEST_USER_MODIFY = 7;
- REQUEST_PERSON_MERGE = 8;
-}
-
-// Expected reply descriptor from the AMIE header
-message ExpectedReply {
- string type = 1; // The type of the expected reply packet, eg, "notify_project_create"
- int64 timeout = 2; // Timeout value as provided by AMIE
-}
-
-// Packet header as returned by the Client API
-message PacketHeader {
- repeated ExpectedReply expected_reply_list = 1;
- int64 packet_id = 2;
- int64 trans_rec_id = 3;
- int64 transaction_id = 4;
- string remote_site_name = 5;
- string local_site_name = 6;
- string originating_site_name = 7;
- bool outgoing_flag = 8;
- string transaction_state = 9;
- int64 packet_rec_id = 10; // Stable, unique per packet
- string client_state = 11; // Site-defined state
- string packet_state = 12; // AMIE-side packet state
- google.protobuf.Timestamp packet_timestamp = 13;
- google.protobuf.Struct client_json = 14;
-}
-
-
-// request_project_create
-message RequestProjectCreate {
- string allocated_resource = 1; // "AllocatedResource"
- repeated string pi_requested_login_list = 2; // "PiRequestedLoginList"
- repeated string resource_list = 3; // "ResourceList"
-
- string service_units_allocated = 4; // "ServiceUnitsAllocated"
- string start_date = 5; // "StartDate" (YYYY-MM-DD as string)
- string end_date = 6; // "EndDate"
-
- // Often present in NPC replies, sometimes seen in requests:
- string project_id = 7; // "ProjectID"
- string pi_person_id = 8; // "PersonID" or "PiPersonID"
- string pi_global_id = 9; // "PiGlobalID"
- google.protobuf.Struct extra_fields = 99;
-}
-
-// request_project_inactivate
-message RequestProjectInactivate {
- string project_id = 1; // "ProjectID"
- string person_id = 2; // "PersonID" (PI)
- repeated string resource_list = 3; // "ResourceList"
- string allocated_resource = 4; // "AllocatedResource"
- string comment = 5; // "Comment" if provided
- string start_date = 6;
- string end_date = 7;
- string service_units_allocated = 8;
- string service_units_remaining = 9;
-
- google.protobuf.Struct extra_fields = 99;
-}
-
-// request_project_reactivate
-message RequestProjectReactivate {
- string project_id = 1;
- string person_id = 2; // PI only should be reactivated
- repeated string resource_list = 3;
- string allocated_resource = 4;
- string start_date = 5;
- string end_date = 6;
- string service_units_allocated = 7;
- string service_units_remaining = 8;
- string grant_number = 9;
-
- google.protobuf.Struct extra_fields = 99;
-}
-
-// request_account_create
-message RequestAccountCreate {
- string project_id = 1;
- string person_id = 2; // Target user
- repeated string resource_list = 3; // "ResourceList"
- string allocated_resource = 4;
-
- // Some sites provide preferred login(s) here
- repeated string user_requested_login_list = 5; // "UserRequestedLoginList"
-
- google.protobuf.Struct extra_fields = 99;
-}
-
-// request_account_inactivate
-message RequestAccountInactivate {
- string project_id = 1; // "ProjectID"
- string person_id = 2; // "PersonID"
- repeated string resource_list = 3; // "ResourceList"
- string allocated_resource = 4;
- string comment = 5;
-
- google.protobuf.Struct extra_fields = 99;
-}
-
-// request_account_reactivate
-message RequestAccountReactivate {
- string project_id = 1; // "ProjectID"
- string person_id = 2; // "PersonID"
- repeated string resource_list = 3; // "ResourceList"
- string allocated_resource = 4;
-
- google.protobuf.Struct extra_fields = 99;
-}
-
-// request_user_modify
-message RequestUserModify {
- string action_type = 1; // "ActionType" (e.g., "replace" or "delete")
- string person_id = 2; // "PersonID"
-
- string first_name = 3;
- string middle_name = 4;
- string last_name = 5;
- string title = 6;
- string email = 7;
- string organization = 8;
- string org_code = 9;
- string business_phone_number = 10;
- string street_address = 11;
- string street_address2 = 12;
- string city = 13;
- string state = 14;
- string zip = 15;
- string country = 16;
-
- repeated string dn_list = 17; // "DnList"
- google.protobuf.Struct extra_fields = 99;
-}
-
-// request_person_merge
-message RequestPersonMerge {
- // AMIE sends identifiers to merge duplicate people
- string surviving_person_id = 1;
- string retiring_person_id = 2;
- // Keep flexible to capture the resto of the fields
- google.protobuf.Struct extra_fields = 99;
-}
-
-// Wrapper for any AMIE packet received by the service
-message Packet {
- PacketType type = 1;
- PacketHeader header = 2;
-
- oneof body {
- RequestProjectCreate request_project_create = 10;
- RequestProjectInactivate request_project_inactivate = 11;
- RequestProjectReactivate request_project_reactivate = 12;
- RequestAccountCreate request_account_create = 13;
- RequestAccountInactivate request_account_inactivate = 14;
- RequestAccountReactivate request_account_reactivate = 15;
- RequestUserModify request_user_modify = 16;
- RequestPersonMerge request_person_merge = 17;
-
- // A fallback for any packet types this schema doesn't support
- google.protobuf.Struct unknown_body = 50;
- }
-
- // Complete unmodified raw JSON of the packet (header + body) as a string
- // For auditing, debugging, and reprocessing
- string raw_json_payload = 98;
-}
diff --git a/allocations/access-ci-service/src/main/proto/internal_events.proto b/allocations/access-ci-service/src/main/proto/internal_events.proto
deleted file mode 100644
index 3e9f7e72d..000000000
--- a/allocations/access-ci-service/src/main/proto/internal_events.proto
+++ /dev/null
@@ -1,159 +0,0 @@
-syntax = "proto3";
-
-option java_multiple_files = true;
-package org.apache.custos.access.ci.service.internal.events.v1;
-
-import "google/protobuf/timestamp.proto";
-import "google/protobuf/struct.proto";
-import "amie_packets.proto";
-
-// Defines the high-level stages in the processing of a single AMIE packet
-enum EventType {
- EVENT_TYPE_UNSPECIFIED = 0;
-
- // Ingestion & persistence
- PACKET_POLLED = 10; // Fetched from AMIE Client API
- PACKET_PERSISTED = 11; // Stored in `packets` table
-
- // Decode
- DECODE_STARTED = 20;
- DECODE_SUCCEEDED = 21;
- DECODE_FAILED = 22;
-
- // Provisioning (account, project, groups, home dir, etc.)
- PROVISIONING_REQUESTED = 30;
- PROVISIONING_SUCCEEDED = 31;
- PROVISIONING_FAILED = 32;
-
- // ACK back to ACCESS (eg, inform_transaction_complete - notify_*)
- ACK_SCHEDULED = 40;
- ACK_DISPATCHED = 41;
- ACK_FAILED = 42;
-}
-
-// Represents the status of a specific processing event (mirrors `processing_events` column)
-enum ProcessingStatus {
- PROCESSING_STATUS_UNSPECIFIED = 0;
- PENDING = 1;
- RUNNING = 2;
- SUCCEEDED = 3;
- FAILED = 4;
- RETRY_SCHEDULED = 5;
- SKIPPED = 6;
-}
-
-// Standard error payload for failures and retries
-message EventError {
- string code = 1; // short code, eg, "AMIE_HTTP_502", "DECODE_JSON", "COMANAGE_API_TIMEOUT"
- string summary = 2; // one-line summary
- string detail = 3; // full error detail
- bool retriable = 4; // indicate whether this can be retried
-}
-
-message PacketPolledPayload {
- int64 amie_packet_rec_id = 1; // from AMIE header
- string poll_run_id = 2;
-}
-
-message PacketPersistedPayload {
- string packet_db_id = 1; // UUID from `packets.id`
- int64 amie_packet_rec_id = 2;
-}
-
-message DecodeStartedPayload {
- string packet_db_id = 1;
- int64 amie_packet_rec_id = 2;
-}
-
-message DecodeSucceededPayload {
- string packet_db_id = 1;
- int64 amie_packet_rec_id = 2;
-
- org.apache.custos.access.ci.service.v1.Packet packet = 3;
-}
-
-message DecodeFailedPayload {
- string packet_db_id = 1;
- int64 amie_packet_rec_id = 2;
- EventError error = 3;
-}
-
-message ProvisioningRequestedPayload {
- string packet_db_id = 1;
- int64 amie_packet_rec_id = 2;
-
- string operation = 3; // eg, "CREATE_UNIX_ACCOUNT", "ADD_TO_PROJECT", "INACTIVATE_ACCOUNT"
- string unix_username = 4; // if known
- string project_id = 5; // ACCESS ProjectID
- repeated string resources = 6; // target resource codes from AMIE
- google.protobuf.Struct desired_state = 7; // flexible struct containing the details needed for the operation
-}
-
-message ProvisioningSucceededPayload {
- string packet_db_id = 1;
- int64 amie_packet_rec_id = 2;
- string operation = 3;
- google.protobuf.Struct result = 4; // eg, { "uid": 12345, "home": "/home/foo" }
-}
-
-message ProvisioningFailedPayload {
- string packet_db_id = 1;
- int64 amie_packet_rec_id = 2;
- string operation = 3;
- EventError error = 4;
-}
-
-message AckScheduledPayload {
- string packet_db_id = 1;
- int64 amie_packet_rec_id = 2;
- string reply_type = 3; // eg, "inform_transaction_complete"
-}
-
-message AckDispatchedPayload {
- string packet_db_id = 1;
- int64 amie_packet_rec_id = 2;
- string reply_type = 3;
- int32 http_status = 4; // response code from the ACCESS API
-}
-
-message AckFailedPayload {
- string packet_db_id = 1;
- int64 amie_packet_rec_id = 2;
- string reply_type = 3;
- EventError error = 4;
-}
-
-// This is the main envelope message that will be serialized and stored
-// in the `processing_events.payload` column in the database
-message ProcessingEvent {
- string id = 1; // UUID for the event (`processing_events.id`)
- string packet_db_id = 2; // `packets.id`
- int64 amie_packet_rec_id = 3; // The original AMIE ID
- EventType type = 4;
- ProcessingStatus status = 5;
- int32 attempts = 6;
-
- google.protobuf.Timestamp created_at = 7;
- google.protobuf.Timestamp started_at = 8;
- google.protobuf.Timestamp finished_at = 9;
-
- // Event-specific payloads
- oneof payload {
- PacketPolledPayload packet_polled = 20;
- PacketPersistedPayload packet_persisted = 21;
-
- DecodeStartedPayload decode_started = 30;
- DecodeSucceededPayload decode_succeeded = 31;
- DecodeFailedPayload decode_failed = 32;
-
- ProvisioningRequestedPayload provisioning_requested = 40;
- ProvisioningSucceededPayload provisioning_succeeded = 41;
- ProvisioningFailedPayload provisioning_failed = 42;
-
- AckScheduledPayload ack_scheduled = 50;
- AckDispatchedPayload ack_dispatched = 51;
- AckFailedPayload ack_failed = 52;
-
- google.protobuf.Struct generic = 90;
- }
-}
diff --git a/allocations/access-ci-service/src/main/resources/application.yml b/allocations/access-ci-service/src/main/resources/application.yml
deleted file mode 100644
index 0156e6caf..000000000
--- a/allocations/access-ci-service/src/main/resources/application.yml
+++ /dev/null
@@ -1,77 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-server:
- port: 8083
-
-spring:
- profiles:
- active: dev
- application:
- name: access-ci-service
- datasource:
- url: "jdbc:mariadb://localhost:3306/access_ci"
- username: admin
- password: admin
- driver-class-name: org.mariadb.jdbc.Driver
- jpa:
- hibernate:
- ddl-auto: validate
- properties:
- hibernate.jdbc.time_zone: UTC
- hibernate.type.preferred_enum_jdbc_type: VARCHAR
- show-sql: false
- database-platform: org.hibernate.dialect.MariaDBDialect
- flyway:
- enabled: true
- locations: classpath:db/migration
-
-access:
- amie:
- base-url: https://a3mdev.xsede.org/amie-api-test
- site-code: ${AMIE_SITE_CODE}
- api-key: ${AMIE_API_KEY}
- scheduler:
- poll-delay: 30s
- worker-delay: 5s
- client:
- connect-timeout: 5s
- read-timeout: 20s
-
-logging:
- pattern:
- level: '%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]'
- level:
- root: info
-
-management:
- endpoints:
- web:
- exposure:
- include: health, prometheus, info
- endpoint:
- health:
- show-details: when-authorized
- prometheus:
- metrics:
- export:
- enabled: true
-
-springdoc:
- swagger-ui:
- title: CUSTOS ACCESS CI SERVICE API
- oauth:
- use-pkce-with-authorization-code-grant: true
\ No newline at end of file
diff --git a/allocations/access-ci-service/src/main/resources/db/migration/V1__initial_migration.sql b/allocations/access-ci-service/src/main/resources/db/migration/V1__initial_migration.sql
deleted file mode 100644
index 57f73937a..000000000
--- a/allocations/access-ci-service/src/main/resources/db/migration/V1__initial_migration.sql
+++ /dev/null
@@ -1,200 +0,0 @@
--- =================================================================
--- Flyway Migration Script for AMIE Packet Decoder
--- Target Database: MySQL / MariaDB
--- =================================================================
-
-SET NAMES utf8mb4;
-SET time_zone = '+00:00';
-
--- -----------------------------
--- TABLE: persons
--- Stores a unique record for each person received from AMIE.
--- -----------------------------
-CREATE TABLE persons
-(
- id VARCHAR(255) NOT NULL, -- Local user ID - UserPersonID
- access_global_id VARCHAR(255) NOT NULL, -- UserGlobalID from AMIE
- first_name VARCHAR(255) NOT NULL,
- last_name VARCHAR(255) NOT NULL,
- email VARCHAR(255) NOT NULL,
- organization VARCHAR(255) NULL,
- org_code VARCHAR(255) NULL,
- nsf_status_code VARCHAR(32) NULL,
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
-
- PRIMARY KEY (id),
- UNIQUE KEY uq_persons_amie_global_id (access_global_id)
-
-) ENGINE = InnoDB
- DEFAULT CHARSET = utf8mb4
- COLLATE = utf8mb4_unicode_ci;
-
-
--- -----------------------------
--- TABLE: person_dns
--- Stores the list of Distinguished Names (DNs) for a person.
--- -----------------------------
-CREATE TABLE person_dns
-(
- id BIGINT NOT NULL AUTO_INCREMENT,
- person_id VARCHAR(255) NOT NULL,
- dn VARCHAR(512) NOT NULL,
-
- PRIMARY KEY (id),
- CONSTRAINT fk_dns_person FOREIGN KEY (person_id) REFERENCES persons (id) ON DELETE CASCADE,
- UNIQUE KEY uq_person_dn (person_id, dn)
-
-) ENGINE = InnoDB
- DEFAULT CHARSET = utf8mb4
- COLLATE = utf8mb4_unicode_ci;
-
-
--- -----------------------------
--- TABLE: cluster_accounts
--- Stores the actual provisioned usernames on the cluster.
--- -----------------------------
-CREATE TABLE cluster_accounts
-(
- id VARCHAR(255) NOT NULL,
- person_id VARCHAR(255) NOT NULL,
- username VARCHAR(255) NOT NULL,
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
-
- PRIMARY KEY (id),
- UNIQUE KEY uq_accounts_username (username),
- CONSTRAINT fk_accounts_person FOREIGN KEY (person_id) REFERENCES persons (id) ON DELETE CASCADE
-
-) ENGINE = InnoDB
- DEFAULT CHARSET = utf8mb4
- COLLATE = utf8mb4_unicode_ci;
-
-
--- -----------------------------
--- TABLE: projects
--- Stores unique information about each project/allocation
--- -----------------------------
-CREATE TABLE projects
-(
- id VARCHAR(255) NOT NULL, -- AMIE ProjectID (local), e.g., "PRJ-TRA258601"
- grant_number VARCHAR(255) NOT NULL,
- is_active BOOLEAN NOT NULL DEFAULT TRUE,
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
-
- PRIMARY KEY (id),
- UNIQUE KEY uq_projects_grant_number (grant_number),
- KEY idx_projects_active (is_active)
-
-) ENGINE = InnoDB
- DEFAULT CHARSET = utf8mb4
- COLLATE = utf8mb4_unicode_ci;
-
-
--- -----------------------------
--- TABLE: project_memberships
--- Links cluster accounts to projects with roles (user memberships on projects).
--- -----------------------------
-CREATE TABLE project_memberships
-(
- id VARCHAR(255) NOT NULL,
- project_id VARCHAR(255) NOT NULL, -- FK to projects.id
- cluster_account_id VARCHAR(255) NOT NULL, -- FK to cluster_accounts.id
- role VARCHAR(32) NULL, -- PI, USER
- is_active BOOLEAN NOT NULL DEFAULT TRUE,
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
-
- PRIMARY KEY (id),
- CONSTRAINT fk_membership_project FOREIGN KEY (project_id) REFERENCES projects (id) ON DELETE CASCADE,
- CONSTRAINT fk_membership_account FOREIGN KEY (cluster_account_id) REFERENCES cluster_accounts (id) ON DELETE CASCADE,
- UNIQUE KEY uq_project_account (project_id, cluster_account_id),
- KEY idx_memberships_project (project_id),
- KEY idx_memberships_account (cluster_account_id),
- KEY idx_memberships_active (is_active)
-
-) ENGINE = InnoDB
- DEFAULT CHARSET = utf8mb4
- COLLATE = utf8mb4_unicode_ci;
-
-
--- Stores each unique AMIE packet received from the polling endpoint
--- -----------------------------
-CREATE TABLE amie_packets
-(
- id VARCHAR(255) NOT NULL,
- amie_id BIGINT NOT NULL, -- packet_rec_id from AMIE
- type VARCHAR(64) NOT NULL, -- eg. request_account_create
- status VARCHAR(32) NOT NULL, -- NEW, DECODED, PROCESSED, FAILED
- raw_json TEXT NOT NULL,
- received_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- decoded_at TIMESTAMP(6) NULL,
- processed_at TIMESTAMP(6) NULL,
- retries INT NOT NULL DEFAULT 0,
- last_error TEXT NULL,
-
- PRIMARY KEY (id),
- UNIQUE KEY uq_packets_amie_id (amie_id),
- KEY idx_amie_packets_status (status),
- KEY idx_amie_packets_received_at (received_at)
-
-) ENGINE = InnoDB
- DEFAULT CHARSET = utf8mb4
- COLLATE = utf8mb4_unicode_ci;
-
-
--- -----------------------------
--- TABLE: amie_processing_events
--- Individual processing steps for a given packet
--- -----------------------------
-CREATE TABLE amie_processing_events
-(
- id VARCHAR(255) NOT NULL,
- packet_id VARCHAR(255) NOT NULL,
- type VARCHAR(64) NOT NULL, -- DECODE_PACKET, SYNC_USER, ACK, etc.
- status VARCHAR(32) NOT NULL, -- PENDING, RUNNING, DONE, FAILED
- attempts INT NOT NULL DEFAULT 0,
- payload LONGBLOB NOT NULL, -- Protobuf serialized DTO
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- started_at TIMESTAMP(6) NULL,
- finished_at TIMESTAMP(6) NULL,
- last_error TEXT NULL,
-
- PRIMARY KEY (id),
- CONSTRAINT fk_amie_events_packet FOREIGN KEY (packet_id) REFERENCES amie_packets (id) ON DELETE CASCADE,
- UNIQUE KEY uq_amie_events_packet_type (packet_id, type),
-
- KEY idx_amie_events_status (status),
- KEY idx_amie_events_packet_id (packet_id),
- KEY idx_amie_events_type (type)
-
-) ENGINE = InnoDB
- DEFAULT CHARSET = utf8mb4
- COLLATE = utf8mb4_unicode_ci;
-
-
--- -----------------------------
--- TABLE: amie_processing_errors
--- Processing error logs
--- -----------------------------
-CREATE TABLE amie_processing_errors
-(
- id BIGINT NOT NULL AUTO_INCREMENT,
- packet_id VARCHAR(255) NULL,
- event_id VARCHAR(255) NULL,
- occurred_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- summary TEXT NOT NULL,
- detail TEXT NULL,
-
- PRIMARY KEY (id),
- CONSTRAINT fk_errors_amie_packet FOREIGN KEY (packet_id) REFERENCES amie_packets (id) ON DELETE SET NULL,
- CONSTRAINT fk_errors_amie_event FOREIGN KEY (event_id) REFERENCES amie_processing_events (id) ON DELETE SET NULL,
-
- KEY idx_errors_amie_packet_id (packet_id),
- KEY idx_errors_amie_event_id (event_id),
- KEY idx_errors_amie_occurred_at (occurred_at)
-
-) ENGINE = InnoDB
- DEFAULT CHARSET = utf8mb4
- COLLATE = utf8mb4_unicode_ci;
diff --git a/allocations/access-ci-service/src/main/resources/db/migration/V2__add_next_retry_at_to_processing_events.sql b/allocations/access-ci-service/src/main/resources/db/migration/V2__add_next_retry_at_to_processing_events.sql
deleted file mode 100644
index 3c6e7a31d..000000000
--- a/allocations/access-ci-service/src/main/resources/db/migration/V2__add_next_retry_at_to_processing_events.sql
+++ /dev/null
@@ -1,5 +0,0 @@
--- Add retry backoff support to processing events.
-
-ALTER TABLE amie_processing_events
- ADD COLUMN next_retry_at TIMESTAMP(6) NULL DEFAULT NULL,
- ADD INDEX idx_amie_events_next_retry_at (next_retry_at);
diff --git a/allocations/access-ci-service/src/main/resources/db/migration/V3__create_audit_log.sql b/allocations/access-ci-service/src/main/resources/db/migration/V3__create_audit_log.sql
deleted file mode 100644
index 6c10ad7e6..000000000
--- a/allocations/access-ci-service/src/main/resources/db/migration/V3__create_audit_log.sql
+++ /dev/null
@@ -1,36 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
--- Audit log for handler actions during AMIE packet processing.
-
-CREATE TABLE amie_audit_log
-(
- id BIGINT NOT NULL AUTO_INCREMENT,
- packet_id VARCHAR(255) NOT NULL,
- event_id VARCHAR(255) NULL,
- action VARCHAR(64) NOT NULL,
- entity_type VARCHAR(64) NOT NULL,
- entity_id VARCHAR(255) NULL,
- summary TEXT NULL,
- created_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
- PRIMARY KEY (id),
- CONSTRAINT fk_audit_packet FOREIGN KEY (packet_id) REFERENCES amie_packets (id) ON DELETE CASCADE,
- CONSTRAINT fk_audit_event FOREIGN KEY (event_id) REFERENCES amie_processing_events (id) ON DELETE SET NULL,
- KEY idx_audit_packet_id (packet_id),
- KEY idx_audit_action (action),
- KEY idx_audit_created_at (created_at)
-) ENGINE = InnoDB
- DEFAULT CHARSET = utf8mb4
- COLLATE = utf8mb4_unicode_ci;
diff --git a/allocations/access-ci-service/src/main/resources/distribution/bin/amie-decoder.sh b/allocations/access-ci-service/src/main/resources/distribution/bin/amie-decoder.sh
deleted file mode 100755
index b8e37fb8f..000000000
--- a/allocations/access-ci-service/src/main/resources/distribution/bin/amie-decoder.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. `dirname $0`/setenv.sh
-# Capture user's working dir before changing directory
-CWD="$PWD"
-cd ${AIRAVATA_HOME}/bin
-LOGO_FILE="logo.txt"
-
-JAVA_OPTS="-Dspring.config.location=${AIRAVATA_HOME}/conf/ -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback-spring.xml"
-AIRAVATA_COMMAND=""
-EXTRA_ARGS=""
-SERVERS=""
-IS_SUBSET=false
-SUBSET=""
-DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/amie-decoder.out"
-LOG_FILE=$DEFAULT_LOG_FILE
-
-# parse command arguments
-for var in "$@"
-do
- case ${var} in
- -xdebug)
- AIRAVATA_COMMAND="${AIRAVATA_COMMAND}"
- JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=*:8000"
- shift
- ;;
- -log)
- shift
- LOG_FILE="$1"
- shift
- # If relative path, expand to absolute path using the user's $CWD
- if [ -z "`echo "$LOG_FILE" | egrep "^/"`" ]; then
- LOG_FILE="${CWD}/${LOG_FILE}"
- fi
- ;;
- -h)
- echo "Usage: custos.sh"
-
- echo "command options:"
- echo " -xdebug Start Custos Service under JPDA debugger"
- echo " -h Display this help and exit"
- shift
- exit 0
- ;;
- *)
- EXTRA_ARGS="${EXTRA_ARGS} ${var}"
- shift
- ;;
- esac
-done
-
-java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
- org.apache.custos.amie.AmieDecoderApplication ${AIRAVATA_COMMAND} $*
\ No newline at end of file
diff --git a/allocations/access-ci-service/src/main/resources/distribution/bin/custos-daemon.sh b/allocations/access-ci-service/src/main/resources/distribution/bin/custos-daemon.sh
deleted file mode 100755
index d8b74d189..000000000
--- a/allocations/access-ci-service/src/main/resources/distribution/bin/custos-daemon.sh
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. `dirname $0`/setenv.sh
-# Capture user's working dir before changing directory
-CWD="$PWD"
-cd ${AIRAVATA_HOME}/bin
-LOGO_FILE="logo.txt"
-
-JAVA_OPTS="-Dspring.config.location=${AIRAVATA_HOME}/conf/ -Dairavata.home=${AIRAVATA_HOME} -Dlogback.configurationFile=file:${AIRAVATA_HOME}/conf/logback-spring.xml"
-AIRAVATA_COMMAND=""
-EXTRA_ARGS=""
-SERVERS=""
-LOGO=true
-IS_SUBSET=false
-SUBSET=""
-DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/amie-decoder-daemon.out"
-LOG_FILE=$DEFAULT_LOG_FILE
-
-SERVICE_NAME="Custos AMIE Decoder Service"
-PID_PATH_NAME="${AIRAVATA_HOME}/bin/service-pid"
-
-case $1 in
- start)
- echo "Starting $SERVICE_NAME ..."
- if [ ! -f $PID_PATH_NAME ]; then
- nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
- org.apache.custos.CustosApplication ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 &
- echo $! > $PID_PATH_NAME
- echo "$SERVICE_NAME started ..."
- else
- echo "$SERVICE_NAME is already running ..."
- fi
- ;;
- stop)
- if [ -f $PID_PATH_NAME ]; then
- PID=$(cat $PID_PATH_NAME);
- echo "$SERVICE_NAME stopping ..."
- kill $PID;
- RETRY=0
- while kill -0 $PID 2> /dev/null; do
- echo "Waiting for the process $PID to be stopped"
- RETRY=`expr ${RETRY} + 1`
- if [ "${RETRY}" -gt "20" ]
- then
- echo "Forcefully killing the process as it is not responding ..."
- kill -9 $PID
- fi
- sleep 1
- done
- echo "$SERVICE_NAME stopped ..."
- rm $PID_PATH_NAME
- else
- echo "$SERVICE_NAME is not running ..."
- fi
- ;;
- restart)
- if [ -f $PID_PATH_NAME ]; then
- PID=$(cat $PID_PATH_NAME);
- echo "$SERVICE_NAME stopping ...";
- kill $PID;
- RETRY=0
- while kill -0 $PID 2> /dev/null; do
- echo "Waiting for the process $PID to be stopped"
- RETRY=`expr ${RETRY} + 1`
- if [ "${RETRY}" -gt "20" ]
- then
- echo "Forcefully killing the process as it is not responding ..."
- kill -9 $PID
- fi
- sleep 1
- done
- echo "$SERVICE_NAME stopped ...";
- rm $PID_PATH_NAME
- echo "$SERVICE_NAME starting ..."
- nohup java ${JAVA_OPTS} -classpath "${AIRAVATA_CLASSPATH}" \
- org.apache.custos.CustosApplication ${AIRAVATA_COMMAND} $* > $LOG_FILE 2>&1 &
- echo $! > $PID_PATH_NAME
- echo "$SERVICE_NAME started ..."
- else
- echo "$SERVICE_NAME is not running ..."
- fi
- ;;
- -h)
- echo "Usage: custos-daemon.sh"
-
- echo "command options:"
- echo " start Start server in daemon mode"
- echo " stop Stop server running in daemon mode"
- echo " restart Restart server in daemon mode"
- echo " -log <LOG_FILE> Where to redirect stdout/stderr (defaults to $DEFAULT_LOG_FILE)"
- echo " -h Display this help and exit"
- shift
- exit 0
- ;;
-esac
\ No newline at end of file
diff --git a/allocations/access-ci-service/src/main/resources/distribution/bin/setenv.sh b/allocations/access-ci-service/src/main/resources/distribution/bin/setenv.sh
deleted file mode 100755
index 3f1d7632b..000000000
--- a/allocations/access-ci-service/src/main/resources/distribution/bin/setenv.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# resolve links - $0 may be a softlink
-PRG="$0"
-
-while [ -h "$PRG" ]; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '.*/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`/"$link"
- fi
-done
-
-PRGDIR=`dirname "$PRG"`
-
-# Only set AIRAVATA_HOME if not already set
-[ -z "$AIRAVATA_HOME" ] && AIRAVATA_HOME=`cd "$PRGDIR/.." ; pwd`
-
-AIRAVATA_CLASSPATH=""
-
-for f in "$AIRAVATA_HOME"/lib/*.jar
-do
- AIRAVATA_CLASSPATH="$AIRAVATA_CLASSPATH":$f
-done
-
-export AIRAVATA_HOME
-export AIRAVATA_CLASSPATH
\ No newline at end of file
diff --git a/allocations/access-ci-service/src/main/resources/distribution/conf/application.yml b/allocations/access-ci-service/src/main/resources/distribution/conf/application.yml
deleted file mode 100644
index fbd9d6ca4..000000000
--- a/allocations/access-ci-service/src/main/resources/distribution/conf/application.yml
+++ /dev/null
@@ -1,77 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-server:
- port: 8083
-
-spring:
- profiles:
- active: prod
- application:
- name: access-ci-service
- datasource:
- url: "jdbc:mariadb://localhost:3306/access_ci"
- username: admin
- password: admin
- driver-class-name: org.mariadb.jdbc.Driver
- jpa:
- hibernate:
- ddl-auto: validate
- properties:
- hibernate.jdbc.time_zone: UTC
- hibernate.type.preferred_enum_jdbc_type: VARCHAR
- show-sql: false
- database-platform: org.hibernate.dialect.MariaDBDialect
- flyway:
- enabled: true
- locations: classpath:db/migration
-
-access:
- amie:
- base-url: https://a3mdev.xsede.org/amie-api-test
- site-code: ${AMIE_SITE_CODE}
- api-key: ${AMIE_API_KEY}
- scheduler:
- poll-delay: 30s
- worker-delay: 5s
- client:
- connect-timeout: 5s
- read-timeout: 20s
-
-logging:
- pattern:
- level: '%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]'
- level:
- root: info
-
-management:
- endpoints:
- web:
- exposure:
- include: health, prometheus, info
- endpoint:
- health:
- show-details: when-authorized
- prometheus:
- metrics:
- export:
- enabled: true
-
-springdoc:
- swagger-ui:
- title: CUSTOS ACCESS CI SERVICE API
- oauth:
- use-pkce-with-authorization-code-grant: true
\ No newline at end of file
diff --git a/allocations/access-ci-service/src/main/resources/distribution/conf/logback-spring.xml b/allocations/access-ci-service/src/main/resources/distribution/conf/logback-spring.xml
deleted file mode 100644
index 42794e77f..000000000
--- a/allocations/access-ci-service/src/main/resources/distribution/conf/logback-spring.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<configuration>
- <include resource="org/springframework/boot/logging/logback/base.xml"/>
- <springProperty scope="context" name="appName" source="spring.application.name"/>
-
- <!-- ================================================================ -->
- <!-- DEV / DEFAULT PROFILE — human-readable text format with MDC -->
- <!-- ================================================================ -->
- <springProfile name="default,dev">
-
- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>logs/custos-amie-decoder.log</file>
- <encoder>
- <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} app=${appName}, host=${HOSTNAME}, traceId=%X{traceId:-}, packetId=%X{packetId:-}, amieId=%X{amieId:-}, packetType=%X{packetType:-}, handler=%X{handler:-}, level=%-5level, [%thread] %logger{36} - %msg%n</pattern>
- </encoder>
- <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
- <fileNamePattern>logs/%d{yyyy-MM}/custos-amie-decoder-%d{MM-dd-yyyy}-%i.log.gz</fileNamePattern>
- <maxFileSize>10MB</maxFileSize>
- <maxHistory>30</maxHistory>
- <totalSizeCap>1GB</totalSizeCap>
- </rollingPolicy>
- </appender>
-
- <appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="FILE"/>
- <queueSize>500</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <includeCallerData>true</includeCallerData>
- </appender>
-
- <logger name="org.hibernate" level="ERROR"/>
- <logger name="org.springframework" level="INFO"/>
-
- <root level="INFO">
- <appender-ref ref="ASYNC_FILE"/>
- </root>
-
- </springProfile>
-
- <!-- ================================================================ -->
- <!-- PROD PROFILE — structured JSON format for log aggregation -->
- <!-- ================================================================ -->
- <springProfile name="prod">
-
- <appender name="FILE_JSON" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>logs/custos-amie-decoder.log</file>
- <encoder class="net.logstash.logback.encoder.LogstashEncoder">
- <includeMdcKeyName>packetId</includeMdcKeyName>
- <includeMdcKeyName>amieId</includeMdcKeyName>
- <includeMdcKeyName>packetType</includeMdcKeyName>
- <includeMdcKeyName>handler</includeMdcKeyName>
- <includeMdcKeyName>traceId</includeMdcKeyName>
- </encoder>
- <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
- <fileNamePattern>logs/%d{yyyy-MM}/custos-amie-decoder-%d{MM-dd-yyyy}-%i.log.gz</fileNamePattern>
- <maxFileSize>10MB</maxFileSize>
- <maxHistory>30</maxHistory>
- <totalSizeCap>1GB</totalSizeCap>
- </rollingPolicy>
- </appender>
-
- <appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="FILE_JSON"/>
- <queueSize>500</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <includeCallerData>true</includeCallerData>
- </appender>
-
- <logger name="org.hibernate" level="ERROR"/>
- <logger name="org.springframework" level="INFO"/>
-
- <root level="INFO">
- <appender-ref ref="ASYNC_FILE"/>
- </root>
-
- </springProfile>
-
-</configuration>
diff --git a/allocations/access-ci-service/src/main/resources/logback-spring.xml b/allocations/access-ci-service/src/main/resources/logback-spring.xml
deleted file mode 100644
index 42794e77f..000000000
--- a/allocations/access-ci-service/src/main/resources/logback-spring.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<configuration>
- <include resource="org/springframework/boot/logging/logback/base.xml"/>
- <springProperty scope="context" name="appName" source="spring.application.name"/>
-
- <!-- ================================================================ -->
- <!-- DEV / DEFAULT PROFILE — human-readable text format with MDC -->
- <!-- ================================================================ -->
- <springProfile name="default,dev">
-
- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>logs/custos-amie-decoder.log</file>
- <encoder>
- <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} app=${appName}, host=${HOSTNAME}, traceId=%X{traceId:-}, packetId=%X{packetId:-}, amieId=%X{amieId:-}, packetType=%X{packetType:-}, handler=%X{handler:-}, level=%-5level, [%thread] %logger{36} - %msg%n</pattern>
- </encoder>
- <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
- <fileNamePattern>logs/%d{yyyy-MM}/custos-amie-decoder-%d{MM-dd-yyyy}-%i.log.gz</fileNamePattern>
- <maxFileSize>10MB</maxFileSize>
- <maxHistory>30</maxHistory>
- <totalSizeCap>1GB</totalSizeCap>
- </rollingPolicy>
- </appender>
-
- <appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="FILE"/>
- <queueSize>500</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <includeCallerData>true</includeCallerData>
- </appender>
-
- <logger name="org.hibernate" level="ERROR"/>
- <logger name="org.springframework" level="INFO"/>
-
- <root level="INFO">
- <appender-ref ref="ASYNC_FILE"/>
- </root>
-
- </springProfile>
-
- <!-- ================================================================ -->
- <!-- PROD PROFILE — structured JSON format for log aggregation -->
- <!-- ================================================================ -->
- <springProfile name="prod">
-
- <appender name="FILE_JSON" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>logs/custos-amie-decoder.log</file>
- <encoder class="net.logstash.logback.encoder.LogstashEncoder">
- <includeMdcKeyName>packetId</includeMdcKeyName>
- <includeMdcKeyName>amieId</includeMdcKeyName>
- <includeMdcKeyName>packetType</includeMdcKeyName>
- <includeMdcKeyName>handler</includeMdcKeyName>
- <includeMdcKeyName>traceId</includeMdcKeyName>
- </encoder>
- <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
- <fileNamePattern>logs/%d{yyyy-MM}/custos-amie-decoder-%d{MM-dd-yyyy}-%i.log.gz</fileNamePattern>
- <maxFileSize>10MB</maxFileSize>
- <maxHistory>30</maxHistory>
- <totalSizeCap>1GB</totalSizeCap>
- </rollingPolicy>
- </appender>
-
- <appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="FILE_JSON"/>
- <queueSize>500</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <includeCallerData>true</includeCallerData>
- </appender>
-
- <logger name="org.hibernate" level="ERROR"/>
- <logger name="org.springframework" level="INFO"/>
-
- <root level="INFO">
- <appender-ref ref="ASYNC_FILE"/>
- </root>
-
- </springProfile>
-
-</configuration>
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/DataAccountCreateHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/DataAccountCreateHandlerTest.java
deleted file mode 100644
index 190bbd7f2..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/DataAccountCreateHandlerTest.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class DataAccountCreateHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private PersonService personService;
-
- @Mock
- private AuditService auditService;
-
- private DataAccountCreateHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new DataAccountCreateHandler(amieClient, personService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("data_account_create");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("data_account_create", "incoming-data.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("data_account_create", "outgoing-inform.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497918L);
- packetEntity.setType("data_account_create");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497918L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("inform_transaction_complete");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("StatusCode");
- assertThat(sentBody).containsKey("DetailCode");
- assertThat(sentBody).containsKey("Message");
-
- assertThat(sentBody.get("StatusCode")).isEqualTo(expectedBody.path("StatusCode").asText());
- assertThat(sentBody.get("DetailCode")).isEqualTo(expectedBody.path("DetailCode").asInt());
- assertThat(sentBody.get("Message")).isEqualTo(expectedBody.path("Message").asText());
- }
-
- @Test
- void handle_withMissingProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("ProjectID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' must not be empty");
- }
-
- @Test
- void handle_withMissingPersonId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("PersonID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'PersonID' must not be empty");
- }
-
- @Test
- void handle_withEmptyDnList_shouldNotCallPersonServiceAndSendReply() {
- JsonNode packetJson = createValidPacketJson();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- verify(personService, never()).persistDnsForPerson(any(), any());
- //noinspection unchecked
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- @Test
- void handle_withNonEmptyDnList_shouldPersistDnsAndSendReply() {
- JsonNode packetJson = createPacketJsonWithDnList();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- // Verify personService.persistDnsForPerson was called with the correct personId
- ArgumentCaptor<String> personIdCaptor = ArgumentCaptor.forClass(String.class);
- ArgumentCaptor<JsonNode> dnListCaptor = ArgumentCaptor.forClass(JsonNode.class);
- verify(personService).persistDnsForPerson(personIdCaptor.capture(), dnListCaptor.capture());
-
- assertThat(personIdCaptor.getValue()).isEqualTo("person-123");
- assertThat(dnListCaptor.getValue().isArray()).isTrue();
- assertThat(dnListCaptor.getValue().size()).isEqualTo(2);
-
- //noinspection unchecked
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- @Test
- void handle_withValidPacketContainingDnList_shouldPersistAllDns() {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("data_account_create", "incoming-data.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497918L);
- packetEntity.setType("data_account_create");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- ArgumentCaptor<JsonNode> dnListCaptor = ArgumentCaptor.forClass(JsonNode.class);
- verify(personService).persistDnsForPerson(eq("test-user-person-123"), dnListCaptor.capture());
- assertThat(dnListCaptor.getValue().size()).isEqualTo(3);
- }
-
- private JsonNode createValidPacketJson() {
- return objectMapper.createObjectNode()
- .set("body", objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123")
- .set("DnList", objectMapper.createArrayNode()));
- }
-
- private JsonNode createPacketJsonWithMissingField(String missingField) {
- JsonNode body = objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123")
- .set("DnList", objectMapper.createArrayNode());
-
- if (body.has(missingField)) {
- ((ObjectNode) body).remove(missingField);
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithDnList() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123")
- .set("DnList", objectMapper.createArrayNode().add("CN=John Doe,OU=Users,DC=test,DC=edu").add("CN=John Doe,OU=Staff,DC=test,DC=edu")));
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("data_account_create");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/DataProjectCreateHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/DataProjectCreateHandlerTest.java
deleted file mode 100644
index 0bf7191c5..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/DataProjectCreateHandlerTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class DataProjectCreateHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private PersonService personService;
-
- @Mock
- private AuditService auditService;
-
- private DataProjectCreateHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new DataProjectCreateHandler(amieClient, personService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("data_project_create");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("data_project_create", "incoming-data.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("data_project_create", "outgoing-inform.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497909L);
- packetEntity.setType("data_project_create");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497909L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("inform_transaction_complete");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("StatusCode");
- assertThat(sentBody).containsKey("DetailCode");
- assertThat(sentBody).containsKey("Message");
-
- assertThat(sentBody.get("StatusCode")).isEqualTo(expectedBody.path("StatusCode").asText());
- assertThat(sentBody.get("DetailCode")).isEqualTo(expectedBody.path("DetailCode").asInt());
- assertThat(sentBody.get("Message")).isEqualTo(expectedBody.path("Message").asText());
- }
-
- @Test
- void handle_withMissingProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("ProjectID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' must not be empty");
- }
-
- @Test
- void handle_withMissingPersonId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("PersonID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'PersonID' must not be empty");
- }
-
- @Test
- void handle_withEmptyDnList_shouldNotCallPersonServiceAndSendReply() {
- JsonNode packetJson = createValidPacketJson();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- verify(personService, never()).persistDnsForPerson(any(), any());
- //noinspection unchecked
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- @Test
- void handle_withNonEmptyDnList_shouldPersistDnsAndSendReply() {
- JsonNode packetJson = createPacketJsonWithDnList();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- ArgumentCaptor<String> personIdCaptor = ArgumentCaptor.forClass(String.class);
- ArgumentCaptor<JsonNode> dnListCaptor = ArgumentCaptor.forClass(JsonNode.class);
- verify(personService).persistDnsForPerson(personIdCaptor.capture(), dnListCaptor.capture());
-
- assertThat(personIdCaptor.getValue()).isEqualTo("person-123");
- assertThat(dnListCaptor.getValue().isArray()).isTrue();
- assertThat(dnListCaptor.getValue().size()).isEqualTo(2);
-
- //noinspection unchecked
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- @Test
- void handle_withValidPacketContainingDnList_shouldPersistAllDns() {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("data_project_create", "incoming-data.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497909L);
- packetEntity.setType("data_project_create");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- ArgumentCaptor<JsonNode> dnListCaptor = ArgumentCaptor.forClass(JsonNode.class);
- verify(personService).persistDnsForPerson(eq("test-person-456"), dnListCaptor.capture());
- assertThat(dnListCaptor.getValue().size()).isEqualTo(3);
- }
-
- private JsonNode createValidPacketJson() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123")
- .set("DnList", objectMapper.createArrayNode()));
- }
-
- private JsonNode createPacketJsonWithMissingField(String missingField) {
- JsonNode body = objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123")
- .set("DnList", objectMapper.createArrayNode());
-
- if (body.has(missingField)) {
- ((ObjectNode) body).remove(missingField);
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithDnList() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123")
- .set("DnList", objectMapper.createArrayNode().add("CN=John Doe,OU=Users,DC=test,DC=edu").add("CN=John Doe,OU=Staff,DC=test,DC=edu")));
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("data_project_create");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/InformTransactionCompleteHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/InformTransactionCompleteHandlerTest.java
deleted file mode 100644
index e34622045..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/InformTransactionCompleteHandlerTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class InformTransactionCompleteHandlerTest {
-
- @Mock
- private AuditService auditService;
-
- private InformTransactionCompleteHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new InformTransactionCompleteHandler(auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("inform_transaction_complete");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("inform_transaction_complete", "incoming-inform.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497913L);
- packetEntity.setType("inform_transaction_complete");
-
- handler.handle(incomingPacket, packetEntity, null);
- }
-
- @Test
- void handle_withMinimalPacket_shouldProcessSuccessfully() {
- JsonNode packetJson = createMinimalPacketJson();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
- }
-
- @Test
- void handle_withNullPacketJson_shouldThrowException() {
- PacketEntity packetEntity = createPacketEntity();
-
- //noinspection DataFlowIssue
- assertThatThrownBy(() -> handler.handle(null, packetEntity, null)).isInstanceOf(NullPointerException.class);
- }
-
- @Test
- void handle_withNullPacketEntity_shouldThrowException() {
- JsonNode packetJson = createValidPacketJson();
-
- //noinspection DataFlowIssue
- assertThatThrownBy(() -> handler.handle(packetJson, null, null)).isInstanceOf(NullPointerException.class);
- }
-
- private JsonNode createValidPacketJson() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode()
- .put("StatusCode", "Success")
- .put("DetailCode", 1)
- .put("Message", "Transaction completed successfully"));
- }
-
- private JsonNode createMinimalPacketJson() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode());
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("inform_transaction_complete");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/NoOpHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/NoOpHandlerTest.java
deleted file mode 100644
index ec8739346..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/NoOpHandlerTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class NoOpHandlerTest {
-
- private NoOpHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new NoOpHandler();
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnWildcard() {
- assertThat(handler.supportsType()).isEqualTo("*");
- }
-
- @Test
- void handle_shouldNotThrowException() {
- JsonNode packetJson = objectMapper.createObjectNode();
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(12345L);
- packetEntity.setType("unknown_type");
-
- handler.handle(packetJson, packetEntity, null);
- }
-
- @Test
- void handle_withNullPacketJson_shouldNotThrowException() {
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(12345L);
- packetEntity.setType("unknown_type");
-
- handler.handle(null, packetEntity, null);
- }
-
- @Test
- void handle_withNullPacketEntity_shouldNotThrowException() {
- JsonNode packetJson = objectMapper.createObjectNode();
-
- //noinspection DataFlowIssue
- assertThatThrownBy(() -> handler.handle(packetJson, null, null)).isInstanceOf(NullPointerException.class);
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/PacketRouterTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/PacketRouterTest.java
deleted file mode 100644
index b94800ebb..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/PacketRouterTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.List;
-
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.lenient;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class PacketRouterTest {
-
- @Mock
- private PacketHandler mockHandler1;
-
- @Mock
- private PacketHandler mockHandler2;
-
- private PacketRouter router;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- lenient().when(mockHandler1.supportsType()).thenReturn("request_project_create");
- lenient().when(mockHandler2.supportsType()).thenReturn("request_account_create");
-
- router = new PacketRouter(List.of(mockHandler1, mockHandler2));
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void route_withMatchingHandler_shouldCallCorrectHandler() throws Exception {
- JsonNode packetJson = objectMapper.createObjectNode();
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setType("request_project_create");
-
- router.route(packetJson, packetEntity, null);
-
- verify(mockHandler1).handle(packetJson, packetEntity, null);
- verify(mockHandler2, never()).handle(any(), any(), any());
- }
-
- @Test
- void route_withDifferentMatchingHandler_shouldCallCorrectHandler() throws Exception {
- JsonNode packetJson = objectMapper.createObjectNode();
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setType("request_account_create");
-
- router.route(packetJson, packetEntity, null);
-
- verify(mockHandler2).handle(packetJson, packetEntity, null);
- verify(mockHandler1, never()).handle(any(), any(), any());
- }
-
- @Test
- void route_withNoMatchingHandler_shouldCallDefaultHandler() throws Exception {
- JsonNode packetJson = objectMapper.createObjectNode();
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setType("unknown_packet_type");
-
- router.route(packetJson, packetEntity, null);
-
- verify(mockHandler1, never()).handle(any(), any(), any());
- verify(mockHandler2, never()).handle(any(), any(), any());
- }
-
- @Test
- void route_withCaseInsensitiveMatching_shouldCallCorrectHandler() throws Exception {
-
- JsonNode packetJson = objectMapper.createObjectNode();
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setType("REQUEST_PROJECT_CREATE");
-
- router.route(packetJson, packetEntity, null);
-
- verify(mockHandler1).handle(packetJson, packetEntity, null);
- verify(mockHandler2, never()).handle(any(), any(), any());
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountCreateHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountCreateHandlerTest.java
deleted file mode 100644
index 17340443e..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountCreateHandlerTest.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.ClusterAccountEntity;
-import org.apache.custos.access.ci.service.model.PersonEntity;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.service.ProjectService;
-import org.apache.custos.access.ci.service.service.UserAccountService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class RequestAccountCreateHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private PersonService personService;
-
- @Mock
- private UserAccountService userAccountService;
-
- @Mock
- private ProjectService projectService;
-
- @Mock
- private ProjectMembershipService membershipService;
-
- @Mock
- private AuditService auditService;
-
- private RequestAccountCreateHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new RequestAccountCreateHandler(amieClient, personService, userAccountService, projectService, membershipService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("request_account_create");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() throws Exception {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("request_account_create", "incoming-request.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("request_account_create", "outgoing-notify.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497917L);
- packetEntity.setType("request_account_create");
-
- PersonEntity personEntity = createPersonEntityFromRealData();
-
- when(personService.findOrCreatePersonFromPacket(any(JsonNode.class))).thenReturn(personEntity);
- when(userAccountService.provisionClusterAccount(personEntity)).thenReturn(createClusterAccount());
-
- handler.handle(incomingPacket, packetEntity, null);
-
- verify(personService).findOrCreatePersonFromPacket(any(JsonNode.class));
- verify(userAccountService).provisionClusterAccount(personEntity);
- verify(projectService).createOrFindProject("test-project-456", "TEST123");
- verify(membershipService).createMembership("test-project-456", "account-123", "USER");
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497917L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("notify_account_create");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("ProjectID");
- assertThat(sentBody).containsKey("GrantNumber");
- assertThat(sentBody).containsKey("UserPersonID");
- assertThat(sentBody).containsKey("UserRemoteSiteLogin");
- assertThat(sentBody).containsKey("UserOrgCode");
- assertThat(sentBody).containsKey("ResourceList");
-
- assertThat(sentBody.get("ProjectID")).isEqualTo(expectedBody.path("ProjectID").asText());
- assertThat(sentBody.get("GrantNumber")).isEqualTo(expectedBody.path("GrantNumber").asText());
- assertThat(sentBody.get("UserPersonID")).isEqualTo(expectedBody.path("UserPersonID").asText());
- }
-
- @Test
- void handle_withMissingProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("ProjectID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' (the local project ID) must not be empty");
- }
-
- @Test
- void handle_withMissingGrantNumber_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("GrantNumber");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'GrantNumber' must not be empty");
- }
-
- @Test
- void handle_withMissingUserGlobalId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("UserGlobalID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'UserGlobalID' must not be empty");
- }
-
- private JsonNode createPacketJsonWithMissingField(String missingField) {
- JsonNode body = objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("GrantNumber", "TEST123")
- .put("UserGlobalID", "USER123456")
- .put("UserFirstName", "John")
- .put("UserLastName", "Doe")
- .put("UserEmail", "john.doe@example.com")
- .put("UserOrganization", "Test University")
- .put("UserOrgCode", "TU")
- .put("NsfStatusCode", "ACTIVE")
- .put("ResourceList", "[]")
- .set("UserDnList", objectMapper.createArrayNode());
-
- if (body.has(missingField)) {
- ((com.fasterxml.jackson.databind.node.ObjectNode) body).remove(missingField);
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("request_account_create");
- return entity;
- }
-
- private PersonEntity createPersonEntityFromRealData() {
- PersonEntity entity = new PersonEntity();
- entity.setId("person-123");
- entity.setAccessGlobalId("12345");
- entity.setFirstName("Test");
- entity.setLastName("User");
- entity.setEmail("testuser@example.com");
- return entity;
- }
-
- private ClusterAccountEntity createClusterAccount() {
- ClusterAccountEntity entity = new ClusterAccountEntity();
- entity.setId("account-123");
- entity.setUsername("testuser");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountInactivateHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountInactivateHandlerTest.java
deleted file mode 100644
index b79d01b76..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountInactivateHandlerTest.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class RequestAccountInactivateHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private ProjectMembershipService membershipService;
-
- @Mock
- private AuditService auditService;
-
- private RequestAccountInactivateHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new RequestAccountInactivateHandler(amieClient, membershipService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("request_account_inactivate");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("request_account_inactivate", "incoming-request.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("request_account_inactivate", "outgoing-notify.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497919L);
- packetEntity.setType("request_account_inactivate");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- verify(membershipService).inactivateMembershipsByPersonAndProject("test-project-456", "test-user-person-123");
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497919L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("notify_account_inactivate");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("ProjectID");
- assertThat(sentBody).containsKey("PersonID");
- assertThat(sentBody).containsKey("ResourceList");
-
- assertThat(sentBody.get("ProjectID")).isEqualTo(expectedBody.path("ProjectID").asText());
- assertThat(sentBody.get("PersonID")).isEqualTo(expectedBody.path("PersonID").asText());
- }
-
- @Test
- void handle_withMissingProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("ProjectID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' must not be empty");
- }
-
- @Test
- void handle_withMissingPersonId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("PersonID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'PersonID' must not be empty");
- }
-
- @Test
- void handle_withEmptyProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithEmptyField("ProjectID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' must not be empty");
- }
-
- @Test
- void handle_withEmptyPersonId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithEmptyField("PersonID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'PersonID' must not be empty");
- }
-
- @Test
- void handle_withResourceList_shouldProcessSuccessfully() {
- JsonNode packetJson = createPacketJsonWithResourceList();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- verify(membershipService).inactivateMembershipsByPersonAndProject("PRJ-TEST123", "person-123");
- //noinspection unchecked
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- private JsonNode createPacketJsonWithMissingField(String missingField) {
- ObjectNode body = objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123");
-
- // Remove the specified field
- if (body.has(missingField)) {
- body.remove(missingField);
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithEmptyField(String fieldName) {
- ObjectNode body = objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123");
-
- body.put(fieldName, "");
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithResourceList() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123")
- .set("ResourceList", objectMapper.createArrayNode().add("resource1").add("resource2")));
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("request_account_inactivate");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountReactivateHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountReactivateHandlerTest.java
deleted file mode 100644
index bc508bc23..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestAccountReactivateHandlerTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class RequestAccountReactivateHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private ProjectMembershipService membershipService;
-
- @Mock
- private AuditService auditService;
-
- private RequestAccountReactivateHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new RequestAccountReactivateHandler(amieClient, membershipService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("request_account_reactivate");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() throws Exception {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("request_account_reactivate", "incoming-request.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("request_account_reactivate", "outgoing-notify.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497923L);
- packetEntity.setType("request_account_reactivate");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- verify(membershipService).reactivateMembershipsByPersonAndProject("test-project-456", "test-user-person-123");
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497923L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("notify_account_reactivate");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("ProjectID");
- assertThat(sentBody).containsKey("PersonID");
- assertThat(sentBody).containsKey("ResourceList");
-
- assertThat(sentBody.get("ProjectID")).isEqualTo(expectedBody.path("ProjectID").asText());
- assertThat(sentBody.get("PersonID")).isEqualTo(expectedBody.path("PersonID").asText());
- }
-
- @Test
- void handle_withMissingProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("ProjectID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' must not be empty");
- }
-
- @Test
- void handle_withMissingPersonId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("PersonID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'PersonID' must not be empty");
- }
-
- @Test
- void handle_withEmptyResourceList_shouldProcessSuccessfully() {
- JsonNode packetJson = createValidPacketJson();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- verify(membershipService).reactivateMembershipsByPersonAndProject("test-project-456", "test-user-person-123");
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- @Test
- void handle_withNonEmptyResourceList_shouldProcessSuccessfully() {
- JsonNode packetJson = createPacketJsonWithResourceList();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- verify(membershipService).reactivateMembershipsByPersonAndProject("test-project-456", "test-user-person-123");
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- private JsonNode createValidPacketJson() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode()
- .put("ProjectID", "test-project-456")
- .put("PersonID", "test-user-person-123")
- .set("ResourceList", objectMapper.createArrayNode()));
- }
-
- private JsonNode createPacketJsonWithMissingField(String missingField) {
- ObjectNode body = objectMapper.createObjectNode()
- .put("ProjectID", "test-project-456")
- .put("PersonID", "test-user-person-123")
- .set("ResourceList", objectMapper.createArrayNode());
-
- if (body.has(missingField)) {
- body.remove(missingField);
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithResourceList() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode()
- .put("ProjectID", "test-project-456")
- .put("PersonID", "test-user-person-123")
- .set("ResourceList", objectMapper.createArrayNode().add("test-resource1.testsite.testorg").add("test-resource2.testsite.testorg")));
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("request_account_reactivate");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestPersonMergeHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestPersonMergeHandlerTest.java
deleted file mode 100644
index 532e3b690..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestPersonMergeHandlerTest.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class RequestPersonMergeHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private PersonService personService;
-
- @Mock
- private AuditService auditService;
-
- private RequestPersonMergeHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new RequestPersonMergeHandler(amieClient, personService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("request_person_merge");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("request_person_merge", "incoming-request.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("request_person_merge", "outgoing-inform.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497920L);
- packetEntity.setType("request_person_merge");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- verify(personService).mergePersons("test-person-primary-123", "test-person-secondary-456");
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497920L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("inform_transaction_complete");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("StatusCode");
- assertThat(sentBody).containsKey("DetailCode");
- assertThat(sentBody).containsKey("Message");
-
- assertThat(sentBody.get("StatusCode")).isEqualTo(expectedBody.path("StatusCode").asText());
- assertThat(sentBody.get("DetailCode")).isEqualTo(expectedBody.path("DetailCode").asInt());
- assertThat(sentBody.get("Message")).isEqualTo(expectedBody.path("Message").asText());
- }
-
- @Test
- void handle_withMissingKeepPersonId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("KeepPersonID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'KeepPersonID' (the surviving user's local ID) must not be empty");
- }
-
- @Test
- void handle_withMissingDeletePersonId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("DeletePersonID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'DeletePersonID' (the retiring user's local ID) must not be empty");
- }
-
- @Test
- void handle_withEmptyKeepPersonId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithEmptyField("KeepPersonID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'KeepPersonID' (the surviving user's local ID) must not be empty");
- }
-
- @Test
- void handle_withEmptyDeletePersonId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithEmptyField("DeletePersonID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'DeletePersonID' (the retiring user's local ID) must not be empty");
- }
-
- @Test
- void handle_withOptionalGlobalIds_shouldProcessSuccessfully() {
- JsonNode packetJson = createPacketJsonWithGlobalIds();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- verify(personService).mergePersons("person-surviving", "person-retiring");
- //noinspection unchecked
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- private JsonNode createPacketJsonWithMissingField(String missingField) {
- ObjectNode body = objectMapper.createObjectNode()
- .put("KeepPersonID", "person-surviving")
- .put("DeletePersonID", "person-retiring");
-
- if (body.has(missingField)) {
- body.remove(missingField);
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithEmptyField(String fieldName) {
- ObjectNode body = objectMapper.createObjectNode()
- .put("KeepPersonID", "person-surviving")
- .put("DeletePersonID", "person-retiring");
-
- body.put(fieldName, "");
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithGlobalIds() {
- return objectMapper.createObjectNode()
- .set("body", objectMapper.createObjectNode()
- .put("KeepPersonID", "person-surviving")
- .put("KeepGlobalID", "GLOBAL123")
- .put("DeletePersonID", "person-retiring")
- .put("DeleteGlobalID", "GLOBAL456"));
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("request_person_merge");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectCreateHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectCreateHandlerTest.java
deleted file mode 100644
index eb825e236..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectCreateHandlerTest.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.ClusterAccountEntity;
-import org.apache.custos.access.ci.service.model.PersonEntity;
-import org.apache.custos.access.ci.service.model.ProjectEntity;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.service.ProjectService;
-import org.apache.custos.access.ci.service.service.UserAccountService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class RequestProjectCreateHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private PersonService personService;
-
- @Mock
- private UserAccountService userAccountService;
-
- @Mock
- private ProjectService projectService;
-
- @Mock
- private ProjectMembershipService membershipService;
-
- @Mock
- private AuditService auditService;
-
- private RequestProjectCreateHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new RequestProjectCreateHandler(amieClient, personService, userAccountService, projectService, membershipService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("request_project_create");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() throws Exception {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("request_project_create", "incoming-request.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("request_project_create", "outgoing-notify.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497907L);
- packetEntity.setType("request_project_create");
-
- PersonEntity personEntity = createPersonEntityFromRealData();
- ProjectEntity projectEntity = createProjectEntityFromRealData();
-
- when(personService.findOrCreatePersonFromPacket(any(JsonNode.class))).thenReturn(personEntity);
- when(userAccountService.provisionClusterAccount(personEntity)).thenReturn(createClusterAccount());
- when(projectService.createOrFindProject(anyString(), anyString())).thenReturn(projectEntity);
-
- handler.handle(incomingPacket, packetEntity, null);
- verify(personService).findOrCreatePersonFromPacket(any(JsonNode.class));
- verify(userAccountService).provisionClusterAccount(personEntity);
- verify(projectService).createOrFindProject(anyString(), anyString());
- verify(membershipService).createMembership(anyString(), anyString(), eq("PI"));
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497907L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("notify_project_create");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("ProjectID");
- assertThat(sentBody).containsKey("GrantNumber");
- assertThat(sentBody).containsKey("PiPersonID");
- assertThat(sentBody).containsKey("PiRemoteSiteLogin");
- assertThat(sentBody).containsKey("PiGlobalID");
- assertThat(sentBody).containsKey("ProjectTitle");
- assertThat(sentBody).containsKey("ResourceList");
-
- assertThat(sentBody.get("GrantNumber")).isEqualTo(expectedBody.path("GrantNumber").asText());
- assertThat(sentBody.get("PiGlobalID")).isEqualTo(expectedBody.path("PiGlobalID").asText());
- assertThat(sentBody.get("ProjectTitle")).isEqualTo(expectedBody.path("ProjectTitle").asText());
- }
-
- @Test
- void handle_withNullPacketJson_shouldThrowException() {
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(null, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessage("packetJson is null");
- }
-
- @Test
- void handle_withMissingBody_shouldThrowException() {
- JsonNode packetJson = objectMapper.createObjectNode();
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessage("packetJson.body is missing");
- }
-
- @Test
- void handle_withMissingGrantNumber_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("GrantNumber");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'GrantNumber' must not be empty");
- }
-
- @Test
- void handle_withMissingPiGlobalId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("PiGlobalID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'PiGlobalID' must not be empty");
- }
-
-
- private JsonNode createPacketJsonWithMissingField(String missingField) {
- ObjectNode body = objectMapper.createObjectNode()
- .put("GrantNumber", "TEST123")
- .put("PiGlobalID", "PI123456")
- .put("PiFirstName", "John")
- .put("PiLastName", "Doe")
- .put("PiEmail", "john.doe@example.com")
- .put("PiOrganization", "Test Org")
- .put("PiOrgCode", "TEST")
- .put("NsfStatusCode", "ACTIVE")
- .put("ProjectTitle", "Test Project")
- .put("ResourceList", "[]")
- .put("PiDnList", "[]");
-
- if (body.has(missingField)) {
- body.remove(missingField);
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("request_project_create");
- return entity;
- }
-
-
- private ClusterAccountEntity createClusterAccount() {
- ClusterAccountEntity entity = new ClusterAccountEntity();
- entity.setId("account-123");
- entity.setUsername("jdoe");
- return entity;
- }
-
- private PersonEntity createPersonEntityFromRealData() {
- PersonEntity entity = new PersonEntity();
- entity.setId("person-123");
- entity.setAccessGlobalId("54806");
- entity.setFirstName("Hui");
- entity.setLastName("Wan");
- entity.setEmail("hwan@uccs.edu");
- return entity;
- }
-
- private ProjectEntity createProjectEntityFromRealData() {
- ProjectEntity entity = new ProjectEntity();
- entity.setId("project-123");
- entity.setGrantNumber("NNT259276");
- entity.setActive(true);
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectInactivateHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectInactivateHandlerTest.java
deleted file mode 100644
index 4d1d84303..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectInactivateHandlerTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.service.ProjectService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class RequestProjectInactivateHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private ProjectService projectService;
-
- @Mock
- private ProjectMembershipService membershipService;
-
- @Mock
- private AuditService auditService;
-
- private RequestProjectInactivateHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new RequestProjectInactivateHandler(amieClient, projectService, membershipService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("request_project_inactivate");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("request_project_inactivate", "incoming-request.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("request_project_inactivate", "outgoing-notify.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497911L);
- packetEntity.setType("request_project_inactivate");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- verify(projectService).inactivateProject("test-project-123");
- verify(membershipService).inactivateAllMembershipsForProject("test-project-123");
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497911L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("notify_project_inactivate");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("ProjectID");
- assertThat(sentBody).containsKey("PersonID");
- assertThat(sentBody).containsKey("ResourceList");
-
- assertThat(sentBody.get("ProjectID")).isEqualTo(expectedBody.path("ProjectID").asText());
- assertThat(sentBody.get("PersonID")).isEqualTo(expectedBody.path("PersonID").asText());
- }
-
- @Test
- void handle_withMissingProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingProjectIdField();
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' must not be empty");
- }
-
- @Test
- void handle_withEmptyProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithEmptyField("ProjectID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' must not be empty");
- }
-
- @Test
- void handle_withOptionalFields_shouldProcessSuccessfully() {
- JsonNode packetJson = createPacketJsonWithOptionalFields();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- verify(projectService).inactivateProject("PRJ-TEST123");
- verify(membershipService).inactivateAllMembershipsForProject("PRJ-TEST123");
- //noinspection unchecked
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- private JsonNode createPacketJsonWithMissingProjectIdField() {
- ObjectNode body = objectMapper.createObjectNode().put("ProjectID", "PRJ-TEST123");
-
- if (body.has("ProjectID")) {
- body.remove("ProjectID");
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithEmptyField(String fieldName) {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode().put(fieldName, ""));
- }
-
- private JsonNode createPacketJsonWithOptionalFields() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123")
- .put("ResourceList", "[]"));
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("request_project_inactivate");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectReactivateHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectReactivateHandlerTest.java
deleted file mode 100644
index 48d9af5e8..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestProjectReactivateHandlerTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.ProjectMembershipService;
-import org.apache.custos.access.ci.service.service.ProjectService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class RequestProjectReactivateHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private ProjectService projectService;
-
- @Mock
- private ProjectMembershipService membershipService;
-
- @Mock
- private AuditService auditService;
-
- private RequestProjectReactivateHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new RequestProjectReactivateHandler(amieClient, projectService, membershipService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("request_project_reactivate");
- }
-
- @Test
- void handle_withValidPacket_shouldProcessSuccessfully() {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("request_project_reactivate", "incoming-request.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("request_project_reactivate", "outgoing-notify.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497914L);
- packetEntity.setType("request_project_reactivate");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- verify(projectService).reactivateProject("test-project-123");
- verify(membershipService).reactivatePiMembership("test-project-123");
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497914L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("notify_project_reactivate");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("ProjectID");
- assertThat(sentBody).containsKey("PersonID");
- assertThat(sentBody).containsKey("ResourceList");
-
- assertThat(sentBody.get("ProjectID")).isEqualTo(expectedBody.path("ProjectID").asText());
- assertThat(sentBody.get("PersonID")).isEqualTo(expectedBody.path("PersonID").asText());
- }
-
- @Test
- void handle_withMissingProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingProjectIdField();
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' must not be empty");
- }
-
- @Test
- void handle_withEmptyProjectId_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithEmptyField("ProjectID");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ProjectID' must not be empty");
- }
-
- @Test
- void handle_withOptionalFields_shouldProcessSuccessfully() {
- JsonNode packetJson = createPacketJsonWithOptionalFields();
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- verify(projectService).reactivateProject("PRJ-TEST123");
- verify(membershipService).reactivatePiMembership("PRJ-TEST123");
- //noinspection unchecked
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- private JsonNode createPacketJsonWithMissingProjectIdField() {
- ObjectNode body = objectMapper.createObjectNode().put("ProjectID", "PRJ-TEST123");
-
- if (body.has("ProjectID")) {
- body.remove("ProjectID");
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithEmptyField(String fieldName) {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode().put(fieldName, ""));
- }
-
- private JsonNode createPacketJsonWithOptionalFields() {
- return objectMapper.createObjectNode().set("body", objectMapper.createObjectNode()
- .put("ProjectID", "PRJ-TEST123")
- .put("PersonID", "person-123")
- .put("ResourceList", "[]"));
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("request_project_reactivate");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestUserModifyHandlerTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestUserModifyHandlerTest.java
deleted file mode 100644
index e998b2b3e..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/handler/amie/RequestUserModifyHandlerTest.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.handler.amie;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.custos.access.ci.service.client.amie.AmieClient;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.service.AuditService;
-import org.apache.custos.access.ci.service.service.PersonService;
-import org.apache.custos.access.ci.service.util.JsonTestUtils;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class RequestUserModifyHandlerTest {
-
- @Mock
- private AmieClient amieClient;
-
- @Mock
- private PersonService personService;
-
- @Mock
- private AuditService auditService;
-
- private RequestUserModifyHandler handler;
- private ObjectMapper objectMapper;
-
- @BeforeEach
- void setUp() {
- handler = new RequestUserModifyHandler(amieClient, personService, auditService);
- objectMapper = new ObjectMapper();
- }
-
- @Test
- void supportsType_shouldReturnCorrectType() {
- assertThat(handler.supportsType()).isEqualTo("request_user_modify");
- }
-
- @Test
- void handle_withReplaceAction_shouldProcessSuccessfully() throws Exception {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("request_user_modify_replace", "incoming-request.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("request_user_modify_replace", "outgoing-inform.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497921L);
- packetEntity.setType("request_user_modify");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- verify(personService).replaceFromModifyPacket(any(JsonNode.class));
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497921L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("inform_transaction_complete");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("StatusCode");
- assertThat(sentBody).containsKey("DetailCode");
- assertThat(sentBody).containsKey("Message");
-
- assertThat(sentBody.get("StatusCode")).isEqualTo(expectedBody.path("StatusCode").asText());
- assertThat(sentBody.get("DetailCode")).isEqualTo(expectedBody.path("DetailCode").asInt());
- assertThat(sentBody.get("Message")).isEqualTo(expectedBody.path("Message").asText());
- }
-
- @Test
- void handle_withDeleteAction_shouldProcessSuccessfully() throws Exception {
- JsonNode incomingPacket = JsonTestUtils.loadMockPacket("request_user_modify_delete", "incoming-request.json");
- JsonNode expectedReply = JsonTestUtils.loadMockPacket("request_user_modify_delete", "outgoing-inform.json");
-
- PacketEntity packetEntity = new PacketEntity();
- packetEntity.setAmieId(233497922L);
- packetEntity.setType("request_user_modify");
-
- handler.handle(incomingPacket, packetEntity, null);
-
- verify(personService).deleteFromModifyPacket(any(JsonNode.class));
-
- @SuppressWarnings("unchecked")
- ArgumentCaptor<Map<String, Object>> replyCaptor = ArgumentCaptor.forClass(Map.class);
- verify(amieClient).replyToPacket(eq(233497922L), replyCaptor.capture());
-
- Map<String, Object> sentReply = replyCaptor.getValue();
- assertThat(sentReply).containsKey("type");
- assertThat(sentReply.get("type")).isEqualTo("inform_transaction_complete");
- assertThat(sentReply).containsKey("body");
-
- @SuppressWarnings("unchecked")
- Map<String, Object> sentBody = (Map<String, Object>) sentReply.get("body");
- JsonNode expectedBody = expectedReply.path("body");
-
- assertThat(sentBody).containsKey("StatusCode");
- assertThat(sentBody).containsKey("DetailCode");
- assertThat(sentBody).containsKey("Message");
-
- assertThat(sentBody.get("StatusCode")).isEqualTo(expectedBody.path("StatusCode").asText());
- assertThat(sentBody.get("DetailCode")).isEqualTo(expectedBody.path("DetailCode").asInt());
- assertThat(sentBody.get("Message")).isEqualTo(expectedBody.path("Message").asText());
- }
-
- @Test
- void handle_withUpperCaseAction_shouldProcessSuccessfully() throws Exception {
- JsonNode packetJson = createValidPacketJson("REPLACE");
- PacketEntity packetEntity = createPacketEntity();
-
- handler.handle(packetJson, packetEntity, null);
-
- verify(personService).replaceFromModifyPacket(any(JsonNode.class));
- //noinspection unchecked
- verify(amieClient).replyToPacket(eq(12345L), any(Map.class));
- }
-
- @Test
- void handle_withMissingActionType_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithMissingField("ActionType");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ActionType' must not be empty (replace|delete)");
- }
-
- @Test
- void handle_withEmptyActionType_shouldThrowException() {
- JsonNode packetJson = createPacketJsonWithEmptyField("ActionType");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("'ActionType' must not be empty (replace|delete)");
- }
-
- @Test
- void handle_withUnsupportedActionType_shouldThrowException() {
- JsonNode packetJson = createValidPacketJson("unsupported");
- PacketEntity packetEntity = createPacketEntity();
-
- assertThatThrownBy(() -> handler.handle(packetJson, packetEntity, null))
- .isInstanceOf(IllegalArgumentException.class)
- .hasMessageContaining("Unsupported ActionType: unsupported");
- }
-
- private JsonNode createValidPacketJson(String actionType) {
- return objectMapper.createObjectNode()
- .set("body", objectMapper.createObjectNode()
- .put("ActionType", actionType)
- .put("UserGlobalID", "USER123456")
- .put("UserFirstName", "John")
- .put("UserLastName", "Doe")
- .put("UserEmail", "john.doe@example.com"));
- }
-
- private JsonNode createPacketJsonWithMissingField(String missingField) {
- ObjectNode body = objectMapper.createObjectNode()
- .put("ActionType", "replace")
- .put("UserGlobalID", "USER123456")
- .put("UserFirstName", "John")
- .put("UserLastName", "Doe")
- .put("UserEmail", "john.doe@example.com");
-
- if (body.has(missingField)) {
- body.remove(missingField);
- }
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private JsonNode createPacketJsonWithEmptyField(String fieldName) {
- ObjectNode body = objectMapper.createObjectNode()
- .put("ActionType", "replace")
- .put("UserGlobalID", "USER123456")
- .put("UserFirstName", "John")
- .put("UserLastName", "Doe")
- .put("UserEmail", "john.doe@example.com");
-
- body.put(fieldName, "");
-
- return objectMapper.createObjectNode().set("body", body);
- }
-
- private PacketEntity createPacketEntity() {
- PacketEntity entity = new PacketEntity();
- entity.setAmieId(12345L);
- entity.setType("request_user_modify");
- return entity;
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/metrics/AmieHealthIndicatorTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/metrics/AmieHealthIndicatorTest.java
deleted file mode 100644
index 2ec32e14c..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/metrics/AmieHealthIndicatorTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.metrics;
-
-import org.apache.custos.access.ci.service.config.AmieProperties;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.boot.actuate.health.Status;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.ResourceAccessException;
-import org.springframework.web.client.RestTemplate;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.when;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class AmieHealthIndicatorTest {
-
- private static final String BASE_URL = "https://a3mdev.xsede.org/amie-api-test";
- private static final String SITE_CODE = "NEXUS";
-
- @Mock
- private RestTemplate restTemplate;
-
- private AmieProperties amieProperties;
- private AmieHealthIndicator healthIndicator;
-
- @BeforeEach
- void setUp() {
- amieProperties = new AmieProperties();
- amieProperties.setBaseUrl(BASE_URL);
- amieProperties.setSiteCode(SITE_CODE);
- healthIndicator = new AmieHealthIndicator(amieProperties, restTemplate);
- }
-
- @Test
- void health_whenAmieApiReturns200_shouldBeUp() {
- when(restTemplate.getForEntity(BASE_URL, String.class))
- .thenReturn(ResponseEntity.ok("OK"));
-
- Health health = healthIndicator.health();
-
- assertThat(health.getStatus()).isEqualTo(Status.UP);
- assertThat(health.getDetails()).containsEntry("url", BASE_URL);
- assertThat(health.getDetails()).containsEntry("siteCode", SITE_CODE);
- assertThat(health.getDetails()).containsEntry("httpStatus", 200);
- }
-
- @Test
- void health_whenAmieApiReturns302_shouldBeUp() {
- when(restTemplate.getForEntity(BASE_URL, String.class))
- .thenReturn(ResponseEntity.status(HttpStatus.FOUND).build());
-
- Health health = healthIndicator.health();
-
- assertThat(health.getStatus()).isEqualTo(Status.UP);
- assertThat(health.getDetails()).containsEntry("httpStatus", 302);
- }
-
- @Test
- void health_whenAmieApiReturns500_shouldBeDown() {
- when(restTemplate.getForEntity(BASE_URL, String.class))
- .thenReturn(ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("error"));
-
- Health health = healthIndicator.health();
-
- assertThat(health.getStatus()).isEqualTo(Status.DOWN);
- assertThat(health.getDetails()).containsEntry("url", BASE_URL);
- assertThat(health.getDetails()).containsEntry("httpStatus", 500);
- }
-
- @Test
- void health_whenRestClientExceptionThrown_shouldBeDown() {
- when(restTemplate.getForEntity(BASE_URL, String.class))
- .thenThrow(new ResourceAccessException("Connection refused"));
-
- Health health = healthIndicator.health();
-
- assertThat(health.getStatus()).isEqualTo(Status.DOWN);
- assertThat(health.getDetails()).containsEntry("url", BASE_URL);
- assertThat(health.getDetails()).containsEntry("siteCode", SITE_CODE);
- }
-
- @Test
- void health_whenNetworkTimeout_shouldIncludeUrlInDownDetails() {
- when(restTemplate.getForEntity(BASE_URL, String.class))
- .thenThrow(new ResourceAccessException("Read timed out"));
-
- Health health = healthIndicator.health();
-
- assertThat(health.getStatus()).isEqualTo(Status.DOWN);
- assertThat(health.getDetails()).containsKey("url");
- assertThat(health.getDetails().get("url")).isEqualTo(BASE_URL);
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/metrics/AmieMetricsTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/metrics/AmieMetricsTest.java
deleted file mode 100644
index fe1e10721..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/metrics/AmieMetricsTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.metrics;
-
-import io.micrometer.core.instrument.Counter;
-import io.micrometer.core.instrument.Timer;
-import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-@Tag("unit")
-class AmieMetricsTest {
-
- private SimpleMeterRegistry registry;
- private AmieMetrics amieMetrics;
-
- @BeforeEach
- void setUp() {
- registry = new SimpleMeterRegistry();
- amieMetrics = new AmieMetrics(registry);
- }
-
- @Test
- void recordPacketReceived_shouldIncrementCounterWithTypeTag() {
- amieMetrics.recordPacketReceived("request_project_create");
- amieMetrics.recordPacketReceived("request_project_create");
- amieMetrics.recordPacketReceived("request_user_modify");
-
- Counter createCounter = registry.find("amie_packets_received_total")
- .tag("type", "request_project_create")
- .counter();
- Counter modifyCounter = registry.find("amie_packets_received_total")
- .tag("type", "request_user_modify")
- .counter();
-
- assertThat(createCounter).isNotNull();
- assertThat(createCounter.count()).isEqualTo(2.0);
- assertThat(modifyCounter).isNotNull();
- assertThat(modifyCounter.count()).isEqualTo(1.0);
- }
-
- @Test
- void recordPacketProcessed_shouldIncrementCounterWithTypeAndOutcomeTags() {
- amieMetrics.recordPacketProcessed("request_project_create", "success");
- amieMetrics.recordPacketProcessed("request_project_create", "failure");
- amieMetrics.recordPacketProcessed("request_project_create", "success");
-
- Counter successCounter = registry.find("amie_packets_processed_total")
- .tag("type", "request_project_create")
- .tag("outcome", "success")
- .counter();
- Counter failureCounter = registry.find("amie_packets_processed_total")
- .tag("type", "request_project_create")
- .tag("outcome", "failure")
- .counter();
-
- assertThat(successCounter).isNotNull();
- assertThat(successCounter.count()).isEqualTo(2.0);
- assertThat(failureCounter).isNotNull();
- assertThat(failureCounter.count()).isEqualTo(1.0);
- }
-
- @Test
- void recordRetry_shouldIncrementRetryCounter() {
- amieMetrics.recordRetry();
- amieMetrics.recordRetry();
- amieMetrics.recordRetry();
-
- Counter retryCounter = registry.find("amie_events_retry_total").counter();
-
- assertThat(retryCounter).isNotNull();
- assertThat(retryCounter.count()).isEqualTo(3.0);
- }
-
- @Test
- void startAndStopProcessingTimer_shouldRecordDurationWithHandlerTag() throws InterruptedException {
- Timer.Sample sample = amieMetrics.startProcessingTimer();
- Thread.sleep(5);
- amieMetrics.stopProcessingTimer(sample, "RequestProjectCreateHandler");
-
- Timer timer = registry.find("amie_packet_processing_duration_seconds")
- .tag("handler", "RequestProjectCreateHandler")
- .timer();
-
- assertThat(timer).isNotNull();
- assertThat(timer.count()).isEqualTo(1);
- assertThat(timer.totalTime(java.util.concurrent.TimeUnit.MILLISECONDS)).isGreaterThan(0);
- }
-
- @Test
- void recordPollerFetch_shouldIncrementByCount() {
- amieMetrics.recordPollerFetch(5);
- amieMetrics.recordPollerFetch(3);
-
- Counter fetchCounter = registry.find("amie_poller_packets_fetched").counter();
-
- assertThat(fetchCounter).isNotNull();
- assertThat(fetchCounter.count()).isEqualTo(8.0);
- }
-
- @Test
- void recordPollerFetch_withZeroCount_shouldNotChangeCounter() {
- amieMetrics.recordPollerFetch(0);
-
- Counter fetchCounter = registry.find("amie_poller_packets_fetched").counter();
-
- assertThat(fetchCounter).isNotNull();
- assertThat(fetchCounter.count()).isEqualTo(0.0);
- }
-}
diff --git a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/service/AuditServiceTest.java b/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/service/AuditServiceTest.java
deleted file mode 100644
index 0df55e7fa..000000000
--- a/allocations/access-ci-service/src/test/java/org/apache/custos/access/ci/service/service/AuditServiceTest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.custos.access.ci.service.service;
-
-import org.apache.custos.access.ci.service.model.amie.AuditAction;
-import org.apache.custos.access.ci.service.model.amie.AuditLogEntity;
-import org.apache.custos.access.ci.service.model.amie.PacketEntity;
-import org.apache.custos.access.ci.service.model.amie.ProcessingEventEntity;
-import org.apache.custos.access.ci.service.repo.amie.AuditLogRepository;
-import org.apache.custos.access.ci.service.repo.amie.PacketRepository;
-import org.apache.custos.access.ci.service.repo.amie.ProcessingEventRepository;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-@ExtendWith(MockitoExtension.class)
-@Tag("unit")
-class AuditServiceTest {
-
- @Mock
- private AuditLogRepository auditLogRepository;
-
- @Mock
- private PacketRepository packetRepository;
-
- @Mock
- private ProcessingEventRepository processingEventRepository;
-
- private AuditService auditService;
-
- @BeforeEach
- void setUp() {
- auditService = new AuditService(auditLogRepository, packetRepository, processingEventRepository);
- }
-
- @Test
- void log_withEventId_shouldCreateAuditEntryWithAllFields() {
- String packetId = "packet-001";
- String eventId = "event-abc";
- PacketEntity packetProxy = new PacketEntity();
- ProcessingEventEntity eventProxy = new ProcessingEventEntity();
-
- when(packetRepository.getReferenceById(packetId)).thenReturn(packetProxy);
- when(processingEventRepository.getReferenceById(eventId)).thenReturn(eventProxy);
- when(auditLogRepository.save(any(AuditLogEntity.class))).thenAnswer(inv -> inv.getArgument(0));
-
- auditService.log(packetId, eventId, AuditAction.CREATE_PERSON, "Person", "person-123", "Created person from packet");
-
- ArgumentCaptor<AuditLogEntity> captor = ArgumentCaptor.forClass(AuditLogEntity.class);
- verify(auditLogRepository).save(captor.capture());
-
- AuditLogEntity saved = captor.getValue();
- assertThat(saved.getPacket()).isSameAs(packetProxy);
- assertThat(saved.getEvent()).isSameAs(eventProxy);
... 168962 lines suppressed ...