Author: doll
Date: Mon Aug 25 14:01:15 2008
New Revision: 688881
URL: http://svn.apache.org/viewvc?rev=688881&view=rev
Log:
0.8.1 change
the emails field now just has "type" and "value" as its attributes which
rendered the actual pojo unneccessary. it now uses the more general ListField
object
(note: this will probably occur with more of them)
also note: because the opensocial js has not changed its field names the js has
to convert these inside the jsonrpccontainer
Removed:
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/EmailImpl.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Email.java
Modified:
incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConfig.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ListField.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXmlConverterTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/JsonConverterPerformancePerf.java
incubator/shindig/trunk/javascript/sampledata/canonicaldb.json
Modified:
incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js
(original)
+++ incubator/shindig/trunk/features/opensocial-current/jsonrpccontainer.js Mon
Aug 25 14:01:15 2008
@@ -258,6 +258,14 @@
};
JsonRpcContainer.prototype.createPersonFromJson = function(serverJson) {
+ // We need to translate from the new person fields to the old ones
+ // TODO(doll): Pull this out into a separate file
+ if (serverJson.emails) {
+ for (var i = 0; i < serverJson.emails.length; i++) {
+ serverJson.emails[i].address = serverJson.emails[i].value;
+ }
+ }
+
return new JsonPerson(serverJson);
};
Modified:
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/model/PersonImpl.java
Mon Aug 25 14:01:15 2008
@@ -20,7 +20,6 @@
import org.apache.shindig.social.opensocial.model.Account;
import org.apache.shindig.social.opensocial.model.Address;
import org.apache.shindig.social.opensocial.model.BodyType;
-import org.apache.shindig.social.opensocial.model.Email;
import org.apache.shindig.social.opensocial.model.Enum;
import org.apache.shindig.social.opensocial.model.ListField;
import org.apache.shindig.social.opensocial.model.Name;
@@ -50,7 +49,7 @@
private Address currentLocation;
private Date dateOfBirth;
private Enum<Enum.Drinker> drinker;
- private List<Email> emails;
+ private List<ListField> emails;
private String ethnicity;
private String fashion;
private List<String> food;
@@ -204,11 +203,11 @@
this.drinker = newDrinker;
}
- public List<Email> getEmails() {
+ public List<ListField> getEmails() {
return emails;
}
- public void setEmails(List<Email> emails) {
+ public void setEmails(List<ListField> emails) {
this.emails = emails;
}
Modified:
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConfig.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConfig.java?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConfig.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/util/BeanJsonLibConfig.java
Mon Aug 25 14:01:15 2008
@@ -18,8 +18,8 @@
package org.apache.shindig.social.core.util;
import org.apache.shindig.social.opensocial.model.Address;
-import org.apache.shindig.social.opensocial.model.Email;
import org.apache.shindig.social.opensocial.model.Enum;
+import org.apache.shindig.social.opensocial.model.ListField;
import org.apache.shindig.social.opensocial.model.MediaItem;
import org.apache.shindig.social.opensocial.model.Organization;
import org.apache.shindig.social.opensocial.model.Phone;
@@ -27,15 +27,14 @@
import com.google.inject.Inject;
import com.google.inject.Injector;
-
-import java.util.HashMap;
-import java.util.Map;
-
import net.sf.ezmorph.MorpherRegistry;
import net.sf.json.JsonConfig;
import net.sf.json.util.EnumMorpher;
import net.sf.json.util.JSONUtils;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* A Json Config class suitable for serializing Shindig json and pojos.
*/
@@ -49,7 +48,7 @@
MorpherRegistry morpherRegistry = JSONUtils.getMorpherRegistry();
morpherRegistry.registerMorpher(new EnumMorpher(Address.Field.class));
morpherRegistry.registerMorpher(new EnumMorpher(Phone.Field.class));
- morpherRegistry.registerMorpher(new EnumMorpher(Email.Field.class));
+ morpherRegistry.registerMorpher(new EnumMorpher(ListField.Field.class));
morpherRegistry.registerMorpher(new EnumMorpher(MediaItem.Field.class));
morpherRegistry.registerMorpher(new EnumMorpher(MediaItem.Type.class));
morpherRegistry.registerMorpher(new EnumMorpher(Enum.Drinker.class));
@@ -110,7 +109,7 @@
// Person map
classMap.put("addresses", Address.class);
classMap.put("phoneNumbers", Phone.class);
- classMap.put("emails", Email.class);
+ classMap.put("emails", ListField.class);
classMap.put("mediaItems", MediaItem.class);
classMap.put("jobs", Organization.class);
classMap.put("schools", Organization.class);
Modified:
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ListField.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ListField.java?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ListField.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/ListField.java
Mon Aug 25 14:01:15 2008
@@ -17,7 +17,30 @@
*/
package org.apache.shindig.social.opensocial.model;
+import org.apache.shindig.social.core.model.ListFieldImpl;
+
+import com.google.inject.ImplementedBy;
+
[EMAIL PROTECTED](ListFieldImpl.class)
+
public interface ListField {
+
+ public static enum Field {
+ VALUE("value"),
+ TYPE("type");
+
+ private final String jsonString;
+
+ private Field(String jsonString) {
+ this.jsonString = jsonString;
+ }
+
+ @Override
+ public String toString() {
+ return this.jsonString;
+ }
+ }
+
String getType();
void setType(String type);
Modified:
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/model/Person.java
Mon Aug 25 14:01:15 2008
@@ -230,7 +230,7 @@
void setAboutMe(String aboutMe);
List<Account> getAccounts();
-
+
void setAccounts(List<Account> accounts);
/**
@@ -391,20 +391,20 @@
void setDrinker(Enum<Enum.Drinker> newDrinker);
/**
- * Get the person's Emails associated with the person, specified as an List
of [EMAIL PROTECTED] Email}.
+ * Get the person's Emails associated with the person.
* Container support for this field is OPTIONAL.
*
* @return a list of the person's emails
*/
- List<Email> getEmails();
+ List<ListField> getEmails();
/**
- * Set the person's Emails associated with the person, specified as an List
of [EMAIL PROTECTED] Email}.
+ * Set the person's Emails associated with the person.
* Container support for this field is OPTIONAL.
*
* @param emails a list of the person's emails
*/
- void setEmails(List<Email> emails);
+ void setEmails(List<ListField> emails);
/**
* Get the person's ethnicity, specified as a string. Container support for
this field is
Modified:
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/RestfulJsonPeopleTest.java
Mon Aug 25 14:01:15 2008
@@ -19,8 +19,8 @@
import org.apache.shindig.social.core.model.AddressImpl;
import org.apache.shindig.social.core.model.BodyTypeImpl;
-import org.apache.shindig.social.core.model.EmailImpl;
import org.apache.shindig.social.core.model.EnumImpl;
+import org.apache.shindig.social.core.model.ListFieldImpl;
import org.apache.shindig.social.core.model.NameImpl;
import org.apache.shindig.social.core.model.OrganizationImpl;
import org.apache.shindig.social.core.model.PersonImpl;
@@ -28,8 +28,8 @@
import org.apache.shindig.social.core.model.UrlImpl;
import org.apache.shindig.social.opensocial.model.Address;
import org.apache.shindig.social.opensocial.model.BodyType;
-import org.apache.shindig.social.opensocial.model.Email;
import org.apache.shindig.social.opensocial.model.Enum;
+import org.apache.shindig.social.opensocial.model.ListField;
import org.apache.shindig.social.opensocial.model.Name;
import org.apache.shindig.social.opensocial.model.Organization;
import org.apache.shindig.social.opensocial.model.Person;
@@ -96,7 +96,7 @@
canonical.setDateOfBirth(new Date());
canonical.setDrinker(new EnumImpl<Enum.Drinker>(Enum.Drinker.SOCIALLY));
- Email email = new EmailImpl("[EMAIL PROTECTED]", "work");
+ ListField email = new ListFieldImpl("work", "[EMAIL PROTECTED]");
canonical.setEmails(Lists.newArrayList(email));
canonical.setEthnicity("developer");
@@ -206,7 +206,7 @@
* {'unstructuredAddress' : 'My home address'}
* ],
* 'emails' : [
- * { 'address' : '[EMAIL PROTECTED]', 'type' : 'work'},
+ * { 'value' : '[EMAIL PROTECTED]', 'type' : 'work'},
* ]
*
* ... etc, etc for all fields in the person object
@@ -269,12 +269,12 @@
assertEquals(1, emailArray.length());
for (int i = 0; i < canonical.getEmails().size(); i++) {
- Email expectedEmail = canonical.getEmails().get(i);
+ ListField expectedEmail = canonical.getEmails().get(i);
JSONObject actualEmail = emailArray.getJSONObject(i);
assertEquals(expectedEmail.getType(),
- actualEmail.getString(Email.Field.TYPE.toString()));
- assertEquals(expectedEmail.getAddress(),
- actualEmail.getString(Email.Field.ADDRESS.toString()));
+ actualEmail.getString(ListField.Field.TYPE.toString()));
+ assertEquals(expectedEmail.getValue(),
+ actualEmail.getString(ListField.Field.VALUE.toString()));
}
assertStringField(result, canonical.getEthnicity(),
Person.Field.ETHNICITY);
Modified:
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonConverterTest.java
Mon Aug 25 14:01:15 2008
@@ -20,7 +20,7 @@
import org.apache.shindig.social.SocialApiTestsGuiceModule;
import org.apache.shindig.social.core.model.ActivityImpl;
import org.apache.shindig.social.core.model.AddressImpl;
-import org.apache.shindig.social.core.model.EmailImpl;
+import org.apache.shindig.social.core.model.ListFieldImpl;
import org.apache.shindig.social.core.model.MediaItemImpl;
import org.apache.shindig.social.core.model.NameImpl;
import org.apache.shindig.social.core.model.PersonImpl;
@@ -28,7 +28,7 @@
import org.apache.shindig.social.core.util.BeanJsonConverter;
import org.apache.shindig.social.opensocial.model.Activity;
import org.apache.shindig.social.opensocial.model.Address;
-import org.apache.shindig.social.opensocial.model.Email;
+import org.apache.shindig.social.opensocial.model.ListField;
import org.apache.shindig.social.opensocial.model.MediaItem;
import org.apache.shindig.social.opensocial.model.Person;
import org.apache.shindig.social.opensocial.model.Phone;
@@ -59,9 +59,9 @@
johnDoe.setAddresses(Lists.<Address>newArrayList(new AddressImpl("My home
address")));
- johnDoe.setEmails(Lists.<Email>newArrayList(
- new EmailImpl("[EMAIL PROTECTED]", "work"),
- new EmailImpl("[EMAIL PROTECTED]", "home")));
+ johnDoe.setEmails(Lists.<ListField>newArrayList(
+ new ListFieldImpl("work", "[EMAIL PROTECTED]"),
+ new ListFieldImpl("home", "[EMAIL PROTECTED]")));
activity = new ActivityImpl("activityId", johnDoe.getId());
@@ -119,11 +119,11 @@
assertEquals(2, emailArray.length());
for (int i = 0; i < johnDoe.getEmails().size(); i++) {
- Email expectedEmail = johnDoe.getEmails().get(i);
+ ListField expectedEmail = johnDoe.getEmails().get(i);
JSONObject actualEmail = emailArray.getJSONObject(i);
assertEquals(expectedEmail.getType(), actualEmail.getString("type"));
- assertEquals(expectedEmail.getAddress(),
- actualEmail.getString("address"));
+ assertEquals(expectedEmail.getValue(),
+ actualEmail.getString("value"));
}
}
Modified:
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanJsonLibConverterTest.java
Mon Aug 25 14:01:15 2008
@@ -17,18 +17,10 @@
*/
package org.apache.shindig.social.opensocial.util;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.shindig.social.JsonLibTestsGuiceModule;
import org.apache.shindig.social.core.model.ActivityImpl;
import org.apache.shindig.social.core.model.AddressImpl;
-import org.apache.shindig.social.core.model.EmailImpl;
+import org.apache.shindig.social.core.model.ListFieldImpl;
import org.apache.shindig.social.core.model.MediaItemImpl;
import org.apache.shindig.social.core.model.NameImpl;
import org.apache.shindig.social.core.model.PersonImpl;
@@ -37,7 +29,7 @@
import org.apache.shindig.social.core.util.BeanJsonLibConverter;
import org.apache.shindig.social.opensocial.model.Activity;
import org.apache.shindig.social.opensocial.model.Address;
-import org.apache.shindig.social.opensocial.model.Email;
+import org.apache.shindig.social.opensocial.model.ListField;
import org.apache.shindig.social.opensocial.model.MediaItem;
import org.apache.shindig.social.opensocial.model.Name;
import org.apache.shindig.social.opensocial.model.Person;
@@ -47,6 +39,13 @@
import com.google.common.collect.Maps;
import com.google.inject.Guice;
import com.google.inject.Injector;
+import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
public class BeanJsonLibConverterTest extends TestCase {
@@ -78,17 +77,17 @@
public void setUp() throws Exception {
super.setUp();
johnDoe = new PersonImpl("johnDoeId", new NameImpl("John Doe"));
- johnDoe.setPhoneNumbers(Lists.<Phone> newArrayList(new
PhoneImpl("+33H000000000", "home"),
+ johnDoe.setPhoneNumbers(Lists.<Phone>newArrayList(new
PhoneImpl("+33H000000000", "home"),
new PhoneImpl("+33M000000000", "mobile"), new
PhoneImpl("+33W000000000", "work")));
- johnDoe.setAddresses(Lists.<Address> newArrayList(new AddressImpl("My home
address")));
+ johnDoe.setAddresses(Lists.<Address>newArrayList(new AddressImpl("My home
address")));
- johnDoe.setEmails(Lists.<Email> newArrayList(new EmailImpl("[EMAIL
PROTECTED]", "work"),
- new EmailImpl("[EMAIL PROTECTED]", "home")));
+ johnDoe.setEmails(Lists.<ListField>newArrayList(new ListFieldImpl("work",
"[EMAIL PROTECTED]"),
+ new ListFieldImpl("home", "[EMAIL PROTECTED]")));
activity = new ActivityImpl("activityId", johnDoe.getId());
- activity.setMediaItems(Lists.<MediaItem> newArrayList(new
MediaItemImpl("image/jpg",
+ activity.setMediaItems(Lists.<MediaItem>newArrayList(new
MediaItemImpl("image/jpg",
MediaItem.Type.IMAGE, "http://foo.bar")));
Injector injector = Guice.createInjector(new JsonLibTestsGuiceModule());
@@ -230,10 +229,10 @@
assertEquals(2, parsedPerson.getEmails().size());
for (int i = 0; i < johnDoe.getEmails().size(); i++) {
- Email expectedEmail = johnDoe.getEmails().get(i);
- Email actualEmail = parsedPerson.getEmails().get(i);
+ ListField expectedEmail = johnDoe.getEmails().get(i);
+ ListField actualEmail = parsedPerson.getEmails().get(i);
assertEquals(expectedEmail.getType(), actualEmail.getType());
- assertEquals(expectedEmail.getAddress(), actualEmail.getAddress());
+ assertEquals(expectedEmail.getValue(), actualEmail.getValue());
}
}
Modified:
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXmlConverterTest.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXmlConverterTest.java?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXmlConverterTest.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/BeanXmlConverterTest.java
Mon Aug 25 14:01:15 2008
@@ -20,7 +20,7 @@
import org.apache.shindig.common.xml.XmlUtil;
import org.apache.shindig.social.core.model.ActivityImpl;
import org.apache.shindig.social.core.model.AddressImpl;
-import org.apache.shindig.social.core.model.EmailImpl;
+import org.apache.shindig.social.core.model.ListFieldImpl;
import org.apache.shindig.social.core.model.MediaItemImpl;
import org.apache.shindig.social.core.model.NameImpl;
import org.apache.shindig.social.core.model.PersonImpl;
@@ -28,7 +28,7 @@
import org.apache.shindig.social.core.util.BeanXmlConverter;
import org.apache.shindig.social.opensocial.model.Activity;
import org.apache.shindig.social.opensocial.model.Address;
-import org.apache.shindig.social.opensocial.model.Email;
+import org.apache.shindig.social.opensocial.model.ListField;
import org.apache.shindig.social.opensocial.model.MediaItem;
import org.apache.shindig.social.opensocial.model.Person;
import org.apache.shindig.social.opensocial.model.Phone;
@@ -60,9 +60,9 @@
johnDoe.setAddresses(Lists.<Address>newArrayList(new AddressImpl("My home
address")));
- johnDoe.setEmails(Lists.<Email>newArrayList(
- new EmailImpl("[EMAIL PROTECTED]", "work"),
- new EmailImpl("[EMAIL PROTECTED]", "home")));
+ johnDoe.setEmails(Lists.<ListField>newArrayList(
+ new ListFieldImpl("work", "[EMAIL PROTECTED]"),
+ new ListFieldImpl("home", "[EMAIL PROTECTED]")));
activity = new ActivityImpl("activityId", johnDoe.getId());
Modified:
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/JsonConverterPerformancePerf.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/JsonConverterPerformancePerf.java?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/JsonConverterPerformancePerf.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/JsonConverterPerformancePerf.java
Mon Aug 25 14:01:15 2008
@@ -17,15 +17,11 @@
*/
package org.apache.shindig.social.opensocial.util;
-import junit.framework.TestCase;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.shindig.social.JsonLibTestsGuiceModule;
import org.apache.shindig.social.SocialApiTestsGuiceModule;
import org.apache.shindig.social.core.model.ActivityImpl;
import org.apache.shindig.social.core.model.AddressImpl;
-import org.apache.shindig.social.core.model.EmailImpl;
+import org.apache.shindig.social.core.model.ListFieldImpl;
import org.apache.shindig.social.core.model.MediaItemImpl;
import org.apache.shindig.social.core.model.NameImpl;
import org.apache.shindig.social.core.model.PersonImpl;
@@ -34,16 +30,18 @@
import org.apache.shindig.social.core.util.BeanJsonLibConverter;
import org.apache.shindig.social.opensocial.model.Activity;
import org.apache.shindig.social.opensocial.model.Address;
-import org.apache.shindig.social.opensocial.model.Email;
+import org.apache.shindig.social.opensocial.model.ListField;
import org.apache.shindig.social.opensocial.model.MediaItem;
import org.apache.shindig.social.opensocial.model.Person;
import org.apache.shindig.social.opensocial.model.Phone;
-import org.json.JSONObject;
-
import com.google.common.collect.Lists;
import com.google.inject.Guice;
import com.google.inject.Injector;
+import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.json.JSONObject;
public class JsonConverterPerformancePerf extends TestCase {
@@ -64,12 +62,12 @@
"+33H000000000", "home"), new PhoneImpl("+33M000000000", "mobile"),
new PhoneImpl("+33W000000000", "work")));
- johnDoe.setAddresses(Lists.<Address> newArrayList(new AddressImpl(
- "My home address")));
+ johnDoe.setAddresses(Lists.<Address>newArrayList(
+ new AddressImpl("My home address")));
- johnDoe.setEmails(Lists.<Email> newArrayList(new EmailImpl(
- "[EMAIL PROTECTED]", "work"),
- new EmailImpl("[EMAIL PROTECTED]", "home")));
+ johnDoe.setEmails(Lists.<ListField>newArrayList(
+ new ListFieldImpl("work", "[EMAIL PROTECTED]"),
+ new ListFieldImpl("home", "[EMAIL PROTECTED]")));
activity = new ActivityImpl("activityId", johnDoe.getId());
@@ -135,7 +133,7 @@
/*
* Output the time per conversion and the memory usage - the output per
* conversion.
- *
+ *
*/
log.info("SF JSON Lib Output "
@@ -203,7 +201,7 @@
r.gc();
long stringsizeStart = r.totalMemory()-r.freeMemory();
-
+
for (int i = 0; i < TEST_SIZE; i++) {
serializeOutput[i] = new String(source);
}
Modified: incubator/shindig/trunk/javascript/sampledata/canonicaldb.json
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/sampledata/canonicaldb.json?rev=688881&r1=688880&r2=688881&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/sampledata/canonicaldb.json (original)
+++ incubator/shindig/trunk/javascript/sampledata/canonicaldb.json Mon Aug 25
14:01:15 2008
@@ -60,7 +60,7 @@
"displayValue" : "Socially"
},
"emails" : [{
-"address" : "[EMAIL PROTECTED]",
+"value" : "[EMAIL PROTECTED]",
"type" : "work"
}],
"ethnicity" : "developer",