Examples of AuditRecordRepresentation


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

   
    @Test
    public void shouldParseWithSimpleProps() throws Exception {
        JSONObject json = new JSONObject("{\"user\":\"us\",\"severity\":\"sever\",\"application\":\"app\",\"activity\":\"activity\"}");
       
        AuditRecordRepresentation parsed = (AuditRecordRepresentation) converter.fromJson(json);
       
        assertThat(parsed.getUser()).isEqualTo(user);
        assertThat(parsed.getSeverity()).isEqualTo(severity);
        assertThat(parsed.getActivity()).isEqualTo(activity);
        assertThat(parsed.getApplication()).isEqualTo(application);
        assertThat(parsed.getChanges()).isNull();
    }
View Full Code Here

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

   
    @Test
    public void shouldParseWithChanges() throws Exception {
        JSONObject json = new JSONObject("{\"user\":\"us\",\"severity\":\"sever\",\"application\":\"app\",\"changes\":[],\"activity\":\"activity\"}");
       
        AuditRecordRepresentation parsed = (AuditRecordRepresentation) converter.fromJson(json);
       
        assertThat(parsed.getUser()).isEqualTo(user);
        assertThat(parsed.getSeverity()).isEqualTo(severity);
        assertThat(parsed.getActivity()).isEqualTo(activity);
        assertThat(parsed.getApplication()).isEqualTo(application);
        assertThat(parsed.getChanges()).isNotNull();
    }
View Full Code Here

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

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

    @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((ManagedObjectRepresentation) 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

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

    }

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

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

        Map map = new HashMap();

        Iterator iterator = result1.iterator();
        while (iterator.hasNext()) {
            AuditRecordRepresentation rep = (AuditRecordRepresentation) iterator.next();
            map.put(rep.getId(), rep);
        }

        iterator = collection1.getAuditRecords().iterator();
        while (iterator.hasNext()) {
            AuditRecordRepresentation orig = (AuditRecordRepresentation) map.get(((AuditRecordRepresentation) iterator.next()).getId());
            assertThat(orig, is(notNullValue()));
        }
    }
View Full Code Here

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

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

    }

    @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

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

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

    @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

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

    }

    @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

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

        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
Copyright © 2018 www.massapi.com. 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.