Package com.cumulocity.rest.representation.operation

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


        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

        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

        assertThat(testObj.size(), equalTo(2));
    }
   
    @Test
    public void testAddNonUniqueList() {
        OperationRepresentation opNonUnique1 = new OperationRepresentation();
        opNonUnique1.setId(new GId("op1"));
        OperationRepresentation opNonUnique2 = new OperationRepresentation();
        opNonUnique2.setId(new GId("op2"));
        List<OperationRepresentation> list = new LinkedList<OperationRepresentation>();
        list.add(opNonUnique1);
        list.add(opNonUnique2);
       
        assertFalse(testObj.addAll(list));
View Full Code Here

        assertThat(testObj.size(), equalTo(2));
    }
   
    @Test
    public void testAddUniqueList() {
        OperationRepresentation opUnique1 = new OperationRepresentation();
        opUnique1.setId(new GId("op3"));
        OperationRepresentation opUnique2 = new OperationRepresentation();
        opUnique2.setId(new GId("op4"));
        List<OperationRepresentation> list = new LinkedList<OperationRepresentation>();
        list.add(opUnique1);
        list.add(opUnique2);
       
        assertTrue(testObj.addAll(list));
View Full Code Here

        assertThat(testObj.size(), equalTo(4));
    }
   
    @Test
    public void testAddMixedList() {
        OperationRepresentation opUnique1 = new OperationRepresentation();
        opUnique1.setId(new GId("op3"));
        OperationRepresentation opNonUnique2 = new OperationRepresentation();
        opNonUnique2.setId(new GId("op1"));
        List<OperationRepresentation> list = new LinkedList<OperationRepresentation>();
        list.add(opUnique1);
        list.add(opNonUnique2);
       
        assertTrue(testObj.addAll(list)); //queue was changed, even if not all elements were added
View Full Code Here

        when(deviceControlApi.getOperation(any(GId.class))).thenReturn(operationRep);
        when(deviceControlApi.update(any(OperationRepresentation.class))).thenAnswer(new Answer<OperationRepresentation>() {
            @Override
            public OperationRepresentation answer(InvocationOnMock invocation) throws Throwable {
                OperationRepresentation passedOperation = (OperationRepresentation) invocation.getArguments()[0];
                statusesRecordedOnDeviceControlApiMock.add(passedOperation.getStatus());
                return passedOperation;
            }
        });
    }
View Full Code Here

    @Test
    public void testOperationProcessingSuccessful() throws Exception {
        //GIVEN
        GId id = new GId("op");

        OperationRepresentation op = new OperationRepresentation();
        op.setId(id);
        queue.add(op);
        when(operationProcessor.process(op)).thenReturn(true);

        //WHEN
        testObj.start();
View Full Code Here

    @Test
    public void testOperationProcessingFailed() throws Exception {
        //GIVEN
        GId id = new GId("op");
        OperationRepresentation op = new OperationRepresentation();
        op.setId(id);
        queue.add(op);
        when(operationProcessor.process(op)).thenReturn(false);

        //WHEN
        testObj.start();
View Full Code Here

    }

    @Test
    public void testStartStop() throws Exception {
        // Given
        OperationRepresentation op = new OperationRepresentation();
        op.setId(new GId("op"));

        // When
        queue.add(op);

        // Then
View Full Code Here

TOP

Related Classes of com.cumulocity.rest.representation.operation.OperationRepresentation

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.