mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
Transform Properties into StartParameterScheme
This commit is contained in:
parent
1f0455d901
commit
adabfc8e9c
9 changed files with 177 additions and 177 deletions
|
@ -138,8 +138,8 @@ type InfrastructureComponent struct {
|
||||||
Location string `json:"location" gorm:"default:''"`
|
Location string `json:"location" gorm:"default:''"`
|
||||||
// Description of the IC
|
// Description of the IC
|
||||||
Description string `json:"description" gorm:"default:''"`
|
Description string `json:"description" gorm:"default:''"`
|
||||||
// Properties of IC as JSON string
|
// JSON scheme of start parameters for IC
|
||||||
Properties postgres.Jsonb `json:"properties"`
|
StartParameterScheme postgres.Jsonb `json:"startparameterscheme"`
|
||||||
// ComponentConfigurations in which the IC is used
|
// ComponentConfigurations in which the IC is used
|
||||||
ComponentConfigurations []ComponentConfiguration `json:"-" gorm:"foreignkey:ICID"`
|
ComponentConfigurations []ComponentConfiguration `json:"-" gorm:"foreignkey:ICID"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||||
// This file was generated by swaggo/swag at
|
// This file was generated by swaggo/swag at
|
||||||
// 2020-10-20 12:56:57.842992188 +0200 CEST m=+0.084567298
|
// 2020-10-20 15:23:51.266197121 +0200 CEST m=+0.098130845
|
||||||
|
|
||||||
package docs
|
package docs
|
||||||
|
|
||||||
|
@ -3000,8 +3000,8 @@ var doc = `{
|
||||||
"description": "Name of the IC",
|
"description": "Name of the IC",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"properties": {
|
"startparameterscheme": {
|
||||||
"description": "Properties of IC as JSON string",
|
"description": "JSON scheme of start parameters for IC",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"state": {
|
"state": {
|
||||||
|
@ -3397,7 +3397,7 @@ var doc = `{
|
||||||
"Name": {
|
"Name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"Properties": {
|
"StartParameterScheme": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"State": {
|
"State": {
|
||||||
|
@ -3432,7 +3432,7 @@ var doc = `{
|
||||||
"Name": {
|
"Name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"Properties": {
|
"StartParameterScheme": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"State": {
|
"State": {
|
||||||
|
|
|
@ -2983,8 +2983,8 @@
|
||||||
"description": "Name of the IC",
|
"description": "Name of the IC",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"properties": {
|
"startparameterscheme": {
|
||||||
"description": "Properties of IC as JSON string",
|
"description": "JSON scheme of start parameters for IC",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"state": {
|
"state": {
|
||||||
|
@ -3380,7 +3380,7 @@
|
||||||
"Name": {
|
"Name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"Properties": {
|
"StartParameterScheme": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"State": {
|
"State": {
|
||||||
|
@ -3415,7 +3415,7 @@
|
||||||
"Name": {
|
"Name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"Properties": {
|
"StartParameterScheme": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"State": {
|
"State": {
|
||||||
|
|
|
@ -163,8 +163,8 @@ definitions:
|
||||||
name:
|
name:
|
||||||
description: Name of the IC
|
description: Name of the IC
|
||||||
type: string
|
type: string
|
||||||
properties:
|
startparameterscheme:
|
||||||
description: Properties of IC as JSON string
|
description: JSON scheme of start parameters for IC
|
||||||
type: string
|
type: string
|
||||||
state:
|
state:
|
||||||
description: State of the IC
|
description: State of the IC
|
||||||
|
@ -431,7 +431,7 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
Name:
|
Name:
|
||||||
type: string
|
type: string
|
||||||
Properties:
|
StartParameterScheme:
|
||||||
type: string
|
type: string
|
||||||
State:
|
State:
|
||||||
type: string
|
type: string
|
||||||
|
@ -459,7 +459,7 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
Name:
|
Name:
|
||||||
type: string
|
type: string
|
||||||
Properties:
|
StartParameterScheme:
|
||||||
type: string
|
type: string
|
||||||
State:
|
State:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
@ -102,7 +102,7 @@ var ICA = database.InfrastructureComponent{
|
||||||
Location: "ACS Laboratory",
|
Location: "ACS Laboratory",
|
||||||
Description: "This is a test description",
|
Description: "This is a test description",
|
||||||
//StateUpdateAt: time.Now().Format(time.RFC1123),
|
//StateUpdateAt: time.Now().Format(time.RFC1123),
|
||||||
Properties: postgres.Jsonb{propertiesA},
|
StartParameterScheme: postgres.Jsonb{propertiesA},
|
||||||
}
|
}
|
||||||
|
|
||||||
var ICB = database.InfrastructureComponent{
|
var ICB = database.InfrastructureComponent{
|
||||||
|
@ -117,7 +117,7 @@ var ICB = database.InfrastructureComponent{
|
||||||
Location: "k8s",
|
Location: "k8s",
|
||||||
Description: "A signal generator for testing purposes",
|
Description: "A signal generator for testing purposes",
|
||||||
//StateUpdateAt: time.Now().Format(time.RFC1123),
|
//StateUpdateAt: time.Now().Format(time.RFC1123),
|
||||||
Properties: postgres.Jsonb{propertiesB},
|
StartParameterScheme: postgres.Jsonb{propertiesB},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scenarios
|
// Scenarios
|
||||||
|
|
|
@ -49,15 +49,15 @@ type ConfigRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ICRequest struct {
|
type ICRequest struct {
|
||||||
UUID string `json:"uuid,omitempty"`
|
UUID string `json:"uuid,omitempty"`
|
||||||
WebsocketURL string `json:"websocketurl,omitempty"`
|
WebsocketURL string `json:"websocketurl,omitempty"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Category string `json:"category,omitempty"`
|
Category string `json:"category,omitempty"`
|
||||||
State string `json:"state,omitempty"`
|
State string `json:"state,omitempty"`
|
||||||
Location string `json:"location,omitempty"`
|
Location string `json:"location,omitempty"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
Properties postgres.Jsonb `json:"properties,omitempty"`
|
StartParameterScheme postgres.Jsonb `json:"startparameterscheme,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ScenarioRequest struct {
|
type ScenarioRequest struct {
|
||||||
|
@ -74,15 +74,15 @@ func addScenarioAndIC() (scenarioID uint, ICID uint) {
|
||||||
|
|
||||||
// POST $newICA
|
// POST $newICA
|
||||||
newICA := ICRequest{
|
newICA := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
_, resp, _ := helper.TestEndpoint(router, token,
|
_, resp, _ := helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newICA})
|
"/api/ic", "POST", helper.KeyModels{"ic": newICA})
|
||||||
|
@ -92,15 +92,15 @@ func addScenarioAndIC() (scenarioID uint, ICID uint) {
|
||||||
|
|
||||||
// POST a second IC to change to that IC during testing
|
// POST a second IC to change to that IC during testing
|
||||||
newICB := ICRequest{
|
newICB := ICRequest{
|
||||||
UUID: helper.ICB.UUID,
|
UUID: helper.ICB.UUID,
|
||||||
WebsocketURL: helper.ICB.WebsocketURL,
|
WebsocketURL: helper.ICB.WebsocketURL,
|
||||||
Type: helper.ICB.Type,
|
Type: helper.ICB.Type,
|
||||||
Name: helper.ICB.Name,
|
Name: helper.ICB.Name,
|
||||||
Category: helper.ICB.Category,
|
Category: helper.ICB.Category,
|
||||||
State: helper.ICB.State,
|
State: helper.ICB.State,
|
||||||
Location: helper.ICB.Location,
|
Location: helper.ICB.Location,
|
||||||
Description: helper.ICB.Description,
|
Description: helper.ICB.Description,
|
||||||
Properties: helper.ICB.Properties,
|
StartParameterScheme: helper.ICB.StartParameterScheme,
|
||||||
}
|
}
|
||||||
_, resp, _ = helper.TestEndpoint(router, token,
|
_, resp, _ = helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newICB})
|
"/api/ic", "POST", helper.KeyModels{"ic": newICB})
|
||||||
|
|
|
@ -39,16 +39,16 @@ import (
|
||||||
var router *gin.Engine
|
var router *gin.Engine
|
||||||
|
|
||||||
type ICRequest struct {
|
type ICRequest struct {
|
||||||
UUID string `json:"uuid,omitempty"`
|
UUID string `json:"uuid,omitempty"`
|
||||||
WebsocketURL string `json:"websocketurl,omitempty"`
|
WebsocketURL string `json:"websocketurl,omitempty"`
|
||||||
APIURL string `json:"apiurl,omitempty"`
|
APIURL string `json:"apiurl,omitempty"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Category string `json:"category,omitempty"`
|
Category string `json:"category,omitempty"`
|
||||||
State string `json:"state,omitempty"`
|
State string `json:"state,omitempty"`
|
||||||
Location string `json:"location,omitempty"`
|
Location string `json:"location,omitempty"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
Properties postgres.Jsonb `json:"properties,omitempty"`
|
StartParameterScheme postgres.Jsonb `json:"startparameterscheme,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
@ -102,16 +102,16 @@ func TestAddICAsAdmin(t *testing.T) {
|
||||||
|
|
||||||
// test POST ic/ $newIC
|
// test POST ic/ $newIC
|
||||||
newIC := ICRequest{
|
newIC := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
APIURL: helper.ICB.APIURL,
|
APIURL: helper.ICB.APIURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
code, resp, err = helper.TestEndpoint(router, token,
|
code, resp, err = helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
||||||
|
@ -157,15 +157,15 @@ func TestAddICAsUser(t *testing.T) {
|
||||||
|
|
||||||
// test POST ic/ $newIC
|
// test POST ic/ $newIC
|
||||||
newIC := ICRequest{
|
newIC := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should fail with unprocessable entity 422 error code
|
// This should fail with unprocessable entity 422 error code
|
||||||
|
@ -188,15 +188,15 @@ func TestUpdateICAsAdmin(t *testing.T) {
|
||||||
|
|
||||||
// test POST ic/ $newIC
|
// test POST ic/ $newIC
|
||||||
newIC := ICRequest{
|
newIC := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
code, resp, err := helper.TestEndpoint(router, token,
|
code, resp, err := helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
||||||
|
@ -254,15 +254,15 @@ func TestUpdateICAsUser(t *testing.T) {
|
||||||
|
|
||||||
// test POST ic/ $newIC
|
// test POST ic/ $newIC
|
||||||
newIC := ICRequest{
|
newIC := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
code, resp, err := helper.TestEndpoint(router, token,
|
code, resp, err := helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
||||||
|
@ -300,15 +300,15 @@ func TestDeleteICAsAdmin(t *testing.T) {
|
||||||
|
|
||||||
// test POST ic/ $newIC
|
// test POST ic/ $newIC
|
||||||
newIC := ICRequest{
|
newIC := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
code, resp, err := helper.TestEndpoint(router, token,
|
code, resp, err := helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
||||||
|
@ -354,15 +354,15 @@ func TestDeleteICAsUser(t *testing.T) {
|
||||||
|
|
||||||
// test POST ic/ $newIC
|
// test POST ic/ $newIC
|
||||||
newIC := ICRequest{
|
newIC := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
code, resp, err := helper.TestEndpoint(router, token,
|
code, resp, err := helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
"/api/ic", "POST", helper.KeyModels{"ic": newIC})
|
||||||
|
@ -404,15 +404,15 @@ func TestGetAllICs(t *testing.T) {
|
||||||
|
|
||||||
// test POST ic/ $newICA
|
// test POST ic/ $newICA
|
||||||
newICA := ICRequest{
|
newICA := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
code, resp, err := helper.TestEndpoint(router, token,
|
code, resp, err := helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newICA})
|
"/api/ic", "POST", helper.KeyModels{"ic": newICA})
|
||||||
|
@ -421,15 +421,15 @@ func TestGetAllICs(t *testing.T) {
|
||||||
|
|
||||||
// test POST ic/ $newICB
|
// test POST ic/ $newICB
|
||||||
newICB := ICRequest{
|
newICB := ICRequest{
|
||||||
UUID: helper.ICB.UUID,
|
UUID: helper.ICB.UUID,
|
||||||
WebsocketURL: helper.ICB.WebsocketURL,
|
WebsocketURL: helper.ICB.WebsocketURL,
|
||||||
Type: helper.ICB.Type,
|
Type: helper.ICB.Type,
|
||||||
Name: helper.ICB.Name,
|
Name: helper.ICB.Name,
|
||||||
Category: helper.ICB.Category,
|
Category: helper.ICB.Category,
|
||||||
State: helper.ICB.State,
|
State: helper.ICB.State,
|
||||||
Location: helper.ICB.Location,
|
Location: helper.ICB.Location,
|
||||||
Description: helper.ICB.Description,
|
Description: helper.ICB.Description,
|
||||||
Properties: helper.ICB.Properties,
|
StartParameterScheme: helper.ICB.StartParameterScheme,
|
||||||
}
|
}
|
||||||
code, resp, err = helper.TestEndpoint(router, token,
|
code, resp, err = helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newICB})
|
"/api/ic", "POST", helper.KeyModels{"ic": newICB})
|
||||||
|
@ -468,15 +468,15 @@ func TestGetConfigsOfIC(t *testing.T) {
|
||||||
|
|
||||||
// test POST ic/ $newICA
|
// test POST ic/ $newICA
|
||||||
newICA := ICRequest{
|
newICA := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
code, resp, err := helper.TestEndpoint(router, token,
|
code, resp, err := helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newICA})
|
"/api/ic", "POST", helper.KeyModels{"ic": newICA})
|
||||||
|
|
|
@ -32,29 +32,29 @@ import (
|
||||||
var validate *validator.Validate
|
var validate *validator.Validate
|
||||||
|
|
||||||
type validNewIC struct {
|
type validNewIC struct {
|
||||||
UUID string `form:"UUID" validate:"required"`
|
UUID string `form:"UUID" validate:"required"`
|
||||||
WebsocketURL string `form:"WebsocketURL" validate:"omitempty"`
|
WebsocketURL string `form:"WebsocketURL" validate:"omitempty"`
|
||||||
APIURL string `form:"APIURL" validate:"omitempty"`
|
APIURL string `form:"APIURL" validate:"omitempty"`
|
||||||
Type string `form:"Type" validate:"required"`
|
Type string `form:"Type" validate:"required"`
|
||||||
Name string `form:"Name" validate:"required"`
|
Name string `form:"Name" validate:"required"`
|
||||||
Category string `form:"Category" validate:"required"`
|
Category string `form:"Category" validate:"required"`
|
||||||
Properties postgres.Jsonb `form:"Properties" validate:"omitempty"`
|
StartParameterScheme postgres.Jsonb `form:"StartParameterScheme" validate:"omitempty"`
|
||||||
State string `form:"State" validate:"omitempty"`
|
State string `form:"State" validate:"omitempty"`
|
||||||
Location string `form:"Location" validate:"omitempty"`
|
Location string `form:"Location" validate:"omitempty"`
|
||||||
Description string `form:"Description" validate:"omitempty"`
|
Description string `form:"Description" validate:"omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type validUpdatedIC struct {
|
type validUpdatedIC struct {
|
||||||
UUID string `form:"UUID" validate:"omitempty"`
|
UUID string `form:"UUID" validate:"omitempty"`
|
||||||
WebsocketURL string `form:"WebsocketURL" validate:"omitempty"`
|
WebsocketURL string `form:"WebsocketURL" validate:"omitempty"`
|
||||||
APIURL string `form:"APIURL" validate:"omitempty"`
|
APIURL string `form:"APIURL" validate:"omitempty"`
|
||||||
Type string `form:"Type" validate:"omitempty"`
|
Type string `form:"Type" validate:"omitempty"`
|
||||||
Name string `form:"Name" validate:"omitempty"`
|
Name string `form:"Name" validate:"omitempty"`
|
||||||
Category string `form:"Category" validate:"omitempty"`
|
Category string `form:"Category" validate:"omitempty"`
|
||||||
Properties postgres.Jsonb `form:"Properties" validate:"omitempty"`
|
StartParameterScheme postgres.Jsonb `form:"StartParameterScheme" validate:"omitempty"`
|
||||||
State string `form:"State" validate:"omitempty"`
|
State string `form:"State" validate:"omitempty"`
|
||||||
Location string `form:"Location" validate:"omitempty"`
|
Location string `form:"Location" validate:"omitempty"`
|
||||||
Description string `form:"Description" validate:"omitempty"`
|
Description string `form:"Description" validate:"omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddICRequest struct {
|
type AddICRequest struct {
|
||||||
|
@ -88,7 +88,7 @@ func (r *AddICRequest) CreateIC() InfrastructureComponent {
|
||||||
s.Category = r.InfrastructureComponent.Category
|
s.Category = r.InfrastructureComponent.Category
|
||||||
s.Location = r.InfrastructureComponent.Location
|
s.Location = r.InfrastructureComponent.Location
|
||||||
s.Description = r.InfrastructureComponent.Description
|
s.Description = r.InfrastructureComponent.Description
|
||||||
s.Properties = r.InfrastructureComponent.Properties
|
s.StartParameterScheme = r.InfrastructureComponent.StartParameterScheme
|
||||||
if r.InfrastructureComponent.State != "" {
|
if r.InfrastructureComponent.State != "" {
|
||||||
s.State = r.InfrastructureComponent.State
|
s.State = r.InfrastructureComponent.State
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,11 +147,11 @@ func (r *UpdateICRequest) UpdatedIC(oldIC InfrastructureComponent) Infrastructur
|
||||||
var emptyJson postgres.Jsonb
|
var emptyJson postgres.Jsonb
|
||||||
// Serialize empty json and params
|
// Serialize empty json and params
|
||||||
emptyJson_ser, _ := json.Marshal(emptyJson)
|
emptyJson_ser, _ := json.Marshal(emptyJson)
|
||||||
startParams_ser, _ := json.Marshal(r.InfrastructureComponent.Properties)
|
startParams_ser, _ := json.Marshal(r.InfrastructureComponent.StartParameterScheme)
|
||||||
opts := jsondiff.DefaultConsoleOptions()
|
opts := jsondiff.DefaultConsoleOptions()
|
||||||
diff, _ := jsondiff.Compare(emptyJson_ser, startParams_ser, &opts)
|
diff, _ := jsondiff.Compare(emptyJson_ser, startParams_ser, &opts)
|
||||||
if diff.String() != "FullMatch" {
|
if diff.String() != "FullMatch" {
|
||||||
s.Properties = r.InfrastructureComponent.Properties
|
s.StartParameterScheme = r.InfrastructureComponent.StartParameterScheme
|
||||||
}
|
}
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
|
|
@ -56,15 +56,15 @@ type ConfigRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ICRequest struct {
|
type ICRequest struct {
|
||||||
UUID string `json:"uuid,omitempty"`
|
UUID string `json:"uuid,omitempty"`
|
||||||
WebsocketURL string `json:"websocketurl,omitempty"`
|
WebsocketURL string `json:"websocketurl,omitempty"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
Category string `json:"category,omitempty"`
|
Category string `json:"category,omitempty"`
|
||||||
State string `json:"state,omitempty"`
|
State string `json:"state,omitempty"`
|
||||||
Location string `json:"location,omitempty"`
|
Location string `json:"location,omitempty"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
Properties postgres.Jsonb `json:"properties,omitempty"`
|
StartParameterScheme postgres.Jsonb `json:"startparameterscheme,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ScenarioRequest struct {
|
type ScenarioRequest struct {
|
||||||
|
@ -81,15 +81,15 @@ func addScenarioAndICAndConfig() (scenarioID uint, ICID uint, configID uint) {
|
||||||
|
|
||||||
// POST $newICA
|
// POST $newICA
|
||||||
newICA := ICRequest{
|
newICA := ICRequest{
|
||||||
UUID: helper.ICA.UUID,
|
UUID: helper.ICA.UUID,
|
||||||
WebsocketURL: helper.ICA.WebsocketURL,
|
WebsocketURL: helper.ICA.WebsocketURL,
|
||||||
Type: helper.ICA.Type,
|
Type: helper.ICA.Type,
|
||||||
Name: helper.ICA.Name,
|
Name: helper.ICA.Name,
|
||||||
Category: helper.ICA.Category,
|
Category: helper.ICA.Category,
|
||||||
State: helper.ICA.State,
|
State: helper.ICA.State,
|
||||||
Location: helper.ICA.Location,
|
Location: helper.ICA.Location,
|
||||||
Description: helper.ICA.Description,
|
Description: helper.ICA.Description,
|
||||||
Properties: helper.ICA.Properties,
|
StartParameterScheme: helper.ICA.StartParameterScheme,
|
||||||
}
|
}
|
||||||
_, resp, _ := helper.TestEndpoint(router, token,
|
_, resp, _ := helper.TestEndpoint(router, token,
|
||||||
"/api/ic", "POST", helper.KeyModels{"ic": newICA})
|
"/api/ic", "POST", helper.KeyModels{"ic": newICA})
|
||||||
|
|
Loading…
Add table
Reference in a new issue