예제 #1
0
// Station handles the higher level business processing for this API Call
func Station(controller *bc.BaseController, stationId string) {
	defer bc.CatchPanic(controller, "Station")

	tracelog.STARTEDf(controller.UserId, "Station", "StationId[%s]", stationId)

	buoyStation, err := buoyService.FindStation(&controller.Service, stationId)
	if err != nil {
		tracelog.COMPLETED_ERRORf(err, controller.UserId, "Station", "StationId[%s]", stationId)
		controller.ServeError(err)
		return
	}

	controller.Data["json"] = &buoyStation
	controller.ServeJson()

	tracelog.COMPLETED(controller.UserId, "Station")
}
예제 #2
0
// Test_Station checks the station service call is working
func Test_Station(t *testing.T) {
	service := Prepare()
	defer Finish(service)

	stationId := "42002"

	buoyStation, err := buoyService.FindStation(service, stationId)

	Convey("Subject: Test Station Service", t, func() {
		Convey("Should Be Able To Perform A Search", func() {
			So(err, ShouldEqual, nil)
		})
		Convey("Should Have Station Data", func() {
			So(buoyStation.StationId, ShouldEqual, stationId)
		})
	})
}