Package org.opensocial

Examples of org.opensocial.Client


  }

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

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

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


  }

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

      Request request = StatusMoodsService.getStatusHistory();
      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 retrieveStatusMoodHistoryForFriends() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      Request request =
        StatusMoodsService.getFriendStatusHistories();
      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 retrieveStatusMoodHistoryForFriend() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      Request request = StatusMoodsService.getFriendStatusHistory(
          "myspace.com.person.63129100");
      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 update() {
    try {
      Client client = new Client(new MySpaceProvider(),
          new OAuth2LeggedScheme(MYSPACE_KEY, MYSPACE_SECRET, MYSPACE_ID));

      StatusMood statusMood = new StatusMood();
      statusMood.setStatus("Working on the Java SDK");
      statusMood.setMoodId(90);

      Request request = StatusMoodsService.updateStatus(statusMood);
      client.send(request);

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

  private static final String ORKUT_SECRET = "uynAeXiWTisflWX99KU1D2q5";
  private static final String ORKUT_ID = "03067092798963641994";

  @BeforeClass
  public static void setup() {
    Client client = new Client(new OrkutSandboxProvider(),
        new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));
    try {
      Request request = AppDataService.updateAppData("java", "rocks");
      client.send(request);
    } catch (Exception e) {
    }
  }
View Full Code Here

    retrieveFromOrkut(true);
  }

  private void retrieveFromOrkut(boolean useRest) {
    try {
      Client client = new Client(new OrkutSandboxProvider(useRest),
          new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));
      Request request = AppDataService.getAppData();
      Response response = client.send(request);

      AppData data = response.getEntry();
      assertTrue(data.hasField(ORKUT_ID));
    } catch (Exception e) {
      fail("Exception occurred while processing request");
View Full Code Here

  private void singleUpdateAndRetrieveFromOrkut(boolean useRest) {
    Random generator = new Random();
    String randomValue = String.valueOf(generator.nextInt());

    Client client = new Client(new OrkutSandboxProvider(useRest),
        new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));

    try {
      Request request = AppDataService.updateAppData("key", randomValue);
      client.send(request);
    } catch (Exception e) {
      fail("Exception occurred while processing update request");
    }

    try {
      Request request = AppDataService.getAppData();
      Response response = client.send(request);

      AppData data = response.getEntry();
      assertTrue(data.getDataForUser(ORKUT_ID, "key").equals(randomValue));
    } catch (Exception e) {
      fail("Exception occurred while processing retrieve request");
    }

    try {
      Request request = AppDataService.deleteAppData("key");
      client.send(request);
    } catch (Exception e) {
      fail("Exception occurred while processing delete request");
    }

    try {
      Request request = AppDataService.getAppData();
      Response response = client.send(request);

      AppData data = response.getEntry();
      assertTrue(data.hasField(ORKUT_ID));
      assertTrue(data.getDataForUser(ORKUT_ID, "key") == null);
      assertTrue(data.getDataForUser(ORKUT_ID, "java") != null);
View Full Code Here

  private void multiUpdateRetrieveAndDeleteFromOrkut(boolean useRest) {
    Random generator = new Random();
    String randomValue1 = String.valueOf(generator.nextInt());
    String randomValue2 = String.valueOf(generator.nextInt());

    Client client = new Client(new OrkutSandboxProvider(useRest),
        new OAuth2LeggedScheme(ORKUT_KEY, ORKUT_SECRET, ORKUT_ID));

    try {
      Map<String, String> data = new HashMap<String, String>();
      data.put("key1", randomValue1);
      data.put("key2", randomValue2);

      Request request = AppDataService.updateAppData(data);
      client.send(request);
    } catch (Exception e) {
      fail("Exception occurred while processing update request");
    }

    try {
      Request request = AppDataService.getAppData();
      Response response = client.send(request);

      AppData data = response.getEntry();
      assertTrue(data.getDataForUser(ORKUT_ID, "key1").equals(randomValue1));
      assertTrue(data.getDataForUser(ORKUT_ID, "key2").equals(randomValue2));
    } catch (Exception e) {
      fail("Exception occurred while processing retrieve request");
    }

    try {
      Request request = AppDataService.deleteAppData(
          new String[] {"key1", "key2"});
      client.send(request);
    } catch (Exception e) {
      fail("Exception occurred while processing delete request");
    }

    try {
      Request request = AppDataService.getAppData();
      Response response = client.send(request);

      AppData data = response.getEntry();
      assertTrue(data.hasField(ORKUT_ID));
      assertTrue(data.getDataForUser(ORKUT_ID, "key1") == null);
      assertTrue(data.getDataForUser(ORKUT_ID, "key2") == null);
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 = ProfileCommentsService.getComments();
      Response response = client.send(request);

      Comment comment = response.getEntry();
      assertTrue(comment.getId() != null);
      assertTrue(comment.getBody() != null);
      assertTrue(comment.getAuthorId() != null);
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.