| 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;
|
|
|
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 |
*/
|
|
|
44 |
@Test
|
|
|
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());
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
/**
|
|
|
53 |
* Test method for {@link in.shop2020.crm.handler.ActivityHandler#insertActivity(in.shop2020.crm.domain.Activity)}.
|
|
|
54 |
* @throws TException
|
|
|
55 |
*/
|
|
|
56 |
@Test
|
|
|
57 |
public void testInsertActivity() throws TException {
|
|
|
58 |
Activity activity = new Activity();
|
|
|
59 |
activity.setCustomerId(34l);
|
|
|
60 |
activity.setContactTimestamp(new Date());
|
|
|
61 |
activity.setTicketPriority(TicketPriority.HIGH);
|
|
|
62 |
activity.setContactingAgentId(0);
|
|
|
63 |
activity.setContactMedium(ContactMedium.EMAIL);
|
|
|
64 |
activity.setCreatorId(0);
|
|
|
65 |
activity.setDescription("sdfklshdf");
|
|
|
66 |
activity.setTicketAssigneeId(0);
|
|
|
67 |
activity.setTicketId(0);
|
|
|
68 |
activity.setTicketPriority(TicketPriority.HIGH);
|
|
|
69 |
activity.setTicketStatus(TicketStatus.OPEN);
|
|
|
70 |
activityHandler.insertActivity(activity);
|
|
|
71 |
System.out.println(activity.getId());
|
|
|
72 |
}
|
|
|
73 |
}
|