Examples of ExternalIDRepresentation


Examples of com.cumulocity.me.rest.representation.identity.ExternalIDRepresentation

        converter.setJsonConversionService(conversionService);
    }
   
    @Test
    public void shouldFormatEmptyExternalIDRepresentation() throws Exception {
        JSONObject json = converter.toJson(new ExternalIDRepresentation());
       
        assertThat(json.toString()).isEqualTo("{}");
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.identity.ExternalIDRepresentation

   
    @Test
    public void shouldParseWithSimpleProps() throws Exception {
        JSONObject json = new JSONObject("{\"externalId\":\"some_id\",\"type\":\"some_type\"}");
       
        ExternalIDRepresentation parsed = (ExternalIDRepresentation) converter.fromJson(json);
       
        assertThat(parsed.getExternalId()).isEqualTo(externalId);
        assertThat(parsed.getType()).isEqualTo(type);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.identity.ExternalIDRepresentation

    @Test
    public void shouldParseWithComplexProps() throws Exception {
        when(conversionService.fromJson(jsonObject("{\"id\":\"src_id\"}"), same(ManagedObjectRepresentation.class))).thenReturn(managedObject);
        JSONObject json = new JSONObject("{\"externalId\":\"some_id\",\"managedObject\":{\"id\":\"src_id\"},\"type\":\"some_type\"}");
       
        ExternalIDRepresentation parsed = (ExternalIDRepresentation) converter.fromJson(json);
       
        assertThat(parsed.getExternalId()).isEqualTo(externalId);
        assertThat(parsed.getType()).isEqualTo(type);
        assertThat(parsed.getManagedObject()).isSameAs(managedObject);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.identity.ExternalIDRepresentation

    // Given
    // ------------------------------------------------------------------------

    @Given("I have external id for '(\\d+)' with value '([^']*)' and type '([^']*)'")
    public void iHaveManagedObject(long globalId, String extId, String type) {
        ExternalIDRepresentation rep = new ExternalIDRepresentation();
        rep.setExternalId(extId);
        rep.setType(type);
        ManagedObjectRepresentation mo = new ManagedObjectRepresentation();
        GId gId = new GId();
        gId.setValue(Long.toString(globalId));
        mo.setId(gId);
        rep.setManagedObject(mo);
        input.add(rep);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.identity.ExternalIDRepresentation

        Iterator iterator = rows.iterator();

        while (iterator.hasNext()) {
            Row row = (Row) iterator.next();
            ExternalIDRepresentation rep = new ExternalIDRepresentation();
            rep.setExternalId(row.value);
            rep.setType(row.type);
            rep.setManagedObject(mo);
            input.add(rep);
        }
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.identity.ExternalIDRepresentation

        }
    }

    @When("I delete the external id")
    public void iDeleteTheExternalId() throws SDKException {
        ExternalIDRepresentation extIdRep = new ExternalIDRepresentation();
        extIdRep.setExternalId(((ExternalIDRepresentation) input.get(0)).getExternalId());
        extIdRep.setType(((ExternalIDRepresentation) input.get(0)).getType());
        identity.deleteExternalId(extIdRep);
    }
View Full Code Here

Examples of com.cumulocity.me.rest.representation.identity.ExternalIDRepresentation

        for (int index = 0; index < input.size(); index++) {
            result.put(((ExternalIDRepresentation) collection1.getExternalIds().get(index)).getExternalId(), collection1.getExternalIds().get(index));
        }

        for (int index = 0; index < input.size(); index++) {
            ExternalIDRepresentation rep = (ExternalIDRepresentation) result.get(((ExternalIDRepresentation) input.get(index)).getExternalId());
            assertNotNull(rep);
            assertEquals(((ExternalIDRepresentation) input.get(index)).getType(), rep.getType());
            assertEquals(((ExternalIDRepresentation) input.get(index)).getManagedObject().getId().getValue(), rep.getManagedObject().getId().getValue());
        }

    }
View Full Code Here

Examples of com.cumulocity.rest.representation.identity.ExternalIDRepresentation

    }

    @Test
    public void createAndDeleteManagedObject() throws Exception {
        // Given
        ExternalIDRepresentation xtIDRep = createExternalIDRep(XT_ID, XT_TYPE);

        ManagedObjectRepresentation moRep1 = createManagedObjectAndAssignExternalID("object1", xtIDRep);
        ManagedObject retrievedMO1 = getManageObjectByExternalID(getExternalIDBoundToGId(moRep1.getId()));
        retrievedMO1.delete();
View Full Code Here

Examples of com.cumulocity.rest.representation.identity.ExternalIDRepresentation

        return xtIDcollectionRep.getExternalIds().get(0);
    }

    private void assignExternalID(ManagedObjectRepresentation moRep, ExternalIDRepresentation xtIDRep) throws SDKException {
        xtIDRep.setManagedObject(moRep);
        ExternalIDRepresentation result = identity.create(xtIDRep);
        xtCollection.add(result);
    }
View Full Code Here

Examples of com.cumulocity.rest.representation.identity.ExternalIDRepresentation

        ExternalIDRepresentation result = identity.create(xtIDRep);
        xtCollection.add(result);
    }

    private ExternalIDRepresentation createExternalIDRep(String extId, String type) {
        ExternalIDRepresentation xtIDRep = new ExternalIDRepresentation();
        xtIDRep.setExternalId(extId);
        xtIDRep.setType(type);
        return xtIDRep;
    }
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.