Пример #1
0
func TestDeleteUser(t *testing.T) {
	buff.WriteString("\n\n\n========================================================\n")
	buff.WriteString("Test delete begin\n\n\n\n")
	buff.WriteString("*************正常delete****************\n")
	fmt.Println("\n\n\n========================================================")
	fmt.Println("Test delete begin\n\n\n")
	fmt.Println("*************正常delete****************")
	str := host + "/user/delbyid?uid=%v"
	for i := 0; i < 10; i++ {
		vmap, err := util.HGet(str, uidSlice[i])
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	str = host + "/user/delbym?mobile=%v"
	for _, m := range regMobileSlice {
		vmap, err := util.HGet(str, m)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************缺省参数delete****************\n")
	fmt.Println("*************缺省参数delete****************")
	str = host + "/user/delbym?head=112"
	for i := 0; i < 10; i++ {
		vmap, err := util.HGet(str)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("\n\n\nTest delete end\n")
	buff.WriteString("========================================================\n\n\n\n")
	fmt.Println("\n\n\nTest delete end")
	fmt.Println("========================================================\n\n\n")
}
Пример #2
0
func TestAuthDriver(t *testing.T) {
	buff.WriteString("\n\n\n========================================================\n")
	buff.WriteString("Test auth begin\n\n\n\n")
	buff.WriteString("*************正常Auth****************\n")
	fmt.Println("\n\n\n========================================================")
	fmt.Println("Test auth begin\n\n\n")
	fmt.Println("*************正常Auth****************")
	str := host + "/user/auth?uid=%v"
	for _, m := range uidSlice {
		vmap, err := util.HGet(str, m)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************缺省参数auth****************\n")
	fmt.Println("*************缺省参数auth****************")
	str = host + "/user/auth?mobile=123"
	for i := 0; i < 10; i++ {
		vmap, err := util.HGet(str)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("\n\n\nTest auth end\n")
	buff.WriteString("========================================================\n\n\n\n")
	fmt.Println("\n\n\nTest auth end")
	fmt.Println("========================================================\n\n\n")
}
Пример #3
0
func TestChargeBalance(t *testing.T) {
	buff.WriteString("\n\n\n========================================================\n")
	buff.WriteString("Test ChargeBalance begin\n\n\n\n")
	buff.WriteString("*************正常ChargeBalance(后20个uid失败)****************\n")
	fmt.Println("\n\n\n========================================================")
	fmt.Println("Test ChargeBalance begin\n\n\n")
	fmt.Println("*************正常ChargeBalance(后20个uid失败)****************")
	str := host + "/user/charge?uid=%v&money=%v"
	for _, m := range uidSlice {
		vmap, err := util.HGet(str, m, 10)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************错误参数ChargeBalance****************\n")
	fmt.Println("*************错误参数ChargeBalance****************")
	str = host + "/user/charge?uid=%v&money=%v"
	for _, m := range uidSlice {
		vmap, err := util.HGet(str, m, -10)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************缺省参数ChargeBalance****************\n")
	fmt.Println("*************缺省参数ChargeBalance****************")
	str = host + "/user/charge?uid=555"
	for i := 0; i < 10; i++ {
		vmap, err := util.HGet(str)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("\n\n\nTest ChargeBalance end\n")
	buff.WriteString("========================================================\n\n\n\n")
	fmt.Println("\n\n\nTest ChargeBalance end")
	fmt.Println("========================================================\n\n\n")
}
Пример #4
0
func TestLogin(t *testing.T) {
	buff.WriteString("\n\n\n========================================================\n")
	buff.WriteString("Test login begin\n\n\n\n")
	buff.WriteString("*************正常保存后登陆(后10个mobile无效)****************\n")
	fmt.Println("\n\n\n========================================================")
	fmt.Println("Test login begin\n\n\n")
	fmt.Println("*************正常保存后登陆(后10个mobile无效)****************")
	str := host + "/user/login?mobile=%v"
	for _, m := range regMobileSlice {
		vmap, err := util.HGet(str, m)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************缺省参数登陆****************\n")
	fmt.Println("*************缺省参数登陆****************")
	for i := 0; i < 10; i++ {
		str := host + "/user/login?"
		vmap, err := util.HGet(str)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	for i := 0; i < 10; i++ {
		str := host + "/user/login?uid=1"
		vmap, err := util.HGet(str)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("\n\n\nTest login end\n")
	buff.WriteString("========================================================\n\n\n\n")
	fmt.Println("\n\n\nTest login end")
	fmt.Println("========================================================\n\n\n")
}
Пример #5
0
func TestWithDraw(t *testing.T) {
	buff.WriteString("\n\n\n========================================================\n")
	buff.WriteString("Test WithDraw begin\n\n\n\n")
	buff.WriteString("*************正常WithDraw****************\n")
	fmt.Println("\n\n\n========================================================")
	fmt.Println("Test WithDraw begin\n\n\n")
	fmt.Println("*************正常WithDraw****************")
	str := host + "/user/withdraw?uid=%v&money=%v"
	for _, m := range uidSlice {
		vmap, err := util.HGet(str, m, 9)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************正常WithDraw,余额不足****************\n")
	fmt.Println("*************正常WithDraw,余额不足****************")
	str = host + "/user/withdraw?uid=%v&money=%v"
	for _, m := range uidSlice {
		vmap, err := util.HGet(str, m, 20)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************错误参数WithDraw****************\n")
	fmt.Println("*************错误参数WithDraw****************")
	str = host + "/user/withdraw?uid=%v&money=%v"
	for _, m := range uidSlice {
		vmap, err := util.HGet(str, m, -10)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************缺省参数WithDraw****************\n")
	fmt.Println("*************缺省参数WithDraw****************")
	str = host + "/user/withdraw?uid=555"
	for i := 0; i < 10; i++ {
		vmap, err := util.HGet(str)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("\n\n\nTest WithDraw end\n")
	buff.WriteString("========================================================\n\n\n\n")
	fmt.Println("\n\n\nTest WithDraw end")
	fmt.Println("========================================================\n\n\n")
}
Пример #6
0
func TestFillInfo(t *testing.T) {
	head := "fill_info_head"
	hobby := "hobby!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
	gender := 1
	ti := time.Now()

	buff.WriteString("\n\n\n========================================================\n")
	buff.WriteString("Test fill info begin\n\n\n\n")
	buff.WriteString("*************正常修改资料****************\n")
	fmt.Println("\n\n\n========================================================")
	fmt.Println("Test fill info begin\n\n\n")
	fmt.Println("*************正常修改资料****************")
	for i, m := range uidSlice {
		str := host + "/user/fill?userName=%v&head=%v&gender=%v&hobby=%v&uid=%v"
		name := "ccc" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		vmap, err := util.HGet(str, name, head, gender, hobby, m)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}

	buff.WriteString("*************缺省参数修改资料****************\n")
	fmt.Println("*************缺省参数修改资料****************")
	for i := 0; i < 10; i++ {
		str := host + "/user/fill?userName=%v&head=%v&gender=%v&uid=%v"
		name := "ccc" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		vmap, err := util.HGet(str, name, head, gender, uidSlice[i])
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	for i := 0; i < 10; i++ {
		str := host + "/user/fill?head=%v&gender=%v&uid=%v"
		vmap, err := util.HGet(str, head, gender, uidSlice[i])
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("\n\n\nTest fill info end\n")
	buff.WriteString("========================================================\n\n\n\n")
	fmt.Println("\n\n\nTest fill info end")
	fmt.Println("========================================================\n\n\n")
}
Пример #7
0
func main() {
	if len(os.Args) < 2 {
		usage()
		ef(1)
		return
	}
	switch os.Args[1] {
	case "-d":
		res, err := ffcm.Dim2(os.Args[2:])
		if err == nil {
			fmt.Println(res)
		} else {
			fmt.Println(err)
			ef(1)
			return
		}
	case "-cov":
		if len(os.Args) < 11 {
			usage()
			ef(1)
			return
		}
		err := do_cov(os.Args[2:])
		if err != nil {
			fmt.Println(err)
			ef(1)
			return
		}
	case "-i":
		if len(os.Args) < 3 {
			usage()
			ef(1)
			return
		}
		var ffprobe = os.Getenv("FFPROBE_C")
		if len(ffprobe) > 0 {
			ffcm.FFPROBE_C = ffprobe
		}
		video, err := ffcm.ParseVideo(os.Args[2])
		if err == nil {
			fmt.Println(video.Width, " ", video.Height, " ", video.Duration)
		} else {
			fmt.Println(err.Error())
			ef(1)
		}
	case "-c":
		var cfg = "conf/ffcm_c.properties"
		if len(os.Args) > 2 {
			cfg = os.Args[2]
		}
		var fcfg_s = util.NewFcfg3()
		fcfg_s.InitWithFilePath2(cfg, true)
		fcfg_s.Print()
		redirect_l(fcfg_s)
		err := ffcm.RunFFCM_Cv(fcfg_s)
		fmt.Println(err)
		smartio.ResetStd()
		time.Sleep(time.Second)
	case "-mem":
		var cfg = "conf/ffcm_s.properties"
		if len(os.Args) > 2 {
			cfg = os.Args[2]
		}
		var fcfg_s = util.NewFcfg3()
		fcfg_s.InitWithFilePath2(cfg, true)
		fcfg_s.Print()
		redirect_l(fcfg_s)
		var err = ffcm.InitDtcmS(fcfg_s, dtm.MemDbc, dtm.NewDoNoneH())
		if err == nil {
			err = ffcm.RunFFCM_S_V(fcfg_s)
		}
		fmt.Println(err)
		smartio.ResetStd()
		time.Sleep(time.Second)
	case "-verify":
		if len(os.Args) < 4 {
			usage()
			ef(1)
			return
		}
		_, err := ffcm.VerifyVideo(os.Args[2], os.Args[3])
		if err == nil {
			fmt.Println("Verify Success")
			ef(0)
		} else {
			fmt.Println("Verify Fail")
			fmt.Println(err)
			ef(1)
		}
		return
	case "-s":
		var cfg = "conf/ffcm_s.properties"
		if len(os.Args) > 2 {
			cfg = os.Args[2]
		}
		var fcfg_s = util.NewFcfg3()
		fcfg_s.InitWithFilePath2(cfg, true)
		fcfg_s.Print()
		redirect_l(fcfg_s)
		var err = ffcm.InitDtcmS(fcfg_s, mdb.MdbH_dc, dtm.NewDoNoneH())
		if err == nil {
			err = ffcm.RunFFCM_S_V(fcfg_s)
		}
		fmt.Println(err)
		smartio.ResetStd()
		time.Sleep(time.Second)
	case "-g":
		if len(os.Args) < 3 {
			usage()
			ef(1)
			return
		}
		var res, err = util.HGet("%v", os.Args[2])
		if err == nil {
			fmt.Println(res)
		} else {
			fmt.Printf("request to %v error->%v\n", os.Args[2], err)
			ef(1)
		}
	default:
		usage()
		ef(1)
	}
}
Пример #8
0
func TestReg(t *testing.T) {
	buff.WriteString("\n\n\n========================================================\n")
	buff.WriteString("Test reg begin\n\n\n\n")
	fmt.Println("\n\n\n========================================================")
	fmt.Println("Test reg begin\n\n\n")
	ti := time.Now()
	buff.WriteString("*************正常参数注册****************\n")
	fmt.Println("*************正常参数注册****************")
	head := "http://e.hiphotos.baidu.com/image/h%3D200/sign=bc09df35750e0cf3bff749fb3a46f23d/2fdda3cc7cd98d102db27e16263fb80e7bec90b6.jpg"
	hobby := "coding!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
	gender := 0
	for i := 0; i < 10; i++ {
		str := host + "/user/reg?userName=%v&mobile=%v&head=%v"
		name := "c" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		mobile := "m" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		regMobileSlice = append(regMobileSlice, mobile)
		var vmap map[string]interface{}
		s, err := util.HGet(str, name, mobile, head)
		vmap, _ = util.Json2Map(s)
		uidSlice = append(uidSlice, vmap["data"])
		writeString(s, err)
		fmt.Println(vmap, err)
	}
	for i := 0; i < 10; i++ {
		str := host + "/user/reg?userName=%v&mobile=%v&head=%v&gender=%d&hobby=%v"
		name := "d" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		mobile := "n" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		regMobileSlice = append(regMobileSlice, mobile)
		var vmap map[string]interface{}
		s, err := util.HGet(str, name, mobile, head, gender, hobby)
		vmap, _ = util.Json2Map(s)
		uidSlice = append(uidSlice, vmap["data"])
		writeString(s, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************正常必要参数only注册****************\n")
	fmt.Println("*************正常必要参数only注册****************")
	for i := 0; i < 10; i++ {
		str := host + "/user/reg?userName=%v&mobile=%v"
		name := "e" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		mobile := "o" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		regMobileSlice = append(regMobileSlice, mobile)
		var vmap map[string]interface{}
		s, err := util.HGet(str, name, mobile)
		vmap, _ = util.Json2Map(s)
		uidSlice = append(uidSlice, vmap["data"])
		writeString(s, err)
		fmt.Println(vmap, err)
	}
	buff.WriteString("*************缺省参数注册****************\n")
	fmt.Println("*************缺省参数注册****************")
	for i := 0; i < 10; i++ {
		str := host + "/user/reg?userName=%v"
		name := "f" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		vmap, err := util.HGet(str, name)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}
	for i := 0; i < 10; i++ {
		str := host + "/user/reg?mobile=%v"
		mobile := "g" + strconv.Itoa(ti.Nanosecond()) + strconv.Itoa(i)
		regMobileSlice = append(regMobileSlice, mobile)
		vmap, err := util.HGet(str, mobile)
		writeString(vmap, err)
		fmt.Println(vmap, err)
	}

	buff.WriteString("\n\n\nTest reg end\n")
	buff.WriteString("========================================================\n\n\n\n")
	fmt.Println("\n\n\nTest reg end")
	fmt.Println("========================================================\n\n\n")
}