Search in sources :

Example 1 with PermissionService

use of org.cloudfoundry.credhub.service.PermissionService in project credhub by cloudfoundry-incubator.

the class GenerateHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    credentialService = mock(PermissionedCredentialService.class);
    universalCredentialGenerator = mock(UniversalCredentialGenerator.class);
    permissionService = mock(PermissionService.class);
    subject = new GenerateHandler(credentialService, permissionService, universalCredentialGenerator);
    generationParameters = new StringGenerationParameters();
    accessControlEntries = new ArrayList<>();
    userContext = new UserContext();
    credentialVersion = mock(PasswordCredentialVersion.class);
    when(credentialService.save(anyObject(), anyObject(), anyObject(), anyList())).thenReturn(credentialVersion);
}
Also used : PermissionService(org.cloudfoundry.credhub.service.PermissionService) PermissionedCredentialService(org.cloudfoundry.credhub.service.PermissionedCredentialService) UserContext(org.cloudfoundry.credhub.auth.UserContext) PasswordCredentialVersion(org.cloudfoundry.credhub.domain.PasswordCredentialVersion) StringGenerationParameters(org.cloudfoundry.credhub.request.StringGenerationParameters) Before(org.junit.Before)

Example 2 with PermissionService

use of org.cloudfoundry.credhub.service.PermissionService in project credhub by cloudfoundry-incubator.

the class SetHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    TestHelper.getBouncyCastleProvider();
    credentialService = mock(PermissionedCredentialService.class);
    certificateAuthorityService = mock(CertificateAuthorityService.class);
    permissionService = mock(PermissionService.class);
    userContext = new UserContext();
    UserContextHolder userContextHolder = new UserContextHolder();
    userContextHolder.setUserContext(userContext);
    subject = new SetHandler(credentialService, permissionService, certificateAuthorityService, userContextHolder);
    generationParameters = new StringGenerationParameters();
    accessControlEntries = new ArrayList<>();
    credentialVersion = mock(PasswordCredentialVersion.class);
    when(credentialService.save(anyObject(), anyObject(), anyObject(), anyList())).thenReturn(credentialVersion);
}
Also used : PermissionService(org.cloudfoundry.credhub.service.PermissionService) PermissionedCredentialService(org.cloudfoundry.credhub.service.PermissionedCredentialService) UserContext(org.cloudfoundry.credhub.auth.UserContext) UserContextHolder(org.cloudfoundry.credhub.auth.UserContextHolder) CertificateAuthorityService(org.cloudfoundry.credhub.data.CertificateAuthorityService) PasswordCredentialVersion(org.cloudfoundry.credhub.domain.PasswordCredentialVersion) StringGenerationParameters(org.cloudfoundry.credhub.request.StringGenerationParameters) Before(org.junit.Before)

Aggregations

UserContext (org.cloudfoundry.credhub.auth.UserContext)2 PasswordCredentialVersion (org.cloudfoundry.credhub.domain.PasswordCredentialVersion)2 StringGenerationParameters (org.cloudfoundry.credhub.request.StringGenerationParameters)2 PermissionService (org.cloudfoundry.credhub.service.PermissionService)2 PermissionedCredentialService (org.cloudfoundry.credhub.service.PermissionedCredentialService)2 Before (org.junit.Before)2 UserContextHolder (org.cloudfoundry.credhub.auth.UserContextHolder)1 CertificateAuthorityService (org.cloudfoundry.credhub.data.CertificateAuthorityService)1