Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.ActivityStreamsEntry


        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


        String uid = userId.getUserId(token);

        List<ActivityEntry> entries = Lists.newLinkedList();

        for (String id : activityIds) {
            ActivityStreamsEntry entry = repository.get(id);

            if (entry!=null){
                if (entry.getUserId().equalsIgnoreCase(uid)) {
                 entries.add(filterFields(entry, fields));
                }
            }
        }
View Full Code Here

    @Override
    public Future<ActivityEntry> getActivityEntry(UserId userId, GroupId groupId, String appId, Set<String> fields, String activityId, SecurityToken token) throws ProtocolException {

        String uid = userId.getUserId(token);

        ActivityStreamsEntry entry = repository.get(activityId);

        if (entry!=null){
            if (entry.getUserId().equalsIgnoreCase(uid)) {
                ActivityEntry activityEntry = filterFields(entry, fields);
                return ImmediateFuture.newInstance(activityEntry);
            } else {
                //TODO: Throw an error?
            }
View Full Code Here

    public Future<Void> deleteActivityEntries(UserId userId, GroupId groupId, String appId, Set<String> activityIds, SecurityToken token) throws ProtocolException {

        String uid = userId.getUserId(token);

        for (String id : activityIds) {
            ActivityStreamsEntry activity = repository.get(id);
            //TODO: should we be checking against the user id?
            if (activity != null && activity.getUserId().equalsIgnoreCase(uid)) {
                repository.delete(activity);
            }
        }

        return ImmediateFuture.newInstance(null);
View Full Code Here

        ActivityStreamsEntryImpl tmp = converter.convert(activity);
        tmp.setUserId(uid);
        tmp.setGroupId(groupId.getObjectId().toString());
        tmp.setAppId(appId);

        ActivityStreamsEntry saved = repository.save(tmp);
        ActivityEntryImpl impl = converter.convert(saved);
        return ImmediateFuture.newInstance((ActivityEntry) impl);
    }
View Full Code Here

        String uid = userId.getUserId(token);


        ActivityStreamsEntryImpl activityEntity = converter.convert(activity);

        ActivityStreamsEntry saved = repository.save(activityEntity);
        return ImmediateFuture.newInstance((ActivityEntry)converter.convert(saved));

    }
View Full Code Here

        assertThat(converter.convert(template), is(sameInstance(template)));
    }

    @Test
    public void nullConversion() {
        ActivityStreamsEntry template = null;
        assertThat(converter.convert(template), is(nullValue()));
    }
View Full Code Here

    }


    @Test
    public void convertValid() {
        ActivityStreamsEntry template = new ActivityStreamsEntryImpl();
        template.setAppId("TEST_A");
        template.setBcc("TEST_B");
        template.setContent("TEST_C");
        template.setContext("TEST_D");
        template.setDc("TEST_E");
        template.setInReplyTo("TEST_F");
        template.setLocation("TEST_G");
        template.setPriority("TEST_H");
        template.setTitle("TEST_I");
        template.setGroupId("TEST_J");
        template.setSource("TEST_K");
        template.setUserId("TEST_K");


        JpaActivityStreamsEntry jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
        assertThat(jpaTemplate, is(instanceOf(JpaActivityStreamsEntry.class)));
        assertThat(jpaTemplate.getAppId(), is(equalTo(template.getAppId())));
        assertThat(jpaTemplate.getBcc(), is(equalTo(template.getBcc())));
        assertThat(jpaTemplate.getContent(), is(equalTo(template.getContent())));
        assertThat(jpaTemplate.getDc(), is(equalTo(template.getDc())));
        assertThat(jpaTemplate.getInReplyTo(), is(equalTo(template.getInReplyTo())));
        assertThat(jpaTemplate.getLocation(), is(equalTo(template.getLocation())));
        assertThat(jpaTemplate.getPriority(), is(equalTo(template.getPriority())));
        assertThat(jpaTemplate.getTitle(), is(equalTo(template.getTitle())));
        assertThat(jpaTemplate.getGroupId(), is(equalTo(template.getGroupId())));
        assertThat(jpaTemplate.getSource(), is(equalTo(template.getSource())));
        assertThat(jpaTemplate.getUserId(), is(equalTo(template.getUserId())));
    }
View Full Code Here

        repository.save(test1);

        List<ActivityStreamsEntry> collection =
                (List<ActivityStreamsEntry>)repository.getAll();

        ActivityStreamsEntry t = repository.get(collection.get(0).getId());
        assertEquals(t.getId(), collection.get(0).getId());
    }
View Full Code Here

          (List<ActivityStreamsEntry>)repository.getAll();

        // Check that it was actually test2 that was deleted
        Iterator it = collection.iterator();
        while(it.hasNext()) {
          ActivityStreamsEntry ae = (ActivityStreamsEntry)it.next();
          assertNotEquals(ae.getId(), deletedId);
        }
        assertEquals(2, collection.size());
        

    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.ActivityStreamsEntry

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.