use of com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabRequest in project cloudbreak by hortonworks.
the class KerberosMgmtVaultComponentV1Test method testGetSecretResponseForKeytabWithService.
@Test
public void testGetSecretResponseForKeytabWithService() throws Exception {
String expectedPath = "account1/ServiceKeytab/keytab/12345-6789/54321-9876/host1/service1";
SecretResponse expectedSecretResponse = new SecretResponse();
expectedSecretResponse.setEnginePath(ENGINE_PATH);
expectedSecretResponse.setSecretPath(expectedPath);
ServiceKeytabRequest serviceKeytabRequest = new ServiceKeytabRequest();
serviceKeytabRequest.setEnvironmentCrn(ENVIRONMENT_ID);
serviceKeytabRequest.setClusterCrn(CLUSTER_ID);
serviceKeytabRequest.setServerHostName(HOST);
serviceKeytabRequest.setServiceName(SERVICE);
Mockito.when(secretService.put(anyString(), anyString())).thenReturn(SECRET);
Mockito.when(stringToSecretResponseConverter.convert(anyString())).thenReturn(expectedSecretResponse);
Assertions.assertEquals(expectedSecretResponse, underTest.getSecretResponseForKeytab(serviceKeytabRequest, ACCOUNT, KEYTAB));
Mockito.verify(secretService).put(expectedPath, KEYTAB);
Mockito.verify(stringToSecretResponseConverter).convert(SECRET);
}
Aggregations