Package org.opensocial

Examples of org.opensocial.Client


        new Date().getTime());
    activity.setBody("opensocial-java-client test activity body");
    activity.setTitleId("test");

    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));
      Request request = ActivitiesService.createActivity(activity);
      client.send(request);
    } catch (Exception e) {
      fail("Exception occurred while processing request");
    }
  }
View Full Code Here


  }

  @Test
  public void retrieveFromMySpace() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));
      Request request = ActivitiesService.getActivities();
      Response response = client.send(request);

      List<Activity> activities = response.getEntries();
      assertTrue(activities.size() > 0);
    } catch (Exception e) {
      fail("Exception occurred while processing request");
View Full Code Here

  private static final String MYSPACE_ID = "495184236";

  @Test
  public void create() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      MediaItem mediaItem = new MediaItem();
      mediaItem.setUrl("http://api.myspace.com/v1/users/63129100");

      Notification notification = new Notification();
      notification.setContent("Hi ${recipient}, here's a notification from " +
          "${canvasUrl}");
      notification.addRecipient("495184236");
      notification.addMediaItem(mediaItem);

      Request request = NotificationsService.createNotification(notification);
      Response response = client.send(request);

      assertTrue(response.getStatusLink() != null);
    } catch (Exception e) {
      fail("Exception occurred while processing request");
    }
View Full Code Here

    retrieveSelfFromOrkut(true);
  }

  private void retrieveSelfFromOrkut(boolean useRest) {
    try {
      Client client = new Client(new OrkutProvider(useRest),
          new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));
      Request request = PeopleService.getViewer();
      Response response = client.send(request);

      Person self = response.getEntry();
      assertTrue(self.getId() != null);
      assertTrue(self.getDisplayName() != null);
    } catch (Exception e) {
View Full Code Here

    retrieveFriendsFromOrkut(true);
  }

  private void retrieveFriendsFromOrkut(boolean useRest) {
    try {
      Client client = new Client(new OrkutProvider(useRest),
          new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));
      Request request = PeopleService.getFriends();
      Response response = client.send(request);

      Person self = response.getEntry();
      assertTrue(self.getId() != null);
      assertTrue(self.getDisplayName() != null);
    } catch (Exception e) {
View Full Code Here

  }

  @Test
  public void retrieveSelfFromGoogle() {
    try {
      Client client = new Client(new GoogleProvider(),
          new OAuth2LeggedScheme(GOOGLE_KEY, GOOGLE_SECRET, GOOGLE_ID));
      Request request = PeopleService.getViewer();
      Response response = client.send(request);

      Person self = response.getEntry();
      assertTrue(self.getId() != null);
      assertTrue(self.getDisplayName() != null);
    } catch (Exception e) {
View Full Code Here

  }

  @Test
  public void retrieveSelfFromMySpace() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));
      Request request = PeopleService.getViewer();
      Response response = client.send(request);

      Person self = response.getEntry();
      assertTrue(self.getId() != null);
      assertTrue(self.getDisplayName() != null);
    } catch (Exception e) {
View Full Code Here

  private static final String MYSPACE_ID = "495184236";

  @Test
  public void retrieve() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      Request request = StatusMoodsService.getStatus();
      Response response = client.send(request);

      StatusMood statusMood = response.getEntry();
      assertTrue(statusMood.getMoodId() != null);
      assertTrue(statusMood.getStatus() != null);
    } catch (Exception e) {
View Full Code Here

  }

  @Test
  public void getFriendsStatus() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      Request request = StatusMoodsService.getFriendStatuses("@me");
      Response response = client.send(request);

      List<StatusMood> statusMoods = response.getEntries();
      assertTrue(statusMoods != null);
      assertTrue(statusMoods.size() > 0);
    } catch (Exception e) {
View Full Code Here

  }

  @Test
  public void retrieveSupportedMood() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      Request request = StatusMoodsService.getSupportedMood(90);
      Response response = client.send(request);

      StatusMood mood = response.getEntry();
      assertTrue(mood.getMoodId() != null);
      assertTrue(mood.getMoodId().equals("90"));
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.opensocial.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.