Search in sources :

Example 6 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class CredentialsControllerGetTest method beforeEach.

@Before
public void beforeEach() {
    Consumer<Long> fakeTimeSetter = mockOutCurrentTimeProvider(mockCurrentTimeProvider);
    fakeTimeSetter.accept(FROZEN_TIME.toEpochMilli());
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Example 7 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class CredentialsControllerTypeSpecificGenerateTest method setup.

@Before
public void setup() throws Exception {
    String fakeSalt = cryptSaltFactory.generateSalt(FAKE_PASSWORD);
    Consumer<Long> fakeTimeSetter = mockOutCurrentTimeProvider(mockCurrentTimeProvider);
    fakeTimeSetter.accept(FROZEN_TIME.toEpochMilli());
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    when(passwordGenerator.generateCredential(any(GenerationParameters.class))).thenReturn(new StringCredentialValue(FAKE_PASSWORD));
    when(certificateGenerator.generateCredential(any(GenerationParameters.class))).thenReturn(new CertificateCredentialValue(CA, CERTIFICATE, PRIVATE_KEY, null));
    when(sshGenerator.generateCredential(any(GenerationParameters.class))).thenReturn(new SshCredentialValue(PUBLIC_KEY, PRIVATE_KEY, null));
    when(rsaGenerator.generateCredential(any(GenerationParameters.class))).thenReturn(new RsaCredentialValue(PUBLIC_KEY, PRIVATE_KEY));
    when(userGenerator.generateCredential(any(GenerationParameters.class))).thenReturn(new UserCredentialValue(USERNAME, FAKE_PASSWORD, fakeSalt));
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : CertificateCredentialValue(org.cloudfoundry.credhub.credential.CertificateCredentialValue) StringCredentialValue(org.cloudfoundry.credhub.credential.StringCredentialValue) RsaCredentialValue(org.cloudfoundry.credhub.credential.RsaCredentialValue) GenerationParameters(org.cloudfoundry.credhub.request.GenerationParameters) StringGenerationParameters(org.cloudfoundry.credhub.request.StringGenerationParameters) Matchers.anyString(org.mockito.Matchers.anyString) AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) UserCredentialValue(org.cloudfoundry.credhub.credential.UserCredentialValue) SshCredentialValue(org.cloudfoundry.credhub.credential.SshCredentialValue) Before(org.junit.Before)

Example 8 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class InterpolationControllerTest method beforeEach.

@Before
public void beforeEach() {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Example 9 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class CredentialSetErrorHandlingTest method setUp.

@Before
public void setUp() {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Example 10 with AuditingHelper

use of org.cloudfoundry.credhub.helper.AuditingHelper in project credhub by cloudfoundry-incubator.

the class PermissionAndCredentialTest method setUp.

@Before
public void setUp() throws Exception {
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
}
Also used : AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Aggregations

AuditingHelper (org.cloudfoundry.credhub.helper.AuditingHelper)19 Before (org.junit.Before)19 MockHttpServletRequestBuilder (org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder)2 CertificateCredentialValue (org.cloudfoundry.credhub.credential.CertificateCredentialValue)1 RsaCredentialValue (org.cloudfoundry.credhub.credential.RsaCredentialValue)1 SshCredentialValue (org.cloudfoundry.credhub.credential.SshCredentialValue)1 StringCredentialValue (org.cloudfoundry.credhub.credential.StringCredentialValue)1 UserCredentialValue (org.cloudfoundry.credhub.credential.UserCredentialValue)1 GenerationParameters (org.cloudfoundry.credhub.request.GenerationParameters)1 StringGenerationParameters (org.cloudfoundry.credhub.request.StringGenerationParameters)1 JSONObject (org.json.JSONObject)1 Matchers.anyString (org.mockito.Matchers.anyString)1