@Test public void testGetActorWorkloadCredentialsResponseToWorkloadCredential() { String passwordHash = "password-hash"; List<UserManagementProto.ActorKerberosKey> kerberosKeys = List.of( UserManagementProto.ActorKerberosKey.newBuilder().build()); long passwordExpiration = System.currentTimeMillis(); List<UserManagementProto.SshPublicKey> sshPublicKeys = List.of( UserManagementProto.SshPublicKey.newBuilder().build()); Optional<Instant> expectedPasswordExpiration = Optional.of(Instant.ofEpochMilli(passwordExpiration)); UserManagementProto.GetActorWorkloadCredentialsResponse actorWorkloadCredentials = UserManagementProto.GetActorWorkloadCredentialsResponse.newBuilder() .setPasswordHash(passwordHash) .setPasswordHashExpirationDate(passwordExpiration) .addAllKerberosKeys(kerberosKeys) .addAllSshPublicKey(sshPublicKeys) .build(); WorkloadCredential workloadCredential = underTest.toWorkloadCredential(actorWorkloadCredentials); assertEquals(passwordHash, workloadCredential.getHashedPassword()); assertEquals(expectedPasswordExpiration, workloadCredential.getExpirationDate()); assertIterableEquals(kerberosKeys, workloadCredential.getKeys()); assertIterableEquals(sshPublicKeys, workloadCredential.getSshPublicKeys()); }
public WorkloadCredential toWorkloadCredential( UserManagementProto.ActorWorkloadCredentials actorWorkloadCredentials) { return new WorkloadCredential(actorWorkloadCredentials.getPasswordHash(), actorWorkloadCredentials.getKerberosKeysList(), toOptionalInstant(actorWorkloadCredentials.getPasswordHashExpirationDate()), actorWorkloadCredentials.getSshPublicKeyList()); }
WorkloadCredentialConverter { public WorkloadCredential toWorkloadCredential( UserManagementProto.ActorWorkloadCredentials actorWorkloadCredentials) { return new WorkloadCredential(actorWorkloadCredentials.getPasswordHash(), actorWorkloadCredentials.getKerberosKeysList(), toOptionalInstant(actorWorkloadCredentials.getPasswordHashExpirationDate()), actorWorkloadCredentials.getSshPublicKeyList()); } }
WorkloadCredentialConverter { public WorkloadCredential toWorkloadCredential( UserManagementProto.ActorWorkloadCredentials actorWorkloadCredentials) { return new WorkloadCredential(actorWorkloadCredentials.getPasswordHash(), actorWorkloadCredentials.getKerberosKeysList(), toOptionalInstant(actorWorkloadCredentials.getPasswordHashExpirationDate()), actorWorkloadCredentials.getSshPublicKeyList()); }  }
WorkloadCredentialConverter { public WorkloadCredential toWorkloadCredential( UserManagementProto.ActorWorkloadCredentials actorWorkloadCredentials) { return new WorkloadCredential(actorWorkloadCredentials.getPasswordHash(), actorWorkloadCredentials.getKerberosKeysList(), toOptionalInstant(actorWorkloadCredentials.getPasswordHashExpirationDate()), actorWorkloadCredentials.getSshPublicKeyList()); }  WorkloadCredential toWorkloadCredential(
            UserManagementProto.ActorWorkloadCredentials actorWorkloadCredentials); WorkloadCredential toWorkloadCredential(
            UserManagementProto.GetActorWorkloadCredentialsResponse actorWorkloadCredentials); }
WorkloadCredentialConverter { public WorkloadCredential toWorkloadCredential( UserManagementProto.ActorWorkloadCredentials actorWorkloadCredentials) { return new WorkloadCredential(actorWorkloadCredentials.getPasswordHash(), actorWorkloadCredentials.getKerberosKeysList(), toOptionalInstant(actorWorkloadCredentials.getPasswordHashExpirationDate()), actorWorkloadCredentials.getSshPublicKeyList()); }  WorkloadCredential toWorkloadCredential(
            UserManagementProto.ActorWorkloadCredentials actorWorkloadCredentials); WorkloadCredential toWorkloadCredential(
            UserManagementProto.GetActorWorkloadCredentialsResponse actorWorkloadCredentials);  }