2022-11-03 21:22:10 +03:00
|
|
|
module Export
|
|
|
|
|
2023-03-23 16:10:51 +04:00
|
|
|
import Srv from "../aqua/single-module-srv.aqua"
|
|
|
|
import NodeUtils from "../aqua/node-utils.aqua"
|
2022-11-03 21:22:10 +03:00
|
|
|
export happy_path, list_services, file_not_found, service_removed, removing_non_exiting
|
|
|
|
|
|
|
|
service Greeting("greeting"):
|
|
|
|
greeting(name: string) -> string
|
|
|
|
|
|
|
|
func happy_path(file_path: string) -> string:
|
|
|
|
file <- NodeUtils.read_file(file_path)
|
|
|
|
created_service <- Srv.create(file.content!)
|
|
|
|
Greeting created_service.service_id!
|
|
|
|
<- Greeting.greeting("test")
|
|
|
|
|
|
|
|
func list_services(file_path: string) -> []string:
|
|
|
|
file <- NodeUtils.read_file(file_path)
|
|
|
|
Srv.create(file.content!)
|
|
|
|
Srv.create(file.content!)
|
|
|
|
Srv.create(file.content!)
|
|
|
|
<- Srv.list()
|
|
|
|
|
|
|
|
func file_not_found() -> string:
|
|
|
|
e <- NodeUtils.read_file("/random/incorrect/file")
|
|
|
|
<- e.error!
|
|
|
|
|
|
|
|
func service_removed(file_path: string) -> string:
|
2023-02-13 17:41:35 +03:00
|
|
|
result: *string
|
|
|
|
|
2022-11-03 21:22:10 +03:00
|
|
|
file <- NodeUtils.read_file(file_path)
|
|
|
|
created_service <- Srv.create(file.content!)
|
|
|
|
Greeting created_service.service_id!
|
|
|
|
Srv.remove(created_service.service_id!)
|
|
|
|
try:
|
|
|
|
dontcare <- Greeting.greeting("test")
|
2023-02-13 17:41:35 +03:00
|
|
|
result <<- "ok"
|
2022-11-03 21:22:10 +03:00
|
|
|
catch e:
|
2023-02-13 17:41:35 +03:00
|
|
|
result <<- e.message
|
|
|
|
<- result!
|
2022-11-03 21:22:10 +03:00
|
|
|
|
|
|
|
func removing_non_exiting() -> string:
|
|
|
|
e <- Srv.remove("random_id")
|
|
|
|
<- e.error!
|
|
|
|
|