Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5432 amar.kumar 1
package in.shop2020.user.test;
2
 
3
import java.util.Date;
4
 
5
import in.shop2020.model.v1.user.Address;
6
import in.shop2020.model.v1.user.AuthenticationException;
7
import in.shop2020.model.v1.user.ShoppingCartException;
8
import in.shop2020.model.v1.user.User;
9
import in.shop2020.model.v1.user.UserAffiliateException;
10
import in.shop2020.model.v1.user.UserCommunicationException;
11
import in.shop2020.model.v1.user.UserContextException;
12
import in.shop2020.model.v1.user.UserContextService.Client;
13
import in.shop2020.model.v1.user.UserType;
14
import in.shop2020.model.v1.user.WidgetException;
15
 
16
import org.apache.thrift.TException;
17
import org.apache.thrift.protocol.TBinaryProtocol;
18
import org.apache.thrift.protocol.TProtocol;
19
import org.apache.thrift.transport.TFramedTransport;
20
import org.apache.thrift.transport.TSocket;
21
import org.apache.thrift.transport.TTransport;
22
import org.apache.thrift.transport.TTransportException;
23
 
24
public class TestUserServer {
25
	private static final int SOCKET_TIMEOUT = 1000 * 60 * 5;
26
 
27
	public static void main(String[] args) throws UserCommunicationException, UserContextException, ShoppingCartException{
28
		TSocket socket = new TSocket("localhost", 9000);
29
		socket.setTimeout(SOCKET_TIMEOUT);
30
 
31
		TTransport transport = new TFramedTransport(socket);
32
		TProtocol protocol = new TBinaryProtocol(transport);
33
		Client client = new Client(protocol);
34
		try {
35
			transport.open();
36
		} catch (TTransportException e) {
37
			e.printStackTrace();
38
		}
39
 
40
		try {
41
//			User user = new User();
42
//			user.setUserId(23);
43
//			user.setName("ama");
44
//			user.setPassword("password");
45
//			user.setEmail("ama.kumar@shop2020.in");
46
//			user.setTrustLevel(5);
47
//			user.setMobileNumber("399999999");
48
//			System.out.println(client.createUser(user));
49
//			
50
//			Address address = new Address();
51
//			address.setLine1("A-2/5, Ashirwad Appt");
52
//			address.setLine2("Paschim Vihar");
53
//			address.setCity("New Delhi");
54
//			address.setPin("110001");
55
//			address.setName("Amard");
56
//			address.setPhone("343212311");
57
//			client.addAddressForUser(49, address, true);
58
//				
59
//			client.putUserNote((long)49, (long)1, "dsfsd", "munote");
60
//			System.out.println(client.getUserNotes(24, 34));
61
//			User user = new User();
62
//			user.setEmail("amar.kumar@shop2020.in");
63
//			user.setPassword("checkpasswordchange");
64
//			client.createUser(user);
65
//			client.createOrders(2, null, new Date().getTime(), null, new Date().getTime(), 24);
66
			client.deleteItemFromCart(1, 1);
67
//			System.out.println(client.getUserById(49));
68
//			client.deleteItemFromMyResearch(24, 1);
69
//		} catch (UserContextException e) {
70
//			e.printStackTrace();
71
		} catch (TException e) {
72
			e.printStackTrace();
73
//		} catch (AuthenticationException e) {
74
//			// TODO Auto-generated catch block
75
//			e.printStackTrace();
76
//		} catch (UserAffiliateException e) {
77
//			// TODO Auto-generated catch block
78
//			e.printStackTrace();
79
//		} catch (WidgetException e) {
80
//			// TODO Auto-generated catch block
81
//			e.printStackTrace();
82
//		} catch (ShoppingCartException e) {
83
//			// TODO Auto-generated catch block
84
//			e.printStackTrace();
85
		}
86
	}
87
}