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
d790ac01
Commit
d790ac01
authored
Mar 19, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try to add zip artifact
parent
8afa984c
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
58 deletions
+92
-58
Converter.java
...rc/main/java/nl/uva/sne/drip/commons/utils/Converter.java
+5
-13
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+64
-45
CloudStormServiceTest.java
...va/nl/uva/sne/drip/provisioner/CloudStormServiceTest.java
+23
-0
No files found.
commons/src/main/java/nl/uva/sne/drip/commons/utils/Converter.java
View file @
d790ac01
...
...
@@ -15,9 +15,11 @@
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
utils
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.FileVisitResult
;
import
java.nio.file.Files
;
...
...
@@ -27,11 +29,14 @@ import java.nio.file.SimpleFileVisitor;
import
java.nio.file.attribute.BasicFileAttributes
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
java.util.zip.ZipOutputStream
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -100,17 +105,4 @@ public class Converter {
return
new
String
(
encodedBytes
,
StandardCharsets
.
UTF_8
);
}
public
static
void
zipFolder
(
Path
sourceFolderPath
,
Path
zipPath
)
throws
FileNotFoundException
,
IOException
{
try
(
ZipOutputStream
zos
=
new
ZipOutputStream
(
new
FileOutputStream
(
zipPath
.
toFile
())))
{
Files
.
walkFileTree
(
sourceFolderPath
,
new
SimpleFileVisitor
<
Path
>()
{
@Override
public
FileVisitResult
visitFile
(
Path
file
,
BasicFileAttributes
attrs
)
throws
IOException
{
zos
.
putNextEntry
(
new
ZipEntry
(
sourceFolderPath
.
relativize
(
file
).
toString
()));
Files
.
copy
(
file
,
zos
);
zos
.
closeEntry
();
return
FileVisitResult
.
CONTINUE
;
}
});
}
}
}
provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
d790ac01
This diff is collapsed.
Click to expand it.
provisioner/src/test/java/nl/uva/sne/drip/provisioner/CloudStormServiceTest.java
View file @
d790ac01
...
...
@@ -19,11 +19,16 @@ import java.util.List;
import
java.util.Map
;
import
nl.uva.sne.drip.commons.utils.ToscaHelper
;
import
nl.uva.sne.drip.model.Message
;
import
nl.uva.sne.drip.model.NodeTemplateMap
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormInfrasCode
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormTopTopology
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVM
;
import
nl.uva.sne.drip.model.cloud.storm.CredentialInfo
;
import
nl.uva.sne.drip.model.cloud.storm.InfrasCode
;
import
nl.uva.sne.drip.model.cloud.storm.OpCode
;
import
nl.uva.sne.drip.model.tosca.Credential
;
import
nl.uva.sne.drip.model.tosca.ToscaTemplate
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
APP_FOLDER_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
INFRASTUCTURE_CODE_FILE_NAME
;
import
static
nl
.
uva
.
sne
.
drip
.
provisioner
.
CloudStormService
.
INFS_FOLDER_NAME
;
...
...
@@ -279,4 +284,22 @@ public class CloudStormServiceTest {
}
}
/**
* Test of addCloudStromArtifacts method, of class CloudStormService.
*/
@Test
public
void
testAddCloudStromArtifacts
()
throws
Exception
{
if
(
ToscaHelper
.
isServiceUp
(
sureToscaBasePath
))
{
}
System
.
out
.
println
(
"addCloudStromArtifacts"
);
initPaths
();
CloudStormService
instance
=
getService
(
messageExampleProvisioneRequestFilePath
);
List
<
NodeTemplateMap
>
vmTopologiesMaps
=
instance
.
getHelper
().
getVMTopologyTemplates
();
for
(
NodeTemplateMap
vmTopologyMap
:
vmTopologiesMaps
)
{
vmTopologyMap
=
instance
.
addCloudStromArtifacts
(
vmTopologyMap
,
tempInputDirPath
);
}
}
}
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