Package org.apache.shindig.social.opensocial.model

Examples of org.apache.shindig.social.opensocial.model.ActivityEntry


    public void testConvertActivityEntry()  {
        ActivityStreamsEntryImpl activityStreamsEntry1 = conversionUtilTest.convert((ActivityEntry)activityEntry);

        assertThat(activityStreamsEntry1.getId(), is(equalTo(activityEntry.getId())));

        ActivityEntry reconverted = conversionUtilTest.convert(activityStreamsEntry1);

        assertThat(reconverted.getId(), is(equalTo(activityStreamsEntry1.getId())));
    }
View Full Code Here


        expect(token.getViewerId()).andReturn(ID_1);
        expect(repository.save(EasyMock.isA(ActivityStreamsEntryImpl.class))).andReturn(activityStreamsEntry);
        replay(repository);
        replay(token);

        ActivityEntry shindigActivity = conversionUtilTest.convert(activityStreamsEntry);
        ActivityStreamsEntry raveActivity = conversionUtilTest.convert(shindigActivity);
        Future<ActivityEntry> activityEntry = service.createActivityEntry(id,groupId,APP_ID,fields, shindigActivity,token);

        assertThat(conversionUtilTest.convert(activityEntry.get()).getTitle(), is(activityStreamsEntry.getTitle()));
    }
View Full Code Here

    assertSame(2, responseItem.getTotalResults());
  }

  @Test
  public void testGetExpectedActivityEntry() throws Exception {
    ActivityEntry entry = db.getActivityEntry(JOHN_DOE, SELF_GROUP, APP_ID,
        ImmutableSet.of("title"), "activity2", new FakeGadgetToken()).get();
    assertNotNull(entry);
    // Check that some fields are fetched and others are not
    assertNotNull(entry.getTitle());
    assertNull(entry.getPublished());
  }
View Full Code Here

      source = new AtomSource(activity);
      generator = new AtomGenerator(activity);
      author = new AtomAuthor(activity);
      updated = activity.getUpdated();
    } else if (o instanceof ActivityEntry) {
      ActivityEntry activity = (ActivityEntry)o;
      id = activity.getId();
      title = activity.getTitle();
      summary = activity.getObject().getSummary();
      author = new AtomAuthor(activity);
      content = new AtomContent(activity);
      try {
        updated = new SimpleDateFormat().parse(activity.getPublished());
      } catch (ParseException e) {
        // TODO: map published to updated field correctly
      }
    } else if (oCopy instanceof Entry) {
      Entry<?, ?> e = (Entry<?, ?>) oCopy;
View Full Code Here

  @Test
  public void testHandleGetActivityEntryById() throws Exception {
    String path = "/activitystreams/john.doe/@friends/@app/myObjectId123"// TODO: change id=1 in DB for consistency
    RestHandler operation = registry.getRestHandler(path, "GET");

    ActivityEntry entry = new ActivityEntryImpl();
    org.easymock.EasyMock.expect(service.getActivityEntry(eq(JOHN_DOE.iterator().next()),
        eq(new GroupId(GroupId.Type.friends, null)),
        eq("appId"), eq(ImmutableSet.<String>of()), eq("myObjectId123"), eq(token))).andReturn(
        ImmediateFuture.newInstance(entry));
View Full Code Here

    String jsonActivityEntry = "{title: 'hi mom!', object: {id: 'testObject'}}";

    String path = "/activitystreams/john.doe/@self/@app";
    RestHandler operation = registry.getRestHandler(path, method);

    ActivityEntry entry = new ActivityEntryImpl();
    org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivityEntry), eq(ActivityEntry.class)))
        .andReturn(entry);

    org.easymock.EasyMock.expect(service.createActivityEntry(eq(JOHN_DOE.iterator().next()),
        eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
View Full Code Here

    String jsonActivityEntry = "{title: 'hi mom!', object: {id: 'testObject'}}";

    String path = "/activitystreams/john.doe/@self/@app";
    RestHandler operation = registry.getRestHandler(path, "POST");

    ActivityEntry entry = new ActivityEntryImpl();
    org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivityEntry), eq(ActivityEntry.class)))
        .andReturn(entry);

    org.easymock.EasyMock.expect(service.createActivityEntry(eq(JOHN_DOE.iterator().next()),
        eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
View Full Code Here

    String jsonActivityEntry = "{title: 'hi mom!', object: {id: 'testObject'}}";

    String path = "/activitystreams/john.doe/@self/@app/testObject";
    RestHandler operation = registry.getRestHandler(path, "PUT");

    ActivityEntry entry = new ActivityEntryImpl();
    org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonActivityEntry), eq(ActivityEntry.class)))
        .andReturn(entry);

    org.easymock.EasyMock.expect(service.updateActivityEntry(eq(JOHN_DOE.iterator().next()),
        eq(new GroupId(GroupId.Type.self, null)), eq("appId"), eq(ImmutableSet.<String>of()),
View Full Code Here

    assertSame(3, responseItem.getTotalResults());
  }

  @Test
  public void testGetExpectedActivityEntry() throws Exception {
    ActivityEntry entry = db.getActivityEntry(JOHN_DOE, SELF_GROUP, APP_ID,
        ImmutableSet.of("title"), "activity2", new FakeGadgetToken()).get();
    assertNotNull(entry);
    // Check that some fields are fetched and others are not
    assertNotNull(entry.getTitle());
    assertNull(entry.getPublished());
  }
View Full Code Here

        expect(token.getViewerId()).andReturn(ID_1);
        expect(repository.save(EasyMock.isA(ActivityStreamsEntryImpl.class))).andReturn(activityStreamsEntry);
        replay(repository);
        replay(token);

        ActivityEntry shindigActivity = conversionUtilTest.convert(activityStreamsEntry);
        ActivityStreamsEntry raveActivity = conversionUtilTest.convert(shindigActivity);
        Future<ActivityEntry> activityEntry = service.createActivityEntry(id,groupId,APP_ID,fields, shindigActivity,token);

        assertThat(conversionUtilTest.convert(activityEntry.get()).getTitle(), is(activityStreamsEntry.getTitle()));
    }
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.opensocial.model.ActivityEntry

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.