Package com.cumulocity.rest.representation.audit

Examples of com.cumulocity.rest.representation.audit.AuditRecordRepresentation


    @Test
    public void shouldGetAuditRecord() throws SDKException {
        // Given
        GId gid = new GId("123");
        AuditRecordRepresentation auditRep = new AuditRecordRepresentation();
        when(restConnector.get(AUDIT_RECORDS_URL + "/123", AuditMediaType.AUDIT_RECORD, AuditRecordRepresentation.class)).thenReturn(
                auditRep);

        // When
        AuditRecordRepresentation result = auditRecordApi.getAuditRecord(gid);

        //then
        assertThat(result, sameInstance(auditRep));
    }
View Full Code Here


    }

    @Test
    public void shouldCreateAuditRecord() throws SDKException {
        // Given
        AuditRecordRepresentation input = new AuditRecordRepresentation();
        AuditRecordRepresentation created = new AuditRecordRepresentation();
        when(restConnector.post(AUDIT_RECORDS_URL, AuditMediaType.AUDIT_RECORD, input)).thenReturn(created);

        // When
        AuditRecordRepresentation result = auditRecordApi.create(input);

        // Then
        assertThat(result, sameInstance(created));
    }
View Full Code Here

    // ------------------------------------------------------------------------

    @Given("I have '(\\d+)' audit records of type '([^']*)' and application '([^']*)' and user '([^']*)' for the managed object$")
    public void iHaveAuditRecord(int n, String type, String application, String user) {
        for (int i = 0; i < n; i++) {
            AuditRecordRepresentation rep = new AuditRecordRepresentation();
            rep.setType(type);
            rep.setTime(new Date());
            rep.setSource(managedObjects.get(0));
            rep.setActivity("Some Activity");
            rep.setApplication(application);
            rep.setUser(user);
            rep.setSeverity("major");
            rep.setText("text");
            input.add(rep);
        }
    }
View Full Code Here

    }

    @When("I get the audit record with the created id$")
    public void iGetWithCreatedId() throws SDKException {
        try {
            AuditRecordRepresentation auditRecordRepresentation = auditRecordsApi.getAuditRecord(result1.get(0).getId());
            assertThat(auditRecordRepresentation, is(notNullValue()));
            result2.add(auditRecordRepresentation);
        } catch (SDKException ex) {
            ex.printStackTrace();
            status = ex.getHttpStatus();
View Full Code Here

        for (AuditRecordRepresentation rep : result1) {
            map.put(rep.getId(), rep);
        }

        for (AuditRecordRepresentation rep : collection1.getAuditRecords()) {
            AuditRecordRepresentation orig = map.get(rep.getId());
            assertThat(orig, is(notNullValue()));
        }
    }
View Full Code Here

TOP

Related Classes of com.cumulocity.rest.representation.audit.AuditRecordRepresentation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.