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
3dc7c5e2
Commit
3dc7c5e2
authored
Dec 09, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rebuild client
parent
4cf842b3
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
501 additions
and
249 deletions
+501
-249
.gitignore
.gitignore
+2
-1
ApiKeyAuth.java
...a/sne/drip/commons/sure-tosca/client/auth/ApiKeyAuth.java
+0
-75
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+9
-5
DefaultApi.java
.../src/main/java/nl/uva/sne/drip/sure_tosca/DefaultApi.java
+18
-18
ApiKeyAuth.java
...main/java/nl/uva/sne/drip/sure_tosca/auth/ApiKeyAuth.java
+73
-0
Authentication.java
.../java/nl/uva/sne/drip/sure_tosca/auth/Authentication.java
+3
-5
HttpBasicAuth.java
...n/java/nl/uva/sne/drip/sure_tosca/auth/HttpBasicAuth.java
+3
-3
OAuth.java
.../src/main/java/nl/uva/sne/drip/sure_tosca/auth/OAuth.java
+4
-3
OAuthFlow.java
.../main/java/nl/uva/sne/drip/sure_tosca/auth/OAuthFlow.java
+1
-1
ApiCallback.java
...n/java/nl/uva/sne/drip/sure_tosca/client/ApiCallback.java
+2
-1
ApiClient.java
...ain/java/nl/uva/sne/drip/sure_tosca/client/ApiClient.java
+117
-97
ApiException.java
.../java/nl/uva/sne/drip/sure_tosca/client/ApiException.java
+2
-2
ApiResponse.java
...n/java/nl/uva/sne/drip/sure_tosca/client/ApiResponse.java
+1
-1
Configuration.java
...java/nl/uva/sne/drip/sure_tosca/client/Configuration.java
+2
-2
GzipRequestInterceptor.java
...va/sne/drip/sure_tosca/client/GzipRequestInterceptor.java
+1
-1
JSON.java
...src/main/java/nl/uva/sne/drip/sure_tosca/client/JSON.java
+1
-1
Pair.java
...src/main/java/nl/uva/sne/drip/sure_tosca/client/Pair.java
+2
-2
ProgressRequestBody.java
...l/uva/sne/drip/sure_tosca/client/ProgressRequestBody.java
+1
-1
ProgressResponseBody.java
.../uva/sne/drip/sure_tosca/client/ProgressResponseBody.java
+1
-1
StringUtil.java
...in/java/nl/uva/sne/drip/sure_tosca/client/StringUtil.java
+2
-2
ToscaHelperTest.java
...t/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
+118
-0
application.properties
drip-commons/src/test/resources/application.properties
+8
-0
pom.xml
drip-provisioner/pom.xml
+12
-0
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+27
-26
application.properies
drip-provisioner/src/main/resources/application.properies
+4
-1
CloudStormServiceTest.java
...va/nl/uva/sne/drip/provisioner/CloudStormServiceTest.java
+80
-0
application.properies
drip-provisioner/src/test/resources/application.properies
+7
-0
No files found.
.gitignore
View file @
3dc7c5e2
...
...
@@ -45,4 +45,5 @@
/spring-server-generated/target/
/manager-services/target/
/drip-manager-services/nbproject/
/drip-manager-services/target/
\ No newline at end of file
/drip-manager-services/target/
/drip-provisioner/nbproject/
\ No newline at end of file
drip-commons/src/main/java/nl/uva/sne/drip/commons/sure-tosca/client/auth/ApiKeyAuth.java
deleted
100644 → 0
View file @
4cf842b3
/*
* tosca-sure
* TOSCA Simple qUeRy sErvice (SURE).
*
* OpenAPI spec version: 1.0.0
* Contact: S.Koulouzis@uva.nl
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package
nl
.
uva
.
sne
.
drip
.
auth
;
import
nl.uva.sne.drip.commons.sure_tosca.client.Pair
;
import
java.util.Map
;
import
java.util.List
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-11-01T13:11:24.211Z"
)
public
class
ApiKeyAuth
implements
Authentication
{
private
final
String
location
;
private
final
String
paramName
;
private
String
apiKey
;
private
String
apiKeyPrefix
;
public
ApiKeyAuth
(
String
location
,
String
paramName
)
{
this
.
location
=
location
;
this
.
paramName
=
paramName
;
}
public
String
getLocation
()
{
return
location
;
}
public
String
getParamName
()
{
return
paramName
;
}
public
String
getApiKey
()
{
return
apiKey
;
}
public
void
setApiKey
(
String
apiKey
)
{
this
.
apiKey
=
apiKey
;
}
public
String
getApiKeyPrefix
()
{
return
apiKeyPrefix
;
}
public
void
setApiKeyPrefix
(
String
apiKeyPrefix
)
{
this
.
apiKeyPrefix
=
apiKeyPrefix
;
}
@Override
public
void
applyToParams
(
List
<
Pair
>
queryParams
,
Map
<
String
,
String
>
headerParams
)
{
if
(
apiKey
==
null
)
{
return
;
}
String
value
;
if
(
apiKeyPrefix
!=
null
)
{
value
=
apiKeyPrefix
+
" "
+
apiKey
;
}
else
{
value
=
apiKey
;
}
if
(
"query"
.
equals
(
location
))
{
queryParams
.
add
(
new
Pair
(
paramName
,
value
));
}
else
if
(
"header"
.
equals
(
location
))
{
headerParams
.
put
(
paramName
,
value
);
}
}
}
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
3dc7c5e2
...
...
@@ -25,12 +25,12 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
nl.uva.sne.drip.commons.sure_tosca.client.ApiException
;
import
nl.uva.sne.drip.commons.sure_tosca.client.Configuration
;
import
nl.uva.sne.drip.commons.sure_tosca.client.DefaultApi
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
nl.uva.sne.drip.sure_tosca.DefaultApi
;
import
org.apache.commons.io.FileUtils
;
import
nl.uva.sne.drip.sure_tosca.client.ApiException
;
import
nl.uva.sne.drip.sure_tosca.client.Configuration
;
/**
*
...
...
@@ -80,9 +80,13 @@ public class ToscaHelper {
return
interfaceDefinitions
;
}
public
List
<
NodeTemplate
>
getVMTopologyTemplates
(
ToscaTemplate
toscaTemplate
)
throws
ApiException
{
List
<
NodeTemplate
>
vmTopologyTemplates
=
api
.
getNodeTemplates
(
String
.
valueOf
(
id
),
"tosca.nodes.ARTICONF.VM.topology"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
public
List
<
NodeTemplate
>
getVMTopologyTemplates
()
throws
ApiException
{
List
<
NodeTemplate
>
vmTopologyTemplates
=
api
.
getNodeTemplates
(
String
.
valueOf
(
id
),
"tosca.nodes.ARTICONF.VM.topology"
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
return
vmTopologyTemplates
;
}
public
ToscaTemplate
execute
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
}
}
drip-commons/src/main/java/nl/uva/sne/drip/
commons/sure_tosca/client
/DefaultApi.java
→
drip-commons/src/main/java/nl/uva/sne/drip/
sure_tosca
/DefaultApi.java
View file @
3dc7c5e2
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
/*
* tosca-sure
* TOSCA Simple qUeRy sErvice (SURE).
...
...
@@ -11,6 +9,7 @@ package nl.uva.sne.drip.commons.sure_tosca.client;
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
;
import
com.google.gson.reflect.TypeToken
;
...
...
@@ -26,6 +25,14 @@ import java.util.Map;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.TopologyTemplate
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
nl.uva.sne.drip.sure_tosca.client.ApiCallback
;
import
nl.uva.sne.drip.sure_tosca.client.ApiClient
;
import
nl.uva.sne.drip.sure_tosca.client.ApiException
;
import
nl.uva.sne.drip.sure_tosca.client.ApiResponse
;
import
nl.uva.sne.drip.sure_tosca.client.Configuration
;
import
nl.uva.sne.drip.sure_tosca.client.Pair
;
import
nl.uva.sne.drip.sure_tosca.client.ProgressRequestBody
;
import
nl.uva.sne.drip.sure_tosca.client.ProgressResponseBody
;
public
class
DefaultApi
{
...
...
@@ -1193,13 +1200,12 @@ public class DefaultApi {
* @param hasRequirements filter if has requirements (optional)
* @param hasCapabilities filter if has capabilities (optional)
* @param hasArtifacts filter if has artifacts (optional)
* @param derivedFrom derived from (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public
com
.
squareup
.
okhttp
.
Call
getNodeTemplatesCall
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
,
String
derivedFrom
,
final
ProgressResponseBody
.
ProgressListener
progressListener
,
final
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
)
throws
ApiException
{
public
com
.
squareup
.
okhttp
.
Call
getNodeTemplatesCall
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
,
final
ProgressResponseBody
.
ProgressListener
progressListener
,
final
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
)
throws
ApiException
{
Object
localVarPostBody
=
null
;
// create path and map variables
...
...
@@ -1232,9 +1238,6 @@ public class DefaultApi {
if
(
hasArtifacts
!=
null
)
{
localVarQueryParams
.
addAll
(
apiClient
.
parameterToPair
(
"has_artifacts"
,
hasArtifacts
));
}
if
(
derivedFrom
!=
null
)
{
localVarQueryParams
.
addAll
(
apiClient
.
parameterToPair
(
"derived_from"
,
derivedFrom
));
}
Map
<
String
,
String
>
localVarHeaderParams
=
new
HashMap
<
String
,
String
>();
...
...
@@ -1269,14 +1272,14 @@ public class DefaultApi {
}
@SuppressWarnings
(
"rawtypes"
)
private
com
.
squareup
.
okhttp
.
Call
getNodeTemplatesValidateBeforeCall
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
,
String
derivedFrom
,
final
ProgressResponseBody
.
ProgressListener
progressListener
,
final
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
)
throws
ApiException
{
private
com
.
squareup
.
okhttp
.
Call
getNodeTemplatesValidateBeforeCall
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
,
final
ProgressResponseBody
.
ProgressListener
progressListener
,
final
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
)
throws
ApiException
{
// verify the required parameter 'id' is set
if
(
id
==
null
)
{
throw
new
ApiException
(
"Missing the required parameter 'id' when calling getNodeTemplates(Async)"
);
}
com
.
squareup
.
okhttp
.
Call
call
=
getNodeTemplatesCall
(
id
,
typeName
,
nodeName
,
hasInterfaces
,
hasProperties
,
hasAttributes
,
hasRequirements
,
hasCapabilities
,
hasArtifacts
,
derivedFrom
,
progressListener
,
progressRequestListener
);
com
.
squareup
.
okhttp
.
Call
call
=
getNodeTemplatesCall
(
id
,
typeName
,
nodeName
,
hasInterfaces
,
hasProperties
,
hasAttributes
,
hasRequirements
,
hasCapabilities
,
hasArtifacts
,
progressListener
,
progressRequestListener
);
return
call
;
}
...
...
@@ -1294,13 +1297,12 @@ public class DefaultApi {
* @param hasRequirements filter if has requirements (optional)
* @param hasCapabilities filter if has capabilities (optional)
* @param hasArtifacts filter if has artifacts (optional)
* @param derivedFrom derived from (optional)
* @return List<NodeTemplate>
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
*/
public
List
<
NodeTemplate
>
getNodeTemplates
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
,
String
derivedFrom
)
throws
ApiException
{
ApiResponse
<
List
<
NodeTemplate
>>
resp
=
getNodeTemplatesWithHttpInfo
(
id
,
typeName
,
nodeName
,
hasInterfaces
,
hasProperties
,
hasAttributes
,
hasRequirements
,
hasCapabilities
,
hasArtifacts
,
derivedFrom
);
public
List
<
NodeTemplate
>
getNodeTemplates
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
)
throws
ApiException
{
ApiResponse
<
List
<
NodeTemplate
>>
resp
=
getNodeTemplatesWithHttpInfo
(
id
,
typeName
,
nodeName
,
hasInterfaces
,
hasProperties
,
hasAttributes
,
hasRequirements
,
hasCapabilities
,
hasArtifacts
);
return
resp
.
getData
();
}
...
...
@@ -1317,13 +1319,12 @@ public class DefaultApi {
* @param hasRequirements filter if has requirements (optional)
* @param hasCapabilities filter if has capabilities (optional)
* @param hasArtifacts filter if has artifacts (optional)
* @param derivedFrom derived from (optional)
* @return ApiResponse<List<NodeTemplate>>
* @throws ApiException If fail to call the API, e.g. server error or cannot
* deserialize the response body
*/
public
ApiResponse
<
List
<
NodeTemplate
>>
getNodeTemplatesWithHttpInfo
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
,
String
derivedFrom
)
throws
ApiException
{
com
.
squareup
.
okhttp
.
Call
call
=
getNodeTemplatesValidateBeforeCall
(
id
,
typeName
,
nodeName
,
hasInterfaces
,
hasProperties
,
hasAttributes
,
hasRequirements
,
hasCapabilities
,
hasArtifacts
,
derivedFrom
,
null
,
null
);
public
ApiResponse
<
List
<
NodeTemplate
>>
getNodeTemplatesWithHttpInfo
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
)
throws
ApiException
{
com
.
squareup
.
okhttp
.
Call
call
=
getNodeTemplatesValidateBeforeCall
(
id
,
typeName
,
nodeName
,
hasInterfaces
,
hasProperties
,
hasAttributes
,
hasRequirements
,
hasCapabilities
,
hasArtifacts
,
null
,
null
);
Type
localVarReturnType
=
new
TypeToken
<
List
<
NodeTemplate
>>()
{
}.
getType
();
return
apiClient
.
execute
(
call
,
localVarReturnType
);
...
...
@@ -1341,13 +1342,12 @@ public class DefaultApi {
* @param hasRequirements filter if has requirements (optional)
* @param hasCapabilities filter if has capabilities (optional)
* @param hasArtifacts filter if has artifacts (optional)
* @param derivedFrom derived from (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing
* the request body object
*/
public
com
.
squareup
.
okhttp
.
Call
getNodeTemplatesAsync
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
,
String
derivedFrom
,
final
ApiCallback
<
List
<
NodeTemplate
>>
callback
)
throws
ApiException
{
public
com
.
squareup
.
okhttp
.
Call
getNodeTemplatesAsync
(
String
id
,
String
typeName
,
String
nodeName
,
Boolean
hasInterfaces
,
Boolean
hasProperties
,
Boolean
hasAttributes
,
Boolean
hasRequirements
,
Boolean
hasCapabilities
,
Boolean
hasArtifacts
,
final
ApiCallback
<
List
<
NodeTemplate
>>
callback
)
throws
ApiException
{
ProgressResponseBody
.
ProgressListener
progressListener
=
null
;
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
=
null
;
...
...
@@ -1368,7 +1368,7 @@ public class DefaultApi {
};
}
com
.
squareup
.
okhttp
.
Call
call
=
getNodeTemplatesValidateBeforeCall
(
id
,
typeName
,
nodeName
,
hasInterfaces
,
hasProperties
,
hasAttributes
,
hasRequirements
,
hasCapabilities
,
hasArtifacts
,
derivedFrom
,
progressListener
,
progressRequestListener
);
com
.
squareup
.
okhttp
.
Call
call
=
getNodeTemplatesValidateBeforeCall
(
id
,
typeName
,
nodeName
,
hasInterfaces
,
hasProperties
,
hasAttributes
,
hasRequirements
,
hasCapabilities
,
hasArtifacts
,
progressListener
,
progressRequestListener
);
Type
localVarReturnType
=
new
TypeToken
<
List
<
NodeTemplate
>>()
{
}.
getType
();
apiClient
.
executeAsync
(
call
,
localVarReturnType
,
callback
);
...
...
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/auth/ApiKeyAuth.java
0 → 100644
View file @
3dc7c5e2
/*
* tosca-sure
* TOSCA Simple qUeRy sErvice (SURE).
*
* OpenAPI spec version: 1.0.0
* Contact: S.Koulouzis@uva.nl
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
auth
;
import
java.util.Map
;
import
java.util.List
;
import
nl.uva.sne.drip.sure_tosca.client.Pair
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-12-09T20:19:44.689Z"
)
public
class
ApiKeyAuth
implements
Authentication
{
private
final
String
location
;
private
final
String
paramName
;
private
String
apiKey
;
private
String
apiKeyPrefix
;
public
ApiKeyAuth
(
String
location
,
String
paramName
)
{
this
.
location
=
location
;
this
.
paramName
=
paramName
;
}
public
String
getLocation
()
{
return
location
;
}
public
String
getParamName
()
{
return
paramName
;
}
public
String
getApiKey
()
{
return
apiKey
;
}
public
void
setApiKey
(
String
apiKey
)
{
this
.
apiKey
=
apiKey
;
}
public
String
getApiKeyPrefix
()
{
return
apiKeyPrefix
;
}
public
void
setApiKeyPrefix
(
String
apiKeyPrefix
)
{
this
.
apiKeyPrefix
=
apiKeyPrefix
;
}
@Override
public
void
applyToParams
(
List
<
Pair
>
queryParams
,
Map
<
String
,
String
>
headerParams
)
{
if
(
apiKey
==
null
)
{
return
;
}
String
value
;
if
(
apiKeyPrefix
!=
null
)
{
value
=
apiKeyPrefix
+
" "
+
apiKey
;
}
else
{
value
=
apiKey
;
}
if
(
"query"
.
equals
(
location
))
{
queryParams
.
add
(
new
Pair
(
paramName
,
value
));
}
else
if
(
"header"
.
equals
(
location
))
{
headerParams
.
put
(
paramName
,
value
);
}
}
}
drip-commons/src/main/java/nl/uva/sne/drip/
commons/sure-tosca/client
/auth/Authentication.java
→
drip-commons/src/main/java/nl/uva/sne/drip/
sure_tosca
/auth/Authentication.java
View file @
3dc7c5e2
...
...
@@ -9,16 +9,14 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package
nl
.
uva
.
sne
.
drip
.
auth
;
import
nl.uva.sne.drip.commons.sure_tosca.client.Pair
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
auth
;
import
java.util.Map
;
import
java.util.List
;
import
nl.uva.sne.drip.sure_tosca.client.Pair
;
public
interface
Authentication
{
/**
* Apply authentication settings to header and query params.
*
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/sure-tosca/client
/auth/HttpBasicAuth.java
→
drip-commons/src/main/java/nl/uva/sne/drip/
sure_tosca
/auth/HttpBasicAuth.java
View file @
3dc7c5e2
...
...
@@ -11,16 +11,16 @@
*/
package
nl
.
uva
.
sne
.
drip
.
auth
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
auth
;
import
nl.uva.sne.drip.commons.sure_tosca.client.Pair
;
import
com.squareup.okhttp.Credentials
;
import
java.util.Map
;
import
java.util.List
;
import
java.io.UnsupportedEncodingException
;
import
nl.uva.sne.drip.sure_tosca.client.Pair
;
public
class
HttpBasicAuth
implements
Authentication
{
private
String
username
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/sure-tosca/client
/auth/OAuth.java
→
drip-commons/src/main/java/nl/uva/sne/drip/
sure_tosca
/auth/OAuth.java
View file @
3dc7c5e2
...
...
@@ -11,14 +11,15 @@
*/
package
nl
.
uva
.
sne
.
drip
.
auth
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
auth
;
import
nl.uva.sne.drip.commons.sure_tosca.client.Pair
;
import
java.util.Map
;
import
java.util.List
;
import
nl.uva.sne.drip.sure_tosca.client.Pair
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
1-01T13:11:24.211
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
2-09T20:19:44.689
Z"
)
public
class
OAuth
implements
Authentication
{
private
String
accessToken
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/sure-tosca/client
/auth/OAuthFlow.java
→
drip-commons/src/main/java/nl/uva/sne/drip/
sure_tosca
/auth/OAuthFlow.java
View file @
3dc7c5e2
...
...
@@ -11,7 +11,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
auth
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
auth
;
public
enum
OAuthFlow
{
accessCode
,
implicit
,
password
,
application
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/ApiCallback.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/ApiCallback.java
View file @
3dc7c5e2
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
/*
* tosca-sure
* TOSCA Simple qUeRy sErvice (SURE).
...
...
@@ -12,6 +11,8 @@ package nl.uva.sne.drip.commons.sure_tosca.client;
*/
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
import
java.io.IOException
;
import
java.util.Map
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/ApiClient.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/ApiClient.java
View file @
3dc7c5e2
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
/*
* tosca-sure
* TOSCA Simple qUeRy sErvice (SURE).
...
...
@@ -11,19 +9,22 @@ package nl.uva.sne.drip.commons.sure_tosca.client;
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
import
com.squareup.okhttp.*
;
import
javax.net.ssl.*
;
import
java.util.*
;
import
org.threeten.bp.LocalDate
;
import
org.threeten.bp.OffsetDateTime
;
import
org.threeten.bp.format.DateTimeFormatter
;
import
com.squareup.okhttp.internal.http.HttpMethod
;
import
com.squareup.okhttp.logging.HttpLoggingInterceptor
;
import
com.squareup.okhttp.logging.HttpLoggingInterceptor.Level
;
import
okio.BufferedSink
;
import
okio.Okio
;
import
org.threeten.bp.LocalDate
;
import
org.threeten.bp.OffsetDateTime
;
import
org.threeten.bp.format.DateTimeFormatter
;
import
javax.net.ssl.*
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -39,16 +40,15 @@ import java.security.cert.CertificateException;
import
java.security.cert.CertificateFactory
;
import
java.security.cert.X509Certificate
;
import
java.text.DateFormat
;
import
java.util.*
;
import
java.util.Map.Entry
;
import
java.util.concurrent.TimeUnit
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
nl.uva.sne.drip.auth.Authentication
;
import
nl.uva.sne.drip.auth.HttpBasicAuth
;
import
nl.uva.sne.drip.auth.ApiKeyAuth
;
import
nl.uva.sne.drip.auth.OAuth
;
import
nl.uva.sne.drip.
sure_tosca.
auth.Authentication
;
import
nl.uva.sne.drip.
sure_tosca.
auth.HttpBasicAuth
;
import
nl.uva.sne.drip.
sure_tosca.
auth.ApiKeyAuth
;
import
nl.uva.sne.drip.
sure_tosca.
auth.OAuth
;
public
class
ApiClient
{
...
...
@@ -79,7 +79,6 @@ public class ApiClient {
public
ApiClient
()
{
httpClient
=
new
OkHttpClient
();
verifyingSsl
=
true
;
json
=
new
JSON
();
...
...
@@ -105,7 +104,8 @@ public class ApiClient {
/**
* Set base path
*
* @param basePath Base path of the URL (e.g https://localhost/tosca-sure/1.0.0
* @param basePath Base path of the URL (e.g
* https://localhost/tosca-sure/1.0.0
* @return An instance of OkHttpClient
*/
public
ApiClient
setBasePath
(
String
basePath
)
{
...
...
@@ -163,9 +163,9 @@ public class ApiClient {
}
/**
* Configure whether to verify certificate and hostname when making https
requests.
*
Default to true.
*
NOTE: Do NOT set to false in production code,
otherwise you would face multiple types of cryptographic attacks.
* Configure whether to verify certificate and hostname when making https
*
requests. Default to true. NOTE: Do NOT set to false in production code,
* otherwise you would face multiple types of cryptographic attacks.
*
* @param verifyingSsl True to verify TLS/SSL connection
* @return ApiClient
...
...
@@ -203,8 +203,8 @@ public class ApiClient {
}
/**
* Configure client keys to use for authorization in an SSL session.
*
Use
null to reset to default.
* Configure client keys to use for authorization in an SSL session.
Use
* null to reset to default.
*
* @param managers The KeyManagers to use
* @return ApiClient
...
...
@@ -392,11 +392,12 @@ public class ApiClient {
}
/**
* The path of temporary folder used to store downloaded files from
endpoints
*
with file response. The default value is <code>null</code>, i.e. using
* the system's default tempopary folder.
* The path of temporary folder used to store downloaded files from
*
endpoints with file response. The default value is <code>null</code>,
*
i.e. using
the system's default tempopary folder.
*
* @see <a href="https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile">createTempFile</a>
* @see
* <a href="https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile">createTempFile</a>
* @return Temporary folder path
*/
public
String
getTempFolderPath
()
{
...
...
@@ -424,8 +425,8 @@ public class ApiClient {
}
/**
* Sets the connect timeout (in milliseconds).
*
A value of 0 means no
timeout, otherwise values must be between 1 and
* Sets the connect timeout (in milliseconds).
A value of 0 means no
* timeout, otherwise values must be between 1 and
* {@link Integer#MAX_VALUE}.
*
* @param connectionTimeout connection timeout in milliseconds
...
...
@@ -446,9 +447,8 @@ public class ApiClient {
}
/**
* Sets the read timeout (in milliseconds).
* A value of 0 means no timeout, otherwise values must be between 1 and
* {@link Integer#MAX_VALUE}.
* Sets the read timeout (in milliseconds). A value of 0 means no timeout,
* otherwise values must be between 1 and {@link Integer#MAX_VALUE}.
*
* @param readTimeout read timeout in milliseconds
* @return Api client
...
...
@@ -468,9 +468,8 @@ public class ApiClient {
}
/**
* Sets the write timeout (in milliseconds).
* A value of 0 means no timeout, otherwise values must be between 1 and
* {@link Integer#MAX_VALUE}.
* Sets the write timeout (in milliseconds). A value of 0 means no timeout,
* otherwise values must be between 1 and {@link Integer#MAX_VALUE}.
*
* @param writeTimeout connection timeout in milliseconds
* @return Api client
...
...
@@ -495,7 +494,7 @@ public class ApiClient {
return
jsonStr
.
substring
(
1
,
jsonStr
.
length
()
-
1
);
}
else
if
(
param
instanceof
Collection
)
{
StringBuilder
b
=
new
StringBuilder
();
for
(
Object
o
:
(
Collection
)
param
)
{
for
(
Object
o
:
(
Collection
)
param
)
{
if
(
b
.
length
()
>
0
)
{
b
.
append
(
","
);
}
...
...
@@ -508,7 +507,8 @@ public class ApiClient {
}
/**
* Formats the specified query parameter to a list containing a single {@code Pair} object.
* Formats the specified query parameter to a list containing a single
* {@code Pair} object.
*
* Note that {@code value} must not be a collection.
*
...
...
@@ -517,19 +517,23 @@ public class ApiClient {
* @return A list containing a single {@code Pair} object.
*/
public
List
<
Pair
>
parameterToPair
(
String
name
,
Object
value
)
{
List
<
Pair
>
params
=
new
ArrayList
<
Pair
>();
List
<
Pair
>
params
=
new
ArrayList
<>();
// preconditions
if
(
name
==
null
||
name
.
isEmpty
()
||
value
==
null
||
value
instanceof
Collection
)
return
params
;
if
(
name
==
null
||
name
.
isEmpty
()
||
value
==
null
||
value
instanceof
Collection
)
{
return
params
;
}
params
.
add
(
new
Pair
(
name
,
parameterToString
(
value
)));
return
params
;
}
/**
* Formats the specified collection query parameters to a list of {@code Pair} objects.
* Formats the specified collection query parameters to a list of
* {@code Pair} objects.
*
* Note that the values of each of the returned Pair objects are percent-encoded.
* Note that the values of each of the returned Pair objects are
* percent-encoded.
*
* @param collectionFormat The collection format of the parameter.
* @param name The name of the parameter.
...
...
@@ -565,7 +569,7 @@ public class ApiClient {
delimiter
=
escapeString
(
"|"
);
}
StringBuilder
sb
=
new
StringBuilder
()
;
StringBuilder
sb
=
new
StringBuilder
();
for
(
Object
item
:
value
)
{
sb
.
append
(
delimiter
);
sb
.
append
(
escapeString
(
parameterToString
(
item
)));
...
...
@@ -577,8 +581,7 @@ public class ApiClient {
}
/**
* Sanitize filename by removing path.
* e.g. ../../sun.gif becomes sun.gif
* Sanitize filename by removing path. e.g. ../../sun.gif becomes sun.gif
*
* @param filename The filename to be sanitized
* @return The sanitized filename
...
...
@@ -588,29 +591,26 @@ public class ApiClient {
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* "* / *" is also default to JSON
* Check if the given MIME is a JSON MIME. JSON MIME examples:
* application/json application/json; charset=UTF8 APPLICATION/JSON
* application/vnd.company+json "* / *" is also default to JSON
*
* @param mime MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public
boolean
isJsonMime
(
String
mime
)
{
String
jsonMime
=
"(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"
;
return
mime
!=
null
&&
(
mime
.
matches
(
jsonMime
)
||
mime
.
equals
(
"*/*"
));
String
jsonMime
=
"(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"
;
return
mime
!=
null
&&
(
mime
.
matches
(
jsonMime
)
||
mime
.
equals
(
"*/*"
));
}
/**
* Select the Accept header's value from the given accepts array:
*
if JSON exists in the given array, use it;
*
otherwise use all of them (joining
into a string)
* Select the Accept header's value from the given accepts array:
if JSON
*
exists in the given array, use it; otherwise use all of them (joining
* into a string)
*
* @param accepts The accepts array to select from
* @return The Accept header to use. If the given array is empty,
*
null will
be returned (not to set the Accept header explicitly).
* @return The Accept header to use. If the given array is empty,
null will
* be returned (not to set the Accept header explicitly).
*/
public
String
selectHeaderAccept
(
String
[]
accepts
)
{
if
(
accepts
.
length
==
0
)
{
...
...
@@ -625,17 +625,17 @@ public class ApiClient {
}
/**
* Select the Content-Type header's value from the given array:
*
if JSON exists in the given array, use it;
*
otherwise use the first one of the
array.
* Select the Content-Type header's value from the given array:
if JSON
*
exists in the given array, use it; otherwise use the first one of the
* array.
*
* @param contentTypes The Content-Type array to select from
* @return The Content-Type header to use. If the given array is empty,
*
or
matches "any", JSON will be used.
* @return The Content-Type header to use. If the given array is empty,
or
* matches "any", JSON will be used.
*/
public
String
selectHeaderContentType
(
String
[]
contentTypes
)
{
if
(
contentTypes
.
length
==
0
||
contentTypes
[
0
].
equals
(
"*/*"
))
{
return
"application/json"
;
return
"application/json"
;
}
for
(
String
contentType
:
contentTypes
)
{
if
(
isJsonMime
(
contentType
))
{
...
...
@@ -660,15 +660,15 @@ public class ApiClient {
}
/**
* Deserialize response body to Java object, according to the return type
and
* the Content-Type response header.
* Deserialize response body to Java object, according to the return type
*
and
the Content-Type response header.
*
* @param <T> Type
* @param response HTTP response
* @param returnType The type of the Java object
* @return The deserialized Java object
* @throws ApiException If fail to deserialize response body, i.e. cannot
read response body
*
or the Content-Type of the response is not supported.
* @throws ApiException If fail to deserialize response body, i.e. cannot
*
read response body
or the Content-Type of the response is not supported.
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
>
T
deserialize
(
Response
response
,
Type
returnType
)
throws
ApiException
{
...
...
@@ -690,10 +690,11 @@ public class ApiClient {
String
respBody
;
try
{
if
(
response
.
body
()
!=
null
)
if
(
response
.
body
()
!=
null
)
{
respBody
=
response
.
body
().
string
();
else
}
else
{
respBody
=
null
;
}
}
catch
(
IOException
e
)
{
throw
new
ApiException
(
e
);
}
...
...
@@ -722,8 +723,8 @@ public class ApiClient {
}
/**
* Serialize the given Java object into request body according to the
object's
* class and the request Content-Type.
* Serialize the given Java object into request body according to the
*
object's
class and the request Content-Type.
*
* @param obj The Java object
* @param contentType The request Content-Type
...
...
@@ -754,7 +755,8 @@ public class ApiClient {
* Download file from the given response.
*
* @param response An instance of the Response object
* @throws ApiException If fail to read file content from response and write to disk
* @throws ApiException If fail to read file content from response and write
* to disk
* @return Downloaded file
*/
public
File
downloadFileFromResponse
(
Response
response
)
throws
ApiException
{
...
...
@@ -802,14 +804,16 @@ public class ApiClient {
suffix
=
filename
.
substring
(
pos
);
}
// File.createTempFile requires the prefix to be at least three characters long
if
(
prefix
.
length
()
<
3
)
if
(
prefix
.
length
()
<
3
)
{
prefix
=
"download-"
;
}
}
if
(
tempFolderPath
==
null
)
if
(
tempFolderPath
==
null
)
{
return
File
.
createTempFile
(
prefix
,
suffix
);
else
}
else
{
return
File
.
createTempFile
(
prefix
,
suffix
,
new
File
(
tempFolderPath
));
}
}
/**
...
...
@@ -825,14 +829,15 @@ public class ApiClient {
}
/**
* Execute HTTP call and deserialize the HTTP response body into the given return type.
* Execute HTTP call and deserialize the HTTP response body into the given
* return type.
*
* @param returnType The return type used to deserialize HTTP response body
* @param <T> The return type corresponding to (same with) returnType
* @param call Call
* @return ApiResponse object containing response status, headers and
*
data,
which is a Java object deserialized from response body and would be null
*
when returnType is null.
* @return ApiResponse object containing response status, headers and
data,
* which is a Java object deserialized from response body and would be null
* when returnType is null.
* @throws ApiException If fail to execute the call
*/
public
<
T
>
ApiResponse
<
T
>
execute
(
Call
call
,
Type
returnType
)
throws
ApiException
{
...
...
@@ -888,13 +893,14 @@ public class ApiClient {
}
/**
* Handle the given response, return the deserialized object when the response is successful.
* Handle the given response, return the deserialized object when the
* response is successful.
*
* @param <T> Type
* @param response Response
* @param returnType Return type
* @throws ApiException If the response has a unsuccessful status code or
*
fail to deserialize the response body
* fail to deserialize the response body
* @return Type
*/
public
<
T
>
T
handleResponse
(
Response
response
,
Type
returnType
)
throws
ApiException
{
...
...
@@ -930,7 +936,8 @@ public class ApiClient {
* Build HTTP call with the given options.
*
* @param path The sub-path of the HTTP URL
* @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE"
* @param method The request method, one of "GET", "HEAD", "OPTIONS",
* "POST", "PUT", "PATCH" and "DELETE"
* @param queryParams The query parameters
* @param collectionQueryParams The collection query parameters
* @param body The request body object
...
...
@@ -951,7 +958,8 @@ public class ApiClient {
* Build an HTTP request with the given options.
*
* @param path The sub-path of the HTTP URL
* @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE"
* @param method The request method, one of "GET", "HEAD", "OPTIONS",
* "POST", "PUT", "PATCH" and "DELETE"
* @param queryParams The query parameters
* @param collectionQueryParams The collection query parameters
* @param body The request body object
...
...
@@ -959,7 +967,7 @@ public class ApiClient {
* @param formParams The form parameters
* @param authNames The authentications to apply
* @param progressRequestListener Progress request listener
* @return The HTTP request
* @return The HTTP request
* @throws ApiException If fail to serialize the request body object
*/
public
Request
buildRequest
(
String
path
,
String
method
,
List
<
Pair
>
queryParams
,
List
<
Pair
>
collectionQueryParams
,
Object
body
,
Map
<
String
,
String
>
headerParams
,
Map
<
String
,
Object
>
formParams
,
String
[]
authNames
,
ProgressRequestBody
.
ProgressRequestListener
progressRequestListener
)
throws
ApiException
{
...
...
@@ -996,7 +1004,7 @@ public class ApiClient {
Request
request
=
null
;
if
(
progressRequestListener
!=
null
&&
reqBody
!=
null
)
{
if
(
progressRequestListener
!=
null
&&
reqBody
!=
null
)
{
ProgressRequestBody
progressRequestBody
=
new
ProgressRequestBody
(
reqBody
,
progressRequestListener
);
request
=
reqBuilder
.
method
(
method
,
progressRequestBody
).
build
();
}
else
{
...
...
@@ -1007,7 +1015,8 @@ public class ApiClient {
}
/**
* Build full URL by concatenating base path, the given sub path and query parameters.
* Build full URL by concatenating base path, the given sub path and query
* parameters.
*
* @param path The sub path
* @param queryParams The query parameters
...
...
@@ -1076,13 +1085,15 @@ public class ApiClient {
* Update query and header parameters based on authentication settings.
*
* @param authNames The authentications to apply
* @param queryParams
List of query parameters
* @param headerParams
Map of header parameters
* @param queryParams List of query parameters
* @param headerParams Map of header parameters
*/
public
void
updateParamsForAuth
(
String
[]
authNames
,
List
<
Pair
>
queryParams
,
Map
<
String
,
String
>
headerParams
)
{
for
(
String
authName
:
authNames
)
{
Authentication
auth
=
authentications
.
get
(
authName
);
if
(
auth
==
null
)
throw
new
RuntimeException
(
"Authentication undefined: "
+
authName
);
if
(
auth
==
null
)
{
throw
new
RuntimeException
(
"Authentication undefined: "
+
authName
);
}
auth
.
applyToParams
(
queryParams
,
headerParams
);
}
}
...
...
@@ -1094,7 +1105,7 @@ public class ApiClient {
* @return RequestBody
*/
public
RequestBody
buildRequestBodyFormEncoding
(
Map
<
String
,
Object
>
formParams
)
{
FormEncodingBuilder
formBuilder
=
new
FormEncodingBuilder
();
FormEncodingBuilder
formBuilder
=
new
FormEncodingBuilder
();
for
(
Entry
<
String
,
Object
>
param
:
formParams
.
entrySet
())
{
formBuilder
.
add
(
param
.
getKey
(),
parameterToString
(
param
.
getValue
()));
}
...
...
@@ -1102,8 +1113,8 @@ public class ApiClient {
}
/**
* Build a multipart (file uploading) request body with the given form
parameters,
* which could contain text fields and file fields.
* Build a multipart (file uploading) request body with the given form
*
parameters,
which could contain text fields and file fields.
*
* @param formParams Form parameters in the form of Map
* @return RequestBody
...
...
@@ -1125,7 +1136,8 @@ public class ApiClient {
}
/**
* Guess Content-Type header from the given file (defaults to "application/octet-stream").
* Guess Content-Type header from the given file (defaults to
* "application/octet-stream").
*
* @param file The given file
* @return The guessed Content-Type
...
...
@@ -1140,8 +1152,8 @@ public class ApiClient {
}
/**
* Apply SSL related settings to httpClient according to the current values
of
* verifyingSsl and sslCaCert.
* Apply SSL related settings to httpClient according to the current values
*
of
verifyingSsl and sslCaCert.
*/
private
void
applySslSettings
()
{
try
{
...
...
@@ -1150,17 +1162,25 @@ public class ApiClient {
if
(!
verifyingSsl
)
{
TrustManager
trustAll
=
new
X509TrustManager
()
{
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{}
public
void
checkClientTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{}
public
void
checkServerTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
@Override
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
null
;
}
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
null
;
}
};
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"TLS"
);
trustManagers
=
new
TrustManager
[]{
trustAll
};
trustManagers
=
new
TrustManager
[]{
trustAll
};
hostnameVerifier
=
new
HostnameVerifier
()
{
@Override
public
boolean
verify
(
String
hostname
,
SSLSession
session
)
{
return
true
;
}
public
boolean
verify
(
String
hostname
,
SSLSession
session
)
{
return
true
;
}
};
}
else
if
(
sslCaCert
!=
null
)
{
char
[]
password
=
null
;
// Any password will work.
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/ApiException.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/ApiException.java
View file @
3dc7c5e2
...
...
@@ -11,12 +11,12 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
import
java.util.Map
;
import
java.util.List
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
1-01T13:11:24.211
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
2-09T20:19:44.689
Z"
)
public
class
ApiException
extends
Exception
{
private
int
code
=
0
;
private
Map
<
String
,
List
<
String
>>
responseHeaders
=
null
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/ApiResponse.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/ApiResponse.java
View file @
3dc7c5e2
...
...
@@ -11,7 +11,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
import
java.util.List
;
import
java.util.Map
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/Configuration.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/Configuration.java
View file @
3dc7c5e2
...
...
@@ -11,9 +11,9 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
1-01T13:11:24.211
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
2-09T20:19:44.689
Z"
)
public
class
Configuration
{
private
static
ApiClient
defaultApiClient
=
new
ApiClient
();
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/GzipRequestInterceptor.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/GzipRequestInterceptor.java
View file @
3dc7c5e2
...
...
@@ -11,7 +11,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
import
com.squareup.okhttp.*
;
import
okio.Buffer
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/JSON.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/JSON.java
View file @
3dc7c5e2
...
...
@@ -11,7 +11,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/Pair.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/Pair.java
View file @
3dc7c5e2
...
...
@@ -11,9 +11,9 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
1-01T13:11:24.211
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
2-09T20:19:44.689
Z"
)
public
class
Pair
{
private
String
name
=
""
;
private
String
value
=
""
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/ProgressRequestBody.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/ProgressRequestBody.java
View file @
3dc7c5e2
...
...
@@ -11,7 +11,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
import
com.squareup.okhttp.MediaType
;
import
com.squareup.okhttp.RequestBody
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/ProgressResponseBody.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/ProgressResponseBody.java
View file @
3dc7c5e2
...
...
@@ -11,7 +11,7 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
import
com.squareup.okhttp.MediaType
;
import
com.squareup.okhttp.ResponseBody
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/
commons/
sure_tosca/client/StringUtil.java
→
drip-commons/src/main/java/nl/uva/sne/drip/sure_tosca/client/StringUtil.java
View file @
3dc7c5e2
...
...
@@ -11,9 +11,9 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
sure_tosca
.
client
;
package
nl
.
uva
.
sne
.
drip
.
sure_tosca
.
client
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
1-01T13:11:24.211
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.JavaClientCodegen"
,
date
=
"2019-1
2-09T20:19:44.689
Z"
)
public
class
StringUtil
{
/**
* Check if the given array contains the given value (with case-insensitive comparison).
...
...
drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
0 → 100644
View file @
3dc7c5e2
/*
* Copyright 2019 S. Koulouzis
*
* 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.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.nio.file.Files
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Properties
;
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
.*;
import
nl.uva.sne.drip.sure_tosca.client.ApiException
;
/**
*
* @author S.Koulouzis
*/
public
class
ToscaHelperTest
{
private
static
ObjectMapper
objectMapper
;
private
static
final
String
testUpdatedApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_2_topologies.yaml"
;
private
static
ToscaHelper
instance
;
private
static
ToscaTemplate
toscaTemplate
;
public
ToscaHelperTest
()
{
}
@BeforeClass
public
static
void
setUpClass
()
throws
UnsupportedEncodingException
,
JsonProcessingException
,
IOException
,
ApiException
{
Properties
prop
=
new
Properties
();
String
resourceName
=
"src/test/resources/application.properties"
;
prop
.
load
(
new
FileInputStream
(
resourceName
));
byte
[]
bytes
=
Files
.
readAllBytes
(
Paths
.
get
(
testUpdatedApplicationExampleToscaFilePath
));
String
ymlStr
=
new
String
(
bytes
,
"UTF-8"
);
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
toscaTemplate
=
objectMapper
.
readValue
(
ymlStr
,
ToscaTemplate
.
class
);
instance
=
new
ToscaHelper
(
toscaTemplate
,
prop
.
getProperty
(
"sure-tosca.base.path"
));
}
@AfterClass
public
static
void
tearDownClass
()
{
}
@Before
public
void
setUp
()
{
}
@After
public
void
tearDown
()
{
}
/**
* Test of getId method, of class ToscaHelper.
*/
@Test
public
void
testGetId
()
{
System
.
out
.
println
(
"getId"
);
Integer
result
=
instance
.
getId
();
assertNotNull
(
result
);
}
/**
* Test of getProvisionInterfaceDefinitions method, of class ToscaHelper.
*/
@Test
public
void
testGetProvisionInterfaceDefinitions
()
throws
Exception
{
System
.
out
.
println
(
"getProvisionInterfaceDefinitions"
);
List
<
String
>
toscaInterfaceTypes
=
new
ArrayList
<>();
toscaInterfaceTypes
.
add
(
"tosca.interfaces.ARTICONF.CloudsStorm"
);
List
<
Map
<
String
,
Object
>>
result
=
instance
.
getProvisionInterfaceDefinitions
(
toscaInterfaceTypes
);
assertNotNull
(
result
);
}
/**
* Test of getVMTopologyTemplates method, of class ToscaHelper.
*/
@Test
public
void
testGetVMTopologyTemplates
()
throws
Exception
{
System
.
out
.
println
(
"getVMTopologyTemplates"
);
List
<
NodeTemplate
>
result
=
instance
.
getVMTopologyTemplates
();
assertNotNull
(
result
);
for
(
NodeTemplate
nodeTemplate:
result
){
assertEquals
(
nodeTemplate
.
getType
(),
"tosca.nodes.ARTICONF.VM.topology"
);
}
}
}
drip-commons/src/test/resources/application.properties
0 → 100644
View file @
3dc7c5e2
message.broker.host
=
127.0.0.1
message.broker.username
=
guest
message.broker.password
=
guest
message.broker.queue.provisioner
=
provisioner
message.broker.queue.planner
=
planner
message.broker.queue.deployer
=
deployer
sure-tosca.base.path
=
http://localhost:8081/tosca-sure/1.0.0
drip-provisioner/pom.xml
View file @
3dc7c5e2
...
...
@@ -49,6 +49,18 @@
<version>
0.1.54
</version>
<type>
jar
</type>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.hamcrest
</groupId>
<artifactId>
hamcrest-core
</artifactId>
<version>
1.3
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
3dc7c5e2
...
...
@@ -13,14 +13,12 @@ import java.io.File;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
nl.uva.sne.drip.commons.sure_tosca.client.ApiException
;
import
nl.uva.sne.drip.commons.utils.ToscaHelper
;
import
nl.uva.sne.drip.model.CloudsStormSubTopology
;
import
nl.uva.sne.drip.model.CloudsStormTopTopology
;
import
nl.uva.sne.drip.model.CloudsStormVM
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
org.apache.commons.io.FilenameUtils
;
...
...
@@ -30,41 +28,41 @@ import org.apache.commons.io.FilenameUtils;
* @author S. Koulouzis
*/
class
CloudStormService
{
private
List
<
Map
.
Entry
>
vmTopologies
;
private
String
tempInputDirPath
;
private
final
ToscaTemplate
toscaTemplate
;
private
final
ToscaHelper
helper
;
CloudStormService
(
String
sureToscaBasePath
,
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
{
this
.
toscaTemplate
=
toscaTemplate
;
this
.
helper
=
new
ToscaHelper
(
toscaTemplate
,
sureToscaBasePath
);
CloudStormService
(
String
sureToscaBasePath
,
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
{
this
.
toscaTemplate
=
toscaTemplate
;
this
.
helper
=
new
ToscaHelper
(
toscaTemplate
,
sureToscaBasePath
);
}
ToscaTemplate
execute
()
throws
FileNotFoundException
,
JSchException
,
IO
Exception
{
public
ToscaTemplate
execute
()
throws
FileNotFoundException
,
JSchException
,
IOException
,
Api
Exception
{
tempInputDirPath
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
File
.
separator
+
"Input-"
+
Long
.
toString
(
System
.
nanoTime
())
+
File
.
separator
;
File
tempInputDir
=
new
File
(
tempInputDirPath
);
if
(!(
tempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
tempInputDir
.
getAbsolutePath
());
}
buildCloudStormTopTopology
(
toscaTemplate
);
return
toscaTemplate
;
}
private
CloudsStormTopTopology
buildCloudStormTopTopology
(
ToscaTemplate
toscaTemplate
)
throws
JSchException
,
IOException
{
private
CloudsStormTopTopology
buildCloudStormTopTopology
(
ToscaTemplate
toscaTemplate
)
throws
JSchException
,
IOException
,
ApiException
{
CloudsStormTopTopology
topTopology
=
new
CloudsStormTopTopology
();
String
publicKeyPath
=
buildSSHKeyPair
();
topTopology
.
setPublicKeyPath
(
publicKeyPath
);
topTopology
.
setUserName
(
getUserName
());
List
<
CloudsStormSubTopology
>
topologies
=
getCloudsStormSubTopologies
(
toscaTemplate
);
topTopology
.
setTopologies
(
topologies
);
return
topTopology
;
}
private
String
buildSSHKeyPair
()
throws
JSchException
,
IOException
{
String
userPublicKeyName
=
"id_rsa.pub"
;
String
publicKeyPath
=
"name@"
+
userPublicKeyName
;
...
...
@@ -76,29 +74,32 @@ class CloudStormService {
kpair
.
dispose
();
return
publicKeyPath
;
}
private
String
getUserName
()
{
return
"vm_user"
;
}
private
List
<
CloudsStormSubTopology
>
getCloudsStormSubTopologies
(
ToscaTemplate
toscaTemplate
)
throws
ApiException
{
List
<
NodeTemplate
>
vmTopologyTemplates
=
helper
.
getVMTopologyTemplates
(
toscaTemplate
);
List
<
NodeTemplate
>
vmTopologyTemplates
=
helper
.
getVMTopologyTemplates
();
List
<
CloudsStormSubTopology
>
cloudsStormSubTopologies
=
new
ArrayList
<>();
for
(
NodeTemplate
nodeTemplate:
vmTopologyTemplates
){
int
i
=
0
;
for
(
NodeTemplate
nodeTemplate
:
vmTopologyTemplates
)
{
CloudsStormSubTopology
cloudsStormSubTopology
=
new
CloudsStormSubTopology
();
Map
<
String
,
Object
>
properties
=
nodeTemplate
.
getProperties
();
String
domain
=
(
String
)
properties
.
get
(
"domain"
);
String
provider
=
(
String
)
properties
.
get
(
"provider"
);
cloudsStormSubTopology
.
setCloudProvider
(
domain
);
cloudsStormSubTopology
.
setCloudProvider
(
provider
);
cloudsStormSubTopology
.
setTopology
(
"vm"
);
cloudsStormSubTopology
.
setTopology
(
"vm_topology"
+
i
);
// List<NodeTemplate> vmTopologyTemplates = helper.getVMTemplatesForTopology();
// CloudsStormVM cloudsStormVM = new CloudsStormVM();
// cloudsStormVM.setName("node"+i);
// cloudsStormVM.setNodeType(domain);
i
++;
}
// List<CloudsStormVM> vms = new ArrayList<>();
// CloudsStormVM cloudsStormVM = new CloudsStormVM();
// cloudsStormVM.setName("Node1");
...
...
@@ -106,5 +107,5 @@ class CloudStormService {
// vms.add(cloudsStormVM);
return
cloudsStormSubTopologies
;
}
}
drip-provisioner/src/main/resources/application.properies
View file @
3dc7c5e2
message.broker.host=127.0.0.1
message.broker.username=guest
message.broker.password=guest
message.broker.queue.provisioner=provisioner
\ No newline at end of file
message.broker.queue.provisioner=provisioner
message.broker.queue.planner=planner
message.broker.queue.deployer=deployer
sure-tosca.base.path=http://localhost:8081/tosca-sure/1.0.0
drip-provisioner/src/test/java/nl/uva/sne/drip/provisioner/CloudStormServiceTest.java
0 → 100644
View file @
3dc7c5e2
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
nl
.
uva
.
sne
.
drip
.
provisioner
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.Properties
;
import
nl.uva.sne.drip.commons.sure_tosca.client.ApiException
;
import
nl.uva.sne.drip.commons.utils.ToscaHelper
;
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
CloudStormServiceTest
{
private
static
ObjectMapper
objectMapper
;
private
static
final
String
testUpdatedApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_2_topologies.yaml"
;
private
static
CloudStormService
instance
;
private
static
ToscaTemplate
toscaTemplate
;
public
CloudStormServiceTest
()
{
}
@BeforeClass
public
static
void
setUpClass
()
throws
FileNotFoundException
,
IOException
,
JsonProcessingException
,
ApiException
{
Properties
prop
=
new
Properties
();
String
resourceName
=
"src/test/resources/application.properies"
;
prop
.
load
(
new
FileInputStream
(
resourceName
));
byte
[]
bytes
=
Files
.
readAllBytes
(
Paths
.
get
(
testUpdatedApplicationExampleToscaFilePath
));
String
ymlStr
=
new
String
(
bytes
,
"UTF-8"
);
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
toscaTemplate
=
objectMapper
.
readValue
(
ymlStr
,
ToscaTemplate
.
class
);
instance
=
new
CloudStormService
(
prop
.
getProperty
(
"sure-tosca.base.path"
),
toscaTemplate
);
}
@AfterClass
public
static
void
tearDownClass
()
{
}
@Before
public
void
setUp
()
{
}
@After
public
void
tearDown
()
{
}
/**
* Test of execute method, of class CloudStormService.
*/
@Test
public
void
testExecute
()
throws
Exception
{
System
.
out
.
println
(
"execute"
);
ToscaTemplate
expResult
=
null
;
ToscaTemplate
result
=
instance
.
execute
();
}
}
drip-provisioner/src/test/resources/application.properies
0 → 100644
View file @
3dc7c5e2
message.broker.host=127.0.0.1
message.broker.username=guest
message.broker.password=guest
message.broker.queue.provisioner=provisioner
message.broker.queue.planner=planner
message.broker.queue.deployer=deployer
sure-tosca.base.path=http://localhost:8081/tosca-sure/1.0.0
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