Subversion Repositories SmartDukaan

Rev

Rev 1946 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package in.shop2020.payment.service;

import in.shop2020.payments.PaymentException;
import in.shop2020.payments.PaymentService.Client;

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 TestPaymentServer {
        private static final int SOCKET_TIMEOUT = 1000 * 60 * 5;
        
        public static void main(String[] args){
                TSocket socket = new TSocket("localhost", 9012);
                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 {
                        client.createPayment(3333, 2700.0, 1, 3456, false);
                } catch (PaymentException e) {
                        e.printStackTrace();
                } catch (TException e) {
                        e.printStackTrace();
                }
                
        }
         
}