Package c8y

Examples of c8y.Relay


   
    @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


    private static final String PROP_STATE = "state";
   
    public JSONObject toJson(Object representation) {
        JSONObject json = new JSONObject();
        Relay relayControl = (Relay) representation;
        putString(json, PROP_STATE, relayControl.getRelayState().name());
        return json;
    }
View Full Code Here

        putString(json, PROP_STATE, relayControl.getRelayState().name());
        return json;
    }

    public Object fromJson(JSONObject json) {
        Relay relayControl = new Relay();
        relayControl.setRelayState(RelayState.OPEN);
        return relayControl;
    }
View Full Code Here

    private String relayRepresentationWithInvalidState = "{\"relayState\":\"MEH\"}";

    @Test
    public final void testThatTheRepresentationOfTheEnumerationSerializesCorrectlyIfStateIsValid() {
        Relay relay = new Relay();
        relay.setRelayState(RelayState.OPEN);
        Relay newRelay = JSONParser.defaultJSONParser().parse(Relay.class, relayRepresentationWithValidState);
        assertTrue(newRelay.getRelayState().equals(relay.getRelayState()));
    }
View Full Code Here

TOP

Related Classes of c8y.Relay

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.