Package com.cumulocity.me.rest.representation.audit

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


   
    @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

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

    @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

    }

    @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

        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

TOP

Related Classes of com.cumulocity.me.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.