Examples of ManagedObjectReferenceRepresentation


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

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

   
    @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

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

    }

    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

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

        // 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

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

        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

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

        // 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

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

        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

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

        this.self = self;
        return this;
    }

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

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

        return restConnector.post(createChildAssetPath(managedObjectRepresentation), InventoryMediaType.MANAGED_OBJECT_REFERENCE,
                createChildObject(childId));
    }
   
    private ManagedObjectReferenceRepresentation createChildObject(GId childId) {
        ManagedObjectReferenceRepresentation morr = new ManagedObjectReferenceRepresentation();
        ManagedObjectRepresentation mor = new ManagedObjectRepresentation();
        mor.setId(childId);
        morr.setManagedObject(mor);
        return morr;
    }
View Full Code Here

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

            throws SDKException {

        // Given
        ManagedObjectRepresentation ch1 = inventory.create(aSampleMo().build());
        ManagedObjectRepresentation ch2 = inventory.create(aSampleMo().build());
        ManagedObjectReferenceRepresentation childRef1 = createChildRef(ch1);
        ManagedObjectReferenceRepresentation childRef2 = createChildRef(ch2);

        // When
        childAdder.addChild(childRef1);
        childAdder.addChild(childRef2);
        childAdder.addChild(childRef1);
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.