Merge pull request #21 from RS7-EdgeComputing/EDGE-254
author이동엽/Service Innovation Lab(SR)/Engineer/삼성전자 <damon92.lee@samsung.com>
Fri, 29 Mar 2019 00:33:00 +0000 (09:33 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 29 Mar 2019 00:33:00 +0000 (09:33 +0900)
Add servicemgr interface

1  2 
src/restapi/v1/restapi.go
src/restapi/v1/restapi_test.go

Simple merge
@@@ -29,10 -26,10 +27,11 @@@ const 
        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"
@@@ -242,54 -218,20 +221,25 @@@ func TestAPIV1DeviceResourceUsageNetwor
        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()