// Run test suite using TCompactBinaryProtocol
func TestTCompactProtocol(t *testing.T) {
	RunSocketTestSuite(t,
		thrift.NewTCompactProtocolFactory(),
		thrift.NewTTransportFactory())
	RunSocketTestSuite(t,
		thrift.NewTCompactProtocolFactory(),
		thrift.NewTBufferedTransportFactory(8912))
	RunSocketTestSuite(t,
		thrift.NewTCompactProtocolFactory(),
		thrift.NewTFramedTransportFactory(thrift.NewTTransportFactory()))
}
Exemple #2
0
func newProtocolFactory(protocol int) (thrift.TProtocolFactory, error) {
	switch protocol {
	case TBinaryProtocol:
		return thrift.NewTBinaryProtocolFactoryDefault(), nil
	case TCompactProtocol:
		return thrift.NewTCompactProtocolFactory(), nil
	case TJSONProtocol:
		return thrift.NewTJSONProtocolFactory(), nil
	case TSimpleJSONProtocol:
		return thrift.NewTSimpleJSONProtocolFactory(), nil
	}

	return nil, errors.New(fmt.Sprint("invalid protocol:", protocol))
}
Exemple #3
0
func main() {
	flag.Usage = Usage
	var client bool
	var server bool
	var protocol string
	var framed bool
	var useHttp bool
	var help bool

	flag.BoolVar(&client, "client", false, "Run client")
	flag.BoolVar(&server, "server", false, "Run server")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson)")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || (client && server) || !(client || server) {
		fmt.Print("flag.NArg() == ", flag.NArg(), "\n")
		flag.Usage()
	}
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	transportFactory := thrift.NewTTransportFactory()
	if framed {
		transportFactory = thrift.NewTFramedTransportFactory(transportFactory)
	}

	if client {
		RunClient(transportFactory, protocolFactory)
	} else if server {
		RunServer(transportFactory, protocolFactory)
	} else {
		flag.Usage()
	}
	os.Exit(0)
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var help bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || flag.NArg() == 0 {
		flag.Usage()
	}

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error resolving address", err.Error())
			os.Exit(1)
		}
		trans, err = thrift.NewTNonblockingSocketAddr(addr)
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprint(os.Stderr, "Error creating transport", err.Error())
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	client := simple.NewContainerOfEnumsTestServiceClientFactory(trans, protocolFactory)
	if err = trans.Open(); err != nil {
		fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error())
		os.Exit(1)
	}

	switch cmd {
	case "echo":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "Echo requires 1 args\n")
			flag.Usage()
		}
		arg33 := flag.Arg(1)
		mbTrans34 := thrift.NewTMemoryBufferLen(len(arg33))
		defer mbTrans34.Close()
		_, err35 := mbTrans34.WriteString(arg33)
		if err35 != nil {
			Usage()
			return
		}
		factory36 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt37 := factory36.GetProtocol(mbTrans34)
		argvalue0 := simple.NewContainerOfEnums()
		err38 := argvalue0.Read(jsProt37)
		if err38 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Echo(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n")
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := thrifttest.NewThriftTestClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "testVoid":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "TestVoid requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.TestVoid())
		fmt.Print("\n")
		break
	case "testString":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestString requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.TestString(value0))
		fmt.Print("\n")
		break
	case "testBool":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestBool requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1) == "true"
		value0 := argvalue0
		fmt.Print(client.TestBool(value0))
		fmt.Print("\n")
		break
	case "testByte":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestByte requires 1 args")
			flag.Usage()
		}
		tmp0, err100 := (strconv.Atoi(flag.Arg(1)))
		if err100 != nil {
			Usage()
			return
		}
		argvalue0 := byte(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestByte(value0))
		fmt.Print("\n")
		break
	case "testI32":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestI32 requires 1 args")
			flag.Usage()
		}
		tmp0, err101 := (strconv.Atoi(flag.Arg(1)))
		if err101 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestI32(value0))
		fmt.Print("\n")
		break
	case "testI64":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestI64 requires 1 args")
			flag.Usage()
		}
		argvalue0, err102 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err102 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestI64(value0))
		fmt.Print("\n")
		break
	case "testDouble":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestDouble requires 1 args")
			flag.Usage()
		}
		argvalue0, err103 := (strconv.ParseFloat(flag.Arg(1), 64))
		if err103 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestDouble(value0))
		fmt.Print("\n")
		break
	case "testBinary":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestBinary requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := argvalue0
		fmt.Print(client.TestBinary(value0))
		fmt.Print("\n")
		break
	case "testStruct":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestStruct requires 1 args")
			flag.Usage()
		}
		arg105 := flag.Arg(1)
		mbTrans106 := thrift.NewTMemoryBufferLen(len(arg105))
		defer mbTrans106.Close()
		_, err107 := mbTrans106.WriteString(arg105)
		if err107 != nil {
			Usage()
			return
		}
		factory108 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt109 := factory108.GetProtocol(mbTrans106)
		argvalue0 := thrifttest.NewXtruct()
		err110 := argvalue0.Read(jsProt109)
		if err110 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestStruct(value0))
		fmt.Print("\n")
		break
	case "testNest":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestNest requires 1 args")
			flag.Usage()
		}
		arg111 := flag.Arg(1)
		mbTrans112 := thrift.NewTMemoryBufferLen(len(arg111))
		defer mbTrans112.Close()
		_, err113 := mbTrans112.WriteString(arg111)
		if err113 != nil {
			Usage()
			return
		}
		factory114 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt115 := factory114.GetProtocol(mbTrans112)
		argvalue0 := thrifttest.NewXtruct2()
		err116 := argvalue0.Read(jsProt115)
		if err116 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestNest(value0))
		fmt.Print("\n")
		break
	case "testMap":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestMap requires 1 args")
			flag.Usage()
		}
		arg117 := flag.Arg(1)
		mbTrans118 := thrift.NewTMemoryBufferLen(len(arg117))
		defer mbTrans118.Close()
		_, err119 := mbTrans118.WriteString(arg117)
		if err119 != nil {
			Usage()
			return
		}
		factory120 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt121 := factory120.GetProtocol(mbTrans118)
		containerStruct0 := thrifttest.NewThriftTestTestMapArgs()
		err122 := containerStruct0.ReadField1(jsProt121)
		if err122 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Thing
		value0 := argvalue0
		fmt.Print(client.TestMap(value0))
		fmt.Print("\n")
		break
	case "testStringMap":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestStringMap requires 1 args")
			flag.Usage()
		}
		arg123 := flag.Arg(1)
		mbTrans124 := thrift.NewTMemoryBufferLen(len(arg123))
		defer mbTrans124.Close()
		_, err125 := mbTrans124.WriteString(arg123)
		if err125 != nil {
			Usage()
			return
		}
		factory126 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt127 := factory126.GetProtocol(mbTrans124)
		containerStruct0 := thrifttest.NewThriftTestTestStringMapArgs()
		err128 := containerStruct0.ReadField1(jsProt127)
		if err128 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Thing
		value0 := argvalue0
		fmt.Print(client.TestStringMap(value0))
		fmt.Print("\n")
		break
	case "testSet":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestSet requires 1 args")
			flag.Usage()
		}
		arg129 := flag.Arg(1)
		mbTrans130 := thrift.NewTMemoryBufferLen(len(arg129))
		defer mbTrans130.Close()
		_, err131 := mbTrans130.WriteString(arg129)
		if err131 != nil {
			Usage()
			return
		}
		factory132 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt133 := factory132.GetProtocol(mbTrans130)
		containerStruct0 := thrifttest.NewThriftTestTestSetArgs()
		err134 := containerStruct0.ReadField1(jsProt133)
		if err134 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Thing
		value0 := argvalue0
		fmt.Print(client.TestSet(value0))
		fmt.Print("\n")
		break
	case "testList":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestList requires 1 args")
			flag.Usage()
		}
		arg135 := flag.Arg(1)
		mbTrans136 := thrift.NewTMemoryBufferLen(len(arg135))
		defer mbTrans136.Close()
		_, err137 := mbTrans136.WriteString(arg135)
		if err137 != nil {
			Usage()
			return
		}
		factory138 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt139 := factory138.GetProtocol(mbTrans136)
		containerStruct0 := thrifttest.NewThriftTestTestListArgs()
		err140 := containerStruct0.ReadField1(jsProt139)
		if err140 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Thing
		value0 := argvalue0
		fmt.Print(client.TestList(value0))
		fmt.Print("\n")
		break
	case "testEnum":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestEnum requires 1 args")
			flag.Usage()
		}
		tmp0, err := (strconv.Atoi(flag.Arg(1)))
		if err != nil {
			Usage()
			return
		}
		argvalue0 := thrifttest.Numberz(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestEnum(value0))
		fmt.Print("\n")
		break
	case "testTypedef":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestTypedef requires 1 args")
			flag.Usage()
		}
		argvalue0, err141 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err141 != nil {
			Usage()
			return
		}
		value0 := thrifttest.UserId(argvalue0)
		fmt.Print(client.TestTypedef(value0))
		fmt.Print("\n")
		break
	case "testMapMap":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestMapMap requires 1 args")
			flag.Usage()
		}
		tmp0, err142 := (strconv.Atoi(flag.Arg(1)))
		if err142 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestMapMap(value0))
		fmt.Print("\n")
		break
	case "testInsanity":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestInsanity requires 1 args")
			flag.Usage()
		}
		arg143 := flag.Arg(1)
		mbTrans144 := thrift.NewTMemoryBufferLen(len(arg143))
		defer mbTrans144.Close()
		_, err145 := mbTrans144.WriteString(arg143)
		if err145 != nil {
			Usage()
			return
		}
		factory146 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt147 := factory146.GetProtocol(mbTrans144)
		argvalue0 := thrifttest.NewInsanity()
		err148 := argvalue0.Read(jsProt147)
		if err148 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TestInsanity(value0))
		fmt.Print("\n")
		break
	case "testMulti":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "TestMulti requires 6 args")
			flag.Usage()
		}
		tmp0, err149 := (strconv.Atoi(flag.Arg(1)))
		if err149 != nil {
			Usage()
			return
		}
		argvalue0 := byte(tmp0)
		value0 := argvalue0
		tmp1, err150 := (strconv.Atoi(flag.Arg(2)))
		if err150 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		argvalue2, err151 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err151 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg152 := flag.Arg(4)
		mbTrans153 := thrift.NewTMemoryBufferLen(len(arg152))
		defer mbTrans153.Close()
		_, err154 := mbTrans153.WriteString(arg152)
		if err154 != nil {
			Usage()
			return
		}
		factory155 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt156 := factory155.GetProtocol(mbTrans153)
		containerStruct3 := thrifttest.NewThriftTestTestMultiArgs()
		err157 := containerStruct3.ReadField4(jsProt156)
		if err157 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Arg3
		value3 := argvalue3
		tmp4, err := (strconv.Atoi(flag.Arg(5)))
		if err != nil {
			Usage()
			return
		}
		argvalue4 := thrifttest.Numberz(tmp4)
		value4 := argvalue4
		argvalue5, err158 := (strconv.ParseInt(flag.Arg(6), 10, 64))
		if err158 != nil {
			Usage()
			return
		}
		value5 := thrifttest.UserId(argvalue5)
		fmt.Print(client.TestMulti(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "testException":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestException requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.TestException(value0))
		fmt.Print("\n")
		break
	case "testMultiException":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "TestMultiException requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.TestMultiException(value0, value1))
		fmt.Print("\n")
		break
	case "testOneway":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TestOneway requires 1 args")
			flag.Usage()
		}
		tmp0, err162 := (strconv.Atoi(flag.Arg(1)))
		if err162 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.TestOneway(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := thrifttest.NewSecondServiceClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "blahBlah":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "BlahBlah requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.BlahBlah())
		fmt.Print("\n")
		break
	case "secondtestString":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "SecondtestString requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.SecondtestString(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var help bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || flag.NArg() == 0 {
		flag.Usage()
	}

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error resolving address", err.Error())
			os.Exit(1)
		}
		trans, err = thrift.NewTNonblockingSocketAddr(addr)
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprint(os.Stderr, "Error creating transport", err.Error())
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	client := librarytest.NewServiceForExceptionWithAMapClientFactory(trans, protocolFactory)
	if err = trans.Open(); err != nil {
		fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error())
		os.Exit(1)
	}

	switch cmd {
	case "methodThatThrowsAnException":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "MethodThatThrowsAnException requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.MethodThatThrowsAnException())
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n")
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var help bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || flag.NArg() == 0 {
		flag.Usage()
	}

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error resolving address", err.Error())
			os.Exit(1)
		}
		trans, err = thrift.NewTNonblockingSocketAddr(addr)
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprint(os.Stderr, "Error creating transport", err.Error())
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	client := Cassandra.NewCassandraClientFactory(trans, protocolFactory)
	if err = trans.Open(); err != nil {
		fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error())
		os.Exit(1)
	}

	switch cmd {
	case "login":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "Login requires 1 args\n")
			flag.Usage()
		}
		arg958 := flag.Arg(1)
		mbTrans959 := thrift.NewTMemoryBufferLen(len(arg958))
		defer mbTrans959.Close()
		_, err960 := mbTrans959.WriteString(arg958)
		if err960 != nil {
			Usage()
			return
		}
		factory961 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt962 := factory961.GetProtocol(mbTrans959)
		argvalue0 := Cassandra.NewAuthenticationRequest()
		err963 := argvalue0.Read(jsProt962)
		if err963 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Login(value0))
		fmt.Print("\n")
		break
	case "set_keyspace":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "SetKeyspace requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.SetKeyspace(value0))
		fmt.Print("\n")
		break
	case "get":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "Get requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg966 := flag.Arg(2)
		mbTrans967 := thrift.NewTMemoryBufferLen(len(arg966))
		defer mbTrans967.Close()
		_, err968 := mbTrans967.WriteString(arg966)
		if err968 != nil {
			Usage()
			return
		}
		factory969 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt970 := factory969.GetProtocol(mbTrans967)
		argvalue1 := Cassandra.NewColumnPath()
		err971 := argvalue1.Read(jsProt970)
		if err971 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := Cassandra.ConsistencyLevel(tmp2)
		value2 := argvalue2
		fmt.Print(client.Get(value0, value1, value2))
		fmt.Print("\n")
		break
	case "get_slice":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetSlice requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg973 := flag.Arg(2)
		mbTrans974 := thrift.NewTMemoryBufferLen(len(arg973))
		defer mbTrans974.Close()
		_, err975 := mbTrans974.WriteString(arg973)
		if err975 != nil {
			Usage()
			return
		}
		factory976 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt977 := factory976.GetProtocol(mbTrans974)
		argvalue1 := Cassandra.NewColumnParent()
		err978 := argvalue1.Read(jsProt977)
		if err978 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg979 := flag.Arg(3)
		mbTrans980 := thrift.NewTMemoryBufferLen(len(arg979))
		defer mbTrans980.Close()
		_, err981 := mbTrans980.WriteString(arg979)
		if err981 != nil {
			Usage()
			return
		}
		factory982 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt983 := factory982.GetProtocol(mbTrans980)
		argvalue2 := Cassandra.NewSlicePredicate()
		err984 := argvalue2.Read(jsProt983)
		if err984 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := Cassandra.ConsistencyLevel(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetSlice(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "get_count":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetCount requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg986 := flag.Arg(2)
		mbTrans987 := thrift.NewTMemoryBufferLen(len(arg986))
		defer mbTrans987.Close()
		_, err988 := mbTrans987.WriteString(arg986)
		if err988 != nil {
			Usage()
			return
		}
		factory989 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt990 := factory989.GetProtocol(mbTrans987)
		argvalue1 := Cassandra.NewColumnParent()
		err991 := argvalue1.Read(jsProt990)
		if err991 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg992 := flag.Arg(3)
		mbTrans993 := thrift.NewTMemoryBufferLen(len(arg992))
		defer mbTrans993.Close()
		_, err994 := mbTrans993.WriteString(arg992)
		if err994 != nil {
			Usage()
			return
		}
		factory995 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt996 := factory995.GetProtocol(mbTrans993)
		argvalue2 := Cassandra.NewSlicePredicate()
		err997 := argvalue2.Read(jsProt996)
		if err997 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := Cassandra.ConsistencyLevel(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetCount(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "multiget_slice":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "MultigetSlice requires 4 args\n")
			flag.Usage()
		}
		arg998 := flag.Arg(1)
		mbTrans999 := thrift.NewTMemoryBufferLen(len(arg998))
		defer mbTrans999.Close()
		_, err1000 := mbTrans999.WriteString(arg998)
		if err1000 != nil {
			Usage()
			return
		}
		factory1001 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1002 := factory1001.GetProtocol(mbTrans999)
		containerStruct0 := Cassandra.NewMultigetSliceArgs()
		err1003 := containerStruct0.ReadField1(jsProt1002)
		if err1003 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Keys
		value0 := argvalue0
		arg1004 := flag.Arg(2)
		mbTrans1005 := thrift.NewTMemoryBufferLen(len(arg1004))
		defer mbTrans1005.Close()
		_, err1006 := mbTrans1005.WriteString(arg1004)
		if err1006 != nil {
			Usage()
			return
		}
		factory1007 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1008 := factory1007.GetProtocol(mbTrans1005)
		argvalue1 := Cassandra.NewColumnParent()
		err1009 := argvalue1.Read(jsProt1008)
		if err1009 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1010 := flag.Arg(3)
		mbTrans1011 := thrift.NewTMemoryBufferLen(len(arg1010))
		defer mbTrans1011.Close()
		_, err1012 := mbTrans1011.WriteString(arg1010)
		if err1012 != nil {
			Usage()
			return
		}
		factory1013 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1014 := factory1013.GetProtocol(mbTrans1011)
		argvalue2 := Cassandra.NewSlicePredicate()
		err1015 := argvalue2.Read(jsProt1014)
		if err1015 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := Cassandra.ConsistencyLevel(tmp3)
		value3 := argvalue3
		fmt.Print(client.MultigetSlice(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "multiget_count":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "MultigetCount requires 4 args\n")
			flag.Usage()
		}
		arg1016 := flag.Arg(1)
		mbTrans1017 := thrift.NewTMemoryBufferLen(len(arg1016))
		defer mbTrans1017.Close()
		_, err1018 := mbTrans1017.WriteString(arg1016)
		if err1018 != nil {
			Usage()
			return
		}
		factory1019 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1020 := factory1019.GetProtocol(mbTrans1017)
		containerStruct0 := Cassandra.NewMultigetCountArgs()
		err1021 := containerStruct0.ReadField1(jsProt1020)
		if err1021 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Keys
		value0 := argvalue0
		arg1022 := flag.Arg(2)
		mbTrans1023 := thrift.NewTMemoryBufferLen(len(arg1022))
		defer mbTrans1023.Close()
		_, err1024 := mbTrans1023.WriteString(arg1022)
		if err1024 != nil {
			Usage()
			return
		}
		factory1025 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1026 := factory1025.GetProtocol(mbTrans1023)
		argvalue1 := Cassandra.NewColumnParent()
		err1027 := argvalue1.Read(jsProt1026)
		if err1027 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1028 := flag.Arg(3)
		mbTrans1029 := thrift.NewTMemoryBufferLen(len(arg1028))
		defer mbTrans1029.Close()
		_, err1030 := mbTrans1029.WriteString(arg1028)
		if err1030 != nil {
			Usage()
			return
		}
		factory1031 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1032 := factory1031.GetProtocol(mbTrans1029)
		argvalue2 := Cassandra.NewSlicePredicate()
		err1033 := argvalue2.Read(jsProt1032)
		if err1033 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := Cassandra.ConsistencyLevel(tmp3)
		value3 := argvalue3
		fmt.Print(client.MultigetCount(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "get_range_slices":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetRangeSlices requires 4 args\n")
			flag.Usage()
		}
		arg1034 := flag.Arg(1)
		mbTrans1035 := thrift.NewTMemoryBufferLen(len(arg1034))
		defer mbTrans1035.Close()
		_, err1036 := mbTrans1035.WriteString(arg1034)
		if err1036 != nil {
			Usage()
			return
		}
		factory1037 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1038 := factory1037.GetProtocol(mbTrans1035)
		argvalue0 := Cassandra.NewColumnParent()
		err1039 := argvalue0.Read(jsProt1038)
		if err1039 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg1040 := flag.Arg(2)
		mbTrans1041 := thrift.NewTMemoryBufferLen(len(arg1040))
		defer mbTrans1041.Close()
		_, err1042 := mbTrans1041.WriteString(arg1040)
		if err1042 != nil {
			Usage()
			return
		}
		factory1043 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1044 := factory1043.GetProtocol(mbTrans1041)
		argvalue1 := Cassandra.NewSlicePredicate()
		err1045 := argvalue1.Read(jsProt1044)
		if err1045 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1046 := flag.Arg(3)
		mbTrans1047 := thrift.NewTMemoryBufferLen(len(arg1046))
		defer mbTrans1047.Close()
		_, err1048 := mbTrans1047.WriteString(arg1046)
		if err1048 != nil {
			Usage()
			return
		}
		factory1049 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1050 := factory1049.GetProtocol(mbTrans1047)
		argvalue2 := Cassandra.NewKeyRange()
		err1051 := argvalue2.Read(jsProt1050)
		if err1051 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := Cassandra.ConsistencyLevel(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetRangeSlices(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "get_indexed_slices":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetIndexedSlices requires 4 args\n")
			flag.Usage()
		}
		arg1052 := flag.Arg(1)
		mbTrans1053 := thrift.NewTMemoryBufferLen(len(arg1052))
		defer mbTrans1053.Close()
		_, err1054 := mbTrans1053.WriteString(arg1052)
		if err1054 != nil {
			Usage()
			return
		}
		factory1055 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1056 := factory1055.GetProtocol(mbTrans1053)
		argvalue0 := Cassandra.NewColumnParent()
		err1057 := argvalue0.Read(jsProt1056)
		if err1057 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg1058 := flag.Arg(2)
		mbTrans1059 := thrift.NewTMemoryBufferLen(len(arg1058))
		defer mbTrans1059.Close()
		_, err1060 := mbTrans1059.WriteString(arg1058)
		if err1060 != nil {
			Usage()
			return
		}
		factory1061 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1062 := factory1061.GetProtocol(mbTrans1059)
		argvalue1 := Cassandra.NewIndexClause()
		err1063 := argvalue1.Read(jsProt1062)
		if err1063 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1064 := flag.Arg(3)
		mbTrans1065 := thrift.NewTMemoryBufferLen(len(arg1064))
		defer mbTrans1065.Close()
		_, err1066 := mbTrans1065.WriteString(arg1064)
		if err1066 != nil {
			Usage()
			return
		}
		factory1067 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1068 := factory1067.GetProtocol(mbTrans1065)
		argvalue2 := Cassandra.NewSlicePredicate()
		err1069 := argvalue2.Read(jsProt1068)
		if err1069 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := Cassandra.ConsistencyLevel(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetIndexedSlices(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "insert":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "Insert requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg1071 := flag.Arg(2)
		mbTrans1072 := thrift.NewTMemoryBufferLen(len(arg1071))
		defer mbTrans1072.Close()
		_, err1073 := mbTrans1072.WriteString(arg1071)
		if err1073 != nil {
			Usage()
			return
		}
		factory1074 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1075 := factory1074.GetProtocol(mbTrans1072)
		argvalue1 := Cassandra.NewColumnParent()
		err1076 := argvalue1.Read(jsProt1075)
		if err1076 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1077 := flag.Arg(3)
		mbTrans1078 := thrift.NewTMemoryBufferLen(len(arg1077))
		defer mbTrans1078.Close()
		_, err1079 := mbTrans1078.WriteString(arg1077)
		if err1079 != nil {
			Usage()
			return
		}
		factory1080 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1081 := factory1080.GetProtocol(mbTrans1078)
		argvalue2 := Cassandra.NewColumn()
		err1082 := argvalue2.Read(jsProt1081)
		if err1082 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := Cassandra.ConsistencyLevel(tmp3)
		value3 := argvalue3
		fmt.Print(client.Insert(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "remove":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "Remove requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg1084 := flag.Arg(2)
		mbTrans1085 := thrift.NewTMemoryBufferLen(len(arg1084))
		defer mbTrans1085.Close()
		_, err1086 := mbTrans1085.WriteString(arg1084)
		if err1086 != nil {
			Usage()
			return
		}
		factory1087 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1088 := factory1087.GetProtocol(mbTrans1085)
		argvalue1 := Cassandra.NewColumnPath()
		err1089 := argvalue1.Read(jsProt1088)
		if err1089 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err1090 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err1090 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := Cassandra.ConsistencyLevel(tmp3)
		value3 := argvalue3
		fmt.Print(client.Remove(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "batch_mutate":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "BatchMutate requires 2 args\n")
			flag.Usage()
		}
		arg1091 := flag.Arg(1)
		mbTrans1092 := thrift.NewTMemoryBufferLen(len(arg1091))
		defer mbTrans1092.Close()
		_, err1093 := mbTrans1092.WriteString(arg1091)
		if err1093 != nil {
			Usage()
			return
		}
		factory1094 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1095 := factory1094.GetProtocol(mbTrans1092)
		containerStruct0 := Cassandra.NewBatchMutateArgs()
		err1096 := containerStruct0.ReadField1(jsProt1095)
		if err1096 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.MutationMap
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := Cassandra.ConsistencyLevel(tmp1)
		value1 := argvalue1
		fmt.Print(client.BatchMutate(value0, value1))
		fmt.Print("\n")
		break
	case "truncate":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "Truncate requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.Truncate(value0))
		fmt.Print("\n")
		break
	case "describe_schema_versions":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "DescribeSchemaVersions requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.DescribeSchemaVersions())
		fmt.Print("\n")
		break
	case "describe_keyspaces":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "DescribeKeyspaces requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.DescribeKeyspaces())
		fmt.Print("\n")
		break
	case "describe_cluster_name":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "DescribeClusterName requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.DescribeClusterName())
		fmt.Print("\n")
		break
	case "describe_version":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "DescribeVersion requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.DescribeVersion())
		fmt.Print("\n")
		break
	case "describe_ring":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "DescribeRing requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.DescribeRing(value0))
		fmt.Print("\n")
		break
	case "describe_partitioner":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "DescribePartitioner requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.DescribePartitioner())
		fmt.Print("\n")
		break
	case "describe_snitch":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "DescribeSnitch requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.DescribeSnitch())
		fmt.Print("\n")
		break
	case "describe_keyspace":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "DescribeKeyspace requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.DescribeKeyspace(value0))
		fmt.Print("\n")
		break
	case "describe_splits":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "DescribeSplits requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		tmp3, err1103 := (strconv.Atoi(flag.Arg(4)))
		if err1103 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		fmt.Print(client.DescribeSplits(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "system_add_column_family":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "SystemAddColumnFamily requires 1 args\n")
			flag.Usage()
		}
		arg1104 := flag.Arg(1)
		mbTrans1105 := thrift.NewTMemoryBufferLen(len(arg1104))
		defer mbTrans1105.Close()
		_, err1106 := mbTrans1105.WriteString(arg1104)
		if err1106 != nil {
			Usage()
			return
		}
		factory1107 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1108 := factory1107.GetProtocol(mbTrans1105)
		argvalue0 := Cassandra.NewCfDef()
		err1109 := argvalue0.Read(jsProt1108)
		if err1109 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.SystemAddColumnFamily(value0))
		fmt.Print("\n")
		break
	case "system_drop_column_family":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "SystemDropColumnFamily requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.SystemDropColumnFamily(value0))
		fmt.Print("\n")
		break
	case "system_add_keyspace":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "SystemAddKeyspace requires 1 args\n")
			flag.Usage()
		}
		arg1111 := flag.Arg(1)
		mbTrans1112 := thrift.NewTMemoryBufferLen(len(arg1111))
		defer mbTrans1112.Close()
		_, err1113 := mbTrans1112.WriteString(arg1111)
		if err1113 != nil {
			Usage()
			return
		}
		factory1114 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1115 := factory1114.GetProtocol(mbTrans1112)
		argvalue0 := Cassandra.NewKsDef()
		err1116 := argvalue0.Read(jsProt1115)
		if err1116 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.SystemAddKeyspace(value0))
		fmt.Print("\n")
		break
	case "system_drop_keyspace":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "SystemDropKeyspace requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.SystemDropKeyspace(value0))
		fmt.Print("\n")
		break
	case "system_update_keyspace":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "SystemUpdateKeyspace requires 1 args\n")
			flag.Usage()
		}
		arg1118 := flag.Arg(1)
		mbTrans1119 := thrift.NewTMemoryBufferLen(len(arg1118))
		defer mbTrans1119.Close()
		_, err1120 := mbTrans1119.WriteString(arg1118)
		if err1120 != nil {
			Usage()
			return
		}
		factory1121 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1122 := factory1121.GetProtocol(mbTrans1119)
		argvalue0 := Cassandra.NewKsDef()
		err1123 := argvalue0.Read(jsProt1122)
		if err1123 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.SystemUpdateKeyspace(value0))
		fmt.Print("\n")
		break
	case "system_update_column_family":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "SystemUpdateColumnFamily requires 1 args\n")
			flag.Usage()
		}
		arg1124 := flag.Arg(1)
		mbTrans1125 := thrift.NewTMemoryBufferLen(len(arg1124))
		defer mbTrans1125.Close()
		_, err1126 := mbTrans1125.WriteString(arg1124)
		if err1126 != nil {
			Usage()
			return
		}
		factory1127 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1128 := factory1127.GetProtocol(mbTrans1125)
		argvalue0 := Cassandra.NewCfDef()
		err1129 := argvalue0.Read(jsProt1128)
		if err1129 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.SystemUpdateColumnFamily(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n")
	}
}
Exemple #9
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var help bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || flag.NArg() == 0 {
		flag.Usage()
	}

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error resolving address", err.Error())
			os.Exit(1)
		}
		trans, err = thrift.NewTNonblockingSocketAddr(addr)
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprint(os.Stderr, "Error creating transport", err.Error())
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	client := tutorial.NewCalculatorClientFactory(trans, protocolFactory)
	if err = trans.Open(); err != nil {
		fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error())
		os.Exit(1)
	}

	switch cmd {
	case "ping":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "Ping requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.Ping())
		fmt.Print("\n")
		break
	case "add":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "Add requires 2 args\n")
			flag.Usage()
		}
		tmp0, err62 := (strconv.Atoi(flag.Arg(1)))
		if err62 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		tmp1, err63 := (strconv.Atoi(flag.Arg(2)))
		if err63 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.Add(value0, value1))
		fmt.Print("\n")
		break
	case "calculate":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "Calculate requires 2 args\n")
			flag.Usage()
		}
		tmp0, err64 := (strconv.Atoi(flag.Arg(1)))
		if err64 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		arg65 := flag.Arg(2)
		mbTrans66 := thrift.NewTMemoryBufferLen(len(arg65))
		defer mbTrans66.Close()
		_, err67 := mbTrans66.WriteString(arg65)
		if err67 != nil {
			Usage()
			return
		}
		factory68 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt69 := factory68.GetProtocol(mbTrans66)
		argvalue1 := tutorial.NewWork()
		err70 := argvalue1.Read(jsProt69)
		if err70 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.Calculate(value0, value1))
		fmt.Print("\n")
		break
	case "zip":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "Zip requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.Zip())
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n")
	}
}
Exemple #10
0
func GetServerParams(
	host string,
	port int64,
	domain_socket string,
	transport string,
	protocol string,
	ssl bool,
	certPath string,
	handler thrifttest.ThriftTest) (thrift.TProcessor, thrift.TServerTransport, thrift.TTransportFactory, thrift.TProtocolFactory, error) {

	var err error
	hostPort := fmt.Sprintf("%s:%d", host, port)

	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
	case "binary":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
	default:
		return nil, nil, nil, nil, fmt.Errorf("Invalid protocol specified %s", protocol)
	}
	if debugServerProtocol {
		protocolFactory = thrift.NewTDebugProtocolFactory(protocolFactory, "server:")
	}

	var serverTransport thrift.TServerTransport
	if ssl {
		cfg := new(tls.Config)
		if cert, err := tls.LoadX509KeyPair(certPath+"/server.crt", certPath+"/server.key"); err != nil {
			return nil, nil, nil, nil, err
		} else {
			cfg.Certificates = append(cfg.Certificates, cert)
		}
		serverTransport, err = thrift.NewTSSLServerSocket(hostPort, cfg)
	} else {
		if domain_socket != "" {
			serverTransport, err = thrift.NewTServerSocket(domain_socket)
		} else {
			serverTransport, err = thrift.NewTServerSocket(hostPort)
		}
	}
	if err != nil {
		return nil, nil, nil, nil, err
	}

	var transportFactory thrift.TTransportFactory

	switch transport {
	case "http":
		// there is no such factory, and we don't need any
		transportFactory = nil
	case "framed":
		transportFactory = thrift.NewTTransportFactory()
		transportFactory = thrift.NewTFramedTransportFactory(transportFactory)
	case "buffered":
		transportFactory = thrift.NewTBufferedTransportFactory(8192)
	case "zlib":
		transportFactory = thrift.NewTZlibTransportFactory(zlib.BestCompression)
	case "":
		transportFactory = thrift.NewTTransportFactory()
	default:
		return nil, nil, nil, nil, fmt.Errorf("Invalid transport specified %s", transport)
	}
	processor := thrifttest.NewThriftTestProcessor(handler)

	return processor, serverTransport, transportFactory, protocolFactory, nil
}
Exemple #11
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var help bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || flag.NArg() == 0 {
		flag.Usage()
	}

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error resolving address", err.Error())
			os.Exit(1)
		}
		trans, err = thrift.NewTNonblockingSocketAddr(addr)
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprint(os.Stderr, "Error creating transport", err.Error())
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	client := Hbase.NewHbaseClientFactory(trans, protocolFactory)
	if err = trans.Open(); err != nil {
		fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error())
		os.Exit(1)
	}

	switch cmd {
	case "enableTable":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "EnableTable requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.EnableTable(value0))
		fmt.Print("\n")
		break
	case "disableTable":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "DisableTable requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.DisableTable(value0))
		fmt.Print("\n")
		break
	case "isTableEnabled":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "IsTableEnabled requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.IsTableEnabled(value0))
		fmt.Print("\n")
		break
	case "compact":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "Compact requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.Compact(value0))
		fmt.Print("\n")
		break
	case "majorCompact":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "MajorCompact requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.MajorCompact(value0))
		fmt.Print("\n")
		break
	case "getTableNames":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetTableNames requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetTableNames())
		fmt.Print("\n")
		break
	case "getColumnDescriptors":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetColumnDescriptors requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		fmt.Print(client.GetColumnDescriptors(value0))
		fmt.Print("\n")
		break
	case "getTableRegions":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetTableRegions requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		fmt.Print(client.GetTableRegions(value0))
		fmt.Print("\n")
		break
	case "createTable":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "CreateTable requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1635 := flag.Arg(2)
		mbTrans1636 := thrift.NewTMemoryBufferLen(len(arg1635))
		defer mbTrans1636.Close()
		_, err1637 := mbTrans1636.WriteString(arg1635)
		if err1637 != nil {
			Usage()
			return
		}
		factory1638 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1639 := factory1638.GetProtocol(mbTrans1636)
		containerStruct1 := Hbase.NewCreateTableArgs()
		err1640 := containerStruct1.ReadField2(jsProt1639)
		if err1640 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.ColumnFamilies
		value1 := argvalue1
		fmt.Print(client.CreateTable(value0, value1))
		fmt.Print("\n")
		break
	case "deleteTable":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "DeleteTable requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		fmt.Print(client.DeleteTable(value0))
		fmt.Print("\n")
		break
	case "get":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "Get requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		arg1645 := flag.Arg(4)
		mbTrans1646 := thrift.NewTMemoryBufferLen(len(arg1645))
		defer mbTrans1646.Close()
		_, err1647 := mbTrans1646.WriteString(arg1645)
		if err1647 != nil {
			Usage()
			return
		}
		factory1648 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1649 := factory1648.GetProtocol(mbTrans1646)
		containerStruct3 := Hbase.NewGetArgs()
		err1650 := containerStruct3.ReadField4(jsProt1649)
		if err1650 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.Get(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getVer":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "GetVer requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		tmp3, err1654 := (strconv.Atoi(flag.Arg(4)))
		if err1654 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		arg1655 := flag.Arg(5)
		mbTrans1656 := thrift.NewTMemoryBufferLen(len(arg1655))
		defer mbTrans1656.Close()
		_, err1657 := mbTrans1656.WriteString(arg1655)
		if err1657 != nil {
			Usage()
			return
		}
		factory1658 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1659 := factory1658.GetProtocol(mbTrans1656)
		containerStruct4 := Hbase.NewGetVerArgs()
		err1660 := containerStruct4.ReadField5(jsProt1659)
		if err1660 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.GetVer(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "getVerTs":
		if flag.NArg()-1 != 6 {
			fmt.Fprint(os.Stderr, "GetVerTs requires 6 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		argvalue3, err1664 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err1664 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		tmp4, err1665 := (strconv.Atoi(flag.Arg(5)))
		if err1665 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		arg1666 := flag.Arg(6)
		mbTrans1667 := thrift.NewTMemoryBufferLen(len(arg1666))
		defer mbTrans1667.Close()
		_, err1668 := mbTrans1667.WriteString(arg1666)
		if err1668 != nil {
			Usage()
			return
		}
		factory1669 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1670 := factory1669.GetProtocol(mbTrans1667)
		containerStruct5 := Hbase.NewGetVerTsArgs()
		err1671 := containerStruct5.ReadField6(jsProt1670)
		if err1671 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.Attributes
		value5 := argvalue5
		fmt.Print(client.GetVerTs(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getRow":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetRow requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1674 := flag.Arg(3)
		mbTrans1675 := thrift.NewTMemoryBufferLen(len(arg1674))
		defer mbTrans1675.Close()
		_, err1676 := mbTrans1675.WriteString(arg1674)
		if err1676 != nil {
			Usage()
			return
		}
		factory1677 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1678 := factory1677.GetProtocol(mbTrans1675)
		containerStruct2 := Hbase.NewGetRowArgs()
		err1679 := containerStruct2.ReadField3(jsProt1678)
		if err1679 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.GetRow(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRowWithColumns":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetRowWithColumns requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1682 := flag.Arg(3)
		mbTrans1683 := thrift.NewTMemoryBufferLen(len(arg1682))
		defer mbTrans1683.Close()
		_, err1684 := mbTrans1683.WriteString(arg1682)
		if err1684 != nil {
			Usage()
			return
		}
		factory1685 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1686 := factory1685.GetProtocol(mbTrans1683)
		containerStruct2 := Hbase.NewGetRowWithColumnsArgs()
		err1687 := containerStruct2.ReadField3(jsProt1686)
		if err1687 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		arg1688 := flag.Arg(4)
		mbTrans1689 := thrift.NewTMemoryBufferLen(len(arg1688))
		defer mbTrans1689.Close()
		_, err1690 := mbTrans1689.WriteString(arg1688)
		if err1690 != nil {
			Usage()
			return
		}
		factory1691 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1692 := factory1691.GetProtocol(mbTrans1689)
		containerStruct3 := Hbase.NewGetRowWithColumnsArgs()
		err1693 := containerStruct3.ReadField4(jsProt1692)
		if err1693 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.GetRowWithColumns(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRowTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetRowTs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2, err1696 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err1696 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg1697 := flag.Arg(4)
		mbTrans1698 := thrift.NewTMemoryBufferLen(len(arg1697))
		defer mbTrans1698.Close()
		_, err1699 := mbTrans1698.WriteString(arg1697)
		if err1699 != nil {
			Usage()
			return
		}
		factory1700 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1701 := factory1700.GetProtocol(mbTrans1698)
		containerStruct3 := Hbase.NewGetRowTsArgs()
		err1702 := containerStruct3.ReadField4(jsProt1701)
		if err1702 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.GetRowTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRowWithColumnsTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "GetRowWithColumnsTs requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1705 := flag.Arg(3)
		mbTrans1706 := thrift.NewTMemoryBufferLen(len(arg1705))
		defer mbTrans1706.Close()
		_, err1707 := mbTrans1706.WriteString(arg1705)
		if err1707 != nil {
			Usage()
			return
		}
		factory1708 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1709 := factory1708.GetProtocol(mbTrans1706)
		containerStruct2 := Hbase.NewGetRowWithColumnsTsArgs()
		err1710 := containerStruct2.ReadField3(jsProt1709)
		if err1710 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		argvalue3, err1711 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err1711 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg1712 := flag.Arg(5)
		mbTrans1713 := thrift.NewTMemoryBufferLen(len(arg1712))
		defer mbTrans1713.Close()
		_, err1714 := mbTrans1713.WriteString(arg1712)
		if err1714 != nil {
			Usage()
			return
		}
		factory1715 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1716 := factory1715.GetProtocol(mbTrans1713)
		containerStruct4 := Hbase.NewGetRowWithColumnsTsArgs()
		err1717 := containerStruct4.ReadField5(jsProt1716)
		if err1717 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.GetRowWithColumnsTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "getRows":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetRows requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1719 := flag.Arg(2)
		mbTrans1720 := thrift.NewTMemoryBufferLen(len(arg1719))
		defer mbTrans1720.Close()
		_, err1721 := mbTrans1720.WriteString(arg1719)
		if err1721 != nil {
			Usage()
			return
		}
		factory1722 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1723 := factory1722.GetProtocol(mbTrans1720)
		containerStruct1 := Hbase.NewGetRowsArgs()
		err1724 := containerStruct1.ReadField2(jsProt1723)
		if err1724 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		arg1725 := flag.Arg(3)
		mbTrans1726 := thrift.NewTMemoryBufferLen(len(arg1725))
		defer mbTrans1726.Close()
		_, err1727 := mbTrans1726.WriteString(arg1725)
		if err1727 != nil {
			Usage()
			return
		}
		factory1728 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1729 := factory1728.GetProtocol(mbTrans1726)
		containerStruct2 := Hbase.NewGetRowsArgs()
		err1730 := containerStruct2.ReadField3(jsProt1729)
		if err1730 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.GetRows(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRowsWithColumns":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetRowsWithColumns requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1732 := flag.Arg(2)
		mbTrans1733 := thrift.NewTMemoryBufferLen(len(arg1732))
		defer mbTrans1733.Close()
		_, err1734 := mbTrans1733.WriteString(arg1732)
		if err1734 != nil {
			Usage()
			return
		}
		factory1735 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1736 := factory1735.GetProtocol(mbTrans1733)
		containerStruct1 := Hbase.NewGetRowsWithColumnsArgs()
		err1737 := containerStruct1.ReadField2(jsProt1736)
		if err1737 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		arg1738 := flag.Arg(3)
		mbTrans1739 := thrift.NewTMemoryBufferLen(len(arg1738))
		defer mbTrans1739.Close()
		_, err1740 := mbTrans1739.WriteString(arg1738)
		if err1740 != nil {
			Usage()
			return
		}
		factory1741 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1742 := factory1741.GetProtocol(mbTrans1739)
		containerStruct2 := Hbase.NewGetRowsWithColumnsArgs()
		err1743 := containerStruct2.ReadField3(jsProt1742)
		if err1743 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		arg1744 := flag.Arg(4)
		mbTrans1745 := thrift.NewTMemoryBufferLen(len(arg1744))
		defer mbTrans1745.Close()
		_, err1746 := mbTrans1745.WriteString(arg1744)
		if err1746 != nil {
			Usage()
			return
		}
		factory1747 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1748 := factory1747.GetProtocol(mbTrans1745)
		containerStruct3 := Hbase.NewGetRowsWithColumnsArgs()
		err1749 := containerStruct3.ReadField4(jsProt1748)
		if err1749 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.GetRowsWithColumns(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRowsTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetRowsTs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1751 := flag.Arg(2)
		mbTrans1752 := thrift.NewTMemoryBufferLen(len(arg1751))
		defer mbTrans1752.Close()
		_, err1753 := mbTrans1752.WriteString(arg1751)
		if err1753 != nil {
			Usage()
			return
		}
		factory1754 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1755 := factory1754.GetProtocol(mbTrans1752)
		containerStruct1 := Hbase.NewGetRowsTsArgs()
		err1756 := containerStruct1.ReadField2(jsProt1755)
		if err1756 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		argvalue2, err1757 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err1757 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg1758 := flag.Arg(4)
		mbTrans1759 := thrift.NewTMemoryBufferLen(len(arg1758))
		defer mbTrans1759.Close()
		_, err1760 := mbTrans1759.WriteString(arg1758)
		if err1760 != nil {
			Usage()
			return
		}
		factory1761 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1762 := factory1761.GetProtocol(mbTrans1759)
		containerStruct3 := Hbase.NewGetRowsTsArgs()
		err1763 := containerStruct3.ReadField4(jsProt1762)
		if err1763 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.GetRowsTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRowsWithColumnsTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "GetRowsWithColumnsTs requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1765 := flag.Arg(2)
		mbTrans1766 := thrift.NewTMemoryBufferLen(len(arg1765))
		defer mbTrans1766.Close()
		_, err1767 := mbTrans1766.WriteString(arg1765)
		if err1767 != nil {
			Usage()
			return
		}
		factory1768 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1769 := factory1768.GetProtocol(mbTrans1766)
		containerStruct1 := Hbase.NewGetRowsWithColumnsTsArgs()
		err1770 := containerStruct1.ReadField2(jsProt1769)
		if err1770 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		arg1771 := flag.Arg(3)
		mbTrans1772 := thrift.NewTMemoryBufferLen(len(arg1771))
		defer mbTrans1772.Close()
		_, err1773 := mbTrans1772.WriteString(arg1771)
		if err1773 != nil {
			Usage()
			return
		}
		factory1774 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1775 := factory1774.GetProtocol(mbTrans1772)
		containerStruct2 := Hbase.NewGetRowsWithColumnsTsArgs()
		err1776 := containerStruct2.ReadField3(jsProt1775)
		if err1776 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		argvalue3, err1777 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err1777 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg1778 := flag.Arg(5)
		mbTrans1779 := thrift.NewTMemoryBufferLen(len(arg1778))
		defer mbTrans1779.Close()
		_, err1780 := mbTrans1779.WriteString(arg1778)
		if err1780 != nil {
			Usage()
			return
		}
		factory1781 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1782 := factory1781.GetProtocol(mbTrans1779)
		containerStruct4 := Hbase.NewGetRowsWithColumnsTsArgs()
		err1783 := containerStruct4.ReadField5(jsProt1782)
		if err1783 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.GetRowsWithColumnsTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "mutateRow":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "MutateRow requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1786 := flag.Arg(3)
		mbTrans1787 := thrift.NewTMemoryBufferLen(len(arg1786))
		defer mbTrans1787.Close()
		_, err1788 := mbTrans1787.WriteString(arg1786)
		if err1788 != nil {
			Usage()
			return
		}
		factory1789 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1790 := factory1789.GetProtocol(mbTrans1787)
		containerStruct2 := Hbase.NewMutateRowArgs()
		err1791 := containerStruct2.ReadField3(jsProt1790)
		if err1791 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Mutations
		value2 := argvalue2
		arg1792 := flag.Arg(4)
		mbTrans1793 := thrift.NewTMemoryBufferLen(len(arg1792))
		defer mbTrans1793.Close()
		_, err1794 := mbTrans1793.WriteString(arg1792)
		if err1794 != nil {
			Usage()
			return
		}
		factory1795 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1796 := factory1795.GetProtocol(mbTrans1793)
		containerStruct3 := Hbase.NewMutateRowArgs()
		err1797 := containerStruct3.ReadField4(jsProt1796)
		if err1797 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.MutateRow(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "mutateRowTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "MutateRowTs requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1800 := flag.Arg(3)
		mbTrans1801 := thrift.NewTMemoryBufferLen(len(arg1800))
		defer mbTrans1801.Close()
		_, err1802 := mbTrans1801.WriteString(arg1800)
		if err1802 != nil {
			Usage()
			return
		}
		factory1803 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1804 := factory1803.GetProtocol(mbTrans1801)
		containerStruct2 := Hbase.NewMutateRowTsArgs()
		err1805 := containerStruct2.ReadField3(jsProt1804)
		if err1805 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Mutations
		value2 := argvalue2
		argvalue3, err1806 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err1806 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg1807 := flag.Arg(5)
		mbTrans1808 := thrift.NewTMemoryBufferLen(len(arg1807))
		defer mbTrans1808.Close()
		_, err1809 := mbTrans1808.WriteString(arg1807)
		if err1809 != nil {
			Usage()
			return
		}
		factory1810 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1811 := factory1810.GetProtocol(mbTrans1808)
		containerStruct4 := Hbase.NewMutateRowTsArgs()
		err1812 := containerStruct4.ReadField5(jsProt1811)
		if err1812 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.MutateRowTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "mutateRows":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "MutateRows requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1814 := flag.Arg(2)
		mbTrans1815 := thrift.NewTMemoryBufferLen(len(arg1814))
		defer mbTrans1815.Close()
		_, err1816 := mbTrans1815.WriteString(arg1814)
		if err1816 != nil {
			Usage()
			return
		}
		factory1817 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1818 := factory1817.GetProtocol(mbTrans1815)
		containerStruct1 := Hbase.NewMutateRowsArgs()
		err1819 := containerStruct1.ReadField2(jsProt1818)
		if err1819 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.RowBatches
		value1 := argvalue1
		arg1820 := flag.Arg(3)
		mbTrans1821 := thrift.NewTMemoryBufferLen(len(arg1820))
		defer mbTrans1821.Close()
		_, err1822 := mbTrans1821.WriteString(arg1820)
		if err1822 != nil {
			Usage()
			return
		}
		factory1823 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1824 := factory1823.GetProtocol(mbTrans1821)
		containerStruct2 := Hbase.NewMutateRowsArgs()
		err1825 := containerStruct2.ReadField3(jsProt1824)
		if err1825 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.MutateRows(value0, value1, value2))
		fmt.Print("\n")
		break
	case "mutateRowsTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "MutateRowsTs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1827 := flag.Arg(2)
		mbTrans1828 := thrift.NewTMemoryBufferLen(len(arg1827))
		defer mbTrans1828.Close()
		_, err1829 := mbTrans1828.WriteString(arg1827)
		if err1829 != nil {
			Usage()
			return
		}
		factory1830 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1831 := factory1830.GetProtocol(mbTrans1828)
		containerStruct1 := Hbase.NewMutateRowsTsArgs()
		err1832 := containerStruct1.ReadField2(jsProt1831)
		if err1832 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.RowBatches
		value1 := argvalue1
		argvalue2, err1833 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err1833 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg1834 := flag.Arg(4)
		mbTrans1835 := thrift.NewTMemoryBufferLen(len(arg1834))
		defer mbTrans1835.Close()
		_, err1836 := mbTrans1835.WriteString(arg1834)
		if err1836 != nil {
			Usage()
			return
		}
		factory1837 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1838 := factory1837.GetProtocol(mbTrans1835)
		containerStruct3 := Hbase.NewMutateRowsTsArgs()
		err1839 := containerStruct3.ReadField4(jsProt1838)
		if err1839 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.MutateRowsTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "atomicIncrement":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "AtomicIncrement requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		argvalue3, err1843 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err1843 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.AtomicIncrement(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "deleteAll":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "DeleteAll requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		arg1847 := flag.Arg(4)
		mbTrans1848 := thrift.NewTMemoryBufferLen(len(arg1847))
		defer mbTrans1848.Close()
		_, err1849 := mbTrans1848.WriteString(arg1847)
		if err1849 != nil {
			Usage()
			return
		}
		factory1850 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1851 := factory1850.GetProtocol(mbTrans1848)
		containerStruct3 := Hbase.NewDeleteAllArgs()
		err1852 := containerStruct3.ReadField4(jsProt1851)
		if err1852 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.DeleteAll(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "deleteAllTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "DeleteAllTs requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		argvalue3, err1856 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err1856 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg1857 := flag.Arg(5)
		mbTrans1858 := thrift.NewTMemoryBufferLen(len(arg1857))
		defer mbTrans1858.Close()
		_, err1859 := mbTrans1858.WriteString(arg1857)
		if err1859 != nil {
			Usage()
			return
		}
		factory1860 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1861 := factory1860.GetProtocol(mbTrans1858)
		containerStruct4 := Hbase.NewDeleteAllTsArgs()
		err1862 := containerStruct4.ReadField5(jsProt1861)
		if err1862 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.DeleteAllTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "deleteAllRow":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "DeleteAllRow requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1865 := flag.Arg(3)
		mbTrans1866 := thrift.NewTMemoryBufferLen(len(arg1865))
		defer mbTrans1866.Close()
		_, err1867 := mbTrans1866.WriteString(arg1865)
		if err1867 != nil {
			Usage()
			return
		}
		factory1868 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1869 := factory1868.GetProtocol(mbTrans1866)
		containerStruct2 := Hbase.NewDeleteAllRowArgs()
		err1870 := containerStruct2.ReadField3(jsProt1869)
		if err1870 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.DeleteAllRow(value0, value1, value2))
		fmt.Print("\n")
		break
	case "increment":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "Increment requires 1 args\n")
			flag.Usage()
		}
		arg1871 := flag.Arg(1)
		mbTrans1872 := thrift.NewTMemoryBufferLen(len(arg1871))
		defer mbTrans1872.Close()
		_, err1873 := mbTrans1872.WriteString(arg1871)
		if err1873 != nil {
			Usage()
			return
		}
		factory1874 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1875 := factory1874.GetProtocol(mbTrans1872)
		argvalue0 := Hbase.NewTIncrement()
		err1876 := argvalue0.Read(jsProt1875)
		if err1876 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Increment(value0))
		fmt.Print("\n")
		break
	case "incrementRows":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "IncrementRows requires 1 args\n")
			flag.Usage()
		}
		arg1877 := flag.Arg(1)
		mbTrans1878 := thrift.NewTMemoryBufferLen(len(arg1877))
		defer mbTrans1878.Close()
		_, err1879 := mbTrans1878.WriteString(arg1877)
		if err1879 != nil {
			Usage()
			return
		}
		factory1880 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1881 := factory1880.GetProtocol(mbTrans1878)
		containerStruct0 := Hbase.NewIncrementRowsArgs()
		err1882 := containerStruct0.ReadField1(jsProt1881)
		if err1882 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Increments
		value0 := argvalue0
		fmt.Print(client.IncrementRows(value0))
		fmt.Print("\n")
		break
	case "deleteAllRowTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "DeleteAllRowTs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2, err1885 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err1885 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg1886 := flag.Arg(4)
		mbTrans1887 := thrift.NewTMemoryBufferLen(len(arg1886))
		defer mbTrans1887.Close()
		_, err1888 := mbTrans1887.WriteString(arg1886)
		if err1888 != nil {
			Usage()
			return
		}
		factory1889 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1890 := factory1889.GetProtocol(mbTrans1887)
		containerStruct3 := Hbase.NewDeleteAllRowTsArgs()
		err1891 := containerStruct3.ReadField4(jsProt1890)
		if err1891 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.DeleteAllRowTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "scannerOpenWithScan":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "ScannerOpenWithScan requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1893 := flag.Arg(2)
		mbTrans1894 := thrift.NewTMemoryBufferLen(len(arg1893))
		defer mbTrans1894.Close()
		_, err1895 := mbTrans1894.WriteString(arg1893)
		if err1895 != nil {
			Usage()
			return
		}
		factory1896 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1897 := factory1896.GetProtocol(mbTrans1894)
		argvalue1 := Hbase.NewTScan()
		err1898 := argvalue1.Read(jsProt1897)
		if err1898 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1899 := flag.Arg(3)
		mbTrans1900 := thrift.NewTMemoryBufferLen(len(arg1899))
		defer mbTrans1900.Close()
		_, err1901 := mbTrans1900.WriteString(arg1899)
		if err1901 != nil {
			Usage()
			return
		}
		factory1902 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1903 := factory1902.GetProtocol(mbTrans1900)
		containerStruct2 := Hbase.NewScannerOpenWithScanArgs()
		err1904 := containerStruct2.ReadField3(jsProt1903)
		if err1904 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.ScannerOpenWithScan(value0, value1, value2))
		fmt.Print("\n")
		break
	case "scannerOpen":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "ScannerOpen requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1907 := flag.Arg(3)
		mbTrans1908 := thrift.NewTMemoryBufferLen(len(arg1907))
		defer mbTrans1908.Close()
		_, err1909 := mbTrans1908.WriteString(arg1907)
		if err1909 != nil {
			Usage()
			return
		}
		factory1910 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1911 := factory1910.GetProtocol(mbTrans1908)
		containerStruct2 := Hbase.NewScannerOpenArgs()
		err1912 := containerStruct2.ReadField3(jsProt1911)
		if err1912 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		arg1913 := flag.Arg(4)
		mbTrans1914 := thrift.NewTMemoryBufferLen(len(arg1913))
		defer mbTrans1914.Close()
		_, err1915 := mbTrans1914.WriteString(arg1913)
		if err1915 != nil {
			Usage()
			return
		}
		factory1916 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1917 := factory1916.GetProtocol(mbTrans1914)
		containerStruct3 := Hbase.NewScannerOpenArgs()
		err1918 := containerStruct3.ReadField4(jsProt1917)
		if err1918 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.ScannerOpen(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "scannerOpenWithStop":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "ScannerOpenWithStop requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		arg1922 := flag.Arg(4)
		mbTrans1923 := thrift.NewTMemoryBufferLen(len(arg1922))
		defer mbTrans1923.Close()
		_, err1924 := mbTrans1923.WriteString(arg1922)
		if err1924 != nil {
			Usage()
			return
		}
		factory1925 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1926 := factory1925.GetProtocol(mbTrans1923)
		containerStruct3 := Hbase.NewScannerOpenWithStopArgs()
		err1927 := containerStruct3.ReadField4(jsProt1926)
		if err1927 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Columns
		value3 := argvalue3
		arg1928 := flag.Arg(5)
		mbTrans1929 := thrift.NewTMemoryBufferLen(len(arg1928))
		defer mbTrans1929.Close()
		_, err1930 := mbTrans1929.WriteString(arg1928)
		if err1930 != nil {
			Usage()
			return
		}
		factory1931 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1932 := factory1931.GetProtocol(mbTrans1929)
		containerStruct4 := Hbase.NewScannerOpenWithStopArgs()
		err1933 := containerStruct4.ReadField5(jsProt1932)
		if err1933 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.ScannerOpenWithStop(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "scannerOpenWithPrefix":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "ScannerOpenWithPrefix requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1936 := flag.Arg(3)
		mbTrans1937 := thrift.NewTMemoryBufferLen(len(arg1936))
		defer mbTrans1937.Close()
		_, err1938 := mbTrans1937.WriteString(arg1936)
		if err1938 != nil {
			Usage()
			return
		}
		factory1939 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1940 := factory1939.GetProtocol(mbTrans1937)
		containerStruct2 := Hbase.NewScannerOpenWithPrefixArgs()
		err1941 := containerStruct2.ReadField3(jsProt1940)
		if err1941 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		arg1942 := flag.Arg(4)
		mbTrans1943 := thrift.NewTMemoryBufferLen(len(arg1942))
		defer mbTrans1943.Close()
		_, err1944 := mbTrans1943.WriteString(arg1942)
		if err1944 != nil {
			Usage()
			return
		}
		factory1945 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1946 := factory1945.GetProtocol(mbTrans1943)
		containerStruct3 := Hbase.NewScannerOpenWithPrefixArgs()
		err1947 := containerStruct3.ReadField4(jsProt1946)
		if err1947 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.ScannerOpenWithPrefix(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "scannerOpenTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "ScannerOpenTs requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1950 := flag.Arg(3)
		mbTrans1951 := thrift.NewTMemoryBufferLen(len(arg1950))
		defer mbTrans1951.Close()
		_, err1952 := mbTrans1951.WriteString(arg1950)
		if err1952 != nil {
			Usage()
			return
		}
		factory1953 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1954 := factory1953.GetProtocol(mbTrans1951)
		containerStruct2 := Hbase.NewScannerOpenTsArgs()
		err1955 := containerStruct2.ReadField3(jsProt1954)
		if err1955 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		argvalue3, err1956 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err1956 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg1957 := flag.Arg(5)
		mbTrans1958 := thrift.NewTMemoryBufferLen(len(arg1957))
		defer mbTrans1958.Close()
		_, err1959 := mbTrans1958.WriteString(arg1957)
		if err1959 != nil {
			Usage()
			return
		}
		factory1960 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1961 := factory1960.GetProtocol(mbTrans1958)
		containerStruct4 := Hbase.NewScannerOpenTsArgs()
		err1962 := containerStruct4.ReadField5(jsProt1961)
		if err1962 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.ScannerOpenTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "scannerOpenWithStopTs":
		if flag.NArg()-1 != 6 {
			fmt.Fprint(os.Stderr, "ScannerOpenWithStopTs requires 6 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		arg1966 := flag.Arg(4)
		mbTrans1967 := thrift.NewTMemoryBufferLen(len(arg1966))
		defer mbTrans1967.Close()
		_, err1968 := mbTrans1967.WriteString(arg1966)
		if err1968 != nil {
			Usage()
			return
		}
		factory1969 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1970 := factory1969.GetProtocol(mbTrans1967)
		containerStruct3 := Hbase.NewScannerOpenWithStopTsArgs()
		err1971 := containerStruct3.ReadField4(jsProt1970)
		if err1971 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Columns
		value3 := argvalue3
		argvalue4, err1972 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err1972 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		arg1973 := flag.Arg(6)
		mbTrans1974 := thrift.NewTMemoryBufferLen(len(arg1973))
		defer mbTrans1974.Close()
		_, err1975 := mbTrans1974.WriteString(arg1973)
		if err1975 != nil {
			Usage()
			return
		}
		factory1976 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1977 := factory1976.GetProtocol(mbTrans1974)
		containerStruct5 := Hbase.NewScannerOpenWithStopTsArgs()
		err1978 := containerStruct5.ReadField6(jsProt1977)
		if err1978 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.Attributes
		value5 := argvalue5
		fmt.Print(client.ScannerOpenWithStopTs(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "scannerGet":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "ScannerGet requires 1 args\n")
			flag.Usage()
		}
		tmp0, err1979 := (strconv.Atoi(flag.Arg(1)))
		if err1979 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := Hbase.ScannerID(argvalue0)
		fmt.Print(client.ScannerGet(value0))
		fmt.Print("\n")
		break
	case "scannerGetList":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "ScannerGetList requires 2 args\n")
			flag.Usage()
		}
		tmp0, err1980 := (strconv.Atoi(flag.Arg(1)))
		if err1980 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := Hbase.ScannerID(argvalue0)
		tmp1, err1981 := (strconv.Atoi(flag.Arg(2)))
		if err1981 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.ScannerGetList(value0, value1))
		fmt.Print("\n")
		break
	case "scannerClose":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "ScannerClose requires 1 args\n")
			flag.Usage()
		}
		tmp0, err1982 := (strconv.Atoi(flag.Arg(1)))
		if err1982 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := Hbase.ScannerID(argvalue0)
		fmt.Print(client.ScannerClose(value0))
		fmt.Print("\n")
		break
	case "getRowOrBefore":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetRowOrBefore requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		fmt.Print(client.GetRowOrBefore(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRegionInfo":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetRegionInfo requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		fmt.Print(client.GetRegionInfo(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n")
	}
}
Exemple #12
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var help bool
	var url http.URL
	var trans thrift.TTransport
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || flag.NArg() == 0 {
		flag.Usage()
	}

	if len(urlString) > 0 {
		url, err := http.ParseURL(urlString)
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
		host = url.Host
		useHttp = len(url.Scheme) <= 0 || url.Scheme == "http"
	} else if useHttp {
		_, err := http.ParseURL(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(url.Raw)
	} else {
		addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error resolving address", err.Error())
			os.Exit(1)
		}
		trans, err = thrift.NewTNonblockingSocketAddr(addr)
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprint(os.Stderr, "Error creating transport", err.Error())
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	client := Hbase.NewHbaseClientFactory(trans, protocolFactory)
	if err = trans.Open(); err != nil {
		fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error())
		os.Exit(1)
	}

	switch cmd {
	case "enableTable":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "EnableTable requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.EnableTable(value0))
		fmt.Print("\n")
		break
	case "disableTable":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "DisableTable requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.DisableTable(value0))
		fmt.Print("\n")
		break
	case "isTableEnabled":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "IsTableEnabled requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.IsTableEnabled(value0))
		fmt.Print("\n")
		break
	case "compact":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "Compact requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.Compact(value0))
		fmt.Print("\n")
		break
	case "majorCompact":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "MajorCompact requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Bytes(argvalue0)
		fmt.Print(client.MajorCompact(value0))
		fmt.Print("\n")
		break
	case "getTableNames":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetTableNames requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetTableNames())
		fmt.Print("\n")
		break
	case "getColumnDescriptors":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetColumnDescriptors requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		fmt.Print(client.GetColumnDescriptors(value0))
		fmt.Print("\n")
		break
	case "getTableRegions":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetTableRegions requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		fmt.Print(client.GetTableRegions(value0))
		fmt.Print("\n")
		break
	case "createTable":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "CreateTable requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1102 := flag.Arg(2)
		mbTrans1103 := thrift.NewTMemoryBufferLen(len(arg1102))
		defer mbTrans1103.Close()
		_, err1104 := mbTrans1103.WriteString(arg1102)
		if err1104 != nil {
			Usage()
			return
		}
		factory1105 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1106 := factory1105.GetProtocol(mbTrans1103)
		containerStruct1 := Hbase.NewCreateTableArgs()
		err1107 := containerStruct1.ReadField2(jsProt1106)
		if err1107 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.ColumnFamilies
		value1 := argvalue1
		fmt.Print(client.CreateTable(value0, value1))
		fmt.Print("\n")
		break
	case "deleteTable":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "DeleteTable requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		fmt.Print(client.DeleteTable(value0))
		fmt.Print("\n")
		break
	case "get":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "Get requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		fmt.Print(client.Get(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getVer":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetVer requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		tmp3, err1115 := (strconv.Atoi(flag.Arg(4)))
		if err1115 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetVer(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getVerTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "GetVerTs requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		argvalue3, err1119 := (strconv.Atoi64(flag.Arg(4)))
		if err1119 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		tmp4, err1120 := (strconv.Atoi(flag.Arg(5)))
		if err1120 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		fmt.Print(client.GetVerTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "getRow":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "GetRow requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		fmt.Print(client.GetRow(value0, value1))
		fmt.Print("\n")
		break
	case "getRowWithColumns":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetRowWithColumns requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1125 := flag.Arg(3)
		mbTrans1126 := thrift.NewTMemoryBufferLen(len(arg1125))
		defer mbTrans1126.Close()
		_, err1127 := mbTrans1126.WriteString(arg1125)
		if err1127 != nil {
			Usage()
			return
		}
		factory1128 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1129 := factory1128.GetProtocol(mbTrans1126)
		containerStruct2 := Hbase.NewGetRowWithColumnsArgs()
		err1130 := containerStruct2.ReadField3(jsProt1129)
		if err1130 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		fmt.Print(client.GetRowWithColumns(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRowTs":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetRowTs requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2, err1133 := (strconv.Atoi64(flag.Arg(3)))
		if err1133 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.GetRowTs(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRowWithColumnsTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetRowWithColumnsTs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1136 := flag.Arg(3)
		mbTrans1137 := thrift.NewTMemoryBufferLen(len(arg1136))
		defer mbTrans1137.Close()
		_, err1138 := mbTrans1137.WriteString(arg1136)
		if err1138 != nil {
			Usage()
			return
		}
		factory1139 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1140 := factory1139.GetProtocol(mbTrans1137)
		containerStruct2 := Hbase.NewGetRowWithColumnsTsArgs()
		err1141 := containerStruct2.ReadField3(jsProt1140)
		if err1141 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		argvalue3, err1142 := (strconv.Atoi64(flag.Arg(4)))
		if err1142 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.GetRowWithColumnsTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRows":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "GetRows requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1144 := flag.Arg(2)
		mbTrans1145 := thrift.NewTMemoryBufferLen(len(arg1144))
		defer mbTrans1145.Close()
		_, err1146 := mbTrans1145.WriteString(arg1144)
		if err1146 != nil {
			Usage()
			return
		}
		factory1147 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1148 := factory1147.GetProtocol(mbTrans1145)
		containerStruct1 := Hbase.NewGetRowsArgs()
		err1149 := containerStruct1.ReadField2(jsProt1148)
		if err1149 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		fmt.Print(client.GetRows(value0, value1))
		fmt.Print("\n")
		break
	case "getRowsWithColumns":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetRowsWithColumns requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1151 := flag.Arg(2)
		mbTrans1152 := thrift.NewTMemoryBufferLen(len(arg1151))
		defer mbTrans1152.Close()
		_, err1153 := mbTrans1152.WriteString(arg1151)
		if err1153 != nil {
			Usage()
			return
		}
		factory1154 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1155 := factory1154.GetProtocol(mbTrans1152)
		containerStruct1 := Hbase.NewGetRowsWithColumnsArgs()
		err1156 := containerStruct1.ReadField2(jsProt1155)
		if err1156 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		arg1157 := flag.Arg(3)
		mbTrans1158 := thrift.NewTMemoryBufferLen(len(arg1157))
		defer mbTrans1158.Close()
		_, err1159 := mbTrans1158.WriteString(arg1157)
		if err1159 != nil {
			Usage()
			return
		}
		factory1160 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1161 := factory1160.GetProtocol(mbTrans1158)
		containerStruct2 := Hbase.NewGetRowsWithColumnsArgs()
		err1162 := containerStruct2.ReadField3(jsProt1161)
		if err1162 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		fmt.Print(client.GetRowsWithColumns(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRowsTs":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetRowsTs requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1164 := flag.Arg(2)
		mbTrans1165 := thrift.NewTMemoryBufferLen(len(arg1164))
		defer mbTrans1165.Close()
		_, err1166 := mbTrans1165.WriteString(arg1164)
		if err1166 != nil {
			Usage()
			return
		}
		factory1167 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1168 := factory1167.GetProtocol(mbTrans1165)
		containerStruct1 := Hbase.NewGetRowsTsArgs()
		err1169 := containerStruct1.ReadField2(jsProt1168)
		if err1169 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		argvalue2, err1170 := (strconv.Atoi64(flag.Arg(3)))
		if err1170 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.GetRowsTs(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRowsWithColumnsTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetRowsWithColumnsTs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1172 := flag.Arg(2)
		mbTrans1173 := thrift.NewTMemoryBufferLen(len(arg1172))
		defer mbTrans1173.Close()
		_, err1174 := mbTrans1173.WriteString(arg1172)
		if err1174 != nil {
			Usage()
			return
		}
		factory1175 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1176 := factory1175.GetProtocol(mbTrans1173)
		containerStruct1 := Hbase.NewGetRowsWithColumnsTsArgs()
		err1177 := containerStruct1.ReadField2(jsProt1176)
		if err1177 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		arg1178 := flag.Arg(3)
		mbTrans1179 := thrift.NewTMemoryBufferLen(len(arg1178))
		defer mbTrans1179.Close()
		_, err1180 := mbTrans1179.WriteString(arg1178)
		if err1180 != nil {
			Usage()
			return
		}
		factory1181 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1182 := factory1181.GetProtocol(mbTrans1179)
		containerStruct2 := Hbase.NewGetRowsWithColumnsTsArgs()
		err1183 := containerStruct2.ReadField3(jsProt1182)
		if err1183 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		argvalue3, err1184 := (strconv.Atoi64(flag.Arg(4)))
		if err1184 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.GetRowsWithColumnsTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "mutateRow":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "MutateRow requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1187 := flag.Arg(3)
		mbTrans1188 := thrift.NewTMemoryBufferLen(len(arg1187))
		defer mbTrans1188.Close()
		_, err1189 := mbTrans1188.WriteString(arg1187)
		if err1189 != nil {
			Usage()
			return
		}
		factory1190 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1191 := factory1190.GetProtocol(mbTrans1188)
		containerStruct2 := Hbase.NewMutateRowArgs()
		err1192 := containerStruct2.ReadField3(jsProt1191)
		if err1192 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Mutations
		value2 := argvalue2
		fmt.Print(client.MutateRow(value0, value1, value2))
		fmt.Print("\n")
		break
	case "mutateRowTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "MutateRowTs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1195 := flag.Arg(3)
		mbTrans1196 := thrift.NewTMemoryBufferLen(len(arg1195))
		defer mbTrans1196.Close()
		_, err1197 := mbTrans1196.WriteString(arg1195)
		if err1197 != nil {
			Usage()
			return
		}
		factory1198 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1199 := factory1198.GetProtocol(mbTrans1196)
		containerStruct2 := Hbase.NewMutateRowTsArgs()
		err1200 := containerStruct2.ReadField3(jsProt1199)
		if err1200 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Mutations
		value2 := argvalue2
		argvalue3, err1201 := (strconv.Atoi64(flag.Arg(4)))
		if err1201 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.MutateRowTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "mutateRows":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "MutateRows requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1203 := flag.Arg(2)
		mbTrans1204 := thrift.NewTMemoryBufferLen(len(arg1203))
		defer mbTrans1204.Close()
		_, err1205 := mbTrans1204.WriteString(arg1203)
		if err1205 != nil {
			Usage()
			return
		}
		factory1206 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1207 := factory1206.GetProtocol(mbTrans1204)
		containerStruct1 := Hbase.NewMutateRowsArgs()
		err1208 := containerStruct1.ReadField2(jsProt1207)
		if err1208 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.RowBatches
		value1 := argvalue1
		fmt.Print(client.MutateRows(value0, value1))
		fmt.Print("\n")
		break
	case "mutateRowsTs":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "MutateRowsTs requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		arg1210 := flag.Arg(2)
		mbTrans1211 := thrift.NewTMemoryBufferLen(len(arg1210))
		defer mbTrans1211.Close()
		_, err1212 := mbTrans1211.WriteString(arg1210)
		if err1212 != nil {
			Usage()
			return
		}
		factory1213 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1214 := factory1213.GetProtocol(mbTrans1211)
		containerStruct1 := Hbase.NewMutateRowsTsArgs()
		err1215 := containerStruct1.ReadField2(jsProt1214)
		if err1215 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.RowBatches
		value1 := argvalue1
		argvalue2, err1216 := (strconv.Atoi64(flag.Arg(3)))
		if err1216 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.MutateRowsTs(value0, value1, value2))
		fmt.Print("\n")
		break
	case "atomicIncrement":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "AtomicIncrement requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		argvalue3, err1220 := (strconv.Atoi64(flag.Arg(4)))
		if err1220 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.AtomicIncrement(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "deleteAll":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "DeleteAll requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		fmt.Print(client.DeleteAll(value0, value1, value2))
		fmt.Print("\n")
		break
	case "deleteAllTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "DeleteAllTs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		argvalue3, err1227 := (strconv.Atoi64(flag.Arg(4)))
		if err1227 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.DeleteAllTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "deleteAllRow":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "DeleteAllRow requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		fmt.Print(client.DeleteAllRow(value0, value1))
		fmt.Print("\n")
		break
	case "deleteAllRowTs":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "DeleteAllRowTs requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2, err1232 := (strconv.Atoi64(flag.Arg(3)))
		if err1232 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.DeleteAllRowTs(value0, value1, value2))
		fmt.Print("\n")
		break
	case "scannerOpen":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "ScannerOpen requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1235 := flag.Arg(3)
		mbTrans1236 := thrift.NewTMemoryBufferLen(len(arg1235))
		defer mbTrans1236.Close()
		_, err1237 := mbTrans1236.WriteString(arg1235)
		if err1237 != nil {
			Usage()
			return
		}
		factory1238 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1239 := factory1238.GetProtocol(mbTrans1236)
		containerStruct2 := Hbase.NewScannerOpenArgs()
		err1240 := containerStruct2.ReadField3(jsProt1239)
		if err1240 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		fmt.Print(client.ScannerOpen(value0, value1, value2))
		fmt.Print("\n")
		break
	case "scannerOpenWithStop":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "ScannerOpenWithStop requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		arg1244 := flag.Arg(4)
		mbTrans1245 := thrift.NewTMemoryBufferLen(len(arg1244))
		defer mbTrans1245.Close()
		_, err1246 := mbTrans1245.WriteString(arg1244)
		if err1246 != nil {
			Usage()
			return
		}
		factory1247 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1248 := factory1247.GetProtocol(mbTrans1245)
		containerStruct3 := Hbase.NewScannerOpenWithStopArgs()
		err1249 := containerStruct3.ReadField4(jsProt1248)
		if err1249 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Columns
		value3 := argvalue3
		fmt.Print(client.ScannerOpenWithStop(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "scannerOpenWithPrefix":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "ScannerOpenWithPrefix requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1252 := flag.Arg(3)
		mbTrans1253 := thrift.NewTMemoryBufferLen(len(arg1252))
		defer mbTrans1253.Close()
		_, err1254 := mbTrans1253.WriteString(arg1252)
		if err1254 != nil {
			Usage()
			return
		}
		factory1255 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1256 := factory1255.GetProtocol(mbTrans1253)
		containerStruct2 := Hbase.NewScannerOpenWithPrefixArgs()
		err1257 := containerStruct2.ReadField3(jsProt1256)
		if err1257 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		fmt.Print(client.ScannerOpenWithPrefix(value0, value1, value2))
		fmt.Print("\n")
		break
	case "scannerOpenTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "ScannerOpenTs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		arg1260 := flag.Arg(3)
		mbTrans1261 := thrift.NewTMemoryBufferLen(len(arg1260))
		defer mbTrans1261.Close()
		_, err1262 := mbTrans1261.WriteString(arg1260)
		if err1262 != nil {
			Usage()
			return
		}
		factory1263 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1264 := factory1263.GetProtocol(mbTrans1261)
		containerStruct2 := Hbase.NewScannerOpenTsArgs()
		err1265 := containerStruct2.ReadField3(jsProt1264)
		if err1265 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		argvalue3, err1266 := (strconv.Atoi64(flag.Arg(4)))
		if err1266 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.ScannerOpenTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "scannerOpenWithStopTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "ScannerOpenWithStopTs requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := Hbase.Text(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := Hbase.Text(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := Hbase.Text(argvalue2)
		arg1270 := flag.Arg(4)
		mbTrans1271 := thrift.NewTMemoryBufferLen(len(arg1270))
		defer mbTrans1271.Close()
		_, err1272 := mbTrans1271.WriteString(arg1270)
		if err1272 != nil {
			Usage()
			return
		}
		factory1273 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1274 := factory1273.GetProtocol(mbTrans1271)
		containerStruct3 := Hbase.NewScannerOpenWithStopTsArgs()
		err1275 := containerStruct3.ReadField4(jsProt1274)
		if err1275 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Columns
		value3 := argvalue3
		argvalue4, err1276 := (strconv.Atoi64(flag.Arg(5)))
		if err1276 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.ScannerOpenWithStopTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "scannerGet":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "ScannerGet requires 1 args\n")
			flag.Usage()
		}
		tmp0, err1277 := (strconv.Atoi(flag.Arg(1)))
		if err1277 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := Hbase.ScannerID(argvalue0)
		fmt.Print(client.ScannerGet(value0))
		fmt.Print("\n")
		break
	case "scannerGetList":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "ScannerGetList requires 2 args\n")
			flag.Usage()
		}
		tmp0, err1278 := (strconv.Atoi(flag.Arg(1)))
		if err1278 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := Hbase.ScannerID(argvalue0)
		tmp1, err1279 := (strconv.Atoi(flag.Arg(2)))
		if err1279 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.ScannerGetList(value0, value1))
		fmt.Print("\n")
		break
	case "scannerClose":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "ScannerClose requires 1 args\n")
			flag.Usage()
		}
		tmp0, err1280 := (strconv.Atoi(flag.Arg(1)))
		if err1280 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := Hbase.ScannerID(argvalue0)
		fmt.Print(client.ScannerClose(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n")
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var help bool
	var url http.URL
	var trans thrift.TTransport
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || flag.NArg() == 0 {
		flag.Usage()
	}

	if len(urlString) > 0 {
		url, err := http.ParseURL(urlString)
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
		host = url.Host
		useHttp = len(url.Scheme) <= 0 || url.Scheme == "http"
	} else if useHttp {
		_, err := http.ParseURL(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(url.Raw)
	} else {
		addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error resolving address", err.Error())
			os.Exit(1)
		}
		trans, err = thrift.NewTNonblockingSocketAddr(addr)
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprint(os.Stderr, "Error creating transport", err.Error())
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	client := fb303.NewFacebookServiceClientFactory(trans, protocolFactory)
	if err = trans.Open(); err != nil {
		fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error())
		os.Exit(1)
	}

	switch cmd {
	case "getName":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetName requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetName())
		fmt.Print("\n")
		break
	case "getVersion":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetVersion requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetVersion())
		fmt.Print("\n")
		break
	case "getStatus":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetStatus requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetStatus())
		fmt.Print("\n")
		break
	case "getStatusDetails":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetStatusDetails requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetStatusDetails())
		fmt.Print("\n")
		break
	case "getCounters":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetCounters requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetCounters())
		fmt.Print("\n")
		break
	case "getCounter":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetCounter requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetCounter(value0))
		fmt.Print("\n")
		break
	case "setOption":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "SetOption requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.SetOption(value0, value1))
		fmt.Print("\n")
		break
	case "getOption":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetOption requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetOption(value0))
		fmt.Print("\n")
		break
	case "getOptions":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetOptions requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetOptions())
		fmt.Print("\n")
		break
	case "getCpuProfile":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetCpuProfile requires 1 args\n")
			flag.Usage()
		}
		tmp0, err155 := (strconv.Atoi(flag.Arg(1)))
		if err155 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.GetCpuProfile(value0))
		fmt.Print("\n")
		break
	case "aliveSince":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "AliveSince requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.AliveSince())
		fmt.Print("\n")
		break
	case "reinitialize":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "Reinitialize requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.Reinitialize())
		fmt.Print("\n")
		break
	case "shutdown":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "Shutdown requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.Shutdown())
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n")
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := stress.NewServiceClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "echoVoid":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "EchoVoid requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.EchoVoid())
		fmt.Print("\n")
		break
	case "echoByte":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "EchoByte requires 1 args")
			flag.Usage()
		}
		tmp0, err26 := (strconv.Atoi(flag.Arg(1)))
		if err26 != nil {
			Usage()
			return
		}
		argvalue0 := byte(tmp0)
		value0 := argvalue0
		fmt.Print(client.EchoByte(value0))
		fmt.Print("\n")
		break
	case "echoI32":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "EchoI32 requires 1 args")
			flag.Usage()
		}
		tmp0, err27 := (strconv.Atoi(flag.Arg(1)))
		if err27 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.EchoI32(value0))
		fmt.Print("\n")
		break
	case "echoI64":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "EchoI64 requires 1 args")
			flag.Usage()
		}
		argvalue0, err28 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err28 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.EchoI64(value0))
		fmt.Print("\n")
		break
	case "echoString":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "EchoString requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.EchoString(value0))
		fmt.Print("\n")
		break
	case "echoList":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "EchoList requires 1 args")
			flag.Usage()
		}
		arg30 := flag.Arg(1)
		mbTrans31 := thrift.NewTMemoryBufferLen(len(arg30))
		defer mbTrans31.Close()
		_, err32 := mbTrans31.WriteString(arg30)
		if err32 != nil {
			Usage()
			return
		}
		factory33 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt34 := factory33.GetProtocol(mbTrans31)
		containerStruct0 := stress.NewServiceEchoListArgs()
		err35 := containerStruct0.ReadField1(jsProt34)
		if err35 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Arg
		value0 := argvalue0
		fmt.Print(client.EchoList(value0))
		fmt.Print("\n")
		break
	case "echoSet":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "EchoSet requires 1 args")
			flag.Usage()
		}
		arg36 := flag.Arg(1)
		mbTrans37 := thrift.NewTMemoryBufferLen(len(arg36))
		defer mbTrans37.Close()
		_, err38 := mbTrans37.WriteString(arg36)
		if err38 != nil {
			Usage()
			return
		}
		factory39 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt40 := factory39.GetProtocol(mbTrans37)
		containerStruct0 := stress.NewServiceEchoSetArgs()
		err41 := containerStruct0.ReadField1(jsProt40)
		if err41 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Arg
		value0 := argvalue0
		fmt.Print(client.EchoSet(value0))
		fmt.Print("\n")
		break
	case "echoMap":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "EchoMap requires 1 args")
			flag.Usage()
		}
		arg42 := flag.Arg(1)
		mbTrans43 := thrift.NewTMemoryBufferLen(len(arg42))
		defer mbTrans43.Close()
		_, err44 := mbTrans43.WriteString(arg42)
		if err44 != nil {
			Usage()
			return
		}
		factory45 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt46 := factory45.GetProtocol(mbTrans43)
		containerStruct0 := stress.NewServiceEchoMapArgs()
		err47 := containerStruct0.ReadField1(jsProt46)
		if err47 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Arg
		value0 := argvalue0
		fmt.Print(client.EchoMap(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var help bool
	var url http.URL
	var trans thrift.TTransport
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || flag.NArg() == 0 {
		flag.Usage()
	}

	if len(urlString) > 0 {
		url, err := http.ParseURL(urlString)
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
		host = url.Host
		useHttp = len(url.Scheme) <= 0 || url.Scheme == "http"
	} else if useHttp {
		_, err := http.ParseURL(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(url.Raw)
	} else {
		addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error resolving address", err.Error())
			os.Exit(1)
		}
		trans, err = thrift.NewTNonblockingSocketAddr(addr)
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprint(os.Stderr, "Error creating transport", err.Error())
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	client := hive_metastore.NewThriftHiveMetastoreClientFactory(trans, protocolFactory)
	if err = trans.Open(); err != nil {
		fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error())
		os.Exit(1)
	}

	switch cmd {
	case "create_database":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "CreateDatabase requires 1 args\n")
			flag.Usage()
		}
		arg1889 := flag.Arg(1)
		mbTrans1890 := thrift.NewTMemoryBufferLen(len(arg1889))
		defer mbTrans1890.Close()
		_, err1891 := mbTrans1890.WriteString(arg1889)
		if err1891 != nil {
			Usage()
			return
		}
		factory1892 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1893 := factory1892.GetProtocol(mbTrans1890)
		argvalue0 := hive_metastore.NewDatabase()
		err1894 := argvalue0.Read(jsProt1893)
		if err1894 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CreateDatabase(value0))
		fmt.Print("\n")
		break
	case "get_database":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetDatabase requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetDatabase(value0))
		fmt.Print("\n")
		break
	case "drop_database":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "DropDatabase requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2) == "true"
		value1 := argvalue1
		fmt.Print(client.DropDatabase(value0, value1))
		fmt.Print("\n")
		break
	case "get_databases":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetDatabases requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetDatabases(value0))
		fmt.Print("\n")
		break
	case "get_all_databases":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetAllDatabases requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetAllDatabases())
		fmt.Print("\n")
		break
	case "alter_database":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "AlterDatabase requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg1900 := flag.Arg(2)
		mbTrans1901 := thrift.NewTMemoryBufferLen(len(arg1900))
		defer mbTrans1901.Close()
		_, err1902 := mbTrans1901.WriteString(arg1900)
		if err1902 != nil {
			Usage()
			return
		}
		factory1903 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1904 := factory1903.GetProtocol(mbTrans1901)
		argvalue1 := hive_metastore.NewDatabase()
		err1905 := argvalue1.Read(jsProt1904)
		if err1905 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.AlterDatabase(value0, value1))
		fmt.Print("\n")
		break
	case "get_type":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetType requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetType(value0))
		fmt.Print("\n")
		break
	case "create_type":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "CreateType requires 1 args\n")
			flag.Usage()
		}
		arg1907 := flag.Arg(1)
		mbTrans1908 := thrift.NewTMemoryBufferLen(len(arg1907))
		defer mbTrans1908.Close()
		_, err1909 := mbTrans1908.WriteString(arg1907)
		if err1909 != nil {
			Usage()
			return
		}
		factory1910 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1911 := factory1910.GetProtocol(mbTrans1908)
		argvalue0 := hive_metastore.NewType()
		err1912 := argvalue0.Read(jsProt1911)
		if err1912 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CreateType(value0))
		fmt.Print("\n")
		break
	case "drop_type":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "DropType requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.DropType(value0))
		fmt.Print("\n")
		break
	case "get_type_all":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetTypeAll requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetTypeAll(value0))
		fmt.Print("\n")
		break
	case "get_fields":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "GetFields requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetFields(value0, value1))
		fmt.Print("\n")
		break
	case "get_schema":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "GetSchema requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetSchema(value0, value1))
		fmt.Print("\n")
		break
	case "create_table":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "CreateTable requires 1 args\n")
			flag.Usage()
		}
		arg1919 := flag.Arg(1)
		mbTrans1920 := thrift.NewTMemoryBufferLen(len(arg1919))
		defer mbTrans1920.Close()
		_, err1921 := mbTrans1920.WriteString(arg1919)
		if err1921 != nil {
			Usage()
			return
		}
		factory1922 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1923 := factory1922.GetProtocol(mbTrans1920)
		argvalue0 := hive_metastore.NewTable()
		err1924 := argvalue0.Read(jsProt1923)
		if err1924 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CreateTable(value0))
		fmt.Print("\n")
		break
	case "drop_table":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "DropTable requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		fmt.Print(client.DropTable(value0, value1, value2))
		fmt.Print("\n")
		break
	case "get_tables":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "GetTables requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetTables(value0, value1))
		fmt.Print("\n")
		break
	case "get_all_tables":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetAllTables requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetAllTables(value0))
		fmt.Print("\n")
		break
	case "get_table":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "GetTable requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetTable(value0, value1))
		fmt.Print("\n")
		break
	case "alter_table":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "AlterTable requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg1935 := flag.Arg(3)
		mbTrans1936 := thrift.NewTMemoryBufferLen(len(arg1935))
		defer mbTrans1936.Close()
		_, err1937 := mbTrans1936.WriteString(arg1935)
		if err1937 != nil {
			Usage()
			return
		}
		factory1938 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1939 := factory1938.GetProtocol(mbTrans1936)
		argvalue2 := hive_metastore.NewTable()
		err1940 := argvalue2.Read(jsProt1939)
		if err1940 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.AlterTable(value0, value1, value2))
		fmt.Print("\n")
		break
	case "add_partition":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "AddPartition requires 1 args\n")
			flag.Usage()
		}
		arg1941 := flag.Arg(1)
		mbTrans1942 := thrift.NewTMemoryBufferLen(len(arg1941))
		defer mbTrans1942.Close()
		_, err1943 := mbTrans1942.WriteString(arg1941)
		if err1943 != nil {
			Usage()
			return
		}
		factory1944 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1945 := factory1944.GetProtocol(mbTrans1942)
		argvalue0 := hive_metastore.NewPartition()
		err1946 := argvalue0.Read(jsProt1945)
		if err1946 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.AddPartition(value0))
		fmt.Print("\n")
		break
	case "append_partition":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "AppendPartition requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg1949 := flag.Arg(3)
		mbTrans1950 := thrift.NewTMemoryBufferLen(len(arg1949))
		defer mbTrans1950.Close()
		_, err1951 := mbTrans1950.WriteString(arg1949)
		if err1951 != nil {
			Usage()
			return
		}
		factory1952 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1953 := factory1952.GetProtocol(mbTrans1950)
		containerStruct2 := hive_metastore.NewAppendPartitionArgs()
		err1954 := containerStruct2.ReadField3(jsProt1953)
		if err1954 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.PartVals
		value2 := argvalue2
		fmt.Print(client.AppendPartition(value0, value1, value2))
		fmt.Print("\n")
		break
	case "append_partition_by_name":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "AppendPartitionByName requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.AppendPartitionByName(value0, value1, value2))
		fmt.Print("\n")
		break
	case "drop_partition":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "DropPartition requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg1960 := flag.Arg(3)
		mbTrans1961 := thrift.NewTMemoryBufferLen(len(arg1960))
		defer mbTrans1961.Close()
		_, err1962 := mbTrans1961.WriteString(arg1960)
		if err1962 != nil {
			Usage()
			return
		}
		factory1963 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1964 := factory1963.GetProtocol(mbTrans1961)
		containerStruct2 := hive_metastore.NewDropPartitionArgs()
		err1965 := containerStruct2.ReadField3(jsProt1964)
		if err1965 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.PartVals
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		fmt.Print(client.DropPartition(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "drop_partition_by_name":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "DropPartitionByName requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		fmt.Print(client.DropPartitionByName(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "get_partition":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetPartition requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg1973 := flag.Arg(3)
		mbTrans1974 := thrift.NewTMemoryBufferLen(len(arg1973))
		defer mbTrans1974.Close()
		_, err1975 := mbTrans1974.WriteString(arg1973)
		if err1975 != nil {
			Usage()
			return
		}
		factory1976 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1977 := factory1976.GetProtocol(mbTrans1974)
		containerStruct2 := hive_metastore.NewGetPartitionArgs()
		err1978 := containerStruct2.ReadField3(jsProt1977)
		if err1978 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.PartVals
		value2 := argvalue2
		fmt.Print(client.GetPartition(value0, value1, value2))
		fmt.Print("\n")
		break
	case "get_partition_with_auth":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "GetPartitionWithAuth requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg1981 := flag.Arg(3)
		mbTrans1982 := thrift.NewTMemoryBufferLen(len(arg1981))
		defer mbTrans1982.Close()
		_, err1983 := mbTrans1982.WriteString(arg1981)
		if err1983 != nil {
			Usage()
			return
		}
		factory1984 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1985 := factory1984.GetProtocol(mbTrans1982)
		containerStruct2 := hive_metastore.NewGetPartitionWithAuthArgs()
		err1986 := containerStruct2.ReadField3(jsProt1985)
		if err1986 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.PartVals
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		arg1988 := flag.Arg(5)
		mbTrans1989 := thrift.NewTMemoryBufferLen(len(arg1988))
		defer mbTrans1989.Close()
		_, err1990 := mbTrans1989.WriteString(arg1988)
		if err1990 != nil {
			Usage()
			return
		}
		factory1991 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1992 := factory1991.GetProtocol(mbTrans1989)
		containerStruct4 := hive_metastore.NewGetPartitionWithAuthArgs()
		err1993 := containerStruct4.ReadField5(jsProt1992)
		if err1993 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.GroupNames
		value4 := argvalue4
		fmt.Print(client.GetPartitionWithAuth(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "get_partition_by_name":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetPartitionByName requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.GetPartitionByName(value0, value1, value2))
		fmt.Print("\n")
		break
	case "get_partitions":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetPartitions requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		tmp2, err1999 := (strconv.Atoi(flag.Arg(3)))
		if err1999 != nil {
			Usage()
			return
		}
		argvalue2 := byte(tmp2)
		value2 := argvalue2
		fmt.Print(client.GetPartitions(value0, value1, value2))
		fmt.Print("\n")
		break
	case "get_partitions_with_auth":
		if flag.NArg()-1 != 5 {
			fmt.Fprint(os.Stderr, "GetPartitionsWithAuth requires 5 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		tmp2, err2002 := (strconv.Atoi(flag.Arg(3)))
		if err2002 != nil {
			Usage()
			return
		}
		argvalue2 := byte(tmp2)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		arg2004 := flag.Arg(5)
		mbTrans2005 := thrift.NewTMemoryBufferLen(len(arg2004))
		defer mbTrans2005.Close()
		_, err2006 := mbTrans2005.WriteString(arg2004)
		if err2006 != nil {
			Usage()
			return
		}
		factory2007 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2008 := factory2007.GetProtocol(mbTrans2005)
		containerStruct4 := hive_metastore.NewGetPartitionsWithAuthArgs()
		err2009 := containerStruct4.ReadField5(jsProt2008)
		if err2009 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.GroupNames
		value4 := argvalue4
		fmt.Print(client.GetPartitionsWithAuth(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "get_partition_names":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetPartitionNames requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		tmp2, err2012 := (strconv.Atoi(flag.Arg(3)))
		if err2012 != nil {
			Usage()
			return
		}
		argvalue2 := byte(tmp2)
		value2 := argvalue2
		fmt.Print(client.GetPartitionNames(value0, value1, value2))
		fmt.Print("\n")
		break
	case "get_partitions_ps":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetPartitionsPs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg2015 := flag.Arg(3)
		mbTrans2016 := thrift.NewTMemoryBufferLen(len(arg2015))
		defer mbTrans2016.Close()
		_, err2017 := mbTrans2016.WriteString(arg2015)
		if err2017 != nil {
			Usage()
			return
		}
		factory2018 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2019 := factory2018.GetProtocol(mbTrans2016)
		containerStruct2 := hive_metastore.NewGetPartitionsPsArgs()
		err2020 := containerStruct2.ReadField3(jsProt2019)
		if err2020 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.PartVals
		value2 := argvalue2
		tmp3, err2021 := (strconv.Atoi(flag.Arg(4)))
		if err2021 != nil {
			Usage()
			return
		}
		argvalue3 := byte(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetPartitionsPs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "get_partitions_ps_with_auth":
		if flag.NArg()-1 != 6 {
			fmt.Fprint(os.Stderr, "GetPartitionsPsWithAuth requires 6 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg2024 := flag.Arg(3)
		mbTrans2025 := thrift.NewTMemoryBufferLen(len(arg2024))
		defer mbTrans2025.Close()
		_, err2026 := mbTrans2025.WriteString(arg2024)
		if err2026 != nil {
			Usage()
			return
		}
		factory2027 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2028 := factory2027.GetProtocol(mbTrans2025)
		containerStruct2 := hive_metastore.NewGetPartitionsPsWithAuthArgs()
		err2029 := containerStruct2.ReadField3(jsProt2028)
		if err2029 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.PartVals
		value2 := argvalue2
		tmp3, err2030 := (strconv.Atoi(flag.Arg(4)))
		if err2030 != nil {
			Usage()
			return
		}
		argvalue3 := byte(tmp3)
		value3 := argvalue3
		argvalue4 := flag.Arg(5)
		value4 := argvalue4
		arg2032 := flag.Arg(6)
		mbTrans2033 := thrift.NewTMemoryBufferLen(len(arg2032))
		defer mbTrans2033.Close()
		_, err2034 := mbTrans2033.WriteString(arg2032)
		if err2034 != nil {
			Usage()
			return
		}
		factory2035 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2036 := factory2035.GetProtocol(mbTrans2033)
		containerStruct5 := hive_metastore.NewGetPartitionsPsWithAuthArgs()
		err2037 := containerStruct5.ReadField6(jsProt2036)
		if err2037 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.GroupNames
		value5 := argvalue5
		fmt.Print(client.GetPartitionsPsWithAuth(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "get_partition_names_ps":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetPartitionNamesPs requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg2040 := flag.Arg(3)
		mbTrans2041 := thrift.NewTMemoryBufferLen(len(arg2040))
		defer mbTrans2041.Close()
		_, err2042 := mbTrans2041.WriteString(arg2040)
		if err2042 != nil {
			Usage()
			return
		}
		factory2043 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2044 := factory2043.GetProtocol(mbTrans2041)
		containerStruct2 := hive_metastore.NewGetPartitionNamesPsArgs()
		err2045 := containerStruct2.ReadField3(jsProt2044)
		if err2045 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.PartVals
		value2 := argvalue2
		tmp3, err2046 := (strconv.Atoi(flag.Arg(4)))
		if err2046 != nil {
			Usage()
			return
		}
		argvalue3 := byte(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetPartitionNamesPs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "get_partitions_by_filter":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "GetPartitionsByFilter requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		tmp3, err2050 := (strconv.Atoi(flag.Arg(4)))
		if err2050 != nil {
			Usage()
			return
		}
		argvalue3 := byte(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetPartitionsByFilter(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "alter_partition":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "AlterPartition requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg2053 := flag.Arg(3)
		mbTrans2054 := thrift.NewTMemoryBufferLen(len(arg2053))
		defer mbTrans2054.Close()
		_, err2055 := mbTrans2054.WriteString(arg2053)
		if err2055 != nil {
			Usage()
			return
		}
		factory2056 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2057 := factory2056.GetProtocol(mbTrans2054)
		argvalue2 := hive_metastore.NewPartition()
		err2058 := argvalue2.Read(jsProt2057)
		if err2058 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.AlterPartition(value0, value1, value2))
		fmt.Print("\n")
		break
	case "get_config_value":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "GetConfigValue requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetConfigValue(value0, value1))
		fmt.Print("\n")
		break
	case "partition_name_to_vals":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "PartitionNameToVals requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.PartitionNameToVals(value0))
		fmt.Print("\n")
		break
	case "partition_name_to_spec":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "PartitionNameToSpec requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.PartitionNameToSpec(value0))
		fmt.Print("\n")
		break
	case "add_index":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "AddIndex requires 2 args\n")
			flag.Usage()
		}
		arg2063 := flag.Arg(1)
		mbTrans2064 := thrift.NewTMemoryBufferLen(len(arg2063))
		defer mbTrans2064.Close()
		_, err2065 := mbTrans2064.WriteString(arg2063)
		if err2065 != nil {
			Usage()
			return
		}
		factory2066 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2067 := factory2066.GetProtocol(mbTrans2064)
		argvalue0 := hive_metastore.NewIndex()
		err2068 := argvalue0.Read(jsProt2067)
		if err2068 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg2069 := flag.Arg(2)
		mbTrans2070 := thrift.NewTMemoryBufferLen(len(arg2069))
		defer mbTrans2070.Close()
		_, err2071 := mbTrans2070.WriteString(arg2069)
		if err2071 != nil {
			Usage()
			return
		}
		factory2072 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2073 := factory2072.GetProtocol(mbTrans2070)
		argvalue1 := hive_metastore.NewTable()
		err2074 := argvalue1.Read(jsProt2073)
		if err2074 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.AddIndex(value0, value1))
		fmt.Print("\n")
		break
	case "alter_index":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "AlterIndex requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		arg2078 := flag.Arg(4)
		mbTrans2079 := thrift.NewTMemoryBufferLen(len(arg2078))
		defer mbTrans2079.Close()
		_, err2080 := mbTrans2079.WriteString(arg2078)
		if err2080 != nil {
			Usage()
			return
		}
		factory2081 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2082 := factory2081.GetProtocol(mbTrans2079)
		argvalue3 := hive_metastore.NewIndex()
		err2083 := argvalue3.Read(jsProt2082)
		if err2083 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.AlterIndex(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "drop_index_by_name":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "DropIndexByName requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		fmt.Print(client.DropIndexByName(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "get_index_by_name":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetIndexByName requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.GetIndexByName(value0, value1, value2))
		fmt.Print("\n")
		break
	case "get_indexes":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetIndexes requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		tmp2, err2093 := (strconv.Atoi(flag.Arg(3)))
		if err2093 != nil {
			Usage()
			return
		}
		argvalue2 := byte(tmp2)
		value2 := argvalue2
		fmt.Print(client.GetIndexes(value0, value1, value2))
		fmt.Print("\n")
		break
	case "get_index_names":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetIndexNames requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		tmp2, err2096 := (strconv.Atoi(flag.Arg(3)))
		if err2096 != nil {
			Usage()
			return
		}
		argvalue2 := byte(tmp2)
		value2 := argvalue2
		fmt.Print(client.GetIndexNames(value0, value1, value2))
		fmt.Print("\n")
		break
	case "create_role":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "CreateRole requires 1 args\n")
			flag.Usage()
		}
		arg2097 := flag.Arg(1)
		mbTrans2098 := thrift.NewTMemoryBufferLen(len(arg2097))
		defer mbTrans2098.Close()
		_, err2099 := mbTrans2098.WriteString(arg2097)
		if err2099 != nil {
			Usage()
			return
		}
		factory2100 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2101 := factory2100.GetProtocol(mbTrans2098)
		argvalue0 := hive_metastore.NewRole()
		err2102 := argvalue0.Read(jsProt2101)
		if err2102 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CreateRole(value0))
		fmt.Print("\n")
		break
	case "drop_role":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "DropRole requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.DropRole(value0))
		fmt.Print("\n")
		break
	case "get_role_names":
		if flag.NArg()-1 != 0 {
			fmt.Fprint(os.Stderr, "GetRoleNames requires 0 args\n")
			flag.Usage()
		}
		fmt.Print(client.GetRoleNames())
		fmt.Print("\n")
		break
	case "grant_role":
		if flag.NArg()-1 != 6 {
			fmt.Fprint(os.Stderr, "GrantRole requires 6 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := hive_metastore.PrincipalType(tmp2)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		tmp4, err := (strconv.Atoi(flag.Arg(5)))
		if err != nil {
			Usage()
			return
		}
		argvalue4 := hive_metastore.PrincipalType(tmp4)
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		fmt.Print(client.GrantRole(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "revoke_role":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "RevokeRole requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := hive_metastore.PrincipalType(tmp2)
		value2 := argvalue2
		fmt.Print(client.RevokeRole(value0, value1, value2))
		fmt.Print("\n")
		break
	case "list_roles":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "ListRoles requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := hive_metastore.PrincipalType(tmp1)
		value1 := argvalue1
		fmt.Print(client.ListRoles(value0, value1))
		fmt.Print("\n")
		break
	case "get_privilege_set":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "GetPrivilegeSet requires 3 args\n")
			flag.Usage()
		}
		arg2111 := flag.Arg(1)
		mbTrans2112 := thrift.NewTMemoryBufferLen(len(arg2111))
		defer mbTrans2112.Close()
		_, err2113 := mbTrans2112.WriteString(arg2111)
		if err2113 != nil {
			Usage()
			return
		}
		factory2114 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2115 := factory2114.GetProtocol(mbTrans2112)
		argvalue0 := hive_metastore.NewHiveObjectRef()
		err2116 := argvalue0.Read(jsProt2115)
		if err2116 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg2118 := flag.Arg(3)
		mbTrans2119 := thrift.NewTMemoryBufferLen(len(arg2118))
		defer mbTrans2119.Close()
		_, err2120 := mbTrans2119.WriteString(arg2118)
		if err2120 != nil {
			Usage()
			return
		}
		factory2121 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2122 := factory2121.GetProtocol(mbTrans2119)
		containerStruct2 := hive_metastore.NewGetPrivilegeSetArgs()
		err2123 := containerStruct2.ReadField3(jsProt2122)
		if err2123 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.GroupNames
		value2 := argvalue2
		fmt.Print(client.GetPrivilegeSet(value0, value1, value2))
		fmt.Print("\n")
		break
	case "list_privileges":
		if flag.NArg()-1 != 3 {
			fmt.Fprint(os.Stderr, "ListPrivileges requires 3 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := hive_metastore.PrincipalType(tmp1)
		value1 := argvalue1
		arg2125 := flag.Arg(3)
		mbTrans2126 := thrift.NewTMemoryBufferLen(len(arg2125))
		defer mbTrans2126.Close()
		_, err2127 := mbTrans2126.WriteString(arg2125)
		if err2127 != nil {
			Usage()
			return
		}
		factory2128 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2129 := factory2128.GetProtocol(mbTrans2126)
		argvalue2 := hive_metastore.NewHiveObjectRef()
		err2130 := argvalue2.Read(jsProt2129)
		if err2130 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.ListPrivileges(value0, value1, value2))
		fmt.Print("\n")
		break
	case "grant_privileges":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GrantPrivileges requires 1 args\n")
			flag.Usage()
		}
		arg2131 := flag.Arg(1)
		mbTrans2132 := thrift.NewTMemoryBufferLen(len(arg2131))
		defer mbTrans2132.Close()
		_, err2133 := mbTrans2132.WriteString(arg2131)
		if err2133 != nil {
			Usage()
			return
		}
		factory2134 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2135 := factory2134.GetProtocol(mbTrans2132)
		argvalue0 := hive_metastore.NewPrivilegeBag()
		err2136 := argvalue0.Read(jsProt2135)
		if err2136 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GrantPrivileges(value0))
		fmt.Print("\n")
		break
	case "revoke_privileges":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "RevokePrivileges requires 1 args\n")
			flag.Usage()
		}
		arg2137 := flag.Arg(1)
		mbTrans2138 := thrift.NewTMemoryBufferLen(len(arg2137))
		defer mbTrans2138.Close()
		_, err2139 := mbTrans2138.WriteString(arg2137)
		if err2139 != nil {
			Usage()
			return
		}
		factory2140 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt2141 := factory2140.GetProtocol(mbTrans2138)
		argvalue0 := hive_metastore.NewPrivilegeBag()
		err2142 := argvalue0.Read(jsProt2141)
		if err2142 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.RevokePrivileges(value0))
		fmt.Print("\n")
		break
	case "get_delegation_token":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "GetDelegationToken requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetDelegationToken(value0))
		fmt.Print("\n")
		break
	case "get_delegation_token_with_signature":
		if flag.NArg()-1 != 2 {
			fmt.Fprint(os.Stderr, "GetDelegationTokenWithSignature requires 2 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetDelegationTokenWithSignature(value0, value1))
		fmt.Print("\n")
		break
	case "renew_delegation_token":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "RenewDelegationToken requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.RenewDelegationToken(value0))
		fmt.Print("\n")
		break
	case "cancel_delegation_token":
		if flag.NArg()-1 != 1 {
			fmt.Fprint(os.Stderr, "CancelDelegationToken requires 1 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.CancelDelegationToken(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n")
	}
}
Exemple #16
0
func TestCompactProtocol(t *testing.T) {
	pf := thrift.NewTCompactProtocolFactory()
	tf := thrift.NewTTransportFactory()

	addr, _ := net.ResolveTCPAddr("tcp", "localhost:8082")

	channel := thrift.NewTSocketAddr(addr)
	defer channel.Close()

	if openErr := channel.Open(); openErr != nil {
		t.Fatalf("Could not open channel due to '%q'.", openErr)
	}

	effectiveTransport := tf.GetTransport(channel)

	client := NewContainerOfEnumsTestServiceClientFactory(effectiveTransport, pf)

	var request *ContainerOfEnums = NewContainerOfEnums()

	var response *ContainerOfEnums
	var anomaly error

	if response, anomaly = client.Echo(request); anomaly != nil {
		t.Fatalf("Could not get response due to '%q'.", anomaly)
	}

	if request.First != response.First {
		t.Errorf("request.First (%q) != response.First (%q)", request.First, response.First)
	}

	if request.IsSetFirst() != response.IsSetFirst() {
		t.Errorf("request.IsSetFirst() (%q) != response.IsSetFirst() (%q).", request.IsSetFirst(), response.IsSetFirst())
	}

	if request.Second != response.Second {
		t.Errorf("request.Second (%q) != response.Second (%q).", request.Second, response.Second)
	}

	if request.IsSetSecond() != response.IsSetSecond() {
		t.Errorf("request.IsSetSecond() (%q) != response.IsSetSecond() (%q).", request.IsSetSecond(), response.IsSetSecond())
	}

	if request.Third != response.Third {
		t.Errorf("request.Third (%q) != response.Third (%q).", request.Third, response.Third)
	}

	if request.IsSetThird() != response.IsSetThird() {
		t.Errorf("request.IsSetThird() (%q) != response.IsSetThird() (%q).", request.IsSetThird(), response.IsSetThird())
	}

	if request.OptionalFourth != response.OptionalFourth {
		t.Errorf("request.OptionalFourth (%q) != response.OptionalFourth (%q).", request.OptionalFourth, response.OptionalFourth)
	}

	if request.IsSetOptionalFourth() != response.IsSetOptionalFourth() {
		t.Errorf("request.IsSetOptionalFourth() (%q) != response.IsSetOptionalFourth() (%q).", request.IsSetOptionalFourth(), response.IsSetOptionalFourth())
	}

	if request.OptionalFifth != response.OptionalFifth {
		t.Errorf("request.OptionalFifth (%q) != response.OptionalFifth (%q).", request.OptionalFifth, response.OptionalFifth)
	}

	if request.IsSetOptionalFifth() != response.IsSetOptionalFifth() {
		t.Errorf("request.IsSetOptionalFifth() (%q) != response.IsSetOptionalFifth() (%q).", request.IsSetOptionalFifth(), response.IsSetOptionalFifth())
	}

	if request.OptionalSixth != response.OptionalSixth {
		t.Errorf("request.OptionalSixth (%q) != response.OptionalSixth (%q).", request.OptionalSixth, response.OptionalSixth)
	}

	if request.IsSetOptionalSixth() != response.IsSetOptionalSixth() {
		t.Errorf("request.IsSetOptionalSixth() (%q) != response.IsSetOptionalSixth() (%q).", request.IsSetOptionalSixth(), response.IsSetOptionalSixth())
	}

	if request.DefaultSeventh != response.DefaultSeventh {
		t.Errorf("request.DefaultSeventh (%q) != response.DefaultSeventh (%q).", request.DefaultSeventh, response.DefaultSeventh)
	}

	if request.IsSetDefaultSeventh() != response.IsSetDefaultSeventh() {
		t.Errorf("request.IsSetDefaultSeventh() (%q) != response.IsSetDefaultSeventh() (%q).", request.IsSetDefaultSeventh(), response.IsSetDefaultSeventh())
	}

	if request.DefaultEighth != response.DefaultEighth {
		t.Errorf("request.DefaultEighth (%q) != response.DefaultEighth (%q).", request.DefaultEighth, response.DefaultEighth)
	}

	if request.IsSetDefaultEighth() != response.IsSetDefaultEighth() {
		t.Errorf("request.IsSetDefaultEighth() (%q) != response.IsSetDefaultEighth() (%q).", request.IsSetDefaultEighth(), response.IsSetDefaultEighth())
	}

	if request.DefaultNineth != response.DefaultNineth {
		t.Errorf("request.DefaultNineth (%q) != response.DefaultNineth (%q).", request.DefaultNineth, response.DefaultNineth)
	}

	if request.IsSetDefaultNineth() != response.IsSetDefaultNineth() {
		t.Errorf("request.IsSetDefaultNineth() (%q) != response.IsSetDefaultNineth() (%q).", request.IsSetDefaultNineth(), response.IsSetDefaultNineth())
	}

	request.First = UndefinedValues_Two
	request.Second = DefinedValues_Two
	request.Third = HeterogeneousValues_Two
	request.OptionalFourth = UndefinedValues_Three
	request.OptionalFifth = DefinedValues_Three
	request.OptionalSixth = HeterogeneousValues_Three

	if response, anomaly = client.Echo(request); anomaly != nil {
		t.Fatalf("Could not get response due to '%q'.", anomaly)
	}

	if request.First != response.First {
		t.Errorf("request.First (%q) != response.First (%q)", request.First, response.First)
	}

	if request.IsSetFirst() != response.IsSetFirst() {
		t.Errorf("request.IsSetFirst() (%q) != response.IsSetFirst() (%q).", request.IsSetFirst(), response.IsSetFirst())
	}

	if request.Second != response.Second {
		t.Errorf("request.Second (%q) != response.Second (%q).", request.Second, response.Second)
	}

	if request.IsSetSecond() != response.IsSetSecond() {
		t.Errorf("request.IsSetSecond() (%q) != response.IsSetSecond() (%q).", request.IsSetSecond(), response.IsSetSecond())
	}

	if request.Third != response.Third {
		t.Errorf("request.Third (%q) != response.Third (%q).", request.Third, response.Third)
	}

	if request.IsSetThird() != response.IsSetThird() {
		t.Errorf("request.IsSetThird() (%q) != response.IsSetThird() (%q).", request.IsSetThird(), response.IsSetThird())
	}

	if request.OptionalFourth != response.OptionalFourth {
		t.Errorf("request.OptionalFourth (%q) != response.OptionalFourth (%q).", request.OptionalFourth, response.OptionalFourth)
	}

	if request.IsSetOptionalFourth() != response.IsSetOptionalFourth() {
		t.Errorf("request.IsSetOptionalFourth() (%q) != response.IsSetOptionalFourth() (%q).", request.IsSetOptionalFourth(), response.IsSetOptionalFourth())
	}

	if request.OptionalFifth != response.OptionalFifth {
		t.Errorf("request.OptionalFifth (%q) != response.OptionalFifth (%q).", request.OptionalFifth, response.OptionalFifth)
	}

	if request.IsSetOptionalFifth() != response.IsSetOptionalFifth() {
		t.Errorf("request.IsSetOptionalFifth() (%q) != response.IsSetOptionalFifth() (%q).", request.IsSetOptionalFifth(), response.IsSetOptionalFifth())
	}

	if request.OptionalSixth != response.OptionalSixth {
		t.Errorf("request.OptionalSixth (%q) != response.OptionalSixth (%q).", request.OptionalSixth, response.OptionalSixth)
	}

	if request.IsSetOptionalSixth() != response.IsSetOptionalSixth() {
		t.Errorf("request.IsSetOptionalSixth() (%q) != response.IsSetOptionalSixth() (%q).", request.IsSetOptionalSixth(), response.IsSetOptionalSixth())
	}

	if request.DefaultSeventh != response.DefaultSeventh {
		t.Errorf("request.DefaultSeventh (%q) != response.DefaultSeventh (%q).", request.DefaultSeventh, response.DefaultSeventh)
	}

	if request.IsSetDefaultSeventh() != response.IsSetDefaultSeventh() {
		t.Errorf("request.IsSetDefaultSeventh() (%q) != response.IsSetDefaultSeventh() (%q).", request.IsSetDefaultSeventh(), response.IsSetDefaultSeventh())
	}

	if request.DefaultEighth != response.DefaultEighth {
		t.Errorf("request.DefaultEighth (%q) != response.DefaultEighth (%q).", request.DefaultEighth, response.DefaultEighth)
	}

	if request.IsSetDefaultEighth() != response.IsSetDefaultEighth() {
		t.Errorf("request.IsSetDefaultEighth() (%q) != response.IsSetDefaultEighth() (%q).", request.IsSetDefaultEighth(), response.IsSetDefaultEighth())
	}

	if request.DefaultNineth != response.DefaultNineth {
		t.Errorf("request.DefaultNineth (%q) != response.DefaultNineth (%q).", request.DefaultNineth, response.DefaultNineth)
	}

	if request.IsSetDefaultNineth() != response.IsSetDefaultNineth() {
		t.Errorf("request.IsSetDefaultNineth() (%q) != response.IsSetDefaultNineth() (%q).", request.IsSetDefaultNineth(), response.IsSetDefaultNineth())
	}
}
Exemple #17
0
func StartClient(
	host string,
	port int64,
	domain_socket string,
	transport string,
	protocol string,
	ssl bool) (client *thrifttest.ThriftTestClient, err error) {

	hostPort := fmt.Sprintf("%s:%d", host, port)

	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
	case "binary":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
	default:
		return nil, fmt.Errorf("Invalid protocol specified %s", protocol)
	}
	if debugClientProtocol {
		protocolFactory = thrift.NewTDebugProtocolFactory(protocolFactory, "client:")
	}
	var trans thrift.TTransport
	if ssl {
		trans, err = thrift.NewTSSLSocket(hostPort, &tls.Config{InsecureSkipVerify: true})
	} else {
		if domain_socket != "" {
			trans, err = thrift.NewTSocket(domain_socket)
		} else {
			trans, err = thrift.NewTSocket(hostPort)
		}
	}
	if err != nil {
		return nil, err
	}
	switch transport {
	case "http":
		trans, err = thrift.NewTHttpClient(fmt.Sprintf("http://%s/service", hostPort))
		if err != nil {
			return nil, err
		}
	case "framed":
		trans = thrift.NewTFramedTransport(trans)
	case "buffered":
		trans = thrift.NewTBufferedTransport(trans, 8192)
	case "":
		trans = trans
	default:
		return nil, fmt.Errorf("Invalid transport specified %s", transport)
	}

	if err = trans.Open(); err != nil {
		return nil, err
	}
	client = thrifttest.NewThriftTestClientFactory(trans, protocolFactory)
	return
}
Exemple #18
0
func StartServer(
	host string,
	port int64,
	domain_socket string,
	transport string,
	protocol string,
	ssl bool,
	certPath string,
	handler thrifttest.ThriftTest) (srv *thrift.TSimpleServer, err error) {

	hostPort := fmt.Sprintf("%s:%d", host, port)

	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
	case "binary":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
	default:
		return nil, fmt.Errorf("Invalid protocol specified %s", protocol)
	}
	if debugServerProtocol {
		protocolFactory = thrift.NewTDebugProtocolFactory(protocolFactory, "server:")
	}

	var serverTransport thrift.TServerTransport
	if ssl {
		cfg := new(tls.Config)
		if cert, err := tls.LoadX509KeyPair(certPath+"/server.crt", certPath+"/server.key"); err != nil {
			return nil, err
		} else {
			cfg.Certificates = append(cfg.Certificates, cert)
		}
		serverTransport, err = thrift.NewTSSLServerSocket(hostPort, cfg)
	} else {
		if domain_socket != "" {
			serverTransport, err = thrift.NewTServerSocket(domain_socket)
		} else {
			serverTransport, err = thrift.NewTServerSocket(hostPort)
		}
	}
	if err != nil {
		return nil, err
	}

	var transportFactory thrift.TTransportFactory

	switch transport {
	case "http":
		return nil, fmt.Errorf("Http server transport is not supported")
		// trans, err = thrift.NewTHttpClient(fmt.Sprintf("http://%s/service", hostPort))
		// if err != nil {
		// 	return nil, err
		// }
	case "framed":
		transportFactory = thrift.NewTTransportFactory()
		transportFactory = thrift.NewTFramedTransportFactory(transportFactory)
	case "buffered":
		transportFactory = thrift.NewTBufferedTransportFactory(8192)
	case "zlib":
		transportFactory = thrift.NewTZlibTransportFactory(zlib.BestCompression)
	case "":
		transportFactory = thrift.NewTTransportFactory()
	default:
		return nil, fmt.Errorf("Invalid transport specified %s", transport)
	}
	processor := thrifttest.NewThriftTestProcessor(handler)
	server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
	if err = server.Listen(); err != nil {
		return
	}
	go server.AcceptLoop()
	return server, nil
}
Exemple #19
0
func main() {
	flag.Parse()
	if *memprofile != "" {
		runtime.MemProfileRate = 100
	}
	var ok bool
	if callType, ok = callTMap[*callName]; !ok {
		log.Fatal("Unknown service call", *callName)
	}
	if *cpuprofile != "" {
		f, err := os.Create(*cpuprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}
	hostPort = fmt.Sprintf("%s:%d", *host, *port)
	var protocolFactory thrift.TProtocolFactory
	var transportFactory thrift.TTransportFactory

	if *compact {
		protocolFactory = thrift.NewTCompactProtocolFactory()
	} else {
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
	}

	if *framed {
		transportFactory = thrift.NewTTransportFactory()
		transportFactory = thrift.NewTFramedTransportFactory(transportFactory)
	} else {
		transportFactory = thrift.NewTBufferedTransportFactory(8192)
	}

	if *runserver > 0 {
		serverTransport, err := thrift.NewTServerSocket(hostPort)
		if err != nil {
			log.Fatalf("Unable to create server socket: %s", err)
		}

		processor := stress.NewServiceProcessor(&handler{})
		server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
		if *clients == 0 {
			server.Serve()
		} else {
			go server.Serve()
		}
	}
	//start clients
	if *clients != 0 {
		ready.Add(*clients + 1)
		done.Add(*clients)
		for i := 0; i < *clients; i++ {
			go client(protocolFactory)
		}
		ready.Done()
		ready.Wait()
		//run!
		startTime := time.Now()
		//wait for completion
		done.Wait()
		endTime := time.Now()
		duration := endTime.Sub(startTime)
		log.Printf("%d calls in %v (%f calls per second)\n", clicounter, duration, float64(clicounter)/duration.Seconds())
	}
	if *memprofile != "" {
		f, err := os.Create(*memprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.WriteHeapProfile(f)
		f.Close()
		return
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var help bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.BoolVar(&help, "help", false, "See usage string")
	flag.Parse()
	if help || flag.NArg() == 0 {
		flag.Usage()
	}

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error parsing URL: ", err.Error(), "\n")
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		addr, err := net.ResolveTCPAddr("tcp", fmt.Sprint(host, ":", port))
		if err != nil {
			fmt.Fprint(os.Stderr, "Error resolving address", err.Error())
			os.Exit(1)
		}
		trans, err = thrift.NewTNonblockingSocketAddr(addr)
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprint(os.Stderr, "Error creating transport", err.Error())
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid protocol specified: ", protocol, "\n")
		Usage()
		os.Exit(1)
	}
	client := librarytest.NewReverseOrderServiceClientFactory(trans, protocolFactory)
	if err = trans.Open(); err != nil {
		fmt.Fprint(os.Stderr, "Error opening socket to ", host, ":", port, " ", err.Error())
		os.Exit(1)
	}

	switch cmd {
	case "myMethod":
		if flag.NArg()-1 != 4 {
			fmt.Fprint(os.Stderr, "MyMethod requires 4 args\n")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err1129 := (strconv.Atoi(flag.Arg(2)))
		if err1129 != nil {
			Usage()
			return
		}
		argvalue1 := byte(tmp1)
		value1 := argvalue1
		tmp2, err1130 := (strconv.Atoi(flag.Arg(3)))
		if err1130 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		argvalue3, err1131 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err1131 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.MyMethod(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprint(os.Stderr, "Invalid function ", cmd, "\n")
	}
}