Subversion Repositories SmartDukaan

Rev

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