service

package
v0.0.0-...-a97389e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: GPL-3.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UploadFail = "file upload failed, %s."
)
View Source
const (
	ZapPath = "/Users/aaron/rd/project/zentao/go/ztf/internal/pkg/plugin/zap-plugin"
)

Variables

View Source
var (
	ErrEmpty = errors.New("请上传正确的文件")
)

Functions

func GetFileName

func GetFileName(name string) (string, error)

GetFileName 获取文件名称

Types

type FileService

type FileService struct {
}

func NewFileService

func NewFileService() *FileService

func (*FileService) GetAllChildren

func (s *FileService) GetAllChildren(childPath string, parent *serverDomain.TestAsset) (err error)

func (*FileService) GetPath

func (s *FileService) GetPath(filename string) string

GetPath 获取文件路径

func (*FileService) LoadDirs

func (s *FileService) LoadDirs(dir string) (asset serverDomain.TestAsset, err error)

func (*FileService) UploadFile

func (s *FileService) UploadFile(ctx iris.Context, fh *multipart.FileHeader) (iris.Map, error)

UploadFile 上传文件

type HeartbeatService

type HeartbeatService struct {
}

func NewHeartbeatService

func NewHeartbeatService() *HeartbeatService

func (*HeartbeatService) Heartbeat

func (s *HeartbeatService) Heartbeat()

type InterpreterService

type InterpreterService struct {
	InterpreterRepo *repo.InterpreterRepo `inject:""`
}

func NewInterpreterService

func NewInterpreterService() *InterpreterService

func (*InterpreterService) Create

func (s *InterpreterService) Create(interpreter model.Interpreter) (id uint, err error)

func (*InterpreterService) Delete

func (s *InterpreterService) Delete(id uint) error

func (*InterpreterService) Get

func (s *InterpreterService) Get(id uint) (interpreter model.Interpreter, err error)

func (*InterpreterService) GetLangSettings

func (s *InterpreterService) GetLangSettings() (mp map[string]interface{}, err error)

func (*InterpreterService) GetMap

func (s *InterpreterService) GetMap(pos []model.Interpreter) (mp map[string]string, err error)

func (*InterpreterService) List

func (s *InterpreterService) List() (ret []model.Interpreter, err error)

func (*InterpreterService) Update

func (s *InterpreterService) Update(interpreter model.Interpreter) (err error)

type JobService

type JobService struct {
	JobRepo *repo.JobRepo `inject:""`
}

func NewJobService

func NewJobService() *JobService

func (*JobService) Add

func (s *JobService) Add(req serverDomain.ZentaoExecReq) (err error)

func (*JobService) Cancel

func (s *JobService) Cancel(id uint)

func (*JobService) Check

func (s *JobService) Check() (err error)

func (*JobService) IsError

func (s *JobService) IsError(po model.Job) bool

func (*JobService) IsTimeout

func (s *JobService) IsTimeout(po model.Job) bool

func (*JobService) List

func (s *JobService) List(status string) (jobs []model.Job, err error)

func (*JobService) NeedRetry

func (s *JobService) NeedRetry(po model.Job) bool

func (*JobService) Query

func (s *JobService) Query() (ret serverDomain.JobQueryResp, err error)

func (*JobService) Restart

func (s *JobService) Restart(po *model.Job) (ret bool)

func (*JobService) Start

func (s *JobService) Start(po *model.Job)

func (*JobService) SubmitExecResult

func (s *JobService) SubmitExecResult(job model.Job, execErr error) (err error)

func (*JobService) SubmitJobStatus

func (s *JobService) SubmitJobStatus(job model.Job) (err error)

type PluginService

type PluginService struct {
	// contains filtered or unexported fields
}

func (*PluginService) Cancel

func (s *PluginService) Cancel() (err error)

func (*PluginService) Exec

func (s *PluginService) Exec() (err error)

func (*PluginService) Install

func (s *PluginService) Install(req commDomain.PluginInstallReq) (err error)

func (*PluginService) Start

func (s *PluginService) Start() (err error)

func (*PluginService) Stop

func (s *PluginService) Stop() (err error)

func (*PluginService) Uninstall

func (s *PluginService) Uninstall() (err error)

type ProxyService

type ProxyService struct {
	ProxyRepo *repo.ProxyRepo `inject:""`
}

func NewProxyService

func NewProxyService() *ProxyService

func (*ProxyService) Check

func (s *ProxyService) Check(proxyId uint) (err error)

func (*ProxyService) CheckServer

func (s *ProxyService) CheckServer(url string) (err error)

func (*ProxyService) Create

func (s *ProxyService) Create(proxy model.Proxy) (id uint, err error)

func (*ProxyService) Delete

func (s *ProxyService) Delete(id uint) error

func (*ProxyService) Get

func (s *ProxyService) Get(id uint) (proxy model.Proxy, err error)

func (*ProxyService) List

func (s *ProxyService) List() (ret []model.Proxy, err error)

func (*ProxyService) Update

func (s *ProxyService) Update(proxy model.Proxy) (err error)

type ServerService

type ServerService struct {
	ServerRepo *repo.ServerRepo `inject:""`
}

func NewServerService

func NewServerService() *ServerService

func (*ServerService) CheckServer

func (s *ServerService) CheckServer(url string) (err error)

func (*ServerService) Create

func (s *ServerService) Create(server model.Server) (id uint, err error)

func (*ServerService) Delete

func (s *ServerService) Delete(id uint) error

func (*ServerService) Get

func (s *ServerService) Get(id uint) (server model.Server, err error)

func (*ServerService) List

func (s *ServerService) List() (ret []model.Server, err error)

func (*ServerService) Update

func (s *ServerService) Update(server model.Server) (err error)

type SiteService

type SiteService struct {
	SiteRepo         *repo.SiteRepo      `inject:""`
	WorkspaceRepo    *repo.WorkspaceRepo `inject:""`
	WorkspaceService *WorkspaceService   `inject:""`
}

func NewSiteService

func NewSiteService() *SiteService

func (*SiteService) Create

func (s *SiteService) Create(site model.Site) (id uint, isDuplicate bool, err error)

func (*SiteService) CreateEmptySite

func (s *SiteService) CreateEmptySite(lang string) (err error)

func (*SiteService) Delete

func (s *SiteService) Delete(id uint) error

func (*SiteService) Get

func (s *SiteService) Get(id uint) (site model.Site, err error)

func (*SiteService) GetDomainObject

func (s *SiteService) GetDomainObject(id uint) (site serverDomain.ZentaoSite, err error)

func (*SiteService) LoadSites

func (s *SiteService) LoadSites(currSiteId int, lang string) (sites []serverDomain.ZentaoSite, currSite serverDomain.ZentaoSite, err error)

func (*SiteService) Paginate

func (s *SiteService) Paginate(req serverDomain.ReqPaginate) (ret domain.PageData, err error)

func (*SiteService) Update

func (s *SiteService) Update(site model.Site) (isDuplicate bool, err error)

type StatisticService

type StatisticService struct {
	StatisticRepo    *repo.StatisticRepo `inject:""`
	WorkspaceService *WorkspaceService   `inject:""`
}

func NewStatisticService

func NewStatisticService() *StatisticService

func (*StatisticService) Create

func (s *StatisticService) Create(statistics model.Statistic) (id uint, isDuplicate bool, err error)

func (*StatisticService) Delete

func (s *StatisticService) Delete(id uint) error

func (*StatisticService) Get

func (s *StatisticService) Get(id uint) (statistics model.Statistic, err error)

func (*StatisticService) GetByPath

func (s *StatisticService) GetByPath(path string) (statistics model.Statistic, err error)

func (*StatisticService) GetFailureLogs

func (s *StatisticService) GetFailureLogs(scriptPath string) (reports []serverDomain.TestReportSummary, err error)

func (*StatisticService) Update

func (s *StatisticService) Update(statistics model.Statistic) (isDuplicate bool, err error)

func (*StatisticService) UpdateStatistic

func (s *StatisticService) UpdateStatistic(logPath string) (scriptPaths []string, err error)

type SyncService

type SyncService struct {
}

func NewSyncService

func NewSyncService() *SyncService

type TestBugService

type TestBugService struct {
	SiteRepo *repo.SiteRepo `inject:""`
}

func NewTestBugService

func NewTestBugService() *TestBugService

func (*TestBugService) GetBugFields

func (s *TestBugService) GetBugFields(siteId, productId int) (bugFields commDomain.ZentaoBugFields, err error)

func (*TestBugService) LoadBugs

func (s *TestBugService) LoadBugs(siteId, productId int) (bugs []commDomain.ZentaoBug, err error)

func (*TestBugService) Submit

func (s *TestBugService) Submit(bug commDomain.ZtfBug, siteId, productId int) (err error)

type TestCaseService

type TestCaseService struct {
}

func NewTestCaseService

func NewTestCaseService() *TestCaseService

type TestExecService

type TestExecService struct {
	WorkspaceService *WorkspaceService `inject:""`
}

func NewTestExecService

func NewTestExecService() *TestExecService

func (*TestExecService) Start

func (s *TestExecService) Start(req serverDomain.ExecReq, wsMsg *websocket.Message) (err error)

func (*TestExecService) Stop

func (s *TestExecService) Stop(wsMsg *websocket.Message) (err error)

type TestFilterService

type TestFilterService struct {
	WorkspaceRepo *repo.WorkspaceRepo `inject:""`
	SiteService   *SiteService        `inject:""`
}

func NewTestFilterService

func NewTestFilterService() *TestFilterService

func (*TestFilterService) ListFilterItems

func (s *TestFilterService) ListFilterItems(filerType commConsts.ScriptFilterType,
	siteId, productId uint) (ret interface{}, err error)

func (*TestFilterService) ListModuleFilter

func (s *TestFilterService) ListModuleFilter(config commDomain.WorkspaceConf, productId uint) (ret []serverDomain.FilterItem, err error)

func (*TestFilterService) ListSuiteFilter

func (s *TestFilterService) ListSuiteFilter(config commDomain.WorkspaceConf, productId uint) (ret []serverDomain.FilterItem, err error)

func (*TestFilterService) ListTaskFilter

func (s *TestFilterService) ListTaskFilter(config commDomain.WorkspaceConf, productId uint) (ret []serverDomain.FilterItem, err error)

func (*TestFilterService) ListWorkspaceFilter

func (s *TestFilterService) ListWorkspaceFilter(siteId, productId uint) (ret []serverDomain.FilterItem, err error)

type TestResultService

type TestResultService struct {
	SiteRepo         *repo.SiteRepo      `inject:""`
	WorkspaceRepo    *repo.WorkspaceRepo `inject:""`
	ProxyService     *ProxyService       `inject:""`
	WorkspaceService *WorkspaceService   `inject:""`
}

func NewTestResultService

func NewTestResultService() *TestResultService

func (*TestResultService) Delete

func (s *TestResultService) Delete(workspaceId int, seq string) (err error)

func (*TestResultService) DownloadFromProxy

func (s *TestResultService) DownloadFromProxy(fileName string, workspaceId int, proxyPath string, pathMap map[string]string) (zipPath string, err error)

func (*TestResultService) Get

func (s *TestResultService) Get(workspaceId int, seq string) (report commDomain.ZtfReport, err error)

func (*TestResultService) GetLatest

func (s *TestResultService) GetLatest(siteId, productId uint) (summary serverDomain.TestReportSummary, err error)

func (*TestResultService) Paginate

func (s *TestResultService) Paginate(siteId, productId uint, req serverDomain.ReqPaginate) (
	data domain.PageData, err error)

func (*TestResultService) Submit

func (s *TestResultService) Submit(result serverDomain.ZentaoResultSubmitReq, siteId, productId int) (err error)

func (*TestResultService) ZipLog

func (s *TestResultService) ZipLog(fileName string) (zipPath string, err error)

type TestScriptService

type TestScriptService struct {
	WorkspaceRepo     *repo.WorkspaceRepo `inject:""`
	SiteService       *SiteService        `inject:""`
	TestResultService *TestResultService  `inject:""`
}

func NewTestScriptService

func NewTestScriptService() *TestScriptService

func (*TestScriptService) CreateNode

func (s *TestScriptService) CreateNode(req serverDomain.CreateScriptReq) (pth string, err *domain.BizError)

func (*TestScriptService) Delete

func (s *TestScriptService) Delete(pth string) (bizErr *domain.BizError)

func (*TestScriptService) GetCaseIdsFromReport

func (s *TestScriptService) GetCaseIdsFromReport(workspaceId int, seq, scope string) (caseIds []string, err error)

func (*TestScriptService) LoadCodeChildren

func (s *TestScriptService) LoadCodeChildren(dir string, workspaceId int) (nodes []*serverDomain.TestAsset, err error)

func (*TestScriptService) LoadTestScriptsBySiteProduct

func (s *TestScriptService) LoadTestScriptsBySiteProduct(
	siteId, productId uint, displayBy, filerType string, filerValue int) (root serverDomain.TestAsset, err error)

func (*TestScriptService) Move

func (*TestScriptService) Paste

func (s *TestScriptService) Paste(req serverDomain.PasteScriptReq) (err error)

func (*TestScriptService) Rename

func (s *TestScriptService) Rename(pth string, name string) (bizErr *domain.BizError)

func (*TestScriptService) UpdateCode

func (s *TestScriptService) UpdateCode(script serverDomain.TestScript) (err error)

func (*TestScriptService) UpdateName

func (s *TestScriptService) UpdateName(script serverDomain.TestScript) (err error)

type WorkspaceService

type WorkspaceService struct {
	WorkspaceRepo      *repo.WorkspaceRepo `inject:""`
	SiteRepo           *repo.SiteRepo      `inject:""`
	InterpreterService *InterpreterService `inject:""`
	ProxyService       *ProxyService       `inject:""`
}

func NewWorkspaceService

func NewWorkspaceService() *WorkspaceService

func (*WorkspaceService) Create

func (s *WorkspaceService) Create(workspace model.Workspace) (id uint, err error)

func (*WorkspaceService) Delete

func (s *WorkspaceService) Delete(id uint) (err error)

func (*WorkspaceService) DeleteByPath

func (s *WorkspaceService) DeleteByPath(path string, productId uint) (err error)

func (*WorkspaceService) Get

func (s *WorkspaceService) Get(id uint) (model.Workspace, error)

func (*WorkspaceService) GetByPath

func (s *WorkspaceService) GetByPath(workspacePath string) (po model.Workspace, err error)

func (*WorkspaceService) ListByProduct

func (s *WorkspaceService) ListByProduct(siteId, productId uint) (pos []model.Workspace, err error)

func (*WorkspaceService) ListWorkspacesByProduct

func (s *WorkspaceService) ListWorkspacesByProduct(siteId, productId uint) (pos []model.Workspace, err error)

func (*WorkspaceService) Paginate

func (*WorkspaceService) Update

func (s *WorkspaceService) Update(workspace model.Workspace) (err error)

func (*WorkspaceService) UpdateAllConfig

func (s *WorkspaceService) UpdateAllConfig()

func (*WorkspaceService) UpdateConfig

func (s *WorkspaceService) UpdateConfig(workspace model.Workspace, by string) (err error)

func (*WorkspaceService) UploadScripts

func (s *WorkspaceService) UploadScripts(fh *multipart.FileHeader, ctx iris.Context) (err error)

func (*WorkspaceService) UploadScriptsToProxy

func (s *WorkspaceService) UploadScriptsToProxy(testSets []serverDomain.TestSet) (pathMap map[string]string, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL