congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
UserId.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.shindig.social.opensocial.spi.UserId
constructor

Best Java code snippets using org.apache.shindig.social.opensocial.spi.UserId.<init> (Showing top 20 results out of 315)

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);
}

org.apache.shindig.social.opensocial.spiUserId<init>

Popular methods of UserId

  • getUserId
  • fromJson
  • getType

Popular in Java

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • JTable (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now