Examples of ManagedObjectReferenceCollectionRepresentation


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

    }

    @Test
    public void testGetAllChildDevice() throws SDKException {
        //Given
        ManagedObjectReferenceCollectionRepresentation retrieved =
                new ManagedObjectReferenceCollectionRepresentation();
        when(restConnector.get(CHILD_DEVICES_URL+ "?pageSize=" + DEFAULT_PAGE_SIZE, MANAGED_OBJECT_REFERENCE_COLLECTION,
                ManagedObjectReferenceCollectionRepresentation.class)).thenReturn(retrieved);

        // when
        ManagedObjectReferenceCollectionRepresentation result = managedObject.getChildDevices().get();

        // then
        assertThat(result.getReferences(), sameInstance(retrieved.getReferences()));
    }
View Full Code Here

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

    }

    @Test
    public void testGetAllChildAssets() throws Exception {
        //Given
        ManagedObjectReferenceCollectionRepresentation retrieved = new ManagedObjectReferenceCollectionRepresentation();
        when(restConnector.get(CHILD_ASSETS_URL+ "?pageSize=" +DEFAULT_PAGE_SIZE, MANAGED_OBJECT_REFERENCE_COLLECTION,
                ManagedObjectReferenceCollectionRepresentation.class)).thenReturn(retrieved);

        // when
        ManagedObjectReferenceCollectionRepresentation result = managedObject.getChildAssets().get();

        // then
        assertThat(result.getReferences(), sameInstance(retrieved.getReferences()));
    }
View Full Code Here

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

        assertThat(result, sameInstance(created));
    }

    private ManagedObjectRepresentation createMoWithChildDevicesAndAssets() {
        ManagedObjectRepresentation mo = new ManagedObjectRepresentation();
        ManagedObjectReferenceCollectionRepresentation childDevices = new ManagedObjectReferenceCollectionRepresentation();
        childDevices.setSelf(CHILD_DEVICES_URL);
        mo.setChildDevices(childDevices);

        ManagedObjectReferenceCollectionRepresentation childAssets = new ManagedObjectReferenceCollectionRepresentation();
        childAssets.setSelf(CHILD_ASSETS_URL);
        mo.setChildAssets(childAssets);

        return mo;
    }
View Full Code Here

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

        ManagedObject parentMo = inventory.getManagedObject(parent.getId());
        parentMo.addChildDevice(childRef1);
        parentMo.addChildDevice(child2.getId());

        // Then
        ManagedObjectReferenceCollectionRepresentation refCollection = inventory.getManagedObject(
                parent.getId()).getChildDevices().get();

        List<ManagedObjectReferenceRepresentation> refs = refCollection.getReferences();
        Set<GId> childDeviceIDs = asSet(refs.get(0).getManagedObject().getId(), refs.get(1).getManagedObject().getId());
        assertThat(childDeviceIDs, is(asSet(child1.getId(), child2.getId())));
       
        // When
        parentMo.deleteChildDevice(child1.getId());
        parentMo.deleteChildDevice(child2.getId());

        // Then
        ManagedObjectReferenceCollectionRepresentation allChildDevices = inventory.getManagedObject(
                parent.getId()).getChildDevices().get();
        assertEquals(0, allChildDevices.getReferences().size());
    }
View Full Code Here

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

        assertThat(refCollection.get().getPageStatistics().getCurrentPage(), is(1));
        assertThat(refCollection.get().getSelf(), containsString("pageSize=" + platform.getPageSize() + "&currentPage=1"));
        assertThat(refCollection.get().getNext(), containsString("pageSize=" + platform.getPageSize() + "&currentPage=2"));
        assertThat(refCollection.get().getPrev(), is(nullValue()));

        ManagedObjectReferenceCollectionRepresentation secondPage = refCollection.getPage(refCollection.get(), 2);
        assertThat(secondPage.getReferences().size(), is(1));
    }
View Full Code Here

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

        ManagedObject parentMo = inventory.getManagedObject(parent.getId());
        parentMo.addChildAssets(childRef1);
        parentMo.addChildAssets(child2.getId());

        // Then
        ManagedObjectReferenceCollectionRepresentation refCollection = inventory.getManagedObject(
                parent.getId()).getChildAssets().get();
        List<ManagedObjectReferenceRepresentation> refs = refCollection.getReferences();
        Set<GId> childDeviceIDs = asSet(refs.get(0).getManagedObject().getId(), refs.get(1).getManagedObject().getId());
        assertThat(childDeviceIDs, is(asSet(child1.getId(), child2.getId())));

        // When
        parentMo.deleteChildAsset(child1.getId());
        parentMo.deleteChildAsset(child2.getId());

        // Then
        ManagedObjectReferenceCollectionRepresentation allChildDevices = inventory.getManagedObject(
                parent.getId()).getChildAssets().get();
        assertEquals(0, allChildDevices.getReferences().size());
    }
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.