You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by aw...@apache.org on 2009/04/24 21:42:46 UTC
svn commit: r768404 - in /incubator/shindig/trunk/java/social-api/src:
main/java/org/apache/shindig/social/opensocial/service/
main/java/org/apache/shindig/social/opensocial/spi/
main/java/org/apache/shindig/social/sample/service/ main/java/org/apache/...
Author: awiner
Date: Fri Apr 24 19:42:45 2009
New Revision: 768404
URL: http://svn.apache.org/viewvc?rev=768404&view=rev
Log:
SocialSpiException is now deprecated - use ProtocolException.
- Changed all references to it in social-api accordingly.
Modified:
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/AppDataHandler.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/MessageHandler.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/MessageService.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/SocialSpiException.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/SampleContainerHandler.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/AppDataHandlerTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/MessageHandlerTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/ActivityHandler.java Fri Apr 24 19:42:45 2009
@@ -20,12 +20,12 @@
import org.apache.shindig.config.ContainerConfig;
import org.apache.shindig.protocol.HandlerPreconditions;
import org.apache.shindig.protocol.Operation;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RequestItem;
import org.apache.shindig.protocol.Service;
import org.apache.shindig.social.opensocial.model.Activity;
import org.apache.shindig.social.opensocial.spi.ActivityService;
import org.apache.shindig.social.opensocial.spi.CollectionOptions;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.opensocial.spi.UserId;
import com.google.common.base.Objects;
@@ -56,7 +56,7 @@
*/
@Operation(httpMethods="DELETE")
public Future<?> delete(SocialRequestItem request)
- throws SocialSpiException {
+ throws ProtocolException {
Set<UserId> userIds = request.getUsers();
Set<String> activityIds = ImmutableSet.copyOf(request.getListParameter("activityId"));
@@ -74,7 +74,7 @@
* examples: /activities/john.doe/@self - postBody is an activity object
*/
@Operation(httpMethods="PUT", bodyParam = "activity")
- public Future<?> update(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> update(SocialRequestItem request) throws ProtocolException {
return create(request);
}
@@ -84,7 +84,7 @@
* examples: /activities/john.doe/@self - postBody is an activity object
*/
@Operation(httpMethods="POST", bodyParam = "activity")
- public Future<?> create(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> create(SocialRequestItem request) throws ProtocolException {
Set<UserId> userIds = request.getUsers();
List<String> activityIds = request.getListParameter("activityId");
@@ -109,7 +109,7 @@
*/
@Operation(httpMethods="GET")
public Future<?> get(SocialRequestItem request)
- throws SocialSpiException {
+ throws ProtocolException {
Set<UserId> userIds = request.getUsers();
Set<String> optionalActivityIds = ImmutableSet.copyOf(request.getListParameter("activityId"));
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/AppDataHandler.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/AppDataHandler.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/AppDataHandler.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/AppDataHandler.java Fri Apr 24 19:42:45 2009
@@ -19,9 +19,9 @@
import org.apache.shindig.protocol.HandlerPreconditions;
import org.apache.shindig.protocol.Operation;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.Service;
import org.apache.shindig.social.opensocial.spi.AppDataService;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.opensocial.spi.UserId;
import java.util.Map;
@@ -53,7 +53,7 @@
*/
@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request)
- throws SocialSpiException {
+ throws ProtocolException {
Set<UserId> userIds = request.getUsers();
@@ -74,7 +74,7 @@
* overridden.
*/
@Operation(httpMethods = "PUT", bodyParam = "data")
- public Future<?> update(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> update(SocialRequestItem request) throws ProtocolException {
return create(request);
}
@@ -87,7 +87,7 @@
* values and set. If there are no fields vars then all of the data will be overridden.
*/
@Operation(httpMethods = "POST", bodyParam = "data")
- public Future<?> create(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> create(SocialRequestItem request) throws ProtocolException {
Set<UserId> userIds = request.getUsers();
HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
@@ -98,7 +98,7 @@
Map<String, String> values = request.getTypedParameter("data", Map.class);
for (String key : values.keySet()) {
if (!isValidKey(key)) {
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST,
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
"One or more of the app data keys are invalid: " + key);
}
}
@@ -113,7 +113,7 @@
* examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
*/
@Operation(httpMethods = "GET")
- public Future<?> get(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> get(SocialRequestItem request) throws ProtocolException {
Set<UserId> userIds = request.getUsers();
// Preconditions
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/MessageHandler.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/MessageHandler.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/MessageHandler.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/MessageHandler.java Fri Apr 24 19:42:45 2009
@@ -17,22 +17,24 @@
*/
package org.apache.shindig.social.opensocial.service;
-import com.google.inject.Inject;
-
+import org.apache.shindig.protocol.HandlerPreconditions;
+import org.apache.shindig.protocol.Operation;
+import org.apache.shindig.protocol.ProtocolException;
+import org.apache.shindig.protocol.Service;
import org.apache.shindig.social.opensocial.model.Message;
import org.apache.shindig.social.opensocial.model.MessageCollection;
+import org.apache.shindig.social.opensocial.spi.CollectionOptions;
import org.apache.shindig.social.opensocial.spi.MessageService;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.opensocial.spi.UserId;
-import org.apache.shindig.social.opensocial.spi.CollectionOptions;
-import org.apache.shindig.protocol.*;
-import java.util.Set;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.Future;
import javax.servlet.http.HttpServletResponse;
+import com.google.inject.Inject;
+
@Service(name = "messages", path="/{userId}+/{msgCollId}/{messageIds}+")
public class MessageHandler {
@@ -44,7 +46,7 @@
}
@Operation(httpMethods = "DELETE")
- public Future<?> delete(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> delete(SocialRequestItem request) throws ProtocolException {
Set<UserId> userIds = request.getUsers();
String msgCollId = request.getParameter("msgCollId");
@@ -54,7 +56,7 @@
HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
if (msgCollId == null) {
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST,
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
"A message collection is required");
}
@@ -67,7 +69,7 @@
@Operation(httpMethods = "GET")
- public Future<?> get(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> get(SocialRequestItem request) throws ProtocolException {
Set<UserId> userIds = request.getUsers();
String msgCollId = request.getParameter("msgCollId");
@@ -94,7 +96,7 @@
* Creates a new message collection or message
*/
@Operation(httpMethods = "POST", bodyParam = "entity")
- public Future<?> modify(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> modify(SocialRequestItem request) throws ProtocolException {
Set<UserId> userIds = request.getUsers();
String msgCollId = request.getParameter("msgCollId");
@@ -128,7 +130,7 @@
* Handles modifying a message or a message collection.
*/
@Operation(httpMethods = "PUT", bodyParam = "entity")
- public Future<?> create(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> create(SocialRequestItem request) throws ProtocolException {
Set<UserId> userIds = request.getUsers();
String msgCollId = request.getParameter("msgCollId");
@@ -140,7 +142,7 @@
UserId user = request.getUsers().iterator().next();
if (msgCollId == null) {
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST,
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
"A message collection is required");
}
@@ -148,7 +150,7 @@
// No message IDs specified, this is a PUT to a message collection
MessageCollection msgCollection = request.getTypedParameter("entity", MessageCollection.class);
if (msgCollection == null) {
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST,
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
"cannot parse message collection");
}
@@ -163,7 +165,7 @@
// TODO, do more validation.
if (message == null || message.getId() == null) {
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST,
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
"cannot parse message or missing ID");
}
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/PersonHandler.java Fri Apr 24 19:42:45 2009
@@ -21,6 +21,7 @@
import org.apache.shindig.config.ContainerConfig;
import org.apache.shindig.protocol.HandlerPreconditions;
import org.apache.shindig.protocol.Operation;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RequestItem;
import org.apache.shindig.protocol.RestfulCollection;
import org.apache.shindig.protocol.Service;
@@ -28,7 +29,6 @@
import org.apache.shindig.social.opensocial.spi.CollectionOptions;
import org.apache.shindig.social.opensocial.spi.GroupId;
import org.apache.shindig.social.opensocial.spi.PersonService;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.opensocial.spi.UserId;
import com.google.common.base.Objects;
@@ -57,7 +57,7 @@
* examples: /people/john.doe/@all /people/john.doe/@friends /people/john.doe/@self
*/
@Operation(httpMethods = "GET")
- public Future<?> get(SocialRequestItem request) throws SocialSpiException {
+ public Future<?> get(SocialRequestItem request) throws ProtocolException {
GroupId groupId = request.getGroup();
Set<String> optionalPersonId = ImmutableSet.copyOf(request.getListParameter("personId"));
Set<String> fields = request.getFields(Person.Field.DEFAULT_FIELDS);
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/ActivityService.java Fri Apr 24 19:42:45 2009
@@ -18,6 +18,7 @@
package org.apache.shindig.social.opensocial.spi;
import org.apache.shindig.auth.SecurityToken;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RestfulCollection;
import org.apache.shindig.social.opensocial.model.Activity;
@@ -43,7 +44,7 @@
*/
Future<RestfulCollection<Activity>> getActivities(Set<UserId> userIds,
GroupId groupId, String appId, Set<String> fields, CollectionOptions options, SecurityToken token)
- throws SocialSpiException;
+ throws ProtocolException;
/**
* Returns a set of activities for the passed in user and group that corresponds to a list of
@@ -60,7 +61,7 @@
*/
Future<RestfulCollection<Activity>> getActivities(UserId userId, GroupId groupId,
String appId, Set<String> fields, CollectionOptions options, Set<String> activityIds, SecurityToken token)
- throws SocialSpiException;
+ throws ProtocolException;
/**
@@ -77,7 +78,7 @@
*/
Future<Activity> getActivity(UserId userId, GroupId groupId, String appId,
Set<String> fields, String activityId, SecurityToken token)
- throws SocialSpiException;
+ throws ProtocolException;
/**
* Deletes the activity for the passed in user and group that corresponds to the activityId.
@@ -90,7 +91,7 @@
* @return a response item containing any errors
*/
Future<Void> deleteActivities(UserId userId, GroupId groupId, String appId,
- Set<String> activityIds, SecurityToken token) throws SocialSpiException;
+ Set<String> activityIds, SecurityToken token) throws ProtocolException;
/**
* Creates the passed in activity for the passed in user and group. Once createActivity is called,
@@ -105,5 +106,5 @@
* @return a response item containing any errors
*/
Future<Void> createActivity(UserId userId, GroupId groupId, String appId,
- Set<String> fields, Activity activity, SecurityToken token) throws SocialSpiException;
+ Set<String> fields, Activity activity, SecurityToken token) throws ProtocolException;
}
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/AppDataService.java Fri Apr 24 19:42:45 2009
@@ -19,6 +19,7 @@
import org.apache.shindig.auth.SecurityToken;
import org.apache.shindig.protocol.DataCollection;
+import org.apache.shindig.protocol.ProtocolException;
import java.util.Map;
import java.util.Set;
@@ -41,7 +42,7 @@
* @return The data fetched
*/
Future<DataCollection> getPersonData(Set<UserId> userIds, GroupId groupId,
- String appId, Set<String> fields, SecurityToken token) throws SocialSpiException;
+ String appId, Set<String> fields, SecurityToken token) throws ProtocolException;
/**
* Deletes data for the specified user and group.
@@ -54,7 +55,7 @@
* @return an error if one occurs
*/
Future<Void> deletePersonData(UserId userId, GroupId groupId,
- String appId, Set<String> fields, SecurityToken token) throws SocialSpiException;
+ String appId, Set<String> fields, SecurityToken token) throws ProtocolException;
/**
* Updates app data for the specified user and group with the new values.
@@ -69,5 +70,5 @@
*/
Future<Void> updatePersonData(UserId userId, GroupId groupId,
String appId, Set<String> fields, Map<String, String> values, SecurityToken token)
- throws SocialSpiException;
+ throws ProtocolException;
}
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/MessageService.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/MessageService.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/MessageService.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/MessageService.java Fri Apr 24 19:42:45 2009
@@ -23,6 +23,7 @@
import org.apache.shindig.social.opensocial.model.Message;
import org.apache.shindig.social.opensocial.model.MessageCollection;
import org.apache.shindig.social.sample.spi.JsonDbOpensocialService;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RestfulCollection;
import java.util.Set;
@@ -45,10 +46,10 @@
* @param options Pagination, etal
* @param token Given security token for this request
* @return a collection of message collections.
- * @throws SocialSpiException when invalid parameters are given
+ * @throws ProtocolException when invalid parameters are given
*/
Future<RestfulCollection<MessageCollection>> getMessageCollections(UserId userId,
- Set<String> fields, CollectionOptions options, SecurityToken token) throws SocialSpiException;
+ Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException;
/**
* Creates a new message collection for the given arguments
@@ -58,9 +59,9 @@
* @param token A security token for this request
*
* @return Data for the message collection that is created
- * @throws SocialSpiException when invalid parameters are given or not implemented
+ * @throws ProtocolException when invalid parameters are given or not implemented
*/
- Future<MessageCollection> createMessageCollection(UserId userId, MessageCollection msgCollection, SecurityToken token) throws SocialSpiException;
+ Future<MessageCollection> createMessageCollection(UserId userId, MessageCollection msgCollection, SecurityToken token) throws ProtocolException;
/**
* Modifies/Updates a message collection for the given arguments
@@ -69,10 +70,10 @@
* @param msgCollection Data for the message collection to be modified
* @param token A security token for this request
*
- * @throws SocialSpiException when invalid parameters are given or not implemented
+ * @throws ProtocolException when invalid parameters are given or not implemented
*/
- Future<Void> modifyMessageCollection(UserId userId, MessageCollection msgCollection, SecurityToken token) throws SocialSpiException;
+ Future<Void> modifyMessageCollection(UserId userId, MessageCollection msgCollection, SecurityToken token) throws ProtocolException;
/**
* Deletes a message collection for the given arguments
@@ -81,11 +82,11 @@
* @param msgCollId Data for the message collection to be modified
* @param token A security token for this request
*
- * @throws SocialSpiException when invalid parameters are given, the message collection does not exist or not implemented
+ * @throws ProtocolException when invalid parameters are given, the message collection does not exist or not implemented
* @return Future<Void>
*/
- Future<Void> deleteMessageCollection(UserId userId, String msgCollId, SecurityToken token) throws SocialSpiException;
+ Future<Void> deleteMessageCollection(UserId userId, String msgCollId, SecurityToken token) throws ProtocolException;
/**
@@ -98,10 +99,10 @@
* @param options Options to control the fetch
* @param token Given security token for this request
* @return a collection of messages
- * @throws SocialSpiException when invalid parameters are given
+ * @throws ProtocolException when invalid parameters are given
*/
Future<RestfulCollection<Message>> getMessages(UserId userId, String msgCollId,
- Set<String> fields, List<String> msgIds, CollectionOptions options, SecurityToken token) throws SocialSpiException;
+ Set<String> fields, List<String> msgIds, CollectionOptions options, SecurityToken token) throws ProtocolException;
/**
@@ -114,10 +115,10 @@
* @param message The message to post
* @param token A valid security token @return a response item containing any errors/
* @return Void Future
- * @throws SocialSpiException when invalid parameters are given
+ * @throws ProtocolException when invalid parameters are given
*/
Future<Void> createMessage(UserId userId, String appId, String msgCollId, Message message,
- SecurityToken token) throws SocialSpiException;
+ SecurityToken token) throws ProtocolException;
/**
* Deletes a set of messages for a given user/message collection
@@ -126,10 +127,10 @@
* @param ids List of IDs to delete
* @param token Given Security Token for this request
* @return Future<Void>
- * @throws SocialSpiException
+ * @throws ProtocolException
*/
Future<Void> deleteMessages(UserId userId, String msgCollId, List<String> ids,
- SecurityToken token) throws SocialSpiException;
+ SecurityToken token) throws ProtocolException;
/**
@@ -140,10 +141,10 @@
* @param message The message details to modify
* @param token Given Security Token for this request
* @return Future<Void>
- * @throws SocialSpiException for invalid parameters or missing messages or users
+ * @throws ProtocolException for invalid parameters or missing messages or users
*/
Future<Void> modifyMessage(UserId userId, String msgCollId, String messageId, Message message, SecurityToken token)
- throws SocialSpiException;
+ throws ProtocolException;
}
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/PersonService.java Fri Apr 24 19:42:45 2009
@@ -18,6 +18,7 @@
package org.apache.shindig.social.opensocial.spi;
import org.apache.shindig.auth.SecurityToken;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RestfulCollection;
import org.apache.shindig.social.opensocial.model.Person;
@@ -63,7 +64,7 @@
*/
Future<RestfulCollection<Person>> getPeople(Set<UserId> userIds, GroupId groupId,
CollectionOptions collectionOptions, Set<String> fields, SecurityToken token)
- throws SocialSpiException;
+ throws ProtocolException;
/**
* Returns a person that corresponds to the passed in person id.
@@ -74,5 +75,5 @@
* @return a list of people.
*/
Future<Person> getPerson(UserId id, Set<String> fields, SecurityToken token)
- throws SocialSpiException;
+ throws ProtocolException;
}
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/SocialSpiException.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/SocialSpiException.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/SocialSpiException.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/spi/SocialSpiException.java Fri Apr 24 19:42:45 2009
@@ -21,8 +21,10 @@
import org.apache.shindig.protocol.ProtocolException;
/**
- * Convenience subclass of ProtocolException to ease transition
+ * Convenience subclass of ProtocolException to ease transition.
+ * @deprecated Use ProtocolException.
*/
+@Deprecated
public class SocialSpiException extends ProtocolException {
public SocialSpiException(int error, String errorMessage, Throwable cause) {
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/SampleContainerHandler.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/SampleContainerHandler.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/SampleContainerHandler.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/service/SampleContainerHandler.java Fri Apr 24 19:42:45 2009
@@ -23,9 +23,9 @@
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.shindig.common.util.ImmediateFuture;
import org.apache.shindig.protocol.Operation;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RequestItem;
import org.apache.shindig.protocol.Service;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.sample.spi.JsonDbOpensocialService;
import org.json.JSONException;
import org.json.JSONObject;
@@ -51,7 +51,7 @@
* We don't distinguish between put and post for these urls.
*/
@Operation(httpMethods = "PUT")
- public Future<?> update(RequestItem request) throws SocialSpiException {
+ public Future<?> update(RequestItem request) throws ProtocolException {
return create(request);
}
@@ -60,18 +60,18 @@
* urls aren't very resty. Consider changing the samplecontainer.html calls post.
*/
@Operation(httpMethods = "POST")
- public Future<?> create(RequestItem request) throws SocialSpiException {
+ public Future<?> create(RequestItem request) throws ProtocolException {
String type = request.getParameter("type");
if (type.equals("setstate")) {
try {
String stateFile = request.getParameter("fileurl");
service.setDb(new JSONObject(fetchStateDocument(stateFile)));
} catch (JSONException e) {
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST,
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
"The json state file was not valid json", e);
}
} else if (type.equals("setevilness")) {
- throw new SocialSpiException(HttpServletResponse.SC_NOT_IMPLEMENTED,
+ throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED,
"evil data has not been implemented yet");
}
Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java Fri Apr 24 19:42:45 2009
@@ -23,6 +23,7 @@
import org.apache.shindig.common.util.ImmediateFuture;
import org.apache.shindig.common.util.ResourceLoader;
import org.apache.shindig.protocol.DataCollection;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RestfulCollection;
import org.apache.shindig.protocol.conversion.BeanConverter;
import org.apache.shindig.protocol.model.SortOrder;
@@ -36,7 +37,6 @@
import org.apache.shindig.social.opensocial.spi.GroupId;
import org.apache.shindig.social.opensocial.spi.MessageService;
import org.apache.shindig.social.opensocial.spi.PersonService;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.opensocial.spi.UserId;
import org.json.JSONArray;
import org.json.JSONException;
@@ -134,7 +134,7 @@
public Future<RestfulCollection<Activity>> getActivities(Set<UserId> userIds, GroupId groupId,
String appId, Set<String> fields, CollectionOptions options, SecurityToken token)
- throws SocialSpiException {
+ throws ProtocolException {
List<Activity> result = Lists.newArrayList();
try {
Set<String> idSet = getIdSet(userIds, groupId, token);
@@ -153,14 +153,14 @@
}
return ImmediateFuture.newInstance(new RestfulCollection<Activity>(result));
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<RestfulCollection<Activity>> getActivities(UserId userId, GroupId groupId,
String appId, Set<String> fields, CollectionOptions options, Set<String> activityIds,
- SecurityToken token) throws SocialSpiException {
+ SecurityToken token) throws ProtocolException {
List<Activity> result = Lists.newArrayList();
try {
String user = userId.getUserId(token);
@@ -176,13 +176,13 @@
}
return ImmediateFuture.newInstance(new RestfulCollection<Activity>(result));
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<Activity> getActivity(UserId userId, GroupId groupId, String appId,
- Set<String> fields, String activityId, SecurityToken token) throws SocialSpiException {
+ Set<String> fields, String activityId, SecurityToken token) throws ProtocolException {
try {
String user = userId.getUserId(token);
if (db.getJSONObject(ACTIVITIES_TABLE).has(user)) {
@@ -196,15 +196,15 @@
}
}
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST, "Activity not found");
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Activity not found");
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<Void> deleteActivities(UserId userId, GroupId groupId, String appId,
- Set<String> activityIds, SecurityToken token) throws SocialSpiException {
+ Set<String> activityIds, SecurityToken token) throws ProtocolException {
try {
String user = userId.getUserId(token);
if (db.getJSONObject(ACTIVITIES_TABLE).has(user)) {
@@ -228,13 +228,13 @@
// What is the appropriate response here??
return ImmediateFuture.newInstance(null);
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<Void> createActivity(UserId userId, GroupId groupId, String appId,
- Set<String> fields, Activity activity, SecurityToken token) throws SocialSpiException {
+ Set<String> fields, Activity activity, SecurityToken token) throws ProtocolException {
// Are fields really needed here?
try {
JSONObject jsonObject = convertFromActivity(activity, fields);
@@ -250,13 +250,13 @@
jsonArray.put(jsonObject);
return ImmediateFuture.newInstance(null);
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<RestfulCollection<Person>> getPeople(Set<UserId> userIds, GroupId groupId,
- CollectionOptions options, Set<String> fields, SecurityToken token) throws SocialSpiException {
+ CollectionOptions options, Set<String> fields, SecurityToken token) throws ProtocolException {
List<Person> result = Lists.newArrayList();
try {
JSONArray people = db.getJSONArray(PEOPLE_TABLE);
@@ -279,7 +279,7 @@
}
if (GroupId.Type.self == groupId.getType() && result.isEmpty()) {
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST, "Person not found");
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Person not found");
}
// We can pretend that by default the people are in top friends order
@@ -301,13 +301,13 @@
return ImmediateFuture.newInstance(new RestfulCollection<Person>(result, options.getFirst(),
totalSize));
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<Person> getPerson(UserId id, Set<String> fields, SecurityToken token)
- throws SocialSpiException {
+ throws ProtocolException {
try {
JSONArray people = db.getJSONArray(PEOPLE_TABLE);
@@ -322,9 +322,9 @@
return ImmediateFuture.newInstance(personObj);
}
}
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST, "Person not found");
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Person not found");
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
@@ -361,13 +361,13 @@
return appData;
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<DataCollection> getPersonData(Set<UserId> userIds, GroupId groupId, String appId,
- Set<String> fields, SecurityToken token) throws SocialSpiException {
+ Set<String> fields, SecurityToken token) throws ProtocolException {
try {
Map<String, Map<String, String>> idToData = Maps.newHashMap();
Set<String> idSet = getIdSet(userIds, groupId, token);
@@ -398,13 +398,13 @@
}
return ImmediateFuture.newInstance(new DataCollection(idToData));
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<Void> deletePersonData(UserId userId, GroupId groupId, String appId,
- Set<String> fields, SecurityToken token) throws SocialSpiException {
+ Set<String> fields, SecurityToken token) throws ProtocolException {
try {
String user = userId.getUserId(token);
if (!db.getJSONObject(DATA_TABLE).has(user)) {
@@ -425,14 +425,14 @@
db.getJSONObject(DATA_TABLE).put(user, newPersonData);
return ImmediateFuture.newInstance(null);
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<Void> updatePersonData(UserId userId, GroupId groupId, String appId,
Set<String> fields, Map<String, String> values, SecurityToken token)
- throws SocialSpiException {
+ throws ProtocolException {
// TODO: this seems redundant. No need to pass both fields and a map of
// field->value
// TODO: According to rest, yes there is. If a field is in the param list
@@ -451,7 +451,7 @@
}
return ImmediateFuture.newInstance(null);
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
@@ -468,7 +468,7 @@
* The message to post.
*/
public Future<Void> createMessage(UserId userId, String appId, String msgCollId, Message message,
- SecurityToken token) throws SocialSpiException {
+ SecurityToken token) throws ProtocolException {
for (String recipient : message.getRecipients()) {
try {
JSONArray outbox = db.getJSONObject(MESSAGE_TABLE).getJSONArray(recipient);
@@ -479,7 +479,7 @@
outbox.put(message);
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
@@ -488,7 +488,7 @@
}
public Future<RestfulCollection<MessageCollection>> getMessageCollections(UserId userId,
- Set<String> fields, CollectionOptions options, SecurityToken token) throws SocialSpiException {
+ Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException {
try {
List<MessageCollection> result = Lists.newArrayList();
JSONObject messageCollections = db.getJSONObject(MESSAGE_TABLE).getJSONObject(
@@ -505,14 +505,14 @@
}
return ImmediateFuture.newInstance(new RestfulCollection<MessageCollection>(result));
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<Void> deleteMessages(UserId userId, String msgCollId, List<String> ids,
- SecurityToken token) throws SocialSpiException {
- throw new SocialSpiException(HttpServletResponse.SC_NOT_IMPLEMENTED,
+ SecurityToken token) throws ProtocolException {
+ throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED,
"this functionality is not yet available");
}
@@ -521,7 +521,7 @@
*/
public Future<RestfulCollection<Message>> getMessages(UserId userId, String msgCollId,
Set<String> fields, List<String> msgIds, CollectionOptions options, SecurityToken token)
- throws SocialSpiException {
+ throws ProtocolException {
try {
List<Message> result = Lists.newArrayList();
JSONArray messages = db.getJSONObject(MESSAGE_TABLE).getJSONObject(userId.getUserId(token))
@@ -530,7 +530,7 @@
// TODO: special case @all
if (messages == null) {
- throw new SocialSpiException(HttpServletResponse.SC_BAD_REQUEST, "message collection"
+ throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "message collection"
+ msgCollId + " not found");
}
@@ -543,32 +543,32 @@
return ImmediateFuture.newInstance(new RestfulCollection<Message>(result));
} catch (JSONException je) {
- throw new SocialSpiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
+ throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
je);
}
}
public Future<MessageCollection> createMessageCollection(UserId userId,
- MessageCollection msgCollection, SecurityToken token) throws SocialSpiException {
- throw new SocialSpiException(HttpServletResponse.SC_NOT_IMPLEMENTED,
+ MessageCollection msgCollection, SecurityToken token) throws ProtocolException {
+ throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED,
"this functionality is not yet available");
}
public Future<Void> modifyMessage(UserId userId, String msgCollId, String messageId,
- Message message, SecurityToken token) throws SocialSpiException {
- throw new SocialSpiException(HttpServletResponse.SC_NOT_IMPLEMENTED,
+ Message message, SecurityToken token) throws ProtocolException {
+ throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED,
"this functionality is not yet available");
}
public Future<Void> modifyMessageCollection(UserId userId, MessageCollection msgCollection,
- SecurityToken token) throws SocialSpiException {
- throw new SocialSpiException(HttpServletResponse.SC_NOT_IMPLEMENTED,
+ SecurityToken token) throws ProtocolException {
+ throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED,
"this functionality is not yet available");
}
public Future<Void> deleteMessageCollection(UserId userId, String msgCollId, SecurityToken token)
- throws SocialSpiException {
- throw new SocialSpiException(HttpServletResponse.SC_NOT_IMPLEMENTED,
+ throws ProtocolException {
+ throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED,
"this functionality is not yet available");
}
Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/ActivityHandlerTest.java Fri Apr 24 19:42:45 2009
@@ -26,6 +26,7 @@
import org.apache.shindig.protocol.DefaultHandlerRegistry;
import org.apache.shindig.protocol.HandlerExecutionListener;
import org.apache.shindig.protocol.HandlerRegistry;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RestHandler;
import org.apache.shindig.protocol.RestfulCollection;
import org.apache.shindig.protocol.conversion.BeanJsonConverter;
@@ -34,7 +35,6 @@
import org.apache.shindig.social.opensocial.spi.ActivityService;
import org.apache.shindig.social.opensocial.spi.CollectionOptions;
import org.apache.shindig.social.opensocial.spi.GroupId;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.opensocial.spi.UserId;
import com.google.common.collect.ImmutableList;
@@ -154,7 +154,7 @@
reset();
}
- private Future<?> setupBodyRequest(String method) throws SocialSpiException {
+ private Future<?> setupBodyRequest(String method) throws ProtocolException {
String jsonActivity = "{title: hi mom!, etc etc}";
String path = "/activities/john.doe/@self/@app";
Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/AppDataHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/AppDataHandlerTest.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/AppDataHandlerTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/AppDataHandlerTest.java Fri Apr 24 19:42:45 2009
@@ -26,11 +26,11 @@
import org.apache.shindig.protocol.DefaultHandlerRegistry;
import org.apache.shindig.protocol.HandlerExecutionListener;
import org.apache.shindig.protocol.HandlerRegistry;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RestHandler;
import org.apache.shindig.protocol.conversion.BeanJsonConverter;
import org.apache.shindig.social.opensocial.spi.AppDataService;
import org.apache.shindig.social.opensocial.spi.GroupId;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.opensocial.spi.UserId;
import org.easymock.classextension.EasyMock;
@@ -138,7 +138,7 @@
verify();
}
- private Future<?> setupPostData(String method) throws SocialSpiException {
+ private Future<?> setupPostData(String method) throws ProtocolException {
String path = "/appdata/john.doe/@self/appId";
RestHandler operation = registry.getRestHandler(path, method);
@@ -193,7 +193,7 @@
operation.execute(params, new StringReader(jsonAppData), token, converter).get();
fail();
} catch (ExecutionException ee) {
- assertEquals(((SocialSpiException)ee.getCause()).getCode(),
+ assertEquals(((ProtocolException)ee.getCause()).getCode(),
HttpServletResponse.SC_BAD_REQUEST);
// was expecting an Exception
}
@@ -223,7 +223,7 @@
operation.execute(params, new StringReader(jsonAppData), token, converter).get();
fail();
} catch (ExecutionException ee) {
- assertEquals(((SocialSpiException)ee.getCause()).getCode(),
+ assertEquals(((ProtocolException)ee.getCause()).getCode(),
HttpServletResponse.SC_BAD_REQUEST);
}
verify();
Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/MessageHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/MessageHandlerTest.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/MessageHandlerTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/MessageHandlerTest.java Fri Apr 24 19:42:45 2009
@@ -17,27 +17,31 @@
*/
package org.apache.shindig.social.opensocial.service;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Sets;
-import com.google.common.collect.ImmutableMap;
-
-import junit.framework.TestCase;
-
import org.apache.shindig.common.testing.FakeGadgetToken;
import org.apache.shindig.common.util.ImmediateFuture;
+import org.apache.shindig.protocol.DefaultHandlerRegistry;
+import org.apache.shindig.protocol.HandlerExecutionListener;
+import org.apache.shindig.protocol.HandlerRegistry;
+import org.apache.shindig.protocol.ProtocolException;
+import org.apache.shindig.protocol.RequestItem;
+import org.apache.shindig.protocol.RestHandler;
+import org.apache.shindig.protocol.conversion.BeanJsonConverter;
import org.apache.shindig.social.core.model.MessageImpl;
import org.apache.shindig.social.opensocial.model.Message;
import org.apache.shindig.social.opensocial.spi.MessageService;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.opensocial.spi.UserId;
-import org.apache.shindig.protocol.conversion.BeanJsonConverter;
-import org.apache.shindig.protocol.*;
import org.easymock.classextension.EasyMock;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
+import junit.framework.TestCase;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+
public class MessageHandlerTest extends TestCase {
private MessageService messageService;
@@ -65,7 +69,7 @@
}
public void testPostMessage()
- throws SocialSpiException, InterruptedException, ExecutionException {
+ throws ProtocolException, InterruptedException, ExecutionException {
MessageImpl message = new MessageImpl("A message body", "A title", Message.Type.PRIVATE_MESSAGE);
message.setRecipients(recipients);
Modified: incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java?rev=768404&r1=768403&r2=768404&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java (original)
+++ incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialServiceTest.java Fri Apr 24 19:42:45 2009
@@ -21,6 +21,7 @@
import org.apache.shindig.auth.SecurityToken;
import org.apache.shindig.common.testing.FakeGadgetToken;
import org.apache.shindig.protocol.DataCollection;
+import org.apache.shindig.protocol.ProtocolException;
import org.apache.shindig.protocol.RestfulCollection;
import org.apache.shindig.protocol.model.FilterOperation;
import org.apache.shindig.protocol.model.SortOrder;
@@ -30,7 +31,6 @@
import org.apache.shindig.social.opensocial.spi.CollectionOptions;
import org.apache.shindig.social.opensocial.spi.GroupId;
import org.apache.shindig.social.opensocial.spi.PersonService;
-import org.apache.shindig.social.opensocial.spi.SocialSpiException;
import org.apache.shindig.social.opensocial.spi.UserId;
import java.util.Collections;
@@ -191,7 +191,7 @@
CANON_USER, SELF_GROUP, APP_ID,
Sets.newHashSet("appId", "body", "mediaItems"), APP_ID, new FakeGadgetToken()).get();
fail();
- } catch (SocialSpiException sse) {
+ } catch (ProtocolException sse) {
assertEquals(HttpServletResponse.SC_BAD_REQUEST, sse.getCode());
}
}