Package com.cumulocity.me.rest.representation.identity

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


   
    @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

    @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

    // 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

        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

        }
    }

    @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

        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

TOP

Related Classes of com.cumulocity.me.rest.representation.identity.ExternalIDRepresentation

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.