Package com.cumulocity.me.rest.representation.inventory

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


        return converter;
    }
   
    @Test
    public void shouldConvertToJson() throws Exception {
        ManagedObjectReferenceRepresentation representation = getSampleManagedObjectReferenceRepresentation();
        JSONObject expectedJSON = aJSONObject().withPropertyBuilder(PROP_MANAGED_OBJECT, getSampleJsonManagedObjectRepresentation()).build();
       
        JSONObject outputJSON = toJson(representation);
       
        assertThat(outputJSON.toString()).isEqualTo(expectedJSON.toString());
View Full Code Here


   
    @Test
    public void shouldConvertFromJson() throws Exception {
        JSONObject json = aJSONObject().withProperty(PROP_MANAGED_OBJECT, getSampleJsonManagedObjectRepresentation().build()).build();
       
        ManagedObjectReferenceRepresentation representation = fromJson(json);

        assertThat(representation.getManagedObject()).isNotNull();
    }
View Full Code Here

    }

    private void addChildDevice(ManagedObjectRepresentation parent, ManagedObjectRepresentation child) throws SDKException {

        ManagedObjectReferenceRepresentation deviceRef = anMoRefRepresentationLike(MO_REF_REPRESENTATION).withMo(child).build();
        inventoryApi.getManagedObject(parent.getId()).addChildDevice(deviceRef);
    }
View Full Code Here

        // Given
        ManagedObjectRepresentation parent = inventory.create(aSampleMo().withName("parent1").build());
        ManagedObjectRepresentation child1 = inventory.create(aSampleMo().withName("child11").build());
        ManagedObjectRepresentation child2 = inventory.create(aSampleMo().withName("child21").build());

        ManagedObjectReferenceRepresentation childRef1 = anMoRefRepresentationLike(MO_REF_REPRESENTATION).withMo(child1).build();
        ManagedObjectReferenceRepresentation childRef2 = anMoRefRepresentationLike(MO_REF_REPRESENTATION).withMo(child2).build();

        // When
        ManagedObject parentMo = inventory.getManagedObject(parent.getId());
        parentMo.addChildDevice(childRef1);
        parentMo.addChildDevice(childRef2);
View Full Code Here

        ManagedObjectRepresentation parent = inventory.create(aSampleMo().withName("parent").build());
        ManagedObject parentMo = inventory.getManagedObject(parent.getId());

        for (int i = 0; i < platform.getPageSize() + 1; i++) {
            ManagedObjectRepresentation child = inventory.create(aSampleMo().withName("child" + i).build());
            ManagedObjectReferenceRepresentation childRef = anMoRefRepresentationLike(MO_REF_REPRESENTATION).withMo(child).build();
            parentMo.addChildDevice(childRef);
        }

        // When
        PagedCollectionResource refCollection = inventory.getManagedObject(parent.getId()).getChildDevices();
View Full Code Here

        // Given
        ManagedObjectRepresentation parent = inventory.create(aSampleMo().withName("parent").build());
        ManagedObjectRepresentation child1 = inventory.create(aSampleMo().withName("child1").build());
        ManagedObjectRepresentation child2 = inventory.create(aSampleMo().withName("child2").build());

        ManagedObjectReferenceRepresentation childRef1 = anMoRefRepresentationLike(MO_REF_REPRESENTATION).withMo(child1).build();
        ManagedObjectReferenceRepresentation childRef2 = anMoRefRepresentationLike(MO_REF_REPRESENTATION).withMo(child2).build();

        // When
        ManagedObject parentMo = inventory.getManagedObject(parent.getId());
        parentMo.addChildAssets(childRef1);
        parentMo.addChildAssets(childRef2);
View Full Code Here

        ManagedObjectRepresentation parent = inventory.create(aSampleMo().withName("parent").build());
        ManagedObject parentMo = inventory.getManagedObject(parent.getId());

        for (int i = 0; i < platform.getPageSize() + 1; i++) {
            ManagedObjectRepresentation child = inventory.create(aSampleMo().withName("child" + i).build());
            ManagedObjectReferenceRepresentation childRef = anMoRefRepresentationLike(MO_REF_REPRESENTATION).withMo(child).build();
            parentMo.addChildAssets(childRef);
        }

        // When
        PagedCollectionResource refCollection = inventory.getManagedObject(parent.getId()).getChildAssets();
View Full Code Here

        this.self = self;
        return this;
    }

    public ManagedObjectReferenceRepresentation build() {
        ManagedObjectReferenceRepresentation ref = new ManagedObjectReferenceRepresentation();
        ref.setManagedObject(mo);
        ref.setSelf(self);
        return ref;
    }
View Full Code Here

TOP

Related Classes of com.cumulocity.me.rest.representation.inventory.ManagedObjectReferenceRepresentation

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.