Author: doll
Date: Mon Aug 25 08:49:32 2008
New Revision: 688765
URL: http://svn.apache.org/viewvc?rev=688765&view=rev
Log:
0.8.1 change
Renamed the sortOrder enum to sortBy and the sortDirection enum to sortOrder to
match the new spec.
Modified:
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.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/sample/spi/JsonDbOpensocialService.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/PersonHandlerTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RestfulRequestItemTest.java
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RpcRequestItemTest.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/RequestItem.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java?rev=688765&r1=688764&r2=688765&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/opensocial/service/RequestItem.java
Mon Aug 25 08:49:32 2008
@@ -115,18 +115,18 @@
return count == null ? DEFAULT_COUNT : Integer.valueOf(count);
}
- public PersonService.SortOrder getSortBy() {
+ public PersonService.SortBy getSortBy() {
String sortBy = getParameter(SORT_BY);
return sortBy == null
- ? PersonService.SortOrder.topFriends
- : PersonService.SortOrder.valueOf(sortBy);
+ ? PersonService.SortBy.topFriends
+ : PersonService.SortBy.valueOf(sortBy);
}
- public PersonService.SortDirection getSortOrder() {
+ public PersonService.SortOrder getSortOrder() {
String sortOrder = getParameter(SORT_ORDER);
return sortOrder == null
- ? PersonService.SortDirection.ascending
- : PersonService.SortDirection.valueOf(sortOrder);
+ ? PersonService.SortOrder.ascending
+ : PersonService.SortOrder.valueOf(sortOrder);
}
public PersonService.FilterType getFilterBy() {
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=688765&r1=688764&r2=688765&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
Mon Aug 25 08:49:32 2008
@@ -31,11 +31,11 @@
public interface PersonService {
- public enum SortOrder {
+ public enum SortBy {
topFriends, name
}
- public enum SortDirection {
+ public enum SortOrder {
ascending, descending
}
@@ -57,7 +57,7 @@
* @param token The gadget token @return a list of people.
*/
Future<ResponseItem<RestfulCollection<Person>>> getPeople(Set<UserId>
userIds, GroupId groupId,
- SortOrder sortBy, SortDirection sortOrder, FilterType filter, int first,
int max,
+ SortBy sortBy, SortOrder sortOrder, FilterType filter, int first, int
max,
Set<String> fields, SecurityToken token);
/**
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=688765&r1=688764&r2=688765&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
Mon Aug 25 08:49:32 2008
@@ -239,7 +239,7 @@
}
public Future<ResponseItem<RestfulCollection<Person>>> getPeople(Set<UserId>
userIds,
- GroupId groupId, SortOrder sortBy, SortDirection sortOrder, FilterType
filter, int first,
+ GroupId groupId, SortBy sortBy, SortOrder sortOrder, FilterType filter,
int first,
int max, Set<String> fields, SecurityToken token) {
List<Person> result = Lists.newArrayList();
try {
@@ -257,11 +257,11 @@
}
// We can pretend that by default the people are in top friends order
- if (sortBy.equals(PersonService.SortOrder.name)) {
+ if (sortBy.equals(SortBy.name)) {
Collections.sort(result, NAME_COMPARATOR);
}
- if (sortOrder.equals(SortDirection.descending)) {
+ if (sortOrder.equals(SortOrder.descending)) {
Collections.reverse(result);
}
Modified:
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/PersonHandlerTest.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/PersonHandlerTest.java?rev=688765&r1=688764&r2=688765&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/PersonHandlerTest.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/PersonHandlerTest.java
Mon Aug 25 08:49:32 2008
@@ -96,8 +96,8 @@
EasyMock.expect(personService.getPeople(
JOHN_DOE,
new GroupId(GroupId.Type.all, null),
- PersonService.SortOrder.topFriends,
- PersonService.SortDirection.ascending,
+ PersonService.SortBy.topFriends,
+ PersonService.SortOrder.ascending,
PersonService.FilterType.all, 0, 20,
DEFAULT_FIELDS,
token))
@@ -116,8 +116,8 @@
EasyMock.expect(personService.getPeople(
JOHN_DOE,
new GroupId(GroupId.Type.friends, null),
- PersonService.SortOrder.topFriends,
- PersonService.SortDirection.ascending,
+ PersonService.SortBy.topFriends,
+ PersonService.SortOrder.ascending,
PersonService.FilterType.all, 0, 20,
DEFAULT_FIELDS,
token))
@@ -129,8 +129,8 @@
}
public void testHandleGetFriendsWithParams() throws Exception {
- PersonService.SortOrder sortBy = PersonService.SortOrder.name;
- PersonService.SortDirection sortOrder =
PersonService.SortDirection.descending;
+ PersonService.SortBy sortBy = PersonService.SortBy.name;
+ PersonService.SortOrder sortOrder = PersonService.SortOrder.descending;
PersonService.FilterType filter = PersonService.FilterType.topFriends;
Map<String, String> params = Maps.newHashMap();
@@ -190,8 +190,8 @@
userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
EasyMock.expect(personService.getPeople(userIdSet,
new GroupId(GroupId.Type.self, null),
- PersonService.SortOrder.topFriends,
- PersonService.SortDirection.ascending,
+ PersonService.SortBy.topFriends,
+ PersonService.SortOrder.ascending,
PersonService.FilterType.all, 0, 20,
DEFAULT_FIELDS,
token)).andReturn(ImmediateFuture.newInstance(data));
Modified:
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RestfulRequestItemTest.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RestfulRequestItemTest.java?rev=688765&r1=688764&r2=688765&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RestfulRequestItemTest.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RestfulRequestItemTest.java
Mon Aug 25 08:49:32 2008
@@ -105,18 +105,18 @@
public void testSortBy() throws Exception {
request.setParameter("sortBy", null);
- assertEquals(PersonService.SortOrder.topFriends, request.getSortBy());
+ assertEquals(PersonService.SortBy.topFriends, request.getSortBy());
request.setParameter("sortBy", "name");
- assertEquals(PersonService.SortOrder.name, request.getSortBy());
+ assertEquals(PersonService.SortBy.name, request.getSortBy());
}
public void testSortOrder() throws Exception {
request.setParameter("sortOrder", null);
- assertEquals(PersonService.SortDirection.ascending,
request.getSortOrder());
+ assertEquals(PersonService.SortOrder.ascending, request.getSortOrder());
request.setParameter("sortOrder", "descending");
- assertEquals(PersonService.SortDirection.descending,
request.getSortOrder());
+ assertEquals(PersonService.SortOrder.descending, request.getSortOrder());
}
public void testFilterBy() throws Exception {
Modified:
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RpcRequestItemTest.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RpcRequestItemTest.java?rev=688765&r1=688764&r2=688765&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RpcRequestItemTest.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/service/RpcRequestItemTest.java
Mon Aug 25 08:49:32 2008
@@ -100,18 +100,18 @@
public void testSortBy() throws Exception {
request.setParameter("sortBy", null);
- assertEquals(PersonService.SortOrder.topFriends, request.getSortBy());
+ assertEquals(PersonService.SortBy.topFriends, request.getSortBy());
request.setParameter("sortBy", "name");
- assertEquals(PersonService.SortOrder.name, request.getSortBy());
+ assertEquals(PersonService.SortBy.name, request.getSortBy());
}
public void testSortOrder() throws Exception {
request.setParameter("sortOrder", null);
- assertEquals(PersonService.SortDirection.ascending,
request.getSortOrder());
+ assertEquals(PersonService.SortOrder.ascending, request.getSortOrder());
request.setParameter("sortOrder", "descending");
- assertEquals(PersonService.SortDirection.descending,
request.getSortOrder());
+ assertEquals(PersonService.SortOrder.descending, request.getSortOrder());
}
public void testFilterBy() throws Exception {
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=688765&r1=688764&r2=688765&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
Mon Aug 25 08:49:32 2008
@@ -87,7 +87,7 @@
public void testGetExpectedFriends() throws Exception {
ResponseItem<RestfulCollection<Person>> responseItem = db.getPeople(
Sets.newHashSet(CANON_USER), new GroupId(GroupId.Type.friends, null),
- PersonService.SortOrder.topFriends,
PersonService.SortDirection.ascending,
+ PersonService.SortBy.topFriends, PersonService.SortOrder.ascending,
PersonService.FilterType.all, 0,
Integer.MAX_VALUE, Collections.<String>emptySet(), token).get();
assertNotNull(responseItem.getResponse());
@@ -100,7 +100,7 @@
public void testGetExpectedUsersForPlural() throws Exception {
ResponseItem<RestfulCollection<Person>> responseItem = db.getPeople(
Sets.newLinkedHashSet(JOHN_DOE, JANE_DOE), new
GroupId(GroupId.Type.friends, null),
- PersonService.SortOrder.topFriends,
PersonService.SortDirection.ascending,
+ PersonService.SortBy.topFriends, PersonService.SortOrder.ascending,
PersonService.FilterType.all, 0,
Integer.MAX_VALUE, Collections.<String>emptySet(), token).get();
assertNotNull(responseItem.getResponse());