Examples of ManagedObjectRepresentation


Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

    @Given("I have external id for '(\\d+)' with value '([^']*)' and type '([^']*)'")
    public void iHaveManagedObject(long globalId, String extId, String type) {
        ExternalIDRepresentation rep = new ExternalIDRepresentation();
        rep.setExternalId(extId);
        rep.setType(type);
        ManagedObjectRepresentation mo = new ManagedObjectRepresentation();
        GId gId = new GId();
        gId.setValue(Long.toString(globalId));
        mo.setId(gId);
        rep.setManagedObject(mo);
        input.add(rep);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

        input.add(rep);
    }

    @Given("I have the global id '(\\d+)' with following external ids:")
    public void iHaveManagedObject(long globalId, List rows) {
        ManagedObjectRepresentation mo = new ManagedObjectRepresentation();
        GId gId = new GId();
        gId.setValue(Long.toString(globalId));
        mo.setId(gId);

        Iterator iterator = rows.iterator();

        while (iterator.hasNext()) {
            Row row = (Row) iterator.next();
View Full Code Here

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

        return new ManagedObjectReferenceRepresentationBuilder()
            .withMo(getSampleManagedObjectRepresentation()).build();
    }
   
    protected ManagedObjectRepresentation getSampleManagedObjectRepresentation() {
        ManagedObjectRepresentation representation = minimalManagedObjectBuilder()
                .withSelf(SELF)
                .withID(getSampleGId())
                .withChildAssets(getMinimalMORCR())
                .withChildDevices(getMinimalMORCR())
                .withParents(getMinimalMORCR())
View Full Code Here

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

    @Test
    public void shouldConvertMinimalMoFromJson() throws Exception {
        JSONObject json = minimalJsonManagedObjectRepresentation().build();

        ManagedObjectRepresentation representation = fromJson(json);

        assertThat(representation.getId()).isEqualTo(new GId(ID));
        assertThat(representation.getSelf()).isEqualTo(SELF);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

        JSONObject json = minimalJsonManagedObjectRepresentation()
                .withPropertyBuilder(PROP_CHILD_ASSETS, minimalJsonObjectRepresentation())
                .withPropertyBuilder(PROP_CHILD_DEVICES, minimalJsonObjectRepresentation())
                .withPropertyBuilder(PROP_PARENTS, minimalJsonObjectRepresentation()).build();

        ManagedObjectRepresentation representation = fromJson(json);

        assertThat(representation.getChildAssets()).isNotNull();
        assertThat(representation.getChildDevices()).isNotNull();
        assertThat(representation.getParents()).isNotNull();
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

    @Test
    public void shouldConvertDateFromJson() throws Exception {
        String stringDate = DateUtils.format(lastUpdated);
        JSONObject json = minimalJsonManagedObjectRepresentation().withProperty(PROP_LAST_UPDATED, stringDate).build();

        ManagedObjectRepresentation representation = fromJson(json);

        assertThat(representation.getLastUpdated()).isEqualTo(lastUpdated);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

        assertThat(representation.getLastUpdated()).isEqualTo(lastUpdated);
    }

    @Test(expected = RepresentationValidationException.class)
    public void shouldRequireNullIdInCreateContext() throws Exception {
        ManagedObjectRepresentation representation = new ManagedObjectRepresentationBuilder().withID(getSampleGId()).build();

        isValid(representation, CREATE);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

        isValid(representation, CREATE);
    }
   
    @Test(expected = RepresentationValidationException.class)
    public void shouldRequireNullDateInCreateContext() throws Exception {
        ManagedObjectRepresentation representation = new ManagedObjectRepresentationBuilder().withLastUpdated(lastUpdated).build();

        isValid(representation, CREATE);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

        isValid(representation, CREATE);
    }
   
    @Test(expected = RepresentationValidationException.class)
    public void shouldRequireNullIdInUpdateContext() throws Exception {
        ManagedObjectRepresentation representation = new ManagedObjectRepresentationBuilder().withID(getSampleGId()).build();

        isValid(representation, UPDATE);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.inventory.ManagedObjectRepresentation

        isValid(representation, UPDATE);
    }
   
    @Test(expected = RepresentationValidationException.class)
    public void shouldRequireNullDateInUpdateContext() throws Exception {
        ManagedObjectRepresentation representation = new ManagedObjectRepresentationBuilder().withLastUpdated(lastUpdated).build();

        isValid(representation, UPDATE);
    }
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.