Package com.cumulocity.model.idtype

Examples of com.cumulocity.model.idtype.GId


    @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


            while (isActive()) {
                try {
                    op = queue.poll(queuePollTimeOut, TimeUnit.MILLISECONDS);
                    if (op != null) {
                        // TODO - refactor. This isn't pretty
                        GId gid = op.getId();
                        Boolean internalOperation = false;
                        if (gid.getValue().startsWith(OperationsQueueHandler.INTERNAL)) {
                            internalOperation = true;
                        }

                        OperationRepresentation executingOperation = null;
                        if (!internalOperation) {
View Full Code Here

    OperationCollectionRepresentation allOperations;

    @Given("^I have a poller for agent '([^']*)'$")
    public void iHaveAPollerForAgent(int arg1) throws Exception {
        GId agentId = getMoId(arg1);
        poller = new OperationsByAgentAndStatusPollerImpl(deviceControlResource, agentId.getValue(), OperationStatus.PENDING,
                operationProcessor);
        poller.start();
    }
View Full Code Here

        poller.start();
    }

    @Given("^I have a operation subscriber for agent '([^']*)'$")
    public void iHaveAOperationSubscriberForAgent(int arg1) throws Exception {
        GId agentId = getMoId(arg1);
        subscriber = new OperationNotificationSubscriber(platform);
        subscriber.subscribe(agentId, new SubscriptionListener<GId, OperationRepresentation>() {

            @Override
            public void onNotification(Subscription<GId> subscription, OperationRepresentation notification) {
View Full Code Here

        }
    }

    @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

        assertThat(allOperations.getOperations().size(), is(equalTo(amount)));
    }

    @When("^I call get on created operation$")
    public void iCallGetOnCreatedOperation() throws Exception {
        GId operationId = operation1.getId();
        operation1 = deviceControlResource.getOperation(operationId);
    }
View Full Code Here

        OperationFilter filter = new OperationFilter().byAgent(getMoId(agentNum).getValue());
        allOperations = deviceControlResource.getOperationsByFilter(filter).get();
    }

    private GId getMoId(int arg1) {
        GId deviceId = managedObjects.get(arg1).getId();
        return deviceId;
    }
View Full Code Here

        ManagedObjectRepresentation representation = new ManagedObjectRepresentation();
        returnResponseWhenPosting(representation);
        when(parser.parse(response, 201, 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.post(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

        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

    }
   
    @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

TOP

Related Classes of com.cumulocity.model.idtype.GId

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.