Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
4053fc74
Commit
4053fc74
authored
Oct 25, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for utils
updated model
parent
779bc2e5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1118 additions
and
1127 deletions
+1118
-1127
NodeTemplateFactory.java
...va/nl/uva/sne/drip/commons/utils/NodeTemplateFactory.java
+34
-0
TOSCAUtils.java
...c/main/java/nl/uva/sne/drip/commons/utils/TOSCAUtils.java
+29
-173
Credentials.java
...mons/src/main/java/nl/uva/sne/drip/model/Credentials.java
+178
-199
NodeTemplate.java
...ons/src/main/java/nl/uva/sne/drip/model/NodeTemplate.java
+2
-3
TopologyTemplate.java
...src/main/java/nl/uva/sne/drip/model/TopologyTemplate.java
+9
-9
ToscaTemplate.java
...ns/src/main/java/nl/uva/sne/drip/model/ToscaTemplate.java
+507
-543
User.java
drip-commons/src/main/java/nl/uva/sne/drip/model/User.java
+190
-200
TOSCAUtilsTest.java
...st/java/nl/uva/sne/drip/commons/utils/TOSCAUtilsTest.java
+169
-0
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/NodeTemplateFactory.java
0 → 100644
View file @
4053fc74
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
utils
;
import
java.util.Map
;
import
nl.uva.sne.drip.model.NodeTemplate
;
/**
*
* @author S. Koulouzis
*/
class
NodeTemplateFactory
{
static
NodeTemplate
create
(
Map
.
Entry
node
)
{
NodeTemplate
nodeTemplate
=
new
NodeTemplate
();
Map
<
String
,
Object
>
nodeMap
=
(
Map
<
String
,
Object
>)
node
.
getValue
();
nodeTemplate
.
setArtifacts
((
Map
<
String
,
Object
>)
nodeMap
.
get
(
"artifacts"
));
return
null
;
}
}
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/TOSCAUtils.java
View file @
4053fc74
...
@@ -18,13 +18,12 @@ package nl.uva.sne.drip.commons.utils;
...
@@ -18,13 +18,12 @@ package nl.uva.sne.drip.commons.utils;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.TopologyTemplate
;
import
nl.uva.sne.drip.model.TopologyTemplate
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
sun.reflect.generics.reflectiveObjects.NotImplementedException
;
/**
/**
*
*
...
@@ -32,7 +31,7 @@ import sun.reflect.generics.reflectiveObjects.NotImplementedException;
...
@@ -32,7 +31,7 @@ import sun.reflect.generics.reflectiveObjects.NotImplementedException;
*/
*/
public
class
TOSCAUtils
{
public
class
TOSCAUtils
{
public
static
List
<
Map
.
Entry
>
getNodes
(
ToscaTemplate
toscaTemplate
,
String
filterType
,
String
filterValue
)
{
public
static
List
<
Map
<
String
,
NodeTemplate
>
>
getNodes
(
ToscaTemplate
toscaTemplate
,
String
filterType
,
String
filterValue
)
{
boolean
byType
=
false
;
boolean
byType
=
false
;
boolean
byName
=
false
;
boolean
byName
=
false
;
switch
(
filterType
)
{
switch
(
filterType
)
{
...
@@ -44,29 +43,29 @@ public class TOSCAUtils {
...
@@ -44,29 +43,29 @@ public class TOSCAUtils {
break
;
break
;
}
}
TopologyTemplate
topologyTemplate
=
toscaTemplate
.
getTopologyTemplate
();
TopologyTemplate
topologyTemplate
=
toscaTemplate
.
getTopologyTemplate
();
Map
<
String
,
Object
>
nodeTemplates
=
topologyTemplate
.
getNodeTemplates
();
Map
<
String
,
NodeTemplate
>
nodeTemplates
=
topologyTemplate
.
getNodeTemplates
();
List
<
Map
.
Entry
>
nodeList
=
new
ArrayList
<>();
List
<
Map
<
String
,
NodeTemplate
>
>
nodeList
=
new
ArrayList
<>();
Set
<
String
>
keys
=
nodeTemplates
.
keySet
();
Iterator
it
=
nodeTemplates
.
entrySet
().
iterator
();
for
(
String
key
:
keys
)
{
while
(
it
.
hasNext
())
{
NodeTemplate
node
=
nodeTemplates
.
get
(
key
);
Map
.
Entry
node
=
(
Map
.
Entry
)
it
.
next
();
if
(
byName
&&
key
.
equals
(
filterValue
))
{
Map
<
String
,
Object
>
nodeValue
=
(
Map
<
String
,
Object
>)
node
.
getValue
();
Map
<
String
,
NodeTemplate
>
ntMap
=
new
HashMap
<>
();
if
(
byName
&&
node
.
getKey
().
equals
(
filterValue
))
{
ntMap
.
put
(
key
,
node
);
nodeList
.
add
(
n
ode
);
nodeList
.
add
(
n
tMap
);
}
}
if
(
byType
)
{
if
(
byType
)
{
String
type
=
(
String
)
nodeValue
.
get
(
"type"
);
if
(
node
.
getType
().
equals
(
filterValue
))
{
if
(
type
.
equals
(
filterValue
))
{
Map
<
String
,
NodeTemplate
>
ntMap
=
new
HashMap
<>();
nodeList
.
add
(
node
);
ntMap
.
put
(
key
,
node
);
nodeList
.
add
(
ntMap
);
}
}
}
}
}
}
return
nodeList
;
return
nodeList
;
}
}
public
static
List
<
Map
.
Entry
>
getNodesByType
(
ToscaTemplate
toscaTemplate
,
String
nodeTypeName
)
{
public
static
List
<
Map
<
String
,
NodeTemplate
>
>
getNodesByType
(
ToscaTemplate
toscaTemplate
,
String
nodeTypeName
)
{
return
getNodes
(
toscaTemplate
,
"type"
,
nodeTypeName
);
return
getNodes
(
toscaTemplate
,
"type"
,
nodeTypeName
);
}
}
...
@@ -101,112 +100,6 @@ public class TOSCAUtils {
...
@@ -101,112 +100,6 @@ public class TOSCAUtils {
return
outputPair
;
return
outputPair
;
}
}
public
static
List
<
Map
.
Entry
>
getDockerContainers
(
ToscaTemplate
toscaTemplate
)
{
TopologyTemplate
topologyTemplate
=
toscaTemplate
.
getTopologyTemplate
();
Map
<
String
,
Object
>
nodeTemplates
=
topologyTemplate
.
getNodeTemplates
();
Iterator
it
=
nodeTemplates
.
entrySet
().
iterator
();
List
<
Map
.
Entry
>
dockerContainers
=
new
ArrayList
<>();
while
(
it
.
hasNext
())
{
Map
.
Entry
node
=
(
Map
.
Entry
)
it
.
next
();
Map
<
String
,
Object
>
nodeValue
=
(
Map
<
String
,
Object
>)
node
.
getValue
();
String
type
=
(
String
)
nodeValue
.
get
(
"type"
);
if
(
type
.
equals
(
"tosca.nodes.ARTICONF.Container.Application.Docker"
))
{
dockerContainers
.
add
(
node
);
}
}
return
dockerContainers
;
}
public
static
List
<
Map
<
String
,
Object
>>
tosca2KubernetesDeployment
(
ToscaTemplate
toscaTemplate
)
{
List
<
Map
.
Entry
>
dockerContainers
=
getDockerContainers
(
toscaTemplate
);
List
<
Map
<
String
,
Object
>>
deployments
=
new
ArrayList
<>();
Iterator
<
Map
.
Entry
>
dicIt
=
dockerContainers
.
iterator
();
while
(
dicIt
.
hasNext
())
{
Map
.
Entry
docker
=
dicIt
.
next
();
String
name
=
(
String
)
docker
.
getKey
();
Map
<
String
,
Object
>
labels
=
new
HashMap
();
labels
.
put
(
"app"
,
name
);
Map
<
String
,
Object
>
metadata
=
new
HashMap
();
metadata
.
put
(
"labels"
,
labels
);
metadata
.
put
(
"name"
,
name
);
Map
<
String
,
Object
>
selector
=
new
HashMap
();
selector
.
put
(
"matchLabels"
,
labels
);
Map
<
String
,
Object
>
template
=
new
HashMap
();
template
.
put
(
"metadata"
,
metadata
);
Map
<
String
,
Object
>
dockerValues
=
(
Map
<
String
,
Object
>)
docker
.
getValue
();
List
<
Map
<
String
,
Object
>>
containersList
=
createContainerList
(
dockerValues
,
name
);
Map
<
String
,
Object
>
spec1
=
new
HashMap
();
spec1
.
put
(
"containers"
,
containersList
);
template
.
put
(
"spec"
,
spec1
);
Map
<
String
,
Object
>
topSpec
=
new
HashMap
();
topSpec
.
put
(
"selector"
,
selector
);
topSpec
.
put
(
"replicas"
,
1
);
topSpec
.
put
(
"template"
,
template
);
Map
<
String
,
Object
>
deployment
=
new
HashMap
();
deployment
.
put
(
"spec"
,
topSpec
);
deployment
.
put
(
"metadata"
,
metadata
);
deployment
.
put
(
"kind"
,
"Deployment"
);
deployment
.
put
(
"apiVersion"
,
"apps/v1"
);
deployments
.
add
(
deployment
);
}
return
deployments
;
}
public
static
List
<
Map
<
String
,
Object
>>
tosca2KubernetesService
(
ToscaTemplate
toscaTemplate
)
{
List
<
Map
.
Entry
>
dockerContainers
=
getDockerContainers
(
toscaTemplate
);
List
<
Map
<
String
,
Object
>>
services
=
new
ArrayList
<>();
Iterator
<
Map
.
Entry
>
dicIt
=
dockerContainers
.
iterator
();
while
(
dicIt
.
hasNext
())
{
Map
.
Entry
docker
=
dicIt
.
next
();
String
name
=
(
String
)
docker
.
getKey
();
Map
<
String
,
Object
>
dockerValues
=
(
Map
<
String
,
Object
>)
docker
.
getValue
();
Map
<
String
,
Object
>
spec
=
new
HashMap
();
spec
.
put
(
"type"
,
"NodePort"
);
Map
<
String
,
Object
>
properties
=
(
Map
<
String
,
Object
>)
dockerValues
.
get
(
"properties"
);
List
<
String
>
toscaPortsList
=
(
List
<
String
>)
properties
.
get
(
"ports"
);
List
<
Map
<
String
,
Object
>>
portList
=
new
ArrayList
<>();
if
(
toscaPortsList
!=
null
)
{
for
(
String
portEntry
:
toscaPortsList
)
{
String
[]
portsArray
=
portEntry
.
split
(
":"
);
Map
<
String
,
Object
>
portMap
=
new
HashMap
();
portMap
.
put
(
"port"
,
Integer
.
valueOf
(
portsArray
[
1
]));
portList
.
add
(
portMap
);
}
spec
.
put
(
"ports"
,
portList
);
}
Map
<
String
,
Object
>
selector
=
new
HashMap
();
selector
.
put
(
"app"
,
name
);
spec
.
put
(
"selector"
,
selector
);
Map
<
String
,
Object
>
labels
=
new
HashMap
();
labels
.
put
(
"app"
,
name
);
Map
<
String
,
Object
>
metadata
=
new
HashMap
();
metadata
.
put
(
"labels"
,
labels
);
metadata
.
put
(
"name"
,
name
);
Map
<
String
,
Object
>
service
=
new
HashMap
();
service
.
put
(
"spec"
,
spec
);
service
.
put
(
"metadata"
,
metadata
);
service
.
put
(
"kind"
,
"Service"
);
service
.
put
(
"apiVersion"
,
"v1"
);
services
.
add
(
service
);
}
return
services
;
}
private
static
List
<
Map
<
String
,
Object
>>
getImageEnvirmoent
(
Map
<
String
,
Object
>
properties
)
{
private
static
List
<
Map
<
String
,
Object
>>
getImageEnvirmoent
(
Map
<
String
,
Object
>
properties
)
{
Map
<
String
,
Object
>
envMap
=
(
Map
<
String
,
Object
>)
properties
.
get
(
"environment"
);
Map
<
String
,
Object
>
envMap
=
(
Map
<
String
,
Object
>)
properties
.
get
(
"environment"
);
...
@@ -231,54 +124,23 @@ public class TOSCAUtils {
...
@@ -231,54 +124,23 @@ public class TOSCAUtils {
return
imageFile
;
return
imageFile
;
}
}
private
static
List
<
Map
<
String
,
Object
>>
createContainerList
(
Map
<
String
,
Object
>
dockerValues
,
String
name
)
{
public
static
List
<
Map
<
String
,
NodeTemplate
>>
getRelatedNodes
(
NodeTemplate
node
,
ToscaTemplate
toscaTemplate
)
{
Map
<
String
,
Object
>
properties
=
(
Map
<
String
,
Object
>)
dockerValues
.
get
(
"properties"
);
List
<
Map
<
String
,
Object
>>
imageEnv
=
getImageEnvirmoent
(
properties
);
String
imageFile
=
getImageFile
(
dockerValues
);
Map
<
String
,
Object
>
container
=
new
HashMap
();
container
.
put
(
"image"
,
imageFile
);
container
.
put
(
"name"
,
name
);
container
.
put
(
"env"
,
imageEnv
);
List
<
String
>
toscaPortsList
=
(
List
<
String
>)
properties
.
get
(
"ports"
);
if
(
toscaPortsList
!=
null
)
{
List
<
Map
<
String
,
Object
>>
portList
=
new
ArrayList
<>();
for
(
String
portEntry
:
toscaPortsList
)
{
String
[]
portsArray
=
portEntry
.
split
(
":"
);
Map
<
String
,
Object
>
portMap
=
new
HashMap
();
portMap
.
put
(
"containerPort"
,
Integer
.
valueOf
(
portsArray
[
0
]));
portList
.
add
(
portMap
);
}
container
.
put
(
"ports"
,
portList
);
}
List
<
Map
<
String
,
Object
>>
containersList
=
new
ArrayList
<>();
containersList
.
add
(
container
);
return
containersList
;
}
public
static
List
<
Map
.
Entry
>
getRelatedNodes
(
Map
<
String
,
Object
>
node
,
ToscaTemplate
toscaTemplate
)
{
String
nodeName
=
node
.
keySet
().
iterator
().
next
();
Map
<
String
,
Object
>
nodeMap
=
(
Map
<
String
,
Object
>)
node
.
get
(
nodeName
);
if
(
node
Map
.
containsKey
(
"requirements"
)
)
{
if
(
node
.
getRequirements
()
!=
null
)
{
List
<
String
>
nodeNames
=
new
ArrayList
<>();
List
<
String
>
nodeNames
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
requirements
=
(
List
<
Map
<
String
,
Object
>>)
nodeMap
.
get
(
"requirements"
);
List
<
Map
<
String
,
Object
>>
requirements
=
node
.
getRequirements
(
);
for
(
Map
<
String
,
Object
>
requirement
:
requirements
)
{
for
(
Map
<
String
,
Object
>
requirement
:
requirements
)
{
String
reqName
=
requirement
.
keySet
().
iterator
().
next
();
String
reqName
=
requirement
.
keySet
().
iterator
().
next
();
Map
<
String
,
Object
>
requirementMap
=
(
Map
<
String
,
Object
>)
requirement
.
get
(
reqName
);
Map
<
String
,
Object
>
requirementMap
=
(
Map
<
String
,
Object
>)
requirement
.
get
(
reqName
);
// String requirementCapability = (String) requirementMap.get("capability");
String
relatedNode
=
(
String
)
requirementMap
.
get
(
"node"
);
String
relatedNode
=
(
String
)
requirementMap
.
get
(
"node"
);
nodeNames
.
add
(
relatedNode
);
nodeNames
.
add
(
relatedNode
);
}
}
List
<
Map
.
Entry
>
retaltedNodes
=
new
ArrayList
<>();
List
<
Map
<
String
,
NodeTemplate
>
>
retaltedNodes
=
new
ArrayList
<>();
for
(
String
name
:
nodeNames
)
{
for
(
String
name
:
nodeNames
)
{
List
<
Map
.
Entry
>
relatedNode
=
getNodesByName
(
toscaTemplate
,
name
);
List
<
Map
<
String
,
NodeTemplate
>
>
relatedNode
=
getNodesByName
(
toscaTemplate
,
name
);
for
(
Map
.
Entry
rNode
:
relatedNode
)
{
for
(
Map
<
String
,
NodeTemplate
>
rNode
:
relatedNode
)
{
retaltedNodes
.
add
(
rNode
);
retaltedNodes
.
add
(
rNode
);
}
}
}
}
return
retaltedNodes
;
return
retaltedNodes
;
}
}
...
@@ -286,28 +148,22 @@ public class TOSCAUtils {
...
@@ -286,28 +148,22 @@ public class TOSCAUtils {
}
}
private
static
List
<
Map
.
Entry
>
getNodesByName
(
ToscaTemplate
toscaTemplate
,
String
name
)
{
private
static
List
<
Map
<
String
,
NodeTemplate
>
>
getNodesByName
(
ToscaTemplate
toscaTemplate
,
String
name
)
{
return
getNodes
(
toscaTemplate
,
"name"
,
name
);
return
getNodes
(
toscaTemplate
,
"name"
,
name
);
}
}
public
static
boolean
nodeIsOfType
(
Map
.
Entry
node
,
String
type
)
{
public
static
boolean
nodeIsOfType
(
NodeTemplate
node
,
String
type
)
{
String
nodeName
=
(
String
)
node
.
getKey
();
if
(
node
.
getType
().
equals
(
type
))
{
Map
<
String
,
Object
>
nodeMap
=
(
Map
<
String
,
Object
>)
node
.
getValue
();
if
(
nodeMap
.
containsKey
(
"type"
)
&&
nodeMap
.
get
(
"type"
).
equals
(
type
))
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
}
public
static
Object
getNodeProperty
(
Map
.
Entry
node
,
String
propertyName
)
{
public
static
Object
getNodeProperty
(
NodeTemplate
node
,
String
propertyName
)
{
Map
<
String
,
Object
>
nodeMap
=
(
Map
<
String
,
Object
>)
node
.
getValue
();
if
(
node
.
getProperties
()
!=
null
)
{
if
(
nodeMap
.
containsKey
(
"properties"
)
)
{
return
node
.
getProperties
().
get
(
propertyName
);
Map
<
String
,
Object
>
properties
=
(
Map
<
String
,
Object
>)
nodeMap
.
get
(
"properties"
);
}
return
properties
.
get
(
propertyName
);
}
return
null
;
return
null
;
}
}
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/Credentials.java
View file @
4053fc74
package
nl
.
uva
.
sne
.
drip
.
model
;
package
nl
.
uva
.
sne
.
drip
.
model
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude.Include
;
import
java.util.Objects
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -10,226 +7,208 @@ import java.util.HashMap;
...
@@ -10,226 +7,208 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
org.springframework.data.annotation.Id
;
/**
/**
* Credentials
* Credentials
*/
*/
@Validated
@Validated
@JsonInclude
(
Include
.
NON_NULL
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-25T14:09:25.182Z"
)
public
class
Credentials
{
@Id
public
class
Credentials
{
@JsonIgnore
@JsonProperty
(
"protocol"
)
private
String
id
;
private
String
protocol
=
null
;
@JsonProperty
(
"protocol
"
)
@JsonProperty
(
"token_type
"
)
private
String
protocol
=
null
;
private
String
tokenType
=
null
;
@JsonProperty
(
"token_type
"
)
@JsonProperty
(
"token
"
)
private
String
tokenType
=
null
;
private
String
token
=
null
;
@JsonProperty
(
"token"
)
@JsonProperty
(
"keys"
)
private
String
token
=
null
;
@Valid
private
Map
<
String
,
String
>
keys
=
null
;
@JsonProperty
(
"keys"
)
@JsonProperty
(
"user"
)
@Valid
private
String
user
=
null
;
private
Map
<
String
,
String
>
keys
=
null
;
@JsonProperty
(
"user
"
)
@JsonProperty
(
"cloud_provider_name
"
)
private
String
user
=
null
;
private
String
cloudProviderName
=
null
;
@JsonProperty
(
"cloud_provider_name"
)
public
Credentials
protocol
(
String
protocol
)
{
private
String
cloudProviderName
=
null
;
this
.
protocol
=
protocol
;
return
this
;
}
public
Credentials
protocol
(
String
protocol
)
{
/**
this
.
protocol
=
protocol
;
* Get protocol
return
this
;
* @return protocol
}
**/
@ApiModelProperty
(
value
=
""
)
@JsonIgnore
public
String
getId
()
{
return
id
;
}
public
void
setID
(
String
id
)
{
this
.
id
=
id
;
}
/**
* Get protocol
*
* @return protocol
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getProtocol
()
{
return
protocol
;
}
public
void
setProtocol
(
String
protocol
)
{
this
.
protocol
=
protocol
;
}
public
Credentials
tokenType
(
String
tokenType
)
{
this
.
tokenType
=
tokenType
;
return
this
;
}
/**
* Get tokenType
*
* @return tokenType
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getTokenType
()
{
public
String
getProtocol
()
{
return
tokenType
;
return
protocol
;
}
}
public
void
setTokenType
(
String
tokenType
)
{
public
void
setProtocol
(
String
protocol
)
{
this
.
tokenType
=
tokenType
;
this
.
protocol
=
protocol
;
}
}
public
Credentials
token
(
String
token
)
{
public
Credentials
tokenType
(
String
tokenType
)
{
this
.
token
=
token
;
this
.
tokenType
=
tokenType
;
return
this
;
return
this
;
}
}
/**
/**
* Get token
* Get tokenType
*
* @return tokenType
* @return token
**/
*
@ApiModelProperty
(
value
=
""
)
*/
@ApiModelProperty
(
value
=
""
)
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
public
String
getTokenType
(
)
{
this
.
token
=
token
;
return
tokenType
;
}
}
public
Credentials
keys
(
Map
<
String
,
String
>
keys
)
{
public
void
setTokenType
(
String
tokenType
)
{
this
.
keys
=
keys
;
this
.
tokenType
=
tokenType
;
return
this
;
}
}
public
Credentials
putKeysItem
(
String
key
,
String
keysItem
)
{
public
Credentials
token
(
String
token
)
{
if
(
this
.
keys
==
null
)
{
this
.
token
=
token
;
this
.
keys
=
new
HashMap
<
String
,
String
>();
return
this
;
}
}
this
.
keys
.
put
(
key
,
keysItem
);
return
this
;
}
/**
/**
* Get keys
* Get token
*
* @return token
* @return keys
**/
*
@ApiModelProperty
(
value
=
""
)
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
String
>
getKeys
()
{
return
keys
;
}
public
void
setKeys
(
Map
<
String
,
String
>
keys
)
{
public
String
getToken
(
)
{
this
.
keys
=
keys
;
return
token
;
}
}
public
Credentials
user
(
String
user
)
{
public
void
setToken
(
String
token
)
{
this
.
user
=
user
;
this
.
token
=
token
;
return
this
;
}
}
public
Credentials
keys
(
Map
<
String
,
String
>
keys
)
{
/**
this
.
keys
=
keys
;
* Get user
return
this
;
*
}
* @return user
*
public
Credentials
putKeysItem
(
String
key
,
String
keysItem
)
{
*/
if
(
this
.
keys
==
null
)
{
@ApiModelProperty
(
value
=
""
)
this
.
keys
=
new
HashMap
<
String
,
String
>();
}
public
String
getUser
()
{
this
.
keys
.
put
(
key
,
keysItem
);
return
user
;
return
this
;
}
}
public
void
setUser
(
String
user
)
{
/**
this
.
user
=
user
;
* Get keys
}
* @return keys
**/
public
Credentials
cloudProviderName
(
String
cloudProviderName
)
{
@ApiModelProperty
(
value
=
""
)
this
.
cloudProviderName
=
cloudProviderName
;
return
this
;
}
public
Map
<
String
,
String
>
getKeys
()
{
return
keys
;
/**
}
* Get cloudProviderName
*
public
void
setKeys
(
Map
<
String
,
String
>
keys
)
{
* @return cloudProviderName
this
.
keys
=
keys
;
*
}
*/
@ApiModelProperty
(
value
=
""
)
public
Credentials
user
(
String
user
)
{
this
.
user
=
user
;
public
String
getCloudProviderName
()
{
return
this
;
return
cloudProviderName
;
}
}
/**
public
void
setCloudProviderName
(
String
cloudProviderName
)
{
* Get user
this
.
cloudProviderName
=
cloudProviderName
;
* @return user
}
**/
@ApiModelProperty
(
value
=
""
)
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
public
String
getUser
()
{
return
true
;
return
user
;
}
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
public
void
setUser
(
String
user
)
{
}
this
.
user
=
user
;
Credentials
credentials
=
(
Credentials
)
o
;
}
return
Objects
.
equals
(
this
.
protocol
,
credentials
.
protocol
)
&&
Objects
.
equals
(
this
.
tokenType
,
credentials
.
tokenType
)
public
Credentials
cloudProviderName
(
String
cloudProviderName
)
{
&&
Objects
.
equals
(
this
.
token
,
credentials
.
token
)
this
.
cloudProviderName
=
cloudProviderName
;
&&
Objects
.
equals
(
this
.
keys
,
credentials
.
keys
)
return
this
;
&&
Objects
.
equals
(
this
.
user
,
credentials
.
user
)
}
&&
Objects
.
equals
(
this
.
cloudProviderName
,
credentials
.
cloudProviderName
);
}
/**
* Get cloudProviderName
@Override
* @return cloudProviderName
public
int
hashCode
()
{
**/
return
Objects
.
hash
(
protocol
,
tokenType
,
token
,
keys
,
user
,
cloudProviderName
);
@ApiModelProperty
(
value
=
""
)
}
@Override
public
String
getCloudProviderName
()
{
public
String
toString
()
{
return
cloudProviderName
;
StringBuilder
sb
=
new
StringBuilder
();
}
sb
.
append
(
"class Credentials {\n"
);
public
void
setCloudProviderName
(
String
cloudProviderName
)
{
sb
.
append
(
" protocol: "
).
append
(
toIndentedString
(
protocol
)).
append
(
"\n"
);
this
.
cloudProviderName
=
cloudProviderName
;
sb
.
append
(
" tokenType: "
).
append
(
toIndentedString
(
tokenType
)).
append
(
"\n"
);
}
sb
.
append
(
" token: "
).
append
(
toIndentedString
(
token
)).
append
(
"\n"
);
sb
.
append
(
" keys: "
).
append
(
toIndentedString
(
keys
)).
append
(
"\n"
);
sb
.
append
(
" user: "
).
append
(
toIndentedString
(
user
)).
append
(
"\n"
);
@Override
sb
.
append
(
" cloudProviderName: "
).
append
(
toIndentedString
(
cloudProviderName
)).
append
(
"\n"
);
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
sb
.
append
(
"}"
);
if
(
this
==
o
)
{
return
sb
.
toString
();
return
true
;
}
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
/**
return
false
;
* Convert the given object to string with each line indented by 4 spaces
}
* (except the first line).
Credentials
credentials
=
(
Credentials
)
o
;
*/
return
Objects
.
equals
(
this
.
protocol
,
credentials
.
protocol
)
&&
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
Objects
.
equals
(
this
.
tokenType
,
credentials
.
tokenType
)
&&
if
(
o
==
null
)
{
Objects
.
equals
(
this
.
token
,
credentials
.
token
)
&&
return
"null"
;
Objects
.
equals
(
this
.
keys
,
credentials
.
keys
)
&&
}
Objects
.
equals
(
this
.
user
,
credentials
.
user
)
&&
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
Objects
.
equals
(
this
.
cloudProviderName
,
credentials
.
cloudProviderName
);
}
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
protocol
,
tokenType
,
token
,
keys
,
user
,
cloudProviderName
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class Credentials {\n"
);
sb
.
append
(
" protocol: "
).
append
(
toIndentedString
(
protocol
)).
append
(
"\n"
);
sb
.
append
(
" tokenType: "
).
append
(
toIndentedString
(
tokenType
)).
append
(
"\n"
);
sb
.
append
(
" token: "
).
append
(
toIndentedString
(
token
)).
append
(
"\n"
);
sb
.
append
(
" keys: "
).
append
(
toIndentedString
(
keys
)).
append
(
"\n"
);
sb
.
append
(
" user: "
).
append
(
toIndentedString
(
user
)).
append
(
"\n"
);
sb
.
append
(
" cloudProviderName: "
).
append
(
toIndentedString
(
cloudProviderName
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
return
"null"
;
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/NodeTemplate.java
View file @
4053fc74
package
nl
.
uva
.
sne
.
drip
.
model
;
package
nl
.
uva
.
sne
.
drip
.
model
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude.Include
;
import
java.util.Objects
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -16,7 +14,8 @@ import javax.validation.Valid;
...
@@ -16,7 +14,8 @@ import javax.validation.Valid;
* NodeTemplate
* NodeTemplate
*/
*/
@Validated
@Validated
@JsonInclude
(
Include
.
NON_NULL
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-25T14:09:25.182Z"
)
public
class
NodeTemplate
{
public
class
NodeTemplate
{
@JsonProperty
(
"name"
)
@JsonProperty
(
"name"
)
private
String
name
=
null
;
private
String
name
=
null
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/model/TopologyTemplate.java
View file @
4053fc74
package
nl
.
uva
.
sne
.
drip
.
model
;
package
nl
.
uva
.
sne
.
drip
.
model
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude.Include
;
import
java.util.Objects
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -16,7 +14,8 @@ import javax.validation.Valid;
...
@@ -16,7 +14,8 @@ import javax.validation.Valid;
* TopologyTemplate
* TopologyTemplate
*/
*/
@Validated
@Validated
@JsonInclude
(
Include
.
NON_NULL
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-25T14:47:27.096Z"
)
public
class
TopologyTemplate
{
public
class
TopologyTemplate
{
@JsonProperty
(
"description"
)
@JsonProperty
(
"description"
)
private
String
description
=
null
;
private
String
description
=
null
;
...
@@ -35,7 +34,7 @@ public class TopologyTemplate {
...
@@ -35,7 +34,7 @@ public class TopologyTemplate {
@JsonProperty
(
"node_templates"
)
@JsonProperty
(
"node_templates"
)
@Valid
@Valid
private
Map
<
String
,
Object
>
nodeTemplates
=
null
;
private
Map
<
String
,
NodeTemplate
>
nodeTemplates
=
null
;
@JsonProperty
(
"relationship_templates"
)
@JsonProperty
(
"relationship_templates"
)
@Valid
@Valid
...
@@ -156,14 +155,14 @@ public class TopologyTemplate {
...
@@ -156,14 +155,14 @@ public class TopologyTemplate {
this
.
outputs
=
outputs
;
this
.
outputs
=
outputs
;
}
}
public
TopologyTemplate
nodeTemplates
(
Map
<
String
,
Object
>
nodeTemplates
)
{
public
TopologyTemplate
nodeTemplates
(
Map
<
String
,
NodeTemplate
>
nodeTemplates
)
{
this
.
nodeTemplates
=
nodeTemplates
;
this
.
nodeTemplates
=
nodeTemplates
;
return
this
;
return
this
;
}
}
public
TopologyTemplate
putNodeTemplatesItem
(
String
key
,
Object
nodeTemplatesItem
)
{
public
TopologyTemplate
putNodeTemplatesItem
(
String
key
,
NodeTemplate
nodeTemplatesItem
)
{
if
(
this
.
nodeTemplates
==
null
)
{
if
(
this
.
nodeTemplates
==
null
)
{
this
.
nodeTemplates
=
new
HashMap
<
String
,
Object
>();
this
.
nodeTemplates
=
new
HashMap
<
String
,
NodeTemplate
>();
}
}
this
.
nodeTemplates
.
put
(
key
,
nodeTemplatesItem
);
this
.
nodeTemplates
.
put
(
key
,
nodeTemplatesItem
);
return
this
;
return
this
;
...
@@ -175,12 +174,13 @@ public class TopologyTemplate {
...
@@ -175,12 +174,13 @@ public class TopologyTemplate {
**/
**/
@ApiModelProperty
(
value
=
""
)
@ApiModelProperty
(
value
=
""
)
@Valid
public
Map
<
String
,
Object
>
getNodeTemplates
()
{
public
Map
<
String
,
NodeTemplate
>
getNodeTemplates
()
{
return
nodeTemplates
;
return
nodeTemplates
;
}
}
public
void
setNodeTemplates
(
Map
<
String
,
Object
>
nodeTemplates
)
{
public
void
setNodeTemplates
(
Map
<
String
,
NodeTemplate
>
nodeTemplates
)
{
this
.
nodeTemplates
=
nodeTemplates
;
this
.
nodeTemplates
=
nodeTemplates
;
}
}
...
...
drip-commons/src/main/java/nl/uva/sne/drip/model/ToscaTemplate.java
View file @
4053fc74
...
@@ -2,9 +2,6 @@ package nl.uva.sne.drip.model;
...
@@ -2,9 +2,6 @@ package nl.uva.sne.drip.model;
import
java.util.Objects
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude.Include
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -12,642 +9,609 @@ import java.util.List;
...
@@ -12,642 +9,609 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
org.springframework.data.annotation.Id
;
/**
/**
* ToscaTemplate
* ToscaTemplate
*/
*/
@Validated
@Validated
@
JsonInclude
(
Include
.
NON_NULL
)
@
javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-25T14:09:25.182Z"
)
public
class
ToscaTemplate
{
public
class
ToscaTemplate
{
@JsonProperty
(
"tosca_definitions_version"
)
private
String
toscaDefinitionsVersion
=
null
;
@Id
@JsonProperty
(
"tosca_default_namespace"
)
@JsonIgnore
private
String
toscaDefaultNamespace
=
null
;
private
String
id
;
@JsonProperty
(
"tosca_definitions_version
"
)
@JsonProperty
(
"template_name
"
)
private
String
toscaDefinitionsVersion
=
null
;
private
String
templateName
=
null
;
@JsonProperty
(
"tosca_default_namespace"
)
@JsonProperty
(
"imports"
)
private
String
toscaDefaultNamespace
=
null
;
@Valid
private
List
<
Map
<
String
,
String
>>
imports
=
null
;
@JsonProperty
(
"template_name"
)
@JsonProperty
(
"repositories"
)
private
String
templateName
=
null
;
@Valid
private
Map
<
String
,
String
>
repositories
=
null
;
@JsonProperty
(
"import
s"
)
@JsonProperty
(
"dsl_definition
s"
)
@Valid
@Valid
private
List
<
Map
<
String
,
String
>>
import
s
=
null
;
private
Map
<
String
,
String
>
dslDefinition
s
=
null
;
@JsonProperty
(
"repositori
es"
)
@JsonProperty
(
"node_typ
es"
)
@Valid
@Valid
private
Map
<
String
,
String
>
repositori
es
=
null
;
private
Map
<
String
,
Object
>
nodeTyp
es
=
null
;
@JsonProperty
(
"dsl_definitions"
)
@JsonProperty
(
"topology_template"
)
@Valid
private
TopologyTemplate
topologyTemplate
=
null
;
private
Map
<
String
,
String
>
dslDefinitions
=
null
;
@JsonProperty
(
"node
_types"
)
@JsonProperty
(
"relationship
_types"
)
@Valid
@Valid
private
Map
<
String
,
Object
>
node
Types
=
null
;
private
Map
<
String
,
Object
>
relationship
Types
=
null
;
@JsonProperty
(
"topology_template"
)
@JsonProperty
(
"relationship_templates"
)
private
TopologyTemplate
topologyTemplate
=
null
;
@Valid
private
Map
<
String
,
Object
>
relationshipTemplates
=
null
;
@JsonProperty
(
"relationship
_types"
)
@JsonProperty
(
"capability
_types"
)
@Valid
@Valid
private
Map
<
String
,
Object
>
relationship
Types
=
null
;
private
Map
<
String
,
Object
>
capability
Types
=
null
;
@JsonProperty
(
"relationship_templat
es"
)
@JsonProperty
(
"artifact_typ
es"
)
@Valid
@Valid
private
Map
<
String
,
Object
>
relationshipTemplat
es
=
null
;
private
Map
<
String
,
Object
>
artifactTyp
es
=
null
;
@JsonProperty
(
"capability
_types"
)
@JsonProperty
(
"data
_types"
)
@Valid
@Valid
private
Map
<
String
,
Object
>
capability
Types
=
null
;
private
Map
<
String
,
Object
>
data
Types
=
null
;
@JsonProperty
(
"artifact
_types"
)
@JsonProperty
(
"interface
_types"
)
@Valid
@Valid
private
Map
<
String
,
Object
>
artifact
Types
=
null
;
private
Map
<
String
,
Object
>
interface
Types
=
null
;
@JsonProperty
(
"data
_types"
)
@JsonProperty
(
"policy
_types"
)
@Valid
@Valid
private
Map
<
String
,
Object
>
data
Types
=
null
;
private
Map
<
String
,
String
>
policy
Types
=
null
;
@JsonProperty
(
"interface
_types"
)
@JsonProperty
(
"group
_types"
)
@Valid
@Valid
private
Map
<
String
,
Object
>
interface
Types
=
null
;
private
Map
<
String
,
Object
>
group
Types
=
null
;
@JsonProperty
(
"policy_types"
)
@JsonProperty
(
"description"
)
@Valid
private
String
description
=
null
;
private
Map
<
String
,
String
>
policyTypes
=
null
;
@JsonProperty
(
"group_types"
)
@JsonProperty
(
"template_author"
)
@Valid
private
String
templateAuthor
=
null
;
private
Map
<
String
,
Object
>
groupTypes
=
null
;
@JsonProperty
(
"description"
)
public
ToscaTemplate
toscaDefinitionsVersion
(
String
toscaDefinitionsVersion
)
{
private
String
description
=
null
;
this
.
toscaDefinitionsVersion
=
toscaDefinitionsVersion
;
return
this
;
}
@JsonProperty
(
"template_author"
)
/**
private
String
templateAuthor
=
null
;
* Get toscaDefinitionsVersion
* @return toscaDefinitionsVersion
**/
@ApiModelProperty
(
value
=
""
)
public
ToscaTemplate
toscaDefinitionsVersion
(
String
toscaDefinitionsVersion
)
{
this
.
toscaDefinitionsVersion
=
toscaDefinitionsVersion
;
return
this
;
}
@JsonIgnore
public
String
getId
()
{
return
id
;
}
public
void
setID
(
String
id
)
{
this
.
id
=
id
;
}
/**
* Get toscaDefinitionsVersion
*
* @return toscaDefinitionsVersion
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getToscaDefinitionsVersion
()
{
return
toscaDefinitionsVersion
;
}
public
void
setToscaDefinitionsVersion
(
String
toscaDefinitionsVersion
)
{
this
.
toscaDefinitionsVersion
=
toscaDefinitionsVersion
;
}
public
ToscaTemplate
toscaDefaultNamespace
(
String
toscaDefaultNamespace
)
{
this
.
toscaDefaultNamespace
=
toscaDefaultNamespace
;
return
this
;
}
/**
* Get toscaDefaultNamespace
*
* @return toscaDefaultNamespace
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getToscaDefaultNamespace
()
{
return
toscaDefaultNamespace
;
}
public
void
setToscaDefaultNamespace
(
String
toscaDefaultNamespace
)
{
this
.
toscaDefaultNamespace
=
toscaDefaultNamespace
;
}
public
ToscaTemplate
templateName
(
String
templateName
)
{
this
.
templateName
=
templateName
;
return
this
;
}
/**
* Get templateName
*
* @return templateName
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getTemplateName
()
{
return
templateName
;
}
public
void
setTemplateName
(
String
templateName
)
{
this
.
templateName
=
templateName
;
}
public
ToscaTemplate
imports
(
List
<
Map
<
String
,
String
>>
imports
)
{
this
.
imports
=
imports
;
return
this
;
}
public
ToscaTemplate
addImportsItem
(
Map
<
String
,
String
>
importsItem
)
{
if
(
this
.
imports
==
null
)
{
this
.
imports
=
new
ArrayList
<>();
}
this
.
imports
.
add
(
importsItem
);
return
this
;
}
/**
* Get imports
*
* @return imports
*
*/
@ApiModelProperty
(
value
=
""
)
@Valid
public
List
<
Map
<
String
,
String
>>
getImports
()
{
return
imports
;
}
public
void
setImports
(
List
<
Map
<
String
,
String
>>
imports
)
{
this
.
imports
=
imports
;
}
public
ToscaTemplate
repositories
(
Map
<
String
,
String
>
repositories
)
{
this
.
repositories
=
repositories
;
return
this
;
}
public
ToscaTemplate
putRepositoriesItem
(
String
key
,
String
repositoriesItem
)
{
if
(
this
.
repositories
==
null
)
{
this
.
repositories
=
new
HashMap
<>();
}
this
.
repositories
.
put
(
key
,
repositoriesItem
);
return
this
;
}
/**
* Get repositories
*
* @return repositories
*
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
String
>
getRepositories
()
{
return
repositories
;
}
public
void
setRepositories
(
Map
<
String
,
String
>
repositories
)
{
this
.
repositories
=
repositories
;
}
public
ToscaTemplate
dslDefinitions
(
Map
<
String
,
String
>
dslDefinitions
)
{
this
.
dslDefinitions
=
dslDefinitions
;
return
this
;
}
public
ToscaTemplate
putDslDefinitionsItem
(
String
key
,
String
dslDefinitionsItem
)
{
if
(
this
.
dslDefinitions
==
null
)
{
this
.
dslDefinitions
=
new
HashMap
<>();
}
this
.
dslDefinitions
.
put
(
key
,
dslDefinitionsItem
);
return
this
;
}
/**
public
String
getToscaDefinitionsVersion
()
{
* Get dslDefinitions
return
toscaDefinitionsVersion
;
*
}
* @return dslDefinitions
*
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
String
>
getDslDefinitions
(
)
{
public
void
setToscaDefinitionsVersion
(
String
toscaDefinitionsVersion
)
{
return
dslDefinitions
;
this
.
toscaDefinitionsVersion
=
toscaDefinitionsVersion
;
}
}
public
void
setDslDefinitions
(
Map
<
String
,
String
>
dslDefinitions
)
{
public
ToscaTemplate
toscaDefaultNamespace
(
String
toscaDefaultNamespace
)
{
this
.
dslDefinitions
=
dslDefinitions
;
this
.
toscaDefaultNamespace
=
toscaDefaultNamespace
;
}
return
this
;
}
public
ToscaTemplate
nodeTypes
(
Map
<
String
,
Object
>
nodeTypes
)
{
/**
this
.
nodeTypes
=
nodeTypes
;
* Get toscaDefaultNamespace
return
this
;
* @return toscaDefaultNamespace
}
**/
@ApiModelProperty
(
value
=
""
)
public
ToscaTemplate
putNodeTypesItem
(
String
key
,
Object
nodeTypesItem
)
{
if
(
this
.
nodeTypes
==
null
)
{
this
.
nodeTypes
=
new
HashMap
<>();
}
this
.
nodeTypes
.
put
(
key
,
nodeTypesItem
);
return
this
;
}
/**
public
String
getToscaDefaultNamespace
()
{
* Get nodeTypes
return
toscaDefaultNamespace
;
*
}
* @return nodeTypes
*
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
Object
>
getNodeTypes
(
)
{
public
void
setToscaDefaultNamespace
(
String
toscaDefaultNamespace
)
{
return
nodeTypes
;
this
.
toscaDefaultNamespace
=
toscaDefaultNamespace
;
}
}
public
void
setNodeTypes
(
Map
<
String
,
Object
>
nodeTypes
)
{
public
ToscaTemplate
templateName
(
String
templateName
)
{
this
.
nodeTypes
=
nodeTypes
;
this
.
templateName
=
templateName
;
}
return
this
;
}
public
ToscaTemplate
topologyTemplate
(
TopologyTemplate
topologyTemplate
)
{
/**
this
.
topologyTemplate
=
topologyTemplate
;
* Get templateName
return
this
;
* @return templateName
}
**/
@ApiModelProperty
(
value
=
""
)
/**
* Get topologyTemplate
*
* @return topologyTemplate
*
*/
@ApiModelProperty
(
value
=
""
)
@Valid
public
String
getTemplateName
()
{
return
templateName
;
}
public
TopologyTemplate
getTopologyTemplate
(
)
{
public
void
setTemplateName
(
String
templateName
)
{
return
topologyTemplat
e
;
this
.
templateName
=
templateNam
e
;
}
}
public
void
setTopologyTemplate
(
TopologyTemplate
topologyTemplate
)
{
public
ToscaTemplate
imports
(
List
<
Map
<
String
,
String
>>
imports
)
{
this
.
topologyTemplate
=
topologyTemplate
;
this
.
imports
=
imports
;
}
return
this
;
}
public
ToscaTemplate
relationshipTypes
(
Map
<
String
,
Object
>
relationshipTypes
)
{
public
ToscaTemplate
addImportsItem
(
Map
<
String
,
String
>
importsItem
)
{
this
.
relationshipTypes
=
relationshipTypes
;
if
(
this
.
imports
==
null
)
{
return
this
;
this
.
imports
=
new
ArrayList
<
Map
<
String
,
String
>>()
;
}
}
this
.
imports
.
add
(
importsItem
);
return
this
;
}
public
ToscaTemplate
putRelationshipTypesItem
(
String
key
,
Object
relationshipTypesItem
)
{
/**
if
(
this
.
relationshipTypes
==
null
)
{
* Get imports
this
.
relationshipTypes
=
new
HashMap
<>();
* @return imports
}
**/
this
.
relationshipTypes
.
put
(
key
,
relationshipTypesItem
);
@ApiModelProperty
(
value
=
""
)
return
this
;
}
/**
@Valid
* Get relationshipTypes
*
* @return relationshipTypes
*
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
Object
>
getRelationshipType
s
()
{
public
List
<
Map
<
String
,
String
>>
getImport
s
()
{
return
relationshipType
s
;
return
import
s
;
}
}
public
void
setRelationshipTypes
(
Map
<
String
,
Object
>
relationshipType
s
)
{
public
void
setImports
(
List
<
Map
<
String
,
String
>>
import
s
)
{
this
.
relationshipTypes
=
relationshipType
s
;
this
.
imports
=
import
s
;
}
}
public
ToscaTemplate
relationshipTemplates
(
Map
<
String
,
Object
>
relationshipTemplat
es
)
{
public
ToscaTemplate
repositories
(
Map
<
String
,
String
>
repositori
es
)
{
this
.
relationshipTemplates
=
relationshipTemplat
es
;
this
.
repositories
=
repositori
es
;
return
this
;
return
this
;
}
}
public
ToscaTemplate
putRelationshipTemplatesItem
(
String
key
,
Object
relationshipTemplatesItem
)
{
public
ToscaTemplate
putRepositoriesItem
(
String
key
,
String
repositoriesItem
)
{
if
(
this
.
relationshipTemplates
==
null
)
{
if
(
this
.
repositories
==
null
)
{
this
.
relationshipTemplates
=
new
HashMap
<>();
this
.
repositories
=
new
HashMap
<>();
}
}
this
.
relationshipTemplates
.
put
(
key
,
relationshipTemplatesItem
);
this
.
repositories
.
put
(
key
,
repositoriesItem
);
return
this
;
return
this
;
}
}
/**
* Get repositories
* @return repositories
**/
@ApiModelProperty
(
value
=
""
)
/**
* Get relationshipTemplates
*
* @return relationshipTemplates
*
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
Object
>
getRelationshipTemplates
()
{
public
Map
<
String
,
String
>
getRepositories
()
{
return
relationshipTemplates
;
return
repositories
;
}
}
public
void
setRepositories
(
Map
<
String
,
String
>
repositories
)
{
this
.
repositories
=
repositories
;
}
public
ToscaTemplate
dslDefinitions
(
Map
<
String
,
String
>
dslDefinitions
)
{
this
.
dslDefinitions
=
dslDefinitions
;
return
this
;
}
public
void
setRelationshipTemplates
(
Map
<
String
,
Object
>
relationshipTemplates
)
{
public
ToscaTemplate
putDslDefinitionsItem
(
String
key
,
String
dslDefinitionsItem
)
{
this
.
relationshipTemplates
=
relationshipTemplates
;
if
(
this
.
dslDefinitions
==
null
)
{
}
this
.
dslDefinitions
=
new
HashMap
<
String
,
String
>();
}
this
.
dslDefinitions
.
put
(
key
,
dslDefinitionsItem
);
return
this
;
}
public
ToscaTemplate
capabilityTypes
(
Map
<
String
,
Object
>
capabilityTypes
)
{
/**
this
.
capabilityTypes
=
capabilityTypes
;
* Get dslDefinitions
return
this
;
* @return dslDefinitions
}
**/
@ApiModelProperty
(
value
=
""
)
public
ToscaTemplate
putCapabilityTypesItem
(
String
key
,
Object
capabilityTypesItem
)
{
if
(
this
.
capabilityTypes
==
null
)
{
this
.
capabilityTypes
=
new
HashMap
<>();
}
this
.
capabilityTypes
.
put
(
key
,
capabilityTypesItem
);
return
this
;
}
/**
public
Map
<
String
,
String
>
getDslDefinitions
()
{
* Get capabilityTypes
return
dslDefinitions
;
*
}
* @return capabilityTypes
*
public
void
setDslDefinitions
(
Map
<
String
,
String
>
dslDefinitions
)
{
*/
this
.
dslDefinitions
=
dslDefinitions
;
@ApiModelProperty
(
value
=
""
)
}
public
ToscaTemplate
nodeTypes
(
Map
<
String
,
Object
>
nodeTypes
)
{
this
.
nodeTypes
=
nodeTypes
;
return
this
;
}
public
Map
<
String
,
Object
>
getCapabilityTypes
()
{
public
ToscaTemplate
putNodeTypesItem
(
String
key
,
Object
nodeTypesItem
)
{
return
capabilityTypes
;
if
(
this
.
nodeTypes
==
null
)
{
}
this
.
nodeTypes
=
new
HashMap
<
String
,
Object
>();
}
this
.
nodeTypes
.
put
(
key
,
nodeTypesItem
);
return
this
;
}
/**
* Get nodeTypes
* @return nodeTypes
**/
@ApiModelProperty
(
value
=
""
)
public
void
setCapabilityTypes
(
Map
<
String
,
Object
>
capabilityTypes
)
{
this
.
capabilityTypes
=
capabilityTypes
;
}
public
ToscaTemplate
artifactTypes
(
Map
<
String
,
Object
>
artifactTypes
)
{
public
Map
<
String
,
Object
>
getNodeTypes
()
{
this
.
artifactTypes
=
artifactTypes
;
return
nodeTypes
;
return
this
;
}
}
public
ToscaTemplate
putArtifactTypesItem
(
String
key
,
Object
artifactTypesItem
)
{
public
void
setNodeTypes
(
Map
<
String
,
Object
>
nodeTypes
)
{
if
(
this
.
artifactTypes
==
null
)
{
this
.
nodeTypes
=
nodeTypes
;
this
.
artifactTypes
=
new
HashMap
<>();
}
}
this
.
artifactTypes
.
put
(
key
,
artifactTypesItem
);
return
this
;
}
/**
public
ToscaTemplate
topologyTemplate
(
TopologyTemplate
topologyTemplate
)
{
* Get artifactTypes
this
.
topologyTemplate
=
topologyTemplate
;
*
return
this
;
* @return artifactTypes
}
*
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
Object
>
getArtifactTypes
()
{
/**
return
artifactTypes
;
* Get topologyTemplate
}
* @return topologyTemplate
**/
@ApiModelProperty
(
value
=
""
)
public
void
setArtifactTypes
(
Map
<
String
,
Object
>
artifactTypes
)
{
@Valid
this
.
artifactTypes
=
artifactTypes
;
}
public
TopologyTemplate
getTopologyTemplate
()
{
return
topologyTemplate
;
}
public
void
setTopologyTemplate
(
TopologyTemplate
topologyTemplate
)
{
this
.
topologyTemplate
=
topologyTemplate
;
}
public
ToscaTemplate
dataTypes
(
Map
<
String
,
Object
>
data
Types
)
{
public
ToscaTemplate
relationshipTypes
(
Map
<
String
,
Object
>
relationship
Types
)
{
this
.
dataTypes
=
data
Types
;
this
.
relationshipTypes
=
relationship
Types
;
return
this
;
return
this
;
}
}
public
ToscaTemplate
putDataTypesItem
(
String
key
,
Object
dataTypesItem
)
{
public
ToscaTemplate
putRelationshipTypesItem
(
String
key
,
Object
relationshipTypesItem
)
{
if
(
this
.
dataTypes
==
null
)
{
if
(
this
.
relationshipTypes
==
null
)
{
this
.
dataTypes
=
new
HashMap
<>();
this
.
relationshipTypes
=
new
HashMap
<
String
,
Object
>();
}
this
.
dataTypes
.
put
(
key
,
dataTypesItem
);
return
this
;
}
}
this
.
relationshipTypes
.
put
(
key
,
relationshipTypesItem
);
return
this
;
}
/**
/**
* Get dataTypes
* Get relationshipTypes
*
* @return relationshipTypes
* @return dataTypes
**/
*
@ApiModelProperty
(
value
=
""
)
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
Object
>
getDataTypes
()
{
return
dataTypes
;
}
public
void
setDataTypes
(
Map
<
String
,
Object
>
dataTypes
)
{
public
Map
<
String
,
Object
>
getRelationshipTypes
()
{
this
.
dataTypes
=
dataTypes
;
return
relationshipTypes
;
}
}
public
void
setRelationshipTypes
(
Map
<
String
,
Object
>
relationshipTypes
)
{
this
.
relationshipTypes
=
relationshipTypes
;
}
public
ToscaTemplate
relationshipTemplates
(
Map
<
String
,
Object
>
relationshipTemplates
)
{
this
.
relationshipTemplates
=
relationshipTemplates
;
return
this
;
}
public
ToscaTemplate
interfaceTypes
(
Map
<
String
,
Object
>
interfaceTypes
)
{
public
ToscaTemplate
putRelationshipTemplatesItem
(
String
key
,
Object
relationshipTemplatesItem
)
{
this
.
interfaceTypes
=
interfaceTypes
;
if
(
this
.
relationshipTemplates
==
null
)
{
return
this
;
this
.
relationshipTemplates
=
new
HashMap
<
String
,
Object
>()
;
}
}
this
.
relationshipTemplates
.
put
(
key
,
relationshipTemplatesItem
);
return
this
;
}
public
ToscaTemplate
putInterfaceTypesItem
(
String
key
,
Object
interfaceTypesItem
)
{
/**
if
(
this
.
interfaceTypes
==
null
)
{
* Get relationshipTemplates
this
.
interfaceTypes
=
new
HashMap
<>();
* @return relationshipTemplates
}
**/
this
.
interfaceTypes
.
put
(
key
,
interfaceTypesItem
);
@ApiModelProperty
(
value
=
""
)
return
this
;
}
/**
* Get interfaceTypes
*
* @return interfaceTypes
*
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
Object
>
getInterfaceTypes
()
{
public
Map
<
String
,
Object
>
getRelationshipTemplates
()
{
return
interfaceTypes
;
return
relationshipTemplates
;
}
}
public
void
setRelationshipTemplates
(
Map
<
String
,
Object
>
relationshipTemplates
)
{
this
.
relationshipTemplates
=
relationshipTemplates
;
}
public
ToscaTemplate
capabilityTypes
(
Map
<
String
,
Object
>
capabilityTypes
)
{
this
.
capabilityTypes
=
capabilityTypes
;
return
this
;
}
public
void
setInterfaceTypes
(
Map
<
String
,
Object
>
interfaceTypes
)
{
public
ToscaTemplate
putCapabilityTypesItem
(
String
key
,
Object
capabilityTypesItem
)
{
this
.
interfaceTypes
=
interfaceTypes
;
if
(
this
.
capabilityTypes
==
null
)
{
this
.
capabilityTypes
=
new
HashMap
<
String
,
Object
>();
}
}
this
.
capabilityTypes
.
put
(
key
,
capabilityTypesItem
);
return
this
;
}
public
ToscaTemplate
policyTypes
(
Map
<
String
,
String
>
policyTypes
)
{
/**
this
.
policyTypes
=
policyTypes
;
* Get capabilityTypes
return
this
;
* @return capabilityTypes
}
**/
@ApiModelProperty
(
value
=
""
)
public
ToscaTemplate
putPolicyTypesItem
(
String
key
,
String
policyTypesItem
)
{
if
(
this
.
policyTypes
==
null
)
{
this
.
policyTypes
=
new
HashMap
<>();
}
this
.
policyTypes
.
put
(
key
,
policyTypesItem
);
return
this
;
}
/**
public
Map
<
String
,
Object
>
getCapabilityTypes
()
{
* Get policyTypes
return
capabilityTypes
;
*
}
* @return policyTypes
*
public
void
setCapabilityTypes
(
Map
<
String
,
Object
>
capabilityTypes
)
{
*/
this
.
capabilityTypes
=
capabilityTypes
;
@ApiModelProperty
(
value
=
""
)
}
public
ToscaTemplate
artifactTypes
(
Map
<
String
,
Object
>
artifactTypes
)
{
this
.
artifactTypes
=
artifactTypes
;
return
this
;
}
public
Map
<
String
,
String
>
getPolicyTypes
()
{
public
ToscaTemplate
putArtifactTypesItem
(
String
key
,
Object
artifactTypesItem
)
{
return
policyTypes
;
if
(
this
.
artifactTypes
==
null
)
{
this
.
artifactTypes
=
new
HashMap
<
String
,
Object
>();
}
}
this
.
artifactTypes
.
put
(
key
,
artifactTypesItem
);
return
this
;
}
public
void
setPolicyTypes
(
Map
<
String
,
String
>
policyTypes
)
{
/**
this
.
policyTypes
=
policyTypes
;
* Get artifactTypes
}
* @return artifactTypes
**/
@ApiModelProperty
(
value
=
""
)
public
ToscaTemplate
groupTypes
(
Map
<
String
,
Object
>
groupTypes
)
{
this
.
groupTypes
=
groupTypes
;
return
this
;
}
public
ToscaTemplate
putGroupTypesItem
(
String
key
,
Object
groupTypesItem
)
{
public
Map
<
String
,
Object
>
getArtifactTypes
()
{
if
(
this
.
groupTypes
==
null
)
{
return
artifactTypes
;
this
.
groupTypes
=
new
HashMap
<>();
}
}
this
.
groupTypes
.
put
(
key
,
groupTypesItem
);
return
this
;
}
/**
public
void
setArtifactTypes
(
Map
<
String
,
Object
>
artifactTypes
)
{
* Get groupTypes
this
.
artifactTypes
=
artifactTypes
;
*
}
* @return groupTypes
*
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
Object
>
getGroupTypes
()
{
public
ToscaTemplate
dataTypes
(
Map
<
String
,
Object
>
dataTypes
)
{
return
groupTypes
;
this
.
dataTypes
=
dataTypes
;
}
return
this
;
}
public
void
setGroupTypes
(
Map
<
String
,
Object
>
groupTypes
)
{
this
.
groupTypes
=
groupTypes
;
}
public
ToscaTemplate
description
(
String
description
)
{
public
ToscaTemplate
putDataTypesItem
(
String
key
,
Object
dataTypesItem
)
{
this
.
description
=
description
;
if
(
this
.
dataTypes
==
null
)
{
return
this
;
this
.
dataTypes
=
new
HashMap
<
String
,
Object
>()
;
}
}
this
.
dataTypes
.
put
(
key
,
dataTypesItem
);
return
this
;
}
/**
/**
* Get description
* Get dataTypes
*
* @return dataTypes
* @return description
**/
*
@ApiModelProperty
(
value
=
""
)
*/
@ApiModelProperty
(
value
=
""
)
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
public
Map
<
String
,
Object
>
getDataTypes
(
)
{
this
.
description
=
description
;
return
dataTypes
;
}
}
public
ToscaTemplate
templateAuthor
(
String
templateAuthor
)
{
public
void
setDataTypes
(
Map
<
String
,
Object
>
dataTypes
)
{
this
.
templateAuthor
=
templateAuthor
;
this
.
dataTypes
=
dataTypes
;
return
this
;
}
}
/**
public
ToscaTemplate
interfaceTypes
(
Map
<
String
,
Object
>
interfaceTypes
)
{
* Get templateAuthor
this
.
interfaceTypes
=
interfaceTypes
;
*
return
this
;
* @return templateAuthor
}
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getTemplateAuthor
()
{
public
ToscaTemplate
putInterfaceTypesItem
(
String
key
,
Object
interfaceTypesItem
)
{
return
templateAuthor
;
if
(
this
.
interfaceTypes
==
null
)
{
this
.
interfaceTypes
=
new
HashMap
<
String
,
Object
>();
}
}
this
.
interfaceTypes
.
put
(
key
,
interfaceTypesItem
);
return
this
;
}
/**
* Get interfaceTypes
* @return interfaceTypes
**/
@ApiModelProperty
(
value
=
""
)
public
void
setTemplateAuthor
(
String
templateAuthor
)
{
this
.
templateAuthor
=
templateAuthor
;
}
@Override
public
Map
<
String
,
Object
>
getInterfaceTypes
()
{
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
return
interfaceTypes
;
if
(
this
==
o
)
{
}
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
ToscaTemplate
toscaTemplate
=
(
ToscaTemplate
)
o
;
return
Objects
.
equals
(
this
.
toscaDefinitionsVersion
,
toscaTemplate
.
toscaDefinitionsVersion
)
&&
Objects
.
equals
(
this
.
toscaDefaultNamespace
,
toscaTemplate
.
toscaDefaultNamespace
)
&&
Objects
.
equals
(
this
.
templateName
,
toscaTemplate
.
templateName
)
&&
Objects
.
equals
(
this
.
imports
,
toscaTemplate
.
imports
)
&&
Objects
.
equals
(
this
.
repositories
,
toscaTemplate
.
repositories
)
&&
Objects
.
equals
(
this
.
dslDefinitions
,
toscaTemplate
.
dslDefinitions
)
&&
Objects
.
equals
(
this
.
nodeTypes
,
toscaTemplate
.
nodeTypes
)
&&
Objects
.
equals
(
this
.
topologyTemplate
,
toscaTemplate
.
topologyTemplate
)
&&
Objects
.
equals
(
this
.
relationshipTypes
,
toscaTemplate
.
relationshipTypes
)
&&
Objects
.
equals
(
this
.
relationshipTemplates
,
toscaTemplate
.
relationshipTemplates
)
&&
Objects
.
equals
(
this
.
capabilityTypes
,
toscaTemplate
.
capabilityTypes
)
&&
Objects
.
equals
(
this
.
artifactTypes
,
toscaTemplate
.
artifactTypes
)
&&
Objects
.
equals
(
this
.
dataTypes
,
toscaTemplate
.
dataTypes
)
&&
Objects
.
equals
(
this
.
interfaceTypes
,
toscaTemplate
.
interfaceTypes
)
&&
Objects
.
equals
(
this
.
policyTypes
,
toscaTemplate
.
policyTypes
)
&&
Objects
.
equals
(
this
.
groupTypes
,
toscaTemplate
.
groupTypes
)
&&
Objects
.
equals
(
this
.
description
,
toscaTemplate
.
description
)
&&
Objects
.
equals
(
this
.
templateAuthor
,
toscaTemplate
.
templateAuthor
);
}
@Override
public
void
setInterfaceTypes
(
Map
<
String
,
Object
>
interfaceTypes
)
{
public
int
hashCode
()
{
this
.
interfaceTypes
=
interfaceTypes
;
return
Objects
.
hash
(
toscaDefinitionsVersion
,
toscaDefaultNamespace
,
templateName
,
imports
,
repositories
,
dslDefinitions
,
nodeTypes
,
topologyTemplate
,
relationshipTypes
,
relationshipTemplates
,
capabilityTypes
,
artifactTypes
,
dataTypes
,
interfaceTypes
,
policyTypes
,
groupTypes
,
description
,
templateAuthor
);
}
}
@Override
public
ToscaTemplate
policyTypes
(
Map
<
String
,
String
>
policyTypes
)
{
public
String
toString
()
{
this
.
policyTypes
=
policyTypes
;
StringBuilder
sb
=
new
StringBuilder
();
return
this
;
sb
.
append
(
"class ToscaTemplate {\n"
);
}
sb
.
append
(
" toscaDefinitionsVersion: "
).
append
(
toIndentedString
(
toscaDefinitionsVersion
)).
append
(
"\n"
);
sb
.
append
(
" toscaDefaultNamespace: "
).
append
(
toIndentedString
(
toscaDefaultNamespace
)).
append
(
"\n"
);
sb
.
append
(
" templateName: "
).
append
(
toIndentedString
(
templateName
)).
append
(
"\n"
);
sb
.
append
(
" imports: "
).
append
(
toIndentedString
(
imports
)).
append
(
"\n"
);
sb
.
append
(
" repositories: "
).
append
(
toIndentedString
(
repositories
)).
append
(
"\n"
);
sb
.
append
(
" dslDefinitions: "
).
append
(
toIndentedString
(
dslDefinitions
)).
append
(
"\n"
);
sb
.
append
(
" nodeTypes: "
).
append
(
toIndentedString
(
nodeTypes
)).
append
(
"\n"
);
sb
.
append
(
" topologyTemplate: "
).
append
(
toIndentedString
(
topologyTemplate
)).
append
(
"\n"
);
sb
.
append
(
" relationshipTypes: "
).
append
(
toIndentedString
(
relationshipTypes
)).
append
(
"\n"
);
sb
.
append
(
" relationshipTemplates: "
).
append
(
toIndentedString
(
relationshipTemplates
)).
append
(
"\n"
);
sb
.
append
(
" capabilityTypes: "
).
append
(
toIndentedString
(
capabilityTypes
)).
append
(
"\n"
);
sb
.
append
(
" artifactTypes: "
).
append
(
toIndentedString
(
artifactTypes
)).
append
(
"\n"
);
sb
.
append
(
" dataTypes: "
).
append
(
toIndentedString
(
dataTypes
)).
append
(
"\n"
);
sb
.
append
(
" interfaceTypes: "
).
append
(
toIndentedString
(
interfaceTypes
)).
append
(
"\n"
);
sb
.
append
(
" policyTypes: "
).
append
(
toIndentedString
(
policyTypes
)).
append
(
"\n"
);
sb
.
append
(
" groupTypes: "
).
append
(
toIndentedString
(
groupTypes
)).
append
(
"\n"
);
sb
.
append
(
" description: "
).
append
(
toIndentedString
(
description
)).
append
(
"\n"
);
sb
.
append
(
" templateAuthor: "
).
append
(
toIndentedString
(
templateAuthor
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
public
ToscaTemplate
putPolicyTypesItem
(
String
key
,
String
policyTypesItem
)
{
* Convert the given object to string with each line indented by 4 spaces
if
(
this
.
policyTypes
==
null
)
{
* (except the first line).
this
.
policyTypes
=
new
HashMap
<
String
,
String
>();
*/
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
return
"null"
;
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
}
this
.
policyTypes
.
put
(
key
,
policyTypesItem
);
return
this
;
}
/**
* Get policyTypes
* @return policyTypes
**/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
String
>
getPolicyTypes
()
{
return
policyTypes
;
}
public
void
setPolicyTypes
(
Map
<
String
,
String
>
policyTypes
)
{
this
.
policyTypes
=
policyTypes
;
}
public
ToscaTemplate
groupTypes
(
Map
<
String
,
Object
>
groupTypes
)
{
this
.
groupTypes
=
groupTypes
;
return
this
;
}
public
ToscaTemplate
putGroupTypesItem
(
String
key
,
Object
groupTypesItem
)
{
if
(
this
.
groupTypes
==
null
)
{
this
.
groupTypes
=
new
HashMap
<
String
,
Object
>();
}
this
.
groupTypes
.
put
(
key
,
groupTypesItem
);
return
this
;
}
/**
* Get groupTypes
* @return groupTypes
**/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
Object
>
getGroupTypes
()
{
return
groupTypes
;
}
public
void
setGroupTypes
(
Map
<
String
,
Object
>
groupTypes
)
{
this
.
groupTypes
=
groupTypes
;
}
public
ToscaTemplate
description
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
/**
* Get description
* @return description
**/
@ApiModelProperty
(
value
=
""
)
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
ToscaTemplate
templateAuthor
(
String
templateAuthor
)
{
this
.
templateAuthor
=
templateAuthor
;
return
this
;
}
/**
* Get templateAuthor
* @return templateAuthor
**/
@ApiModelProperty
(
value
=
""
)
public
String
getTemplateAuthor
()
{
return
templateAuthor
;
}
public
void
setTemplateAuthor
(
String
templateAuthor
)
{
this
.
templateAuthor
=
templateAuthor
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
ToscaTemplate
toscaTemplate
=
(
ToscaTemplate
)
o
;
return
Objects
.
equals
(
this
.
toscaDefinitionsVersion
,
toscaTemplate
.
toscaDefinitionsVersion
)
&&
Objects
.
equals
(
this
.
toscaDefaultNamespace
,
toscaTemplate
.
toscaDefaultNamespace
)
&&
Objects
.
equals
(
this
.
templateName
,
toscaTemplate
.
templateName
)
&&
Objects
.
equals
(
this
.
imports
,
toscaTemplate
.
imports
)
&&
Objects
.
equals
(
this
.
repositories
,
toscaTemplate
.
repositories
)
&&
Objects
.
equals
(
this
.
dslDefinitions
,
toscaTemplate
.
dslDefinitions
)
&&
Objects
.
equals
(
this
.
nodeTypes
,
toscaTemplate
.
nodeTypes
)
&&
Objects
.
equals
(
this
.
topologyTemplate
,
toscaTemplate
.
topologyTemplate
)
&&
Objects
.
equals
(
this
.
relationshipTypes
,
toscaTemplate
.
relationshipTypes
)
&&
Objects
.
equals
(
this
.
relationshipTemplates
,
toscaTemplate
.
relationshipTemplates
)
&&
Objects
.
equals
(
this
.
capabilityTypes
,
toscaTemplate
.
capabilityTypes
)
&&
Objects
.
equals
(
this
.
artifactTypes
,
toscaTemplate
.
artifactTypes
)
&&
Objects
.
equals
(
this
.
dataTypes
,
toscaTemplate
.
dataTypes
)
&&
Objects
.
equals
(
this
.
interfaceTypes
,
toscaTemplate
.
interfaceTypes
)
&&
Objects
.
equals
(
this
.
policyTypes
,
toscaTemplate
.
policyTypes
)
&&
Objects
.
equals
(
this
.
groupTypes
,
toscaTemplate
.
groupTypes
)
&&
Objects
.
equals
(
this
.
description
,
toscaTemplate
.
description
)
&&
Objects
.
equals
(
this
.
templateAuthor
,
toscaTemplate
.
templateAuthor
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
toscaDefinitionsVersion
,
toscaDefaultNamespace
,
templateName
,
imports
,
repositories
,
dslDefinitions
,
nodeTypes
,
topologyTemplate
,
relationshipTypes
,
relationshipTemplates
,
capabilityTypes
,
artifactTypes
,
dataTypes
,
interfaceTypes
,
policyTypes
,
groupTypes
,
description
,
templateAuthor
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class ToscaTemplate {\n"
);
sb
.
append
(
" toscaDefinitionsVersion: "
).
append
(
toIndentedString
(
toscaDefinitionsVersion
)).
append
(
"\n"
);
sb
.
append
(
" toscaDefaultNamespace: "
).
append
(
toIndentedString
(
toscaDefaultNamespace
)).
append
(
"\n"
);
sb
.
append
(
" templateName: "
).
append
(
toIndentedString
(
templateName
)).
append
(
"\n"
);
sb
.
append
(
" imports: "
).
append
(
toIndentedString
(
imports
)).
append
(
"\n"
);
sb
.
append
(
" repositories: "
).
append
(
toIndentedString
(
repositories
)).
append
(
"\n"
);
sb
.
append
(
" dslDefinitions: "
).
append
(
toIndentedString
(
dslDefinitions
)).
append
(
"\n"
);
sb
.
append
(
" nodeTypes: "
).
append
(
toIndentedString
(
nodeTypes
)).
append
(
"\n"
);
sb
.
append
(
" topologyTemplate: "
).
append
(
toIndentedString
(
topologyTemplate
)).
append
(
"\n"
);
sb
.
append
(
" relationshipTypes: "
).
append
(
toIndentedString
(
relationshipTypes
)).
append
(
"\n"
);
sb
.
append
(
" relationshipTemplates: "
).
append
(
toIndentedString
(
relationshipTemplates
)).
append
(
"\n"
);
sb
.
append
(
" capabilityTypes: "
).
append
(
toIndentedString
(
capabilityTypes
)).
append
(
"\n"
);
sb
.
append
(
" artifactTypes: "
).
append
(
toIndentedString
(
artifactTypes
)).
append
(
"\n"
);
sb
.
append
(
" dataTypes: "
).
append
(
toIndentedString
(
dataTypes
)).
append
(
"\n"
);
sb
.
append
(
" interfaceTypes: "
).
append
(
toIndentedString
(
interfaceTypes
)).
append
(
"\n"
);
sb
.
append
(
" policyTypes: "
).
append
(
toIndentedString
(
policyTypes
)).
append
(
"\n"
);
sb
.
append
(
" groupTypes: "
).
append
(
toIndentedString
(
groupTypes
)).
append
(
"\n"
);
sb
.
append
(
" description: "
).
append
(
toIndentedString
(
description
)).
append
(
"\n"
);
sb
.
append
(
" templateAuthor: "
).
append
(
toIndentedString
(
templateAuthor
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
return
"null"
;
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/User.java
View file @
4053fc74
...
@@ -2,236 +2,226 @@ package nl.uva.sne.drip.model;
...
@@ -2,236 +2,226 @@ package nl.uva.sne.drip.model;
import
java.util.Objects
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonCreator
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
javax.validation.constraints.*
;
import
org.springframework.data.annotation.Id
;
/**
/**
* User
* User
*/
*/
@Validated
@Validated
public
class
User
{
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-25T14:09:25.182Z"
)
@JsonProperty
(
"id"
)
public
class
User
{
@Id
@JsonProperty
(
"id"
)
private
Long
id
=
null
;
private
Long
id
=
null
;
@JsonProperty
(
"username"
)
@JsonProperty
(
"username"
)
private
String
username
=
null
;
private
String
username
=
null
;
@JsonProperty
(
"firstName"
)
@JsonProperty
(
"firstName"
)
private
String
firstName
=
null
;
private
String
firstName
=
null
;
@JsonProperty
(
"lastName"
)
@JsonProperty
(
"lastName"
)
private
String
lastName
=
null
;
private
String
lastName
=
null
;
@JsonProperty
(
"email"
)
@JsonProperty
(
"email"
)
private
String
email
=
null
;
private
String
email
=
null
;
@JsonProperty
(
"password"
)
@JsonProperty
(
"password"
)
private
String
password
=
null
;
private
String
password
=
null
;
@JsonProperty
(
"userStatus"
)
@JsonProperty
(
"userStatus"
)
private
Integer
userStatus
=
null
;
private
Integer
userStatus
=
null
;
public
User
id
(
Long
id
)
{
public
User
id
(
Long
id
)
{
this
.
id
=
id
;
this
.
id
=
id
;
return
this
;
return
this
;
}
}
/**
* Get id
*
* @return id
*
*/
@ApiModelProperty
(
value
=
""
)
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
User
username
(
String
username
)
{
this
.
username
=
username
;
return
this
;
}
/**
* Get username
*
* @return username
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
User
firstName
(
String
firstName
)
{
this
.
firstName
=
firstName
;
return
this
;
}
/**
* Get firstName
*
* @return firstName
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getFirstName
()
{
return
firstName
;
}
public
void
setFirstName
(
String
firstName
)
{
this
.
firstName
=
firstName
;
}
public
User
lastName
(
String
lastName
)
{
/**
this
.
lastName
=
lastName
;
* Get id
return
this
;
* @return id
}
**/
@ApiModelProperty
(
value
=
""
)
/**
* Get lastName
*
* @return lastName
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getLastName
()
{
return
lastName
;
}
public
void
setLastName
(
String
lastName
)
{
this
.
lastName
=
lastName
;
}
public
User
email
(
String
email
)
{
this
.
email
=
email
;
return
this
;
}
/**
public
Long
getId
()
{
* Get email
return
id
;
*
}
* @return email
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getEmail
(
)
{
public
void
setId
(
Long
id
)
{
return
email
;
this
.
id
=
id
;
}
}
public
void
setEmail
(
String
email
)
{
public
User
username
(
String
username
)
{
this
.
email
=
email
;
this
.
username
=
username
;
}
return
this
;
}
public
User
password
(
String
password
)
{
/**
this
.
password
=
password
;
* Get username
return
this
;
* @return username
}
**/
@ApiModelProperty
(
value
=
""
)
/**
* Get password
*
* @return password
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getPassword
()
{
public
String
getUsername
()
{
return
password
;
return
username
;
}
}
public
void
setPassword
(
String
password
)
{
public
void
setUsername
(
String
username
)
{
this
.
password
=
password
;
this
.
username
=
username
;
}
}
public
User
userStatus
(
Integer
userStatus
)
{
public
User
firstName
(
String
firstName
)
{
this
.
userStatus
=
userStatus
;
this
.
firstName
=
firstName
;
return
this
;
return
this
;
}
}
/**
/**
* User Status
* Get firstName
*
* @return firstName
* @return userStatus
**/
*
@ApiModelProperty
(
value
=
""
)
*/
@ApiModelProperty
(
value
=
"User Status"
)
public
Integer
getUserStatus
()
{
return
userStatus
;
}
public
void
setUserStatus
(
Integer
userStatus
)
{
public
String
getFirstName
(
)
{
this
.
userStatus
=
userStatus
;
return
firstName
;
}
}
@Override
public
void
setFirstName
(
String
firstName
)
{
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
this
.
firstName
=
firstName
;
if
(
this
==
o
)
{
}
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
User
user
=
(
User
)
o
;
return
Objects
.
equals
(
this
.
id
,
user
.
id
)
&&
Objects
.
equals
(
this
.
username
,
user
.
username
)
&&
Objects
.
equals
(
this
.
firstName
,
user
.
firstName
)
&&
Objects
.
equals
(
this
.
lastName
,
user
.
lastName
)
&&
Objects
.
equals
(
this
.
email
,
user
.
email
)
&&
Objects
.
equals
(
this
.
password
,
user
.
password
)
&&
Objects
.
equals
(
this
.
userStatus
,
user
.
userStatus
);
}
@Override
public
User
lastName
(
String
lastName
)
{
public
int
hashCode
()
{
this
.
lastName
=
lastName
;
return
Objects
.
hash
(
id
,
username
,
firstName
,
lastName
,
email
,
password
,
userStatus
)
;
return
this
;
}
}
@Override
/**
public
String
toString
()
{
* Get lastName
StringBuilder
sb
=
new
StringBuilder
();
* @return lastName
sb
.
append
(
"class User {\n"
);
**/
@ApiModelProperty
(
value
=
""
)
sb
.
append
(
" id: "
).
append
(
toIndentedString
(
id
)).
append
(
"\n"
);
sb
.
append
(
" username: "
).
append
(
toIndentedString
(
username
)).
append
(
"\n"
);
sb
.
append
(
" firstName: "
).
append
(
toIndentedString
(
firstName
)).
append
(
"\n"
);
sb
.
append
(
" lastName: "
).
append
(
toIndentedString
(
lastName
)).
append
(
"\n"
);
sb
.
append
(
" email: "
).
append
(
toIndentedString
(
email
)).
append
(
"\n"
);
sb
.
append
(
" password: "
).
append
(
toIndentedString
(
password
)).
append
(
"\n"
);
sb
.
append
(
" userStatus: "
).
append
(
toIndentedString
(
userStatus
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
* Convert the given object to string with each line indented by 4 spaces
public
String
getLastName
()
{
* (except the first line).
return
lastName
;
*/
}
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
public
void
setLastName
(
String
lastName
)
{
return
"null"
;
this
.
lastName
=
lastName
;
}
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
public
User
email
(
String
email
)
{
this
.
email
=
email
;
return
this
;
}
/**
* Get email
* @return email
**/
@ApiModelProperty
(
value
=
""
)
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
public
User
password
(
String
password
)
{
this
.
password
=
password
;
return
this
;
}
/**
* Get password
* @return password
**/
@ApiModelProperty
(
value
=
""
)
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
User
userStatus
(
Integer
userStatus
)
{
this
.
userStatus
=
userStatus
;
return
this
;
}
/**
* User Status
* @return userStatus
**/
@ApiModelProperty
(
value
=
"User Status"
)
public
Integer
getUserStatus
()
{
return
userStatus
;
}
public
void
setUserStatus
(
Integer
userStatus
)
{
this
.
userStatus
=
userStatus
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
User
user
=
(
User
)
o
;
return
Objects
.
equals
(
this
.
id
,
user
.
id
)
&&
Objects
.
equals
(
this
.
username
,
user
.
username
)
&&
Objects
.
equals
(
this
.
firstName
,
user
.
firstName
)
&&
Objects
.
equals
(
this
.
lastName
,
user
.
lastName
)
&&
Objects
.
equals
(
this
.
email
,
user
.
email
)
&&
Objects
.
equals
(
this
.
password
,
user
.
password
)
&&
Objects
.
equals
(
this
.
userStatus
,
user
.
userStatus
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
id
,
username
,
firstName
,
lastName
,
email
,
password
,
userStatus
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class User {\n"
);
sb
.
append
(
" id: "
).
append
(
toIndentedString
(
id
)).
append
(
"\n"
);
sb
.
append
(
" username: "
).
append
(
toIndentedString
(
username
)).
append
(
"\n"
);
sb
.
append
(
" firstName: "
).
append
(
toIndentedString
(
firstName
)).
append
(
"\n"
);
sb
.
append
(
" lastName: "
).
append
(
toIndentedString
(
lastName
)).
append
(
"\n"
);
sb
.
append
(
" email: "
).
append
(
toIndentedString
(
email
)).
append
(
"\n"
);
sb
.
append
(
" password: "
).
append
(
toIndentedString
(
password
)).
append
(
"\n"
);
sb
.
append
(
" userStatus: "
).
append
(
toIndentedString
(
userStatus
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
return
"null"
;
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
}
}
drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/TOSCAUtilsTest.java
0 → 100644
View file @
4053fc74
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
utils
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
org.junit.After
;
import
org.junit.AfterClass
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
/**
*
* @author alogo
*/
public
class
TOSCAUtilsTest
{
private
static
ToscaTemplate
toscaTemplate
;
public
TOSCAUtilsTest
()
{
}
@BeforeClass
public
static
void
setUpClass
()
throws
IOException
{
String
toscaFilePath
=
"../TOSCA/application_example_output.yaml"
;
String
ymlStr
=
new
String
(
Files
.
readAllBytes
(
Paths
.
get
(
toscaFilePath
)));
ObjectMapper
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
toscaTemplate
=
objectMapper
.
readValue
(
ymlStr
,
ToscaTemplate
.
class
);
}
@AfterClass
public
static
void
tearDownClass
()
{
}
@Before
public
void
setUp
()
{
}
@After
public
void
tearDown
()
{
}
/**
* Test of getNodesByType method, of class TOSCAUtils.
*/
@Test
public
void
testGetNodesByType
()
{
System
.
out
.
println
(
"getNodesByType"
);
String
nodeTypeName
=
"tosca.nodes.ARTICONF.VM.topology"
;
List
<
Map
<
String
,
NodeTemplate
>>
result
=
testGetNodesByType
(
nodeTypeName
);
assertEquals
(
1
,
result
.
size
());
nodeTypeName
=
"tosca.nodes.ARTICONF.VM.Compute"
;
result
=
testGetNodesByType
(
nodeTypeName
);
assertEquals
(
2
,
result
.
size
());
}
/**
* Test of getRelatedNodes method, of class TOSCAUtils.
*/
@Test
public
void
testGetRelatedNodes
()
{
System
.
out
.
println
(
"getRelatedNodes"
);
String
nodeTypeName
=
"tosca.nodes.ARTICONF.VM.topology"
;
List
<
Map
<
String
,
NodeTemplate
>>
vmTopologies
=
TOSCAUtils
.
getNodesByType
(
toscaTemplate
,
nodeTypeName
);
NodeTemplate
vmTopology
=
vmTopologies
.
get
(
0
).
get
(
vmTopologies
.
get
(
0
).
keySet
().
iterator
().
next
());
nodeTypeName
=
"tosca.nodes.ARTICONF.VM.Compute"
;
List
<
Map
<
String
,
NodeTemplate
>>
result
=
TOSCAUtils
.
getRelatedNodes
(
vmTopology
,
toscaTemplate
);
assertEquals
(
2
,
result
.
size
());
for
(
Map
<
String
,
NodeTemplate
>
node
:
result
)
{
String
name
=
node
.
keySet
().
iterator
().
next
();
assertEquals
(
nodeTypeName
,
node
.
get
(
name
).
getType
());
}
}
/**
* Test of nodeIsOfType method, of class TOSCAUtils.
*/
@Test
public
void
testNodeIsOfType
()
{
System
.
out
.
println
(
"nodeIsOfType"
);
String
nodeTypeName
=
"tosca.nodes.ARTICONF.VM.topology"
;
List
<
Map
<
String
,
NodeTemplate
>>
vmTopologies
=
TOSCAUtils
.
getNodesByType
(
toscaTemplate
,
nodeTypeName
);
NodeTemplate
vmTopology
=
vmTopologies
.
get
(
0
).
get
(
vmTopologies
.
get
(
0
).
keySet
().
iterator
().
next
());
boolean
expResult
=
true
;
boolean
result
=
TOSCAUtils
.
nodeIsOfType
(
vmTopology
,
nodeTypeName
);
assertEquals
(
expResult
,
result
);
expResult
=
false
;
nodeTypeName
=
"tosca.nodes.ARTICONF"
;
result
=
TOSCAUtils
.
nodeIsOfType
(
vmTopology
,
nodeTypeName
);
assertEquals
(
expResult
,
result
);
}
/**
* Test of getNodeProperty method, of class TOSCAUtils.
*/
@Test
public
void
testGetNodeProperty
()
{
System
.
out
.
println
(
"getNodeProperty"
);
testGetVMProperties
();
}
private
void
testGetVMProperties
()
{
String
nodeTypeName
=
"tosca.nodes.ARTICONF.VM.Compute"
;
List
<
Map
<
String
,
NodeTemplate
>>
vms
=
TOSCAUtils
.
getNodesByType
(
toscaTemplate
,
nodeTypeName
);
assertEquals
(
2
,
vms
.
size
());
Map
<
String
,
Object
>
vmProertyMap
=
new
HashMap
<>();
vmProertyMap
.
put
(
"disk_size"
,
"50000 MB"
);
vmProertyMap
.
put
(
"host_name"
,
"vm"
);
vmProertyMap
.
put
(
"mem_size"
,
"6000 MB"
);
vmProertyMap
.
put
(
"num_cores"
,
2
);
vmProertyMap
.
put
(
"os"
,
"ubuntu 16"
);
vmProertyMap
.
put
(
"user_name"
,
"vm_user"
);
for
(
Map
<
String
,
NodeTemplate
>
vmMap
:
vms
)
{
Set
<
String
>
keys
=
vmProertyMap
.
keySet
();
NodeTemplate
vm
=
vmMap
.
get
(
vmMap
.
keySet
().
iterator
().
next
());
for
(
String
propName
:
keys
)
{
Object
result
=
TOSCAUtils
.
getNodeProperty
(
vm
,
propName
);
assertEquals
(
vmProertyMap
.
get
(
propName
),
result
);
}
}
}
private
List
<
Map
<
String
,
NodeTemplate
>>
testGetNodesByType
(
String
nodeTypeName
)
{
List
<
Map
<
String
,
NodeTemplate
>>
result
=
TOSCAUtils
.
getNodesByType
(
toscaTemplate
,
nodeTypeName
);
for
(
Map
<
String
,
NodeTemplate
>
node
:
result
)
{
String
name
=
node
.
keySet
().
iterator
().
next
();
assertEquals
(
nodeTypeName
,
node
.
get
(
name
).
getType
());
}
return
result
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment