package org.springframework.cloud.cloudfoundry;

import java.util.Map;

import org.springframework.cloud.service.common.MongoServiceInfo;

/**
 * 
 * @author Ramnivas Laddad
 *
 */
public class MongoServiceInfoCreator extends CloudFoundryServiceInfoCreator<MongoServiceInfo> {

	public MongoServiceInfoCreator() {
		super("mongodb");

	}

	public MongoServiceInfo createServiceInfo(Map<String,Object> serviceData) {
		@SuppressWarnings("unchecked")
		Map<String,Object> credentials = (Map<String, Object>) serviceData.get("credentials");
		
		String id = (String) serviceData.get("name");
		
		String uri = (String) credentials.get("uri");

		return new MongoServiceInfo(id, uri);
	}

}

@@ -138,17 +138,16 @@
 %0A%0A/**%0A *
- 
 %0A * @aut
@@ -526,26 +526,24 @@
 dentials%22);%0A
-%09%09
 %0A%09%09String id
@@ -579,18 +579,16 @@
 name%22);%0A
-%09%09
 %0A%09%09Strin
@@ -604,16 +604,18 @@
 String) 
+((
 credenti
@@ -628,16 +628,76 @@
 t(%22uri%22)
+ == null) ? credentials.get(%22url%22) : credentials.get(%22uri%22))
 ;%0A%0A%09%09ret

Add fix for MongoDb if url is used instead of uri