Package org.apache.rave.model

Examples of org.apache.rave.model.ActivityStreamsEntry


        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

    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

        }
        return ids;
    }

    private ActivityEntry getActivity(Set<String> fields, String uid, Map<String, Person> peopleById, String id) {
        ActivityStreamsEntry entry = repository.get(id);

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

        MongoDbActivityStreamsEntry entry = new MongoDbActivityStreamsEntry();
        entry.setId(ID);
        expect(template.findById(ID, ENTITY_CLASS, ACTIVITIES)).andReturn(entry);
        replay(template);

        ActivityStreamsEntry result = repository.get(ID);
        assertThat(result, is(sameInstance((ActivityStreamsEntry)entry)));
    }
View Full Code Here

        assertThat(result, is(sameInstance((ActivityStreamsEntry)entry)));
    }

    @Test
    public void save() {
        ActivityStreamsEntry original = new ActivityStreamsEntryImpl();
        ActivityStreamsEntry converted = new ActivityStreamsEntryImpl();
        expect(factory.convert(original, ActivityStreamsEntry.class)).andReturn(converted);
        template.save(converted, ACTIVITIES);
        expectLastCall();
        replay(factory, template);

        ActivityStreamsEntry result = repository.save(original);
        assertThat(result, is(sameInstance(converted)));
        verify(factory, template);
    }
View Full Code Here

        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

        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

TOP

Related Classes of org.apache.rave.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.