Examples of GId


Examples of com.cumulocity.model.idtype.GId

        ManagedObjectRepresentation representation = new ManagedObjectRepresentation();
        returnResponseWhenPut(representation);
        when(parser.parse(response, 200, ManagedObjectRepresentation.class)).thenReturn(null);
        when(response.getLocation()).thenReturn(new URI("http://URI"));
        when(parser.parseIdFromLocation(response)).thenReturn(new GId("mo_id"));

        // When
        ManagedObjectRepresentation result = restConnector.put(PATH, mediaType, representation);

        // Then
        verify(typeBuilder, never()).accept(any(MediaType.class));
        assertThat(result, sameInstance(representation));
        assertThat(result.getId(), is(new GId("mo_id")));
    }
View Full Code Here

Examples of com.cumulocity.model.idtype.GId

    }
   
    @Test
    public void shouldRetrieveAlarmRep() throws SDKException {
        //Given
        GId gid = new GId("global_id");
        AlarmRepresentation alarmRep = new AlarmRepresentation();
        when(restConnector.get(ALARM_COLLECTION_URL + "/global_id", AlarmMediaType.ALARM, AlarmRepresentation.class)).thenReturn(alarmRep);

        //When
        AlarmRepresentation retrieved = alarmApi.getAlarm(gid);
View Full Code Here

Examples of com.cumulocity.model.idtype.GId

    @Test
    public void shouldUpdateAlarmRep() throws SDKException {
        //Given
        AlarmRepresentation alarmToUpdate = new AlarmRepresentation();
        alarmToUpdate.setId(new GId("global_id"));
        alarmToUpdate.setStatus("STATUS");
        AlarmRepresentation alarmRep = new AlarmRepresentation();
        when(
                restConnector.put(eq(ALARM_COLLECTION_URL + "/global_id"), eq(AlarmMediaType.ALARM),
                        argThat(hasOnlyUpdatableFields(alarmToUpdate)))).thenReturn(alarmRep);
View Full Code Here

Examples of com.cumulocity.model.idtype.GId

            .build();
    }

    private ManagedObjectRepresentation source() {
        ManagedObjectRepresentation source = new ManagedObjectRepresentation();
        source.setId(new GId("1"));
        return source;
    }
View Full Code Here

Examples of com.cumulocity.model.idtype.GId

    public void shouldHoldStatusAndSource() {
        // given
        CumulocityAlarmStatuses status = CumulocityAlarmStatuses.ACKNOWLEDGED;

        // when
        AlarmFilter filter = alarmFilter.bySource(new GId("1")).byStatus(status);

        // then
        assertThat(filter.getSource(), is("1"));
        assertThat(filter.getStatus(), is(status.toString()));
    }
View Full Code Here

Examples of com.cumulocity.model.idtype.GId

    @Test
    public void shouldGetMo() throws Exception {
        //Given
        String gidValue = "gid_value";
        GId gid = new GId(gidValue);

        //When
        ManagedObjectImpl mo = (ManagedObjectImpl) inventoryApiResource.getManagedObject(gid);

        // Then
View Full Code Here

Examples of com.cumulocity.model.idtype.GId

    }

    @Test(expected = SDKException.class)
    public void shouldThrowExceptionWhenGetWithIncorrectGid() throws SDKException {
        // Given
        GId gid = new GId();

        // When
        inventoryApiResource.getManagedObject(gid);

        // Then
View Full Code Here

Examples of com.cumulocity.model.idtype.GId

    }

    @Test
    public void testGetChildDevice() throws SDKException {
        //Given
        GId gid = new GId("deviceId");
        ManagedObjectReferenceRepresentation retrieved = new ManagedObjectReferenceRepresentation();
        when(restConnector.get(CHILD_DEVICES_URL + "/deviceId", MANAGED_OBJECT_REFERENCE,
                ManagedObjectReferenceRepresentation.class)).thenReturn(retrieved);

        // when
View Full Code Here

Examples of com.cumulocity.model.idtype.GId

    }

    @Test
    public void testDeleteChildDevice() throws Exception {
        //Given
        GId gid = new GId("deviceId");

        // when
        managedObject.deleteChildDevice(gid);

        // then
View Full Code Here

Examples of com.cumulocity.model.idtype.GId

    }

    @Test
    public void testGetChildAsset() throws Exception {
        //Given
        GId gid = new GId("assetId");
        ManagedObjectReferenceRepresentation retrieved = new ManagedObjectReferenceRepresentation();
        when(restConnector.get(CHILD_ASSETS_URL + "/assetId", MANAGED_OBJECT_REFERENCE,
                ManagedObjectReferenceRepresentation.class)).thenReturn(retrieved);

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