Ejemplo n.º 1
0
func (self *FopImgInfo) doTestGetImgInfo(downloadUrl string) (msg string, err error) {
	begin := time.Now()
	url := downloadUrl + "?imageInfo"
	netBuf, err := util.DoHttpGet(url)
	end := time.Now()
	duration := end.Sub(begin)
	msg = util.GenLog("Fp    "+self.Env.Id+"_"+self.Name+"_doTestGetImgInfo", begin, end, duration)
	if err != nil {
		return
	}

	var serImgInfo ImageInfo
	json.Unmarshal(netBuf.Bytes(), &serImgInfo)
	locImgInfo := self.TargetImgInfo

	if err = CheckImgInfo(serImgInfo, locImgInfo); err != nil {
		return
	}
	return
}
Ejemplo n.º 2
0
func (self *FopImgOp) doTestImgOp(downloadUrl string) (msg string, err error) {
	begin := time.Now()
	url := downloadUrl + "?" + self.Op
	netBuf, err := util.DoHttpGet(url)
	end := time.Now()
	duration := end.Sub(begin)
	msg = util.GenLog("Fp    "+self.Env.Id+"_"+self.Name+"_doTestImgOp", begin, end, duration)
	if err != nil {
		return
	}
	targetFile, err := os.Open(self.TargetImg)
	if err != nil {
		return
	}
	_, err = util.CheckImg(netBuf, targetFile)
	if err != nil {
		return
	}

	return
}