Examples of OperationRepresentation


Examples of com.cumulocity.me.rest.representation.operation.OperationRepresentation

    OperationCollectionRepresentation allOperations;

    @When("^I create an operation for device '([^']*)'$")
    public void iCreateAnOperationForDevice(int deviceNum) throws Exception {
        GId deviceId = getMoId(deviceNum);
        OperationRepresentation operationRepresentation = new OperationRepresentation();
        operationRepresentation.setDeviceId(deviceId);
        operationRepresentation.set("smaple_value", "sample_operation_type");
        operation1 = deviceControlResource.create(operationRepresentation);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.operation.OperationRepresentation

    }
   
    @Test
    public void shouldCreateRelayOperation() {
        GId deviceId = getMoId(1);
        OperationRepresentation operation = new OperationRepresentation();
        Relay relayControl = new Relay();
        relayControl.setRelayState(RelayState.OPEN);
        operation.set(relayControl);
        operation.setDeviceId(deviceId);
       
        operation1 = deviceControlResource.create(operation);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.operation.OperationRepresentation

        return this;
    }
   
    @Override
    protected OperationRepresentation createDomainObject() {
        OperationRepresentation operation = new OperationRepresentation();
        for (Object object : dynamicProperties) {
            operation.set(object);
        }
        return operation;
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.operation.OperationRepresentation

   
    @Test
    public void shouldParseWithSimpleProps() throws Exception {
        JSONObject json = new JSONObject("{\"creationTime\":\"2001-01-01T00:00:01.0Z\",\"status\":\"some_status\",\"deviceId\":\"deviceId\",\"failureReason\":\"some_failure_reason\",\"id\":\"testid\"}");
       
        OperationRepresentation parsed = (OperationRepresentation) converter.fromJson(json);
       
        assertThat(parsed.getId()).isEqualTo(id);
        assertThat(parsed.getDeviceId()).isEqualTo(deviceId);
        assertThat(parsed.getStatus()).isEqualTo(status);
        assertThat(parsed.getFailureReason()).isEqualTo(failureReason);
        assertThat(parsed.getCreationTime()).isEqualTo(creationTime);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.operation.OperationRepresentation

   
    @Test
    public void shouldParseWithDeviceIds() throws Exception {
        JSONObject json = new JSONObject("{\"creationTime\":\"2001-01-01T00:00:01.0Z\",\"status\":\"some_status\",\"deviceId\":\"deviceId\",\"failureReason\":\"some_failure_reason\",\"id\":\"testid\"}");
       
        OperationRepresentation parsed = (OperationRepresentation) converter.fromJson(json);
       
        assertThat(parsed.getId()).isEqualTo(id);
        assertThat(parsed.getDeviceId()).isEqualTo(deviceId);
        assertThat(parsed.getStatus()).isEqualTo(status);
        assertThat(parsed.getFailureReason()).isEqualTo(failureReason);
        assertThat(parsed.getCreationTime()).isEqualTo(creationTime);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.operation.OperationRepresentation

    @Test
    public void shouldParseWithFragment() throws Exception {
        when(conversionService.fromJson(jsonObject("{\"type\":\"test\"}"), same(TestFragment.class))).thenReturn(fragment);
        JSONObject json = new JSONObject("{\"com_cumulocity_me_rest_convert_TestFragment\":{\"type\":\"test\"},\"id\":\"testid\"}");
       
        OperationRepresentation parsed = (OperationRepresentation) converter.fromJson(json);
       
        assertThat(parsed.getId()).isEqualTo(id);
        assertThat(parsed.getAttrs().size()).isEqualTo(1);
        assertThat(parsed.get(TestFragment.class)).isSameAs(fragment);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.operation.OperationRepresentation

        String url = getSelfUri() + "/" + operation.getId().getValue();
        return (OperationRepresentation) restConnector.put(url, DeviceControlMediaType.OPERATION, prepareOperationForUpdate(operation));
    }

    private OperationRepresentation prepareOperationForUpdate(OperationRepresentation operation) {
        OperationRepresentation toSend = new OperationRepresentation();
        toSend.setStatus(operation.getStatus());
        toSend.setAttrs(operation.getAttrs());
        return toSend;
    }
View Full Code Here

Examples of com.cumulocity.rest.representation.operation.OperationRepresentation

    OperationsQueue testObj;
   
    @Before
    public void setUp() {
        testObj = new OperationsQueue();
        OperationRepresentation op1 = new OperationRepresentation();
        op1.setId(new GId("op1"));
        OperationRepresentation op2 = new OperationRepresentation();
        op2.setId(new GId("op2"));
        testObj.add(op1);
        testObj.add(op2);
    }
View Full Code Here

Examples of com.cumulocity.rest.representation.operation.OperationRepresentation

        testObj.add(op2);
    }
   
    @Test
    public void testAddUnique() {
        OperationRepresentation op3 = new OperationRepresentation();
        op3.setId(new GId("op3"));
        assertTrue(testObj.add(op3));
        assertThat(testObj.size(), equalTo(3));
    }
View Full Code Here

Examples of com.cumulocity.rest.representation.operation.OperationRepresentation

        assertThat(testObj.size(), equalTo(3));
    }

    @Test
    public void testAddNonUnique() {
        OperationRepresentation opNonUnique = new OperationRepresentation();
        opNonUnique.setId(new GId("op2"));
        assertFalse(testObj.add(opNonUnique));
        assertThat(testObj.size(), equalTo(2));
    }
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.