ConstDeviceResourceUsageNetworkGet = "/api/v1/device/resource/usage/network"
// @TODO discovery mgr URI
+ ConstDiscoverymgrDevices = "/api/v1/discoverymgr/devices"
// Service mgr URI
- ConstServicemgrServices = "/api/v1/servicemgr/services"
+ ConstServicemgrServices = "/api/v1/servicemgr/services"
+ ConstServicemgrServicesNoti = "/api/v1/servicemgr/services/notification/"
ConstAppName = "AppName"
ConstServiceName = "ls"
testGet(t, targetURI, http.StatusOK)
}
+func TestAPIV1DiscoverymgrDevicesGet(t *testing.T) {
+ targetURI := ConstDiscoverymgrDevices
+ testGet(t, targetURI, http.StatusOK)
+}
+
func TestAPIV1ServicemgrServicesPost(t *testing.T) {
- registerService(t)
+ executeService(t)
}
- func TestAPIV1ServicemgrServicesGet(t *testing.T) {
- registerService(t)
+ func TestAPIV1ServicemgrServicesNotificationServiceIDPost(t *testing.T) {
+ statusNotificationRequest := make(map[string]interface{})
+ statusNotificationRequest["ServiceID"] = 1
+ statusNotificationRequest["Status"] = "Failed"
- targetURI := ConstServicemgrServices
- testGet(t, targetURI, http.StatusOK)
- }
+ snbytes, _ := json.Marshal(statusNotificationRequest)
- func TestAPIV1ServicemgrServicesGetByAppName(t *testing.T) {
- // @TODO add register service
- registerService(t)
+ targetURI := ConstServicemgrServicesNoti
- targetURI := ConstServicemgrServices + "/" + ConstAppName
- testGet(t, targetURI, http.StatusOK)
- }
-
- func TestAPIV1ServicemgrServicesGetByServiceID(t *testing.T) {
- // @TODO add register service
- createResponse := registerService(t)
-
- targetURI := ConstServicemgrServices + "/" + strconv.FormatUint(createResponse.ServiceList[0].ID, 10)
- testGet(t, targetURI, http.StatusOK)
- }
-
- func TestAPIV1ServicemgrServicesServiceIDPost(t *testing.T) {
- createResponse := registerService(t)
- executeService(t, createResponse.ServiceList[0].ID)
-
- time.Sleep(time.Second * 2)
- }
-
- func TestAPIV1ServicemgrServicesServiceIDDeleteNotFoundService(t *testing.T) {
- // createResponse := registerService(t)
- // executeService(t, createResponse.ServiceList[0].ID)
-
- // time.Sleep(time.Second * 1)
- // targetURI := ConstServicemgrServices + "/" + strconv.FormatUint(createResponse.ServiceList[0].ID, 10)
-
- targetURI := ConstServicemgrServices + "/6"
- res, err := DoDelete(testURL + targetURI)
+ res, err := DoPost(testURL+targetURI+"1", snbytes)
if err != nil {
t.Log(err.Error())
t.Error()