本文整理匯總了Golang中github.com/getgauge/gauge/gauge_messages.APIMessage類的典型用法代碼示例。如果您正苦於以下問題:Golang APIMessage類的具體用法?Golang APIMessage怎麽用?Golang APIMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了APIMessage類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: getStepValueRequestResponse
func (handler *gaugeApiMessageHandler) getStepValueRequestResponse(message *gauge_messages.APIMessage) *gauge_messages.APIMessage {
request := message.GetStepValueRequest()
stepText := request.GetStepText()
hasInlineTable := request.GetHasInlineTable()
stepValue, err := parser.ExtractStepValueAndParams(stepText, hasInlineTable)
if err != nil {
return handler.getErrorResponse(message, err)
}
stepValueResponse := &gauge_messages.GetStepValueResponse{StepValue: parser.ConvertToProtoStepValue(stepValue)}
return &gauge_messages.APIMessage{MessageType: gauge_messages.APIMessage_GetStepValueResponse.Enum(), MessageId: message.MessageId, StepValueResponse: stepValueResponse}
}
示例2: getLanguagePluginLibPath
func (handler *gaugeApiMessageHandler) getLanguagePluginLibPath(message *gauge_messages.APIMessage) *gauge_messages.APIMessage {
libPathRequest := message.GetLibPathRequest()
language := libPathRequest.GetLanguage()
languageInstallDir, err := common.GetPluginInstallDir(language, "")
if err != nil {
return handler.getErrorMessage(err)
}
runnerInfo, err := runner.GetRunnerInfo(language)
if err != nil {
return handler.getErrorMessage(err)
}
relativeLibPath := runnerInfo.Lib
libPath := path.Join(languageInstallDir, relativeLibPath)
response := &gauge_messages.GetLanguagePluginLibPathResponse{Path: proto.String(libPath)}
return &gauge_messages.APIMessage{MessageType: gauge_messages.APIMessage_GetLanguagePluginLibPathResponse.Enum(), MessageId: message.MessageId, LibPathResponse: response}
}
示例3: formatSpecs
func (handler *gaugeApiMessageHandler) formatSpecs(message *gauge_messages.APIMessage) *gauge_messages.APIMessage {
request := message.GetFormatSpecsRequest()
results := formatter.FormatSpecFiles(request.GetSpecs()...)
warnings := make([]string, 0)
errors := make([]string, 0)
for _, result := range results {
if result.ParseError != nil {
errors = append(errors, result.ParseError.Error())
}
if result.Warnings != nil {
warningTexts := make([]string, 0)
for _, warning := range result.Warnings {
warningTexts = append(warningTexts, warning.String())
}
warnings = append(warnings, warningTexts...)
}
}
formatResponse := &gauge_messages.FormatSpecsResponse{Errors: errors, Warnings: warnings}
return &gauge_messages.APIMessage{MessageId: message.MessageId, MessageType: gauge_messages.APIMessage_FormatSpecsResponse.Enum(), FormatSpecsResponse: formatResponse}
}
示例4: extractConcept
func (handler *gaugeApiMessageHandler) extractConcept(message *gauge_messages.APIMessage) *gauge_messages.APIMessage {
request := message.GetExtractConceptRequest()
success, err, filesChanged := conceptExtractor.ExtractConcept(request.GetConceptName(), request.GetSteps(), request.GetConceptFileName(), request.GetChangeAcrossProject(), request.GetSelectedTextInfo())
response := &gauge_messages.ExtractConceptResponse{IsSuccess: proto.Bool(success), Error: proto.String(err.Error()), FilesChanged: filesChanged}
return &gauge_messages.APIMessage{MessageId: message.MessageId, MessageType: gauge_messages.APIMessage_ExtractConceptResponse.Enum(), ExtractConceptResponse: response}
}