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

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


//    }

    @Test
    public void createManagedObjectWithCoordinateFragment() throws Exception {
        // Given
        Coordinate coordinate = new Coordinate(100.0, 10.0);
        ManagedObjectRepresentation rep = aSampleMo().with(coordinate).build();

        // When
        ManagedObjectRepresentation result = inventory.create(rep);

        // Then
        assertThat(result.getId()).isNotNull();
        Coordinate fragment = (Coordinate) result.get(Coordinate.class);
        assertThat(fragment).isEqualTo(coordinate);
    }
View Full Code Here


        // Given
        ManagedObjectRepresentation rep = aSampleMo().build();
        ManagedObjectRepresentation result = inventory.create(rep);

        // When
        Coordinate coordinate = new Coordinate(100.0, 10.0);
        result.set(coordinate);

        GId id = result.getId();
        result.setId(null);
        result.setLastUpdated(null);
View Full Code Here

    }

    @Test @Ignore("unsupported on ME")
    public void createAndUpdateManagedObjectByRemovingFragment() throws Exception {
        // Given
        ManagedObjectRepresentation rep = aSampleMo().with(new Coordinate()).build();
        ManagedObjectRepresentation created = inventory.create(rep);

        // When
        created.set(null, Coordinate.class);
        GId id = created.getId();
View Full Code Here

    //
    @Test
    public void queryWithFragmentType() throws Exception {
        // Given
        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 = (ManagedObjectCollectionRepresentation) inventory.getManagedObjectsByFilter(filter).get();
View Full Code Here

    @Test
    public void getAllWhen20ManagedObjectsPresent() throws Exception {
        // Given
        int numOfMos = 20;
        for (int i = 0; i < numOfMos; i++) {
            inventory.create(aSampleMo().withName("MO" + i).with(new Coordinate()).build());
        }

        // When
        ManagedObjectCollectionRepresentation mos = (ManagedObjectCollectionRepresentation) inventory.getManagedObjects().get();
View Full Code Here

    }

    @Override
    public JSONObject toJson(Object object) {
        JSONObject json = new JSONObject();
        Coordinate representation = (Coordinate) object;
        putDoubleObj(json, PROP_LONGITUDE, representation.getLongitude());
        putDoubleObj(json, PROP_LATITUDE, representation.getLatitude());
        return json;
    }
View Full Code Here

        return json;
    }

    @Override
    public Object fromJson(JSONObject json) {
        Coordinate representation = new Coordinate();
        representation.setLongitude(getDoubleObj(json, PROP_LONGITUDE));
        representation.setLatitude(getDoubleObj(json, PROP_LATITUDE));
        return representation;
    }
View Full Code Here

TOP

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

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.