Package com.cumulocity.rest.representation.identity

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


        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

        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

        Map<String, String> params = new HashMap<String, String>();
        params.put("type", extIdType);
        params.put("externaId", extIdValue);

        ExternalIDRepresentation extIdRep = new ExternalIDRepresentation();

        identityApiRep.setExternalId(TEMPLATE_URL);
        when(templateUrlParser.replacePlaceholdersWithParams(TEMPLATE_URL, params)).thenReturn(EXACT_URL);
        when(restConnector.get(EXACT_URL, IdentityMediaType.EXTERNAL_ID, ExternalIDRepresentation.class)).thenReturn(extIdRep);

       
        // When
        ExternalIDRepresentation result = identityApiImpl.getExternalId(extID);

        // Then
        assertThat(result, sameInstance(extIdRep));
    }
View Full Code Here

    @Test
    public void testDelete() throws SDKException {
        // Given
        String extIdType = "myExtIdType";
        String extIdValue = "myExtIdValue";
        ExternalIDRepresentation extIdRep = new ExternalIDRepresentation();
        extIdRep.setExternalId(extIdValue);
        extIdRep.setType(extIdType);

        Map<String, String> params = new HashMap<String, String>();
        params.put("type", extIdType);
        params.put("externaId", extIdValue);
View Full Code Here

        // Given
        ManagedObjectRepresentation mo = new ManagedObjectRepresentation();
        String globalIdValue = "myGlobalIdValue";
        mo.setId(new GId(globalIdValue));

        ExternalIDRepresentation repToCreate = new ExternalIDRepresentation();
        repToCreate.setManagedObject(mo);

        ExternalIDRepresentation createdRep = new ExternalIDRepresentation();

        identityApiRep.setExternalIdsOfGlobalId(TEMPLATE_URL);
        when(templateUrlParser.replacePlaceholdersWithParams(TEMPLATE_URL, singletonMap("globalId", globalIdValue))).thenReturn(EXACT_URL);
        when(restConnector.post(EXACT_URL, IdentityMediaType.EXTERNAL_ID, repToCreate)).thenReturn(createdRep);

        // When
        ExternalIDRepresentation result = identityApiImpl.create(repToCreate);

        // Then
        assertThat(result, sameInstance(createdRep));
    }
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

        GId gId = new GId();
        gId.setValue(Long.toString(globalId));
        mo.setId(gId);

        for (Row row : rows) {
            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(input.get(0).getExternalId());
        extIdRep.setType(input.get(0).getType());
        identity.deleteExternalId(extIdRep);
    }
View Full Code Here

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

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

    }
View Full Code Here

TOP

Related Classes of com.cumulocity.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.