func (this *ServiceComponentController) Post() {
	action := this.GetString("action")
	sid, _ := this.GetInt64("sid", 0)
	switch action {
	case "":
		component := entity.Component{}
		component.Sid = sid
		component.Name = this.GetString("name")
		component.Value = this.GetString("value")
		id, err := this.GetInt64("id", 0)
		if err == nil {
			if id == 0 {
				component.Save()
			} else {
				component.Id = id
				component.Update()
			}
		}

	case "delete":
		this.DeleteComponent()
	}
	redirectUrl := fmt.Sprintf("templatesdetail?serviceId=%d", sid)
	this.Redirect(redirectUrl, 301) //this.Get()
}
		var component entity.Component = entity.Component{Name: "component", Value: "description"}
		err := component.Save()
		Expect(err).ToNot(HaveOccurred())

		err = component.Delete()
		Expect(err).ToNot(HaveOccurred())
	})
	It("Component Update", func() {
		component := entity.Component{Name: "component mysql-service", Value: "provide mysql store service"}
		id, err := orm.NewOrm().Insert(&component)
		Expect(err).ToNot(HaveOccurred())
		component1 := entity.Component{}
		component1.Id = id
		errs := component1.Load()
		Expect(errs).ToNot(HaveOccurred())
		component1.Name = "New-template-mysql-service"
		errs = component1.Update()
		Expect(errs).ToNot(HaveOccurred())
		errs = component1.Load()
		Expect(errs).ToNot(HaveOccurred())

		Expect(component1.Name).To(Equal("New-template-mysql-service"))

		errs = component1.Delete()
		Expect(errs).ToNot(HaveOccurred())

	})
})

func init() {
	mysqlUrl := "root:c1oudc0w@tcp(127.0.0.1:3306)/cf_deploy_ui?charset=utf8&parseTime=true&loc=Asia%2FShanghai"