Search in sources :

Example 1 with AuditingHelper

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

the class AuditTest 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 2 with AuditingHelper

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

the class CertificateGetTest method beforeEach.

@Before
public void beforeEach() throws Exception {
    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 3 with AuditingHelper

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

the class CertificateSetAndRegenerateTest method beforeEach.

@Before
public void beforeEach() throws Exception {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    MockHttpServletRequestBuilder generateCaRequest = post("/api/v1/data").header("Authorization", "Bearer " + UAA_OAUTH2_PASSWORD_GRANT_TOKEN).accept(APPLICATION_JSON).contentType(APPLICATION_JSON).content("{\n" + "  \"name\" :\"" + CA_NAME + "\",\n" + "  \"type\" : \"certificate\",\n" + "  \"parameters\" : {\n" + "    \"common_name\" : \"federation\",\n" + "    \"is_ca\" : true,\n" + "    \"self_sign\" : true\n" + "  }\n" + "}");
    final String generateCaResponse = this.mockMvc.perform(generateCaRequest).andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
    caCertificate = JsonPath.parse(generateCaResponse).read("$.value.certificate");
    caId = JsonPath.parse(generateCaResponse).read("$.id");
    caCredentialUuid = getCertificateId(mockMvc, CA_NAME);
    assertNotNull(caCertificate);
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : MockHttpServletRequestBuilder(org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder) AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Example 4 with AuditingHelper

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

the class PermissionsEndpointWithoutEnforcementTest method beforeEach.

@Before
public void beforeEach() throws Exception {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    RequestHelper.setPassword(mockMvc, credentialName, "testpassword", CredentialWriteMode.NO_OVERWRITE.mode);
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
Also used : AuditingHelper(org.cloudfoundry.credhub.helper.AuditingHelper) Before(org.junit.Before)

Example 5 with AuditingHelper

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

the class CertificateVersionDeleteTest method beforeEach.

@Before
public void beforeEach() throws Exception {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(springSecurity()).build();
    auditingHelper = new AuditingHelper(requestAuditRecordRepository, eventAuditRecordRepository);
}
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