Package org.opensocial

Examples of org.opensocial.Client


      OAuth3LeggedScheme authScheme = new OAuth3LeggedScheme(provider,
          credentials[0], credentials[1]);
      authScheme.setRequestToken(requestToken);
      authScheme.setAccessToken(accessToken);

      return new Client(provider, authScheme);
    }

    return null;
  }
View Full Code Here


  private static final String MYSPACE_ID = "495184236";

  @Test
  public void retrieveMediaItems() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));
      Request request = MediaItemsService.getMediaItems(
          "myspace.com.album.81886");
      Response response = client.send(request);

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

  }

  @Test
  public void retrieveMediaItem() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));
      Request request = MediaItemsService.getMediaItem(
          "myspace.com.mediaItem.image.646364", "myspace.com.album.81886");
      Response response = client.send(request);

      MediaItem mediaItem = response.getEntry();
      assertTrue(mediaItem != null);
      assertTrue(mediaItem.getId().equals(
          "myspace.com.mediaItem.image.646364"));
View Full Code Here

  }

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

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

  }

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

      MediaItem mediaItem = new MediaItem();
      mediaItem.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
      mediaItem.setAlbumId("myspace.com.album.81886");
      mediaItem.setType("IMAGE");
      mediaItem.setMimeType("image/gif");

      Request request = MediaItemsService.createMediaItem(mediaItem);
      Response response = client.send(request);

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

  }

  @Test(expected=RequestException.class)
  public void createMediaItemWithoutAlbumId() throws RequestException,
      IOException {
    Client client = new Client(new MySpaceProvider(),
        new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

    MediaItem mediaItem = new MediaItem();
    mediaItem.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
    mediaItem.setType("IMAGE");
View Full Code Here

  }

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

      MediaItem mediaItem = new MediaItem();
      mediaItem.setId("myspace.com.mediaItem.image.646364");
      mediaItem.setAlbumId("myspace.com.album.81886");
      mediaItem.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
      mediaItem.setType("IMAGE");
      mediaItem.setMimeType("image/gif");

      Request request = MediaItemsService.updateMediaItem(mediaItem);
      Response response = client.send(request);

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

    }
  }

  @Test(expected=RequestException.class)
  public void updateMediaItemWithoutId() throws RequestException, IOException {
    Client client = new Client(new MySpaceProvider(),
        new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

    MediaItem mediaItem = new MediaItem();
    mediaItem.setAlbumId("myspace.com.album.81886");
    mediaItem.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
View Full Code Here

  }

  @Test(expected=RequestException.class)
  public void updateMediaItemWithoutAlbumId() throws RequestException,
      IOException {
    Client client = new Client(new MySpaceProvider(),
        new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

    MediaItem mediaItem = new MediaItem();
    mediaItem.setId("myspace.com.mediaItem.image.646364");
    mediaItem.setUrl("http://www.google.com/intl/en_ALL/images/logo.gif");
View Full Code Here

      setupClient();
    }
  }

  private void setupClient() {
    Client client = getClient();

    if (client == null) {
      showChooser();
    } else {
      showContacts(client);
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.