Subversion Repositories SmartDukaan

Rev

Rev 3024 | Rev 3106 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3024 mandeep.dh 1
/**
2
 * 
3
 */
4
package in.shop2020.crm.handler;
5
 
6
import in.shop2020.crm.ContactMedium;
7
import in.shop2020.crm.TicketPriority;
8
import in.shop2020.crm.TicketStatus;
9
import in.shop2020.crm.domain.Activity;
10
 
11
import java.util.Date;
12
import java.util.List;
13
 
14
import junit.framework.Assert;
15
 
16
import org.apache.thrift.TException;
17
import org.junit.Before;
3029 mandeep.dh 18
import org.junit.Ignore;
3024 mandeep.dh 19
import org.junit.Test;
20
import org.springframework.context.ApplicationContext;
21
import org.springframework.context.support.ClassPathXmlApplicationContext;
22
 
23
/**
24
 * Unit test cases for ActivityHandler
25
 *
26
 * @author mandeep
27
 */
28
public class ActivityHandlerTest {
29
 
30
    private ActivityHandler activityHandler;
31
 
32
    /**
33
     * @throws java.lang.Exception
34
     */
35
    @Before
36
    public void setUp() throws Exception {
37
        ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:context.xml");
38
        activityHandler = ctx.getBean(ActivityHandler.class);
39
    }
40
 
41
    /**
42
     * Test method for {@link in.shop2020.crm.handler.ActivityHandler#fetchActivities(long, in.shop2020.crm.ActivityStatus, long)}.
43
     * @throws TException 
44
     */
3029 mandeep.dh 45
    @Ignore
3024 mandeep.dh 46
    public void testFetchActivities() throws TException {
47
        List<Activity> activities = activityHandler.getActivities(1l);
48
        Assert.assertTrue(activities.isEmpty());
49
        activities = activityHandler.getActivities(null);
50
        Assert.assertTrue(!activities.isEmpty());
51
    }
52
 
53
    /**
54
     * Test method for {@link in.shop2020.crm.handler.ActivityHandler#insertActivity(in.shop2020.crm.domain.Activity)}.
55
     * @throws TException 
56
     */
3029 mandeep.dh 57
    @Ignore
3024 mandeep.dh 58
    public void testInsertActivity() throws TException {
59
        Activity activity = new Activity();
60
        activity.setCustomerId(34l);
61
        activity.setContactTimestamp(new Date());
62
        activity.setTicketPriority(TicketPriority.HIGH);
63
        activity.setContactingAgentId(0);
64
        activity.setContactMedium(ContactMedium.EMAIL);
65
        activity.setCreatorId(0);
66
        activity.setDescription("sdfklshdf");
67
        activity.setTicketAssigneeId(0);
68
        activity.setTicketId(0);
69
        activity.setTicketPriority(TicketPriority.HIGH);
70
        activity.setTicketStatus(TicketStatus.OPEN);
71
        activityHandler.insertActivity(activity);
72
        System.out.println(activity.getId());
73
    }
74
}