本文整理了Java中org.apache.shindig.social.opensocial.spi.UserId.<init>()
方法的一些代码示例,展示了UserId.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UserId.<init>()
方法的具体详情如下:
包路径:org.apache.shindig.social.opensocial.spi.UserId
类名称:UserId
方法名:<init>
暂无
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-social-api
public static UserId fromJson(String jsonId) {
Type idSpecEnum = Type.jsonValueOf(jsonId);
if (idSpecEnum != null) {
return new UserId(idSpecEnum, null);
}
return new UserId(Type.userId, jsonId);
}
代码示例来源:origin: org.apache.shindig/shindig-social-api
public static UserId fromJson(String jsonId) {
Type idSpecEnum = Type.jsonValueOf(jsonId);
if (idSpecEnum != null) {
return new UserId(idSpecEnum, null);
}
return new UserId(Type.userId, jsonId);
}
代码示例来源:origin: com.lmco.shindig/shindig-social-api
public static UserId fromJson(String jsonId) {
Type idSpecEnum = Type.jsonValueOf(jsonId);
if (idSpecEnum != null) {
return new UserId(idSpecEnum, null);
}
return new UserId(Type.userId, jsonId);
}
代码示例来源:origin: org.apache.shindig/shindig-samples
public static Set<UserId> buildUserIds(String... userIds) {
// Set user id list
Set<UserId> userIdSet = Sets.newHashSet();
for (String userId: userIds) {
userIdSet.add(new UserId(Type.userId, userId));
}
return userIdSet;
}
代码示例来源:origin: org.apache.shindig/shindig-samples
@Test
public void getCanonicalPerson() throws Exception {
Future<Person> person = this.personServiceDb.getPerson(new UserId(Type.userId, "canonical"), Person.Field.ALL_FIELDS, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
SpiTestUtil.assertPersonEquals(person.get(), canonical);
}
代码示例来源:origin: com.lmco.shindig/shindig-social-api
@Before
public void setUp() throws Exception {
token = new FakeGadgetToken();
messageService = EasyMock.createMock(MessageService.class);
messageService = EasyMock.createMock(MessageService.class);
converter = EasyMock.createMock(BeanJsonConverter.class);
sender = new UserId(UserId.Type.userId, "message.sender");
recipients = ImmutableList.of("second.recipient", "first.recipient");
handler = new MessageHandler(messageService);
registry = new DefaultHandlerRegistry(null, converter,
new HandlerExecutionListener.NoOpHandler());
registry.addHandlers(ImmutableSet.<Object>of(handler));
}
代码示例来源:origin: org.apache.shindig/shindig-samples
@Test
public void getJohnDoeActivityWithAppId1() throws Exception {
Future<Activity> result = this.activityServiceDb.getActivity(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), null, ACTIVITY_ALL_FIELDS, "1", SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
Activity activity = result.get();
SpiTestUtil.assertActivityEquals(activity, testActivity);
}
代码示例来源:origin: org.apache.shindig/shindig-social-api
@Before
public void setUp() throws Exception {
token = new FakeGadgetToken();
messageService = EasyMock.createMock(MessageService.class);
messageService = EasyMock.createMock(MessageService.class);
converter = EasyMock.createMock(BeanJsonConverter.class);
sender = new UserId(UserId.Type.userId, "message.sender");
recipients = ImmutableList.of("second.recipient", "first.recipient");
handler = new MessageHandler(messageService, new CollectionOptionsFactory());
registry = new DefaultHandlerRegistry(null, converter,
new HandlerExecutionListener.NoOpHandler());
registry.addHandlers(ImmutableSet.<Object>of(handler));
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-social-api
@Before
public void setUp() throws Exception {
token = new FakeGadgetToken();
messageService = EasyMock.createMock(MessageService.class);
messageService = EasyMock.createMock(MessageService.class);
converter = EasyMock.createMock(BeanJsonConverter.class);
sender = new UserId(UserId.Type.userId, "message.sender");
recipients = ImmutableList.of("second.recipient", "first.recipient");
handler = new MessageHandler(messageService, new CollectionOptionsFactory());
registry = new DefaultHandlerRegistry(null, converter,
new HandlerExecutionListener.NoOpHandler());
registry.addHandlers(ImmutableSet.<Object>of(handler));
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-social-api
@Test
public void testGetUserId() throws Exception {
UserId owner = new UserId(UserId.Type.owner, "hello");
assertEquals("owner", owner.getUserId(new FakeGadgetToken().setOwnerId("owner")));
UserId viewer = new UserId(UserId.Type.viewer, "hello");
assertEquals("viewer", viewer.getUserId(new FakeGadgetToken().setViewerId("viewer")));
UserId me = new UserId(UserId.Type.me, "hello");
assertEquals("viewer", me.getUserId(new FakeGadgetToken().setViewerId("viewer")));
UserId user = new UserId(UserId.Type.userId, "hello");
assertEquals("hello", user.getUserId(new FakeGadgetToken()));
}
代码示例来源:origin: org.apache.shindig/shindig-social-api
@Test
public void testGetUserId() throws Exception {
UserId owner = new UserId(UserId.Type.owner, "hello");
assertEquals("owner", owner.getUserId(new FakeGadgetToken().setOwnerId("owner")));
UserId viewer = new UserId(UserId.Type.viewer, "hello");
assertEquals("viewer", viewer.getUserId(new FakeGadgetToken().setViewerId("viewer")));
UserId me = new UserId(UserId.Type.me, "hello");
assertEquals("viewer", me.getUserId(new FakeGadgetToken().setViewerId("viewer")));
UserId user = new UserId(UserId.Type.userId, "hello");
assertEquals("hello", user.getUserId(new FakeGadgetToken()));
}
代码示例来源:origin: com.lmco.shindig/shindig-social-api
@Test
public void testGetUserId() throws Exception {
UserId owner = new UserId(UserId.Type.owner, "hello");
assertEquals("owner", owner.getUserId(new FakeGadgetToken().setOwnerId("owner")));
UserId viewer = new UserId(UserId.Type.viewer, "hello");
assertEquals("viewer", viewer.getUserId(new FakeGadgetToken().setViewerId("viewer")));
UserId me = new UserId(UserId.Type.me, "hello");
assertEquals("viewer", me.getUserId(new FakeGadgetToken().setViewerId("viewer")));
UserId user = new UserId(UserId.Type.userId, "hello");
assertEquals("hello", user.getUserId(new FakeGadgetToken()));
}
代码示例来源:origin: org.apache.shindig/shindig-social-api
@Test
public void testHandleGetPlural() throws Exception {
String path = "/appdata/john.doe,jane.doe/@self/appId";
RestHandler operation = registry.getRestHandler(path, "GET");
DataCollection data = new DataCollection(null);
Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
org.easymock.EasyMock.expect(appDataService.getPersonData(eq(userIdSet),
eq(new GroupId(GroupId.Type.self, null)),
eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
.andReturn(Futures.immediateFuture(data));
replay();
assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
null, token, converter).get());
verify();
}
代码示例来源:origin: org.apache.shindig/shindig-samples
@Test
public void updateJohnDoeApplicationDataSettingCountTo5() throws Exception {
// Do update
Map<String, String> values = new MapMaker().makeMap();
values.put("count", "5");
this.appDataServiceDb.updatePersonData(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), values, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
// Verify that update succeeded
Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, null, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
DataCollection data = results.get();
assertEquals(1, data.getEntry().size());
assertEquals("5", data.getEntry().get("john.doe").get("count"));
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-social-api
@Test
public void testHandleGetPlural() throws Exception {
String path = "/appdata/john.doe,jane.doe/@self/appId";
RestHandler operation = registry.getRestHandler(path, "GET");
DataCollection data = new DataCollection(null);
Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
org.easymock.EasyMock.expect(appDataService.getPersonData(eq(userIdSet),
eq(new GroupId(GroupId.Type.self, null)),
eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
.andReturn(Futures.immediateFuture(data));
replay();
assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
null, token, converter).get());
verify();
}
代码示例来源:origin: org.apache.shindig/shindig-social-api
@Test
public void testHandleGetPlural() throws Exception {
String path = "/people/john.doe,jane.doe/@self";
RestHandler operation = registry.getRestHandler(path, "GET");
List<Person> people = ImmutableList.of();
RestfulCollection<Person> data = new RestfulCollection<Person>(people);
Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
expect(personService.getPeople(eq(userIdSet),
eq(new GroupId(GroupId.Type.self, null)),
eq(DEFAULT_OPTIONS),
eq(DEFAULT_FIELDS),
eq(token))).andReturn(Futures.immediateFuture(data));
replay();
assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
null, token, converter).get());
verify();
}
代码示例来源:origin: org.apache.shindig/shindig-samples
@Test
public void deleteJohnDoeApplicationDataWithInvalidField() throws Exception {
// Do delete with invalid field
this.appDataServiceDb.deletePersonData(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("peabody"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
// Verify that delete did not occur
Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
DataCollection data = results.get();
assertEquals(1, data.getEntry().size());
assertEquals("0", data.getEntry().get("john.doe").get("count"));
}
代码示例来源:origin: org.apache.shindig/shindig-samples
@Test
public void deleteJohnDoeApplicationDataWithCountField() throws Exception {
// Do delete
this.appDataServiceDb.deletePersonData(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
// Verify that delete succeeded
Future<DataCollection> results = this.appDataServiceDb.getPersonData(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), DEFAULT_APPLICATION_ID, SpiTestUtil.asSet("count"), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
DataCollection data = results.get();
assertEquals(1, data.getEntry().size());
assertEquals(null, data.getEntry().get("john.doe").get("count"));
}
代码示例来源:origin: com.lmco.shindig/shindig-social-api
@Test
public void testHandleGetPlural() throws Exception {
String path = "/appdata/john.doe,jane.doe/@self/appId";
RestHandler operation = registry.getRestHandler(path, "GET");
DataCollection data = new DataCollection(null);
Set<UserId> userIdSet = Sets.newLinkedHashSet(JOHN_DOE);
userIdSet.add(new UserId(UserId.Type.userId, "jane.doe"));
org.easymock.EasyMock.expect(appDataService.getPersonData(eq(userIdSet),
eq(new GroupId(GroupId.Type.self, null)),
eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
.andReturn(ImmediateFuture.newInstance(data));
replay();
assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
null, token, converter).get());
verify();
}
代码示例来源:origin: org.apache.shindig/shindig-samples
@Test
public void createNewActivityForJohnDoe() throws Exception {
// Create new activity
final String title = "hi mom!";
final String body = "and dad.";
Activity activity = SpiTestUtil.buildTestActivity("2", "john.doe", title, body);
this.activityServiceDb.createActivity(new UserId(Type.userId, "john.doe"), new GroupId(GroupId.Type.self, "@self"), "2", ACTIVITY_ALL_FIELDS, activity, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
// Check activity was created as expected
Future<RestfulCollection<Activity>> result = this.activityServiceDb.getActivities(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.self, "@self"), null, ACTIVITY_ALL_FIELDS, new CollectionOptions(), SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
RestfulCollection<Activity> activityCollection = result.get();
assertEquals(2, activityCollection.getTotalResults());
assertEquals(0, activityCollection.getStartIndex());
activity = activityCollection.getEntry().get(1);
assertEquals(activity.getTitle(), title);
assertEquals(activity.getBody(), body);
}
内容来源于网络,如有侵权,请联系作者删除!