Package com.streamreduce.core.model.messages

Examples of com.streamreduce.core.model.messages.SobaMessage


    @Test
    @Ignore
    public void testGetPrivateMessageById() throws Exception {
        // get one random message
        SobaMessage privateMessage = applicationManager.getMessageService().getAllMessages(getTestUser(), null, null, 1, true, null, null, null, false).get(0);
        SobaMessageResponseDTO responseDTO = jsonToObject(makeRequest(getUrl() + "/" + privateMessage.getId(), "GET",
                null, authToken),
                TypeFactory.defaultInstance().constructType(SobaMessageResponseDTO.class));

        assertNotNull(responseDTO);
        assertEquals(privateMessage.getId(), responseDTO.getMessageId());
    }
View Full Code Here


    @Test
    @Ignore
    public void testAddCommentToMessage() throws Exception {

        // get the message
        SobaMessage sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        assertEquals(0, sobaMessage.getComments().size());

        JSONObject json = new JSONObject();

        json.put("comment", "Some Dumb Comment");

        String url = getUrl() + "/" + userMessage.getMessageId() + "/comment";
        makeRequest(url, "PUT", json, authToken);

        sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        assertEquals(1, sobaMessage.getComments().size());

    }
View Full Code Here

    @Test
    @Ignore
    public void testDeleteCommentOnMessage() throws Exception {

        // get the message
        SobaMessage sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        assertEquals(0, sobaMessage.getComments().size());

        JSONObject json = new JSONObject();

        json.put("comment", "Some Dumb Comment");

        String url = getUrl() + "/" + userMessage.getMessageId() + "/comment";
        makeRequest(url, "PUT", json, authToken);

        sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        assertEquals(1, sobaMessage.getComments().size());
        MessageComment messageComment =  sobaMessage.getComments().get(0);

        // now remove (nullify) the comment
        makeRequest(url + "/" + messageComment.getCreated(), "DELETE", json, authToken);

        sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        assertEquals(sobaMessage.getComments().get(0).getComment(), "comment removed by @" + testUser.getAlias());

    }
View Full Code Here

    @Test
    @Ignore
    public void testGetCommentsForMessage() throws Exception {

        int num = 0;
        SobaMessage sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        sobaMessage.addComment(new MessageComment(getTestUser(), "Some comment from test user"));
        num = sobaMessage.getComments().size();
        applicationManager.getMessageService().updateMessage(getTestUser().getAccount(), sobaMessage);

        String url = getUrl() + "/" + userMessage.getMessageId() + "/comment";
        String response = makeRequest(url, "GET", null, authToken);
View Full Code Here

    }

    @Test
    @Ignore
    public void testGetTags() throws Exception {
        SobaMessage sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        int num = sobaMessage.getHashtags().size();

        String url = getUrl() + "/" + userMessage.getMessageId() + "/hashtag";
        String response = makeRequest(url, "GET", null, authToken);

        Set<String> tags = jsonToObject(response, TypeFactory.defaultInstance().constructCollectionType(Set.class,
View Full Code Here

    @Test
    @Ignore
    public void testAddTag() throws Exception {

        SobaMessage sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        int num = sobaMessage.getHashtags().size();

        String url = getUrl() + "/" + userMessage.getMessageId() + "/hashtag";
        JSONObject json = new JSONObject();

        json.put("hashtag", "#foo");

        makeRequest(url, "POST", json, authToken);

        sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        assertEquals(num + 1, sobaMessage.getHashtags().size());

        String response = makeRequest(getUrl() + "/" + userMessage.getMessageId(), "GET", json, authToken);
        SobaMessageResponseDTO sobaMessageResponseDTO = jsonToObject(response,
                TypeFactory.defaultInstance().constructType(SobaMessageResponseDTO.class));
View Full Code Here


    @Test
    @Ignore
    public void testRemoveTag() throws Exception {
        SobaMessage sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        sobaMessage.addHashtag("foo");

        int num = sobaMessage.getHashtags().size();

        applicationManager.getMessageService().updateMessage(getTestUser().getAccount(), sobaMessage);

        String url = getUrl() + "/" + userMessage.getMessageId() + "/hashtag/foo";
        makeRequest(url, "DELETE", null, authToken);

        sobaMessage = applicationManager.getMessageService().getMessage(getTestUser().getAccount(),
                userMessage.getMessageId());

        assertEquals(num - 1, sobaMessage.getHashtags().size());
    }
View Full Code Here

TOP

Related Classes of com.streamreduce.core.model.messages.SobaMessage

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.