Blame | Last modification | View Log | RSS feed
package in.shop2020.user.test;import java.util.Date;import in.shop2020.model.v1.user.Address;import in.shop2020.model.v1.user.AuthenticationException;import in.shop2020.model.v1.user.ShoppingCartException;import in.shop2020.model.v1.user.User;import in.shop2020.model.v1.user.UserAffiliateException;import in.shop2020.model.v1.user.UserCommunicationException;import in.shop2020.model.v1.user.UserContextException;import in.shop2020.model.v1.user.UserContextService.Client;import in.shop2020.model.v1.user.UserType;import in.shop2020.model.v1.user.WidgetException;import org.apache.thrift.TException;import org.apache.thrift.protocol.TBinaryProtocol;import org.apache.thrift.protocol.TProtocol;import org.apache.thrift.transport.TFramedTransport;import org.apache.thrift.transport.TSocket;import org.apache.thrift.transport.TTransport;import org.apache.thrift.transport.TTransportException;public class TestUserServer {private static final int SOCKET_TIMEOUT = 1000 * 60 * 5;public static void main(String[] args) throws UserCommunicationException, UserContextException, ShoppingCartException{TSocket socket = new TSocket("localhost", 9000);socket.setTimeout(SOCKET_TIMEOUT);TTransport transport = new TFramedTransport(socket);TProtocol protocol = new TBinaryProtocol(transport);Client client = new Client(protocol);try {transport.open();} catch (TTransportException e) {e.printStackTrace();}try {// User user = new User();// user.setUserId(23);// user.setName("ama");// user.setPassword("password");// user.setEmail("ama.kumar@shop2020.in");// user.setTrustLevel(5);// user.setMobileNumber("399999999");// System.out.println(client.createUser(user));//// Address address = new Address();// address.setLine1("A-2/5, Ashirwad Appt");// address.setLine2("Paschim Vihar");// address.setCity("New Delhi");// address.setPin("110001");// address.setName("Amard");// address.setPhone("343212311");// client.addAddressForUser(49, address, true);//// client.putUserNote((long)49, (long)1, "dsfsd", "munote");// System.out.println(client.getUserNotes(24, 34));// User user = new User();// user.setEmail("amar.kumar@shop2020.in");// user.setPassword("checkpasswordchange");// client.createUser(user);// client.createOrders(2, null, new Date().getTime(), null, new Date().getTime(), 24);client.deleteItemFromCart(1, 1);// System.out.println(client.getUserById(49));// client.deleteItemFromMyResearch(24, 1);// } catch (UserContextException e) {// e.printStackTrace();} catch (TException e) {e.printStackTrace();// } catch (AuthenticationException e) {// // TODO Auto-generated catch block// e.printStackTrace();// } catch (UserAffiliateException e) {// // TODO Auto-generated catch block// e.printStackTrace();// } catch (WidgetException e) {// // TODO Auto-generated catch block// e.printStackTrace();// } catch (ShoppingCartException e) {// // TODO Auto-generated catch block// e.printStackTrace();}}}