Package com.cumulocity.rest.representation.inventory

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


    }

    @Test
    public void getAllWhenNoManagedObjectPresent() throws Exception {
        // When
        ManagedObjectCollectionRepresentation mos = inventory.getManagedObjects().get();

        // Then
        assertThat(mos.getManagedObjects(), is(Collections.<ManagedObjectRepresentation>emptyList()));
    }
View Full Code Here


        // When
        inventory.create(rep1);
        inventory.create(rep2);

        // Then
        ManagedObjectCollectionRepresentation mos = inventory.getManagedObjects().get();
        assertThat(mos.getManagedObjects().size(), is(2));
    }
View Full Code Here

        inventory.create(aSampleMo().withType("typeA").withName("A2").build());
        inventory.create(aSampleMo().withType("typeB").withName("B").build());

        // When
        InventoryFilter filterA = new InventoryFilter().byType("typeA");
        ManagedObjectCollectionRepresentation typeAMos = inventory.getManagedObjectsByFilter(filterA).get();

        // Then
        assertThat(typeAMos.getManagedObjects().size(), is(2));

        // When
        InventoryFilter filterB = new InventoryFilter().byType("typeB");
        ManagedObjectCollectionRepresentation typeBMos = inventory.getManagedObjectsByFilter(filterB).get();

        // Then
        assertThat(typeBMos.getManagedObjects().size(), is(1));
    }
View Full Code Here

        ManagedObjectRepresentation mo1 = inventory.create(aSampleMo().withName("MO1").build());
        ManagedObjectRepresentation mo3 = inventory.create(aSampleMo().withName("MO3").build());
        inventory.create(aSampleMo().withName("MO2").build());

        // When
        ManagedObjectCollectionRepresentation moCollection = inventory.getManagedObjectsByFilter(new InventoryFilter().byIds(asList(mo3.getId(), mo1.getId()))).get();

        // Then
        List<ManagedObjectRepresentation> mos = moCollection.getManagedObjects();
        assertThat(mos.size(), is(2));
        assertThat(mos.get(0).getName(), is("MO3"));
        assertThat(mos.get(1).getName(), is("MO1"));

    }
View Full Code Here

        inventory.create(aSampleMo().withName("MO1").with(new Coordinate()).build());
        inventory.create(aSampleMo().withName("MO2").with(new SecondFragment()).build());

        // When
        InventoryFilter filter = new InventoryFilter().byFragmentType(Coordinate.class);
        ManagedObjectCollectionRepresentation coordinates = inventory.getManagedObjectsByFilter(filter).get();

        // Then
        assertThat(coordinates.getManagedObjects().size(), is(1));
    }
View Full Code Here

        for (int i = 0; i < numOfMos; i++) {
            inventory.create(aSampleMo().withName("MO" + i).with(new Coordinate()).build());
        }

        // When
        ManagedObjectCollectionRepresentation mos = inventory.getManagedObjects().get();

        // Then
        assertThat(mos.getPageStatistics().getTotalPages(), is(4));

        // When
        ManagedObjectCollectionRepresentation secondPage = inventory.getManagedObjects().getPage(mos, 2);

        // Then
        assertThat(secondPage.getPageStatistics().getCurrentPage(), is(2));

        // When
        ManagedObjectCollectionRepresentation thirdPage = inventory.getManagedObjects().getNextPage(secondPage);

        // Then
        assertThat(thirdPage.getPageStatistics().getCurrentPage(), is(3));

        // When
        ManagedObjectCollectionRepresentation firstPage = inventory.getManagedObjects().getPreviousPage(secondPage);
        assertThat(firstPage.getPageStatistics().getCurrentPage(), is(1));
    }
View Full Code Here

TOP

Related Classes of com.cumulocity.rest.representation.inventory.ManagedObjectCollectionRepresentation

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.