@Test public void testSetLicenseShouldReturnACloudbreakLicense() throws IOException { Path licenseFilePath = Files.createTempFile("license", "txt"); Files.writeString(licenseFilePath, VALID_LICENSE); ReflectionTestUtils.setField(underTest, "cmLicenseFilePath", licenseFilePath.toString()); try { underTest.init(); String actual = ReflectionTestUtils.getField(underTest, "cbLicense").toString(); assertThat(actual).isEqualTo(VALID_LICENSE); } finally { Files.delete(licenseFilePath); } }
@PostConstruct public void init() { cbLicense = getLicense(); telemetyPublisherCredential = getAltusCredential(databusTpCredentialFile, databusTpCredentialProfile); fluentCredential = getAltusCredential(databusFluentCredentialFile, databusFluentCredentialProfile); eventGenerationIdsCache = CacheBuilder.newBuilder() .expireAfterWrite(eventGenerationExirationMinutes, TimeUnit.MINUTES) .build(new CacheLoader<>() { @Override public GetEventGenerationIdsResponse load(String key) { GetEventGenerationIdsResponse.Builder respBuilder = GetEventGenerationIdsResponse.newBuilder(); respBuilder.setLastRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastResourceRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastGroupMembershipChangedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorDeletedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorWorkloadCredentialsChangedEventId(UUID.randomUUID().toString()); return respBuilder.build(); } }); initializeActorWorkloadCredentials(); initializeWorkloadPasswordPolicy(); }
MockUserManagementService extends UserManagementImplBase { @PostConstruct public void init() { cbLicense = getLicense(); telemetyPublisherCredential = getAltusCredential(databusTpCredentialFile, databusTpCredentialProfile); fluentCredential = getAltusCredential(databusFluentCredentialFile, databusFluentCredentialProfile); eventGenerationIdsCache = CacheBuilder.newBuilder() .expireAfterWrite(eventGenerationExirationMinutes, TimeUnit.MINUTES) .build(new CacheLoader<>() { @Override public GetEventGenerationIdsResponse load(String key) { GetEventGenerationIdsResponse.Builder respBuilder = GetEventGenerationIdsResponse.newBuilder(); respBuilder.setLastRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastResourceRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastGroupMembershipChangedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorDeletedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorWorkloadCredentialsChangedEventId(UUID.randomUUID().toString()); return respBuilder.build(); } }); initializeActorWorkloadCredentials(); initializeWorkloadPasswordPolicy(); } }
MockUserManagementService extends UserManagementImplBase { @PostConstruct public void init() { cbLicense = getLicense(); telemetyPublisherCredential = getAltusCredential(databusTpCredentialFile, databusTpCredentialProfile); fluentCredential = getAltusCredential(databusFluentCredentialFile, databusFluentCredentialProfile); eventGenerationIdsCache = CacheBuilder.newBuilder() .expireAfterWrite(eventGenerationExirationMinutes, TimeUnit.MINUTES) .build(new CacheLoader<>() { @Override public GetEventGenerationIdsResponse load(String key) { GetEventGenerationIdsResponse.Builder respBuilder = GetEventGenerationIdsResponse.newBuilder(); respBuilder.setLastRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastResourceRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastGroupMembershipChangedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorDeletedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorWorkloadCredentialsChangedEventId(UUID.randomUUID().toString()); return respBuilder.build(); } }); initializeActorWorkloadCredentials(); initializeWorkloadPasswordPolicy(); }  }
MockUserManagementService extends UserManagementImplBase { @PostConstruct public void init() { cbLicense = getLicense(); telemetyPublisherCredential = getAltusCredential(databusTpCredentialFile, databusTpCredentialProfile); fluentCredential = getAltusCredential(databusFluentCredentialFile, databusFluentCredentialProfile); eventGenerationIdsCache = CacheBuilder.newBuilder() .expireAfterWrite(eventGenerationExirationMinutes, TimeUnit.MINUTES) .build(new CacheLoader<>() { @Override public GetEventGenerationIdsResponse load(String key) { GetEventGenerationIdsResponse.Builder respBuilder = GetEventGenerationIdsResponse.newBuilder(); respBuilder.setLastRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastResourceRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastGroupMembershipChangedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorDeletedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorWorkloadCredentialsChangedEventId(UUID.randomUUID().toString()); return respBuilder.build(); } }); initializeActorWorkloadCredentials(); initializeWorkloadPasswordPolicy(); }  @PostConstruct void init(); @Override void getUser(GetUserRequest request, StreamObserver<GetUserResponse> responseObserver); @Override void listUsers(ListUsersRequest request, StreamObserver<ListUsersResponse> responseObserver); @Override void getRights(GetRightsRequest request, StreamObserver<GetRightsResponse> responseObserver); @Override void listGroupsForMember(ListGroupsForMemberRequest request, StreamObserver<ListGroupsForMemberResponse> responseObserver); @Override void listWorkloadAdministrationGroups(ListWorkloadAdministrationGroupsRequest request,
            StreamObserver<ListWorkloadAdministrationGroupsResponse> responseObserver); @Override void listServicePrincipalCloudIdentities(ListServicePrincipalCloudIdentitiesRequest request,
        StreamObserver<ListServicePrincipalCloudIdentitiesResponse> responseObserver); @Override void listWorkloadAdministrationGroupsForMember(ListWorkloadAdministrationGroupsForMemberRequest request,
            StreamObserver<ListWorkloadAdministrationGroupsForMemberResponse> responseObserver); @Override void listGroups(ListGroupsRequest request, StreamObserver<ListGroupsResponse> responseObserver); @Override void listMachineUsers(ListMachineUsersRequest request, StreamObserver<ListMachineUsersResponse> responseObserver); @Override void getAccount(GetAccountRequest request, StreamObserver<GetAccountResponse> responseObserver); @Override void listTerms(ListTermsRequest request, StreamObserver<ListTermsResponse> responseObserver); @Override void verifyInteractiveUserSessionToken(VerifyInteractiveUserSessionTokenRequest request,
            StreamObserver<VerifyInteractiveUserSessionTokenResponse> responseObserver); @Override void authenticate(AuthenticateRequest request,
            StreamObserver<AuthenticateResponse> responseObserver); void assignResourceRole(AssignResourceRoleRequest request, StreamObserver<AssignResourceRoleResponse> responseObserver); @Override void unassignResourceRole(UnassignResourceRoleRequest request, StreamObserver<UnassignResourceRoleResponse> responseObserver); @Override void assignRole(AssignRoleRequest request, StreamObserver<AssignRoleResponse> responseObserver); @Override void unassignRole(UnassignRoleRequest request, StreamObserver<UnassignRoleResponse> responseObserver); @Override void getAssigneeAuthorizationInformation(GetAssigneeAuthorizationInformationRequest request,
            StreamObserver<GetAssigneeAuthorizationInformationResponse> responseObserver); @Override void listResourceAssignees(ListResourceAssigneesRequest request,
            StreamObserver<ListResourceAssigneesResponse> responseObserver); @Override void notifyResourceDeleted(NotifyResourceDeletedRequest request,
            StreamObserver<NotifyResourceDeletedResponse> responseObserver); @Override void createAccessKey(CreateAccessKeyRequest request,
            StreamObserver<CreateAccessKeyResponse> responseObserver); @Override void listAccessKeys(ListAccessKeysRequest request, StreamObserver<ListAccessKeysResponse> responseObserver); @Override void deleteAccessKey(DeleteAccessKeyRequest request,
            StreamObserver<DeleteAccessKeyResponse> responseObserver); @Override void createMachineUser(CreateMachineUserRequest request,
            StreamObserver<CreateMachineUserResponse> responseObserver); @Override void deleteMachineUser(DeleteMachineUserRequest request, StreamObserver<DeleteMachineUserResponse> responseObserver); @Override void getIdPMetadataForWorkloadSSO(
            GetIdPMetadataForWorkloadSSORequest request,
            StreamObserver<GetIdPMetadataForWorkloadSSOResponse> responseObserver); @Override void listRoles(ListRolesRequest request, StreamObserver<ListRolesResponse> responseObserver); @Override void getActorWorkloadCredentials(GetActorWorkloadCredentialsRequest request,
            io.grpc.stub.StreamObserver<GetActorWorkloadCredentialsResponse> responseObserver); @Override void getEventGenerationIds(GetEventGenerationIdsRequest request, StreamObserver<GetEventGenerationIdsResponse> responseObserver); @Override void getWorkloadAdministrationGroupName(GetWorkloadAdministrationGroupNameRequest request,
            StreamObserver<GetWorkloadAdministrationGroupNameResponse> responseObserver); @Override void setWorkloadAdministrationGroupName(SetWorkloadAdministrationGroupNameRequest request,
            StreamObserver<SetWorkloadAdministrationGroupNameResponse> responseObserver); @Override void deleteWorkloadAdministrationGroupName(DeleteWorkloadAdministrationGroupNameRequest request,
            StreamObserver<DeleteWorkloadAdministrationGroupNameResponse> responseObserver); }
MockUserManagementService extends UserManagementImplBase { @PostConstruct public void init() { cbLicense = getLicense(); telemetyPublisherCredential = getAltusCredential(databusTpCredentialFile, databusTpCredentialProfile); fluentCredential = getAltusCredential(databusFluentCredentialFile, databusFluentCredentialProfile); eventGenerationIdsCache = CacheBuilder.newBuilder() .expireAfterWrite(eventGenerationExirationMinutes, TimeUnit.MINUTES) .build(new CacheLoader<>() { @Override public GetEventGenerationIdsResponse load(String key) { GetEventGenerationIdsResponse.Builder respBuilder = GetEventGenerationIdsResponse.newBuilder(); respBuilder.setLastRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastResourceRoleAssignmentEventId(UUID.randomUUID().toString()); respBuilder.setLastGroupMembershipChangedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorDeletedEventId(UUID.randomUUID().toString()); respBuilder.setLastActorWorkloadCredentialsChangedEventId(UUID.randomUUID().toString()); return respBuilder.build(); } }); initializeActorWorkloadCredentials(); initializeWorkloadPasswordPolicy(); }  @PostConstruct void init(); @Override void getUser(GetUserRequest request, StreamObserver<GetUserResponse> responseObserver); @Override void listUsers(ListUsersRequest request, StreamObserver<ListUsersResponse> responseObserver); @Override void getRights(GetRightsRequest request, StreamObserver<GetRightsResponse> responseObserver); @Override void listGroupsForMember(ListGroupsForMemberRequest request, StreamObserver<ListGroupsForMemberResponse> responseObserver); @Override void listWorkloadAdministrationGroups(ListWorkloadAdministrationGroupsRequest request,
            StreamObserver<ListWorkloadAdministrationGroupsResponse> responseObserver); @Override void listServicePrincipalCloudIdentities(ListServicePrincipalCloudIdentitiesRequest request,
        StreamObserver<ListServicePrincipalCloudIdentitiesResponse> responseObserver); @Override void listWorkloadAdministrationGroupsForMember(ListWorkloadAdministrationGroupsForMemberRequest request,
            StreamObserver<ListWorkloadAdministrationGroupsForMemberResponse> responseObserver); @Override void listGroups(ListGroupsRequest request, StreamObserver<ListGroupsResponse> responseObserver); @Override void listMachineUsers(ListMachineUsersRequest request, StreamObserver<ListMachineUsersResponse> responseObserver); @Override void getAccount(GetAccountRequest request, StreamObserver<GetAccountResponse> responseObserver); @Override void listTerms(ListTermsRequest request, StreamObserver<ListTermsResponse> responseObserver); @Override void verifyInteractiveUserSessionToken(VerifyInteractiveUserSessionTokenRequest request,
            StreamObserver<VerifyInteractiveUserSessionTokenResponse> responseObserver); @Override void authenticate(AuthenticateRequest request,
            StreamObserver<AuthenticateResponse> responseObserver); void assignResourceRole(AssignResourceRoleRequest request, StreamObserver<AssignResourceRoleResponse> responseObserver); @Override void unassignResourceRole(UnassignResourceRoleRequest request, StreamObserver<UnassignResourceRoleResponse> responseObserver); @Override void assignRole(AssignRoleRequest request, StreamObserver<AssignRoleResponse> responseObserver); @Override void unassignRole(UnassignRoleRequest request, StreamObserver<UnassignRoleResponse> responseObserver); @Override void getAssigneeAuthorizationInformation(GetAssigneeAuthorizationInformationRequest request,
            StreamObserver<GetAssigneeAuthorizationInformationResponse> responseObserver); @Override void listResourceAssignees(ListResourceAssigneesRequest request,
            StreamObserver<ListResourceAssigneesResponse> responseObserver); @Override void notifyResourceDeleted(NotifyResourceDeletedRequest request,
            StreamObserver<NotifyResourceDeletedResponse> responseObserver); @Override void createAccessKey(CreateAccessKeyRequest request,
            StreamObserver<CreateAccessKeyResponse> responseObserver); @Override void listAccessKeys(ListAccessKeysRequest request, StreamObserver<ListAccessKeysResponse> responseObserver); @Override void deleteAccessKey(DeleteAccessKeyRequest request,
            StreamObserver<DeleteAccessKeyResponse> responseObserver); @Override void createMachineUser(CreateMachineUserRequest request,
            StreamObserver<CreateMachineUserResponse> responseObserver); @Override void deleteMachineUser(DeleteMachineUserRequest request, StreamObserver<DeleteMachineUserResponse> responseObserver); @Override void getIdPMetadataForWorkloadSSO(
            GetIdPMetadataForWorkloadSSORequest request,
            StreamObserver<GetIdPMetadataForWorkloadSSOResponse> responseObserver); @Override void listRoles(ListRolesRequest request, StreamObserver<ListRolesResponse> responseObserver); @Override void getActorWorkloadCredentials(GetActorWorkloadCredentialsRequest request,
            io.grpc.stub.StreamObserver<GetActorWorkloadCredentialsResponse> responseObserver); @Override void getEventGenerationIds(GetEventGenerationIdsRequest request, StreamObserver<GetEventGenerationIdsResponse> responseObserver); @Override void getWorkloadAdministrationGroupName(GetWorkloadAdministrationGroupNameRequest request,
            StreamObserver<GetWorkloadAdministrationGroupNameResponse> responseObserver); @Override void setWorkloadAdministrationGroupName(SetWorkloadAdministrationGroupNameRequest request,
            StreamObserver<SetWorkloadAdministrationGroupNameResponse> responseObserver); @Override void deleteWorkloadAdministrationGroupName(DeleteWorkloadAdministrationGroupNameRequest request,
            StreamObserver<DeleteWorkloadAdministrationGroupNameResponse> responseObserver); @Value("#{'${auth.config.dir:}/${auth.mock.sshpublickey.file:}'}")
    private String sshPublicKeyFilePath; }