Subversion Repositories SmartDukaan

Rev

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