IdentityClientImpl implements IdentityClient { @Override public String getUserId(IdentityContextMessage identityContextMessage) throws Exception { String jsonIdentityContextMessage = _jsonObjectMapper.map( identityContextMessage); String identityPath = String.format( "/%s%s", identityContextMessage.getDataSourceId(), _SYSTEM_PROPERTY_VALUE_IDENTITY_GATEWAY_PATH); if (_logger.isDebugEnabled()) { _logger.debug( "Sending identity request {} to destination {} jsonIdentityContextMessage, _SYSTEM_PROPERTY_VALUE_IDENTITY_GATEWAY_PROTOCOL, _SYSTEM_PROPERTY_VALUE_IDENTITY_GATEWAY_HOST, _SYSTEM_PROPERTY_VALUE_IDENTITY_GATEWAY_PORT, identityPath); } _jsonWebServiceClient.setHostName( _SYSTEM_PROPERTY_VALUE_IDENTITY_GATEWAY_HOST); _jsonWebServiceClient.setHostPort( GetterUtil.getInteger( _SYSTEM_PROPERTY_VALUE_IDENTITY_GATEWAY_PORT)); _jsonWebServiceClient.setProtocol( _SYSTEM_PROPERTY_VALUE_IDENTITY_GATEWAY_PROTOCOL); return _jsonWebServiceClient.doPostAsJSON( identityPath, jsonIdentityContextMessage); }  @Override String getUserId(IdentityContextMessage identityContextMessage);  }
@Test public void testGetUUID() throws Exception { IdentityContextMessage.Builder identityContextMessageBuilder = IdentityContextMessage.builder("ApplicationKey"); identityContextMessageBuilder.dataSourceIdentifier("Liferay"); identityContextMessageBuilder.dataSourceIndividualIdentifier("12345"); identityContextMessageBuilder.domain("liferay.com"); identityContextMessageBuilder.language("en-US"); identityContextMessageBuilder.protocolVersion("1.0"); identityContextMessageBuilder.identityFieldsProperty( "email", "julio.camarero@liferay.com"); identityContextMessageBuilder.identityFieldsProperty( "name", "Julio Camarero"); String response = _identityClientImpl.getUserId( identityContextMessageBuilder.build()); Assert.assertNotNull(response); }