diff --git a/server/src/test/java/org/opentosca/toscana/core/csar/CsarFilesystemDaoTest.java b/server/src/test/java/org/opentosca/toscana/core/csar/CsarFilesystemDaoTest.java index 4787a2a69..3e18e3295 100644 --- a/server/src/test/java/org/opentosca/toscana/core/csar/CsarFilesystemDaoTest.java +++ b/server/src/test/java/org/opentosca/toscana/core/csar/CsarFilesystemDaoTest.java @@ -60,7 +60,7 @@ public void create() throws Exception { File transformationFolder = new File(csarFolder, CsarFilesystemDao.TRANSFORMATION_DIR); assertTrue(contentFolder.isDirectory()); assertTrue(transformationFolder.isDirectory()); - assertTrue(contentFolder.list().length > 2); // not elegant but lazy.. + assertTrue(contentFolder.list().length > 3); // not elegant but lazy.. } @Test diff --git a/server/src/test/resources/csars/csar-make b/server/src/test/resources/csars/csar-make deleted file mode 100755 index f6f3e0cfa..000000000 --- a/server/src/test/resources/csars/csar-make +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# run this script (no args required) in order to (re)pack all csars -pushd "$(dirname "$0")" > /dev/null -for CSAR_DIR in $(find -mindepth 3 -maxdepth 3 -type d); do - pushd $CSAR_DIR > /dev/null - NAME=$(basename $CSAR_DIR) - zip -r ../${NAME}.csar * > /dev/null - echo Packaged $NAME as ${NAME}.csar - popd > /dev/null -done -popd > /dev/null diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing.csar b/server/src/test/resources/csars/yaml/invalid/dependencies_missing.csar index 4d2ca9a70..b1444e29d 100644 Binary files a/server/src/test/resources/csars/yaml/invalid/dependencies_missing.csar and b/server/src/test/resources/csars/yaml/invalid/dependencies_missing.csar differ diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockertypes.yaml b/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockertypes.yaml deleted file mode 100644 index 19bf4f55a..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockertypes.yaml +++ /dev/null @@ -1,67 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - DockerEngine: - derived_from: tosca.nodes.Root - # needs capability: DockerHost or similar.. - capabilities: - host: - type: DockerHost - requirements: - - os: - type: linux - distribution: ubuntu - architecture: x86_64 - interfaces: - Standard: - create: - implementation: dockerengine_create.sh - start: - implementation: dockerengine_start.sh - stop: - implementation: dockerengine_stop.sh - DockerApp: - derived_from: tosca.nodes.Root - requirements: - - host: - capability: DockerHost - node: DockerEngine - relationship: tosca.relationships.HostedOn - - network: - capability: SimplePublicWebEndpoint - attributes: - tag: - type: string - description: the tag for the docker image - identifier: - type: string - description: the identifier (name) for the docker container - endpoint: { get_operation_output: [ SELF, Standard, create, endpoint ] } - interfaces: - Standard: - inputs: - tag: { get_attribute: [ SELF, tag ] } - identifier: { get_attribute: [ SELF, identifier ] } - create: - implementation: dockerapp_create.sh - start: - implementation: dockerapp_create.sh - stop: - implementation: dockerapp_stop.sh - delete: - implementation: dockerapp_delete.sh -capability_types: - DockerHost: - derived_from: tosca.capabilities.Root - type: tosca.capabilities.Root - sources: [ DockerApp ] - SimplePublicWebEndpoint: - derived_from: tosca.capabilities.Endpoint - properties: - protocol: - value: http - port: - value: 80 - url_path: - value: / - network_name: - value: PUBLIC diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/template.yaml b/server/src/test/resources/csars/yaml/invalid/dependencies_missing/template.yaml deleted file mode 100644 index dd10c12c1..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/template.yaml +++ /dev/null @@ -1,99 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1 -description: Template for deploying the simple-task-app via docker -metadata: - template_name: simple-task-docker-template - template_author: stupro-toscana - template_version: 1.0 - -node_types: - DockerEngine: - derived_from: tosca.nodes.Root - # needs capability: DockerHost or similar.. - capabilities: - host: - type: DockerHost - requirements: - - os: - type: linux - distribution: ubuntu - architecture: x86_64 - interfaces: - Standard: - create: - implementation: docker/dockerengine_create.sh - start: - implementation: docker/dockerengine_start.sh - stop: - implementation: docker/dockerengine_stop.sh - DockerApp: - derived_from: tosca.nodes.Root - requirements: - - host: - capability: DockerHost - node: DockerEngine - relationship: tosca.relationships.HostedOn - - network: - capability: SimplePublicWebEndpoint - attributes: - tag: - type: string - description: the tag for the docker image - identifier: - type: string - description: the identifier (name) for the docker container - interfaces: - Standard: - create: - implementation: docker/dockerapp_create.sh - start: - implementation: docker/dockerapp_create.sh - stop: - implementation: docker/dockerapp_stop.sh - delete: - implementation: docker/dockerapp_delete.sh -capability_types: - DockerHost: - derived_from: tosca.capabilities.Root - valid_source_types: [ DockerApp ] - SimplePublicWebEndpoint: - derived_from: tosca.capabilities.Endpoint - properties: - protocol: http - port: 80 - url_path: / - network_name: PUBLIC - -topology_template: - node_templates: - myDockerEngine: - type: DockerEngine - - simpleTaskApp: - type: DockerApp - attributes: - tag: - description: tag for docker image - value: simple-task-app - identifier: - description: identifier of docker container - value: simple-task-app-1 - endpoint: - value: { get_operation_output: [ SELF, Standard, create, endpoint ] } - interfaces: - Standard: - inputs: - tag: { get_attribute: [ SELF, tag ] } - identifier: { get_attribute: [ SELF, identifier ] } - create: - implementation: - primary: simple-task-app/create.sh - # dependencies will get copied by orchestrator to the same location - # as create.sh, before create.sh is executed - - - outputs: - endpoint: - description: the endpoint of the simple-task-app - value: { get_attribute: [ simpleTaskApp, endpoint ] } - type: string - diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing.csar b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing.csar index 1ab62b908..76619132d 100644 Binary files a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing.csar and b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing.csar differ diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_create.sh b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_create.sh deleted file mode 100755 index 44336c750..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_create.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# IMPORTANT: don't simply run script like this: ./create -# instead, run it like this: . create -# This sources the script (executes commands in same shell); -# the exported endpoint will therefore be available afterwards -docker build -t $tag . -docker create -p 80:80 --name="$identifier" -i $tag && -export endpoint=$(curl -s http://whatismyip.akamai.com/) -echo "created container '$identifier' from image "$tag". endpoint is: '$endpoint'" diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_delete.sh b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_delete.sh deleted file mode 100755 index ff3b70a0f..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_delete.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -docker rm simple-task-app-1 && -echo "deleted simple-task-app" diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_start.sh b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_start.sh deleted file mode 100755 index fb8a128af..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_start.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -docker start $identifier > /dev/null && -echo "started $identifier" - diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_stop.sh b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_stop.sh deleted file mode 100755 index c9d606fef..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerapp_stop.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -docker stop -t0 simple-task-app-1 > /dev/null && -echo 'stopped simple-task-app' diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerengine_create.sh b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerengine_create.sh deleted file mode 100755 index f54500b53..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerengine_create.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -sudo apt-get update && sudo apt-get install -y docker-ce -sudo groupadd docker -sudo usermod -aG docker $USER diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerengine_start.sh b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerengine_start.sh deleted file mode 100755 index a7d0ed4dc..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerengine_start.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -sudo systemctl start dockerd diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerengine_stop.sh b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerengine_stop.sh deleted file mode 100755 index 83d30db99..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockerengine_stop.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -sudo systemctl stop dockerd diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockertypes.yaml b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockertypes.yaml deleted file mode 100644 index 19bf4f55a..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/docker/dockertypes.yaml +++ /dev/null @@ -1,67 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0 -node_types: - DockerEngine: - derived_from: tosca.nodes.Root - # needs capability: DockerHost or similar.. - capabilities: - host: - type: DockerHost - requirements: - - os: - type: linux - distribution: ubuntu - architecture: x86_64 - interfaces: - Standard: - create: - implementation: dockerengine_create.sh - start: - implementation: dockerengine_start.sh - stop: - implementation: dockerengine_stop.sh - DockerApp: - derived_from: tosca.nodes.Root - requirements: - - host: - capability: DockerHost - node: DockerEngine - relationship: tosca.relationships.HostedOn - - network: - capability: SimplePublicWebEndpoint - attributes: - tag: - type: string - description: the tag for the docker image - identifier: - type: string - description: the identifier (name) for the docker container - endpoint: { get_operation_output: [ SELF, Standard, create, endpoint ] } - interfaces: - Standard: - inputs: - tag: { get_attribute: [ SELF, tag ] } - identifier: { get_attribute: [ SELF, identifier ] } - create: - implementation: dockerapp_create.sh - start: - implementation: dockerapp_create.sh - stop: - implementation: dockerapp_stop.sh - delete: - implementation: dockerapp_delete.sh -capability_types: - DockerHost: - derived_from: tosca.capabilities.Root - type: tosca.capabilities.Root - sources: [ DockerApp ] - SimplePublicWebEndpoint: - derived_from: tosca.capabilities.Endpoint - properties: - protocol: - value: http - port: - value: 80 - url_path: - value: / - network_name: - value: PUBLIC diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/Dockerfile b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/Dockerfile deleted file mode 100644 index 95abd426a..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM janes/alpine-lamp -MAINTAINER hnicke -COPY index.php /www -COPY mysql-credentials.php /www -COPY createdb.sql / - -EXPOSE 80 - -RUN nohup mysqld --skip-grant-tables --bind-address 0.0.0.0 --user mysql > /dev/null 2>&1 & \ - sleep 10 && mysql -u root < /createdb.sql - -ENTRYPOINT httpd && \ - nohup mysqld --skip-grant-tables --bind-address 0.0.0.0 --user mysql > /dev/null 2>&1 & \ - tail -f /dev/null diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/createdb.sql b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/createdb.sql deleted file mode 100644 index 4a62e2720..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/createdb.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE database mydb; -create table mydb.tasks - (id int not null unique auto_increment, - task varchar(255), - primary key (id) - ); - diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/index.php b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/index.php deleted file mode 100644 index 0065fa98f..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/index.php +++ /dev/null @@ -1,79 +0,0 @@ -query("INSERT INTO tasks(task) VALUES('".$task."')")) { - echo("Creating task failed"); - } - $conn->close(); -} -/** -* reads from db and prints it in html -*/ -function readFromDb() -{ - $sql = "select * from tasks"; - $conn = newDbConnection(); - $result = $conn->query($sql); - $conn->close(); - if ($result->num_rows > 0) { - // output data for each row - while ($row = $result->fetch_assoc()) { - echo htmlspecialchars("id: " . $row['id']. " - Task: " . $row['task'])."
"; - } - return; - } - echo "0 results"; -} - -/** -* generates new DB connection with given credentials -*/ -function newDbConnection() -{ - extract($GLOBALS); - $conn = new mysqli($host, $username, $password, $database, $port); - if ($conn->connect_error) { - die("Connection failed: " . $conn->connect_error); - } - return $conn; -} -?> - - - - - SimpleTaskApp - - - -

SimpleTaskApp

- -
- - -
- - - diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/mysql-credentials.php b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/mysql-credentials.php deleted file mode 100644 index 5196befdb..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/simple-task-app/mysql-credentials.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/template.yaml b/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/template.yaml deleted file mode 100644 index 4f5b2af0d..000000000 --- a/server/src/test/resources/csars/yaml/invalid/dockerapp_missing/template.yaml +++ /dev/null @@ -1,82 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1 -description: Template for deploying the simple-task-app via docker -metadata: - template_name: simple-task-docker-template - template_author: stupro-toscana - template_version: 1.0 - -node_types: - DockerEngine: - derived_from: tosca.nodes.Root - # needs capability: DockerHost or similar.. - capabilities: - host: - type: DockerHost - requirements: - - os: - type: linux - distribution: ubuntu - architecture: x86_64 - interfaces: - Standard: - create: - implementation: docker/dockerengine_create.sh - start: - implementation: docker/dockerengine_start.sh - stop: - implementation: docker/dockerengine_stop.sh - DockerApp: - derived_from: tosca.nodes.Root - requirements: - - host: - capability: DockerHost - node: DockerEngine - relationship: tosca.relationships.HostedOn - - network: - capability: SimplePublicWebEndpoint - attributes: - tag: - type: string - description: the tag for the docker image - identifier: - type: string - description: the identifier (name) for the docker container - interfaces: - Standard: - create: - implementation: docker/dockerapp_create.sh - start: - implementation: docker/dockerapp_create.sh - stop: - implementation: docker/dockerapp_stop.sh - delete: - implementation: docker/dockerapp_delete.sh -capability_types: - DockerHost: - derived_from: tosca.capabilities.Root - valid_source_types: [ DockerApp ] - SimplePublicWebEndpoint: - derived_from: tosca.capabilities.Endpoint - properties: - protocol: - default: http - port: - default: 80 - url_path: - default: / - network_name: - default: PUBLIC - -topology_template: - node_templates: - myDockerEngine: - type: DockerEngine - - - - - outputs: - endpoint: - description: the endpoint of the simple-task-app - value: { get_attribute: [ simpleTaskApp, endpoint ] } - diff --git a/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous.csar b/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous.csar index fa1dce20d..1d6975a4e 100644 Binary files a/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous.csar and b/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous.csar differ diff --git a/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous/second_entrypoint_this_will_cause_error.yaml b/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous/second_entrypoint_this_will_cause_error.yaml deleted file mode 100644 index fef6c0ce7..000000000 --- a/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous/second_entrypoint_this_will_cause_error.yaml +++ /dev/null @@ -1,2 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1 -description: second template file that should cause the ParserService to reject the csar diff --git a/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous/template.yaml b/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous/template.yaml deleted file mode 100644 index 5871c834a..000000000 --- a/server/src/test/resources/csars/yaml/invalid/entrypoint_ambiguous/template.yaml +++ /dev/null @@ -1,2 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1 -description: Template for deploying the simple-task-app via docker diff --git a/server/src/test/resources/csars/yaml/invalid/entrypoint_missing.csar b/server/src/test/resources/csars/yaml/invalid/entrypoint_missing.csar index c13f345a4..f9626f4ad 100644 Binary files a/server/src/test/resources/csars/yaml/invalid/entrypoint_missing.csar and b/server/src/test/resources/csars/yaml/invalid/entrypoint_missing.csar differ diff --git a/server/src/test/resources/csars/yaml/invalid/entrypoint_missing/nothing.txt b/server/src/test/resources/csars/yaml/invalid/entrypoint_missing/nothing.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/server/src/test/resources/csars/yaml/valid/entrypoint_is_yml.csar b/server/src/test/resources/csars/yaml/valid/entrypoint_is_yml.csar index d793d46d8..1efaa7030 100644 Binary files a/server/src/test/resources/csars/yaml/valid/entrypoint_is_yml.csar and b/server/src/test/resources/csars/yaml/valid/entrypoint_is_yml.csar differ diff --git a/server/src/test/resources/csars/yaml/valid/entrypoint_is_yml/template.yml b/server/src/test/resources/csars/yaml/valid/entrypoint_is_yml/template.yml deleted file mode 100644 index e2b3b588d..000000000 --- a/server/src/test/resources/csars/yaml/valid/entrypoint_is_yml/template.yml +++ /dev/null @@ -1,5 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1 -description: test template; purpose: test whether .yml files are also accepted as entrypoint files - template_name: simple-task-docker-template - template_author: stupro-toscana - template_version: 1.0 diff --git a/server/src/test/resources/csars/yaml/valid/lamp-input.csar b/server/src/test/resources/csars/yaml/valid/lamp-input.csar deleted file mode 100644 index 58400b6d4..000000000 Binary files a/server/src/test/resources/csars/yaml/valid/lamp-input.csar and /dev/null differ diff --git a/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/configure_myphpapp.sh b/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/configure_myphpapp.sh deleted file mode 100644 index 373db8a68..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/configure_myphpapp.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -CREDENTIALS="/var/www/html/mysql-credentials.php" - -sed -i "s:DATABASE_HOST:${database_host}:g" $CREDENTIALS -sed -i "s:DATABASE_PASSWORD:${database_password}:g" $CREDENTIALS -sed -i "s:DATABASE_NAME:${database_name}:g" $CREDENTIALS -sed -i "s:DATABASE_PORT:${database_port}:g" $CREDENTIALS diff --git a/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/create_myphpapp.sh b/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/create_myphpapp.sh deleted file mode 100644 index 8db477e8b..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/create_myphpapp.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# install php on a linux machine with php-mysql -sudo apt-get update -y && sudo apt-get upgrade -y -sudo apt-get install -y php php-mysql libapache2-mod-php7.0 - -sudo mv myphpapp.php /var/www/html/ -sudo mv mysql-credentials.php /var/www/html/ - diff --git a/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/myphpapp.php b/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/myphpapp.php deleted file mode 100644 index 0fb716ad7..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/myphpapp.php +++ /dev/null @@ -1,76 +0,0 @@ -query("INSERT INTO tasks(task) VALUES('".$task."')")) { - echo("Creating task failed"); - } - $conn->close(); -} -/** -* reads from db and prints it in html -*/ -function readFromDb() -{ - $sql = "select * from tasks"; - $conn = newDbConnection(); - $result = $conn->query($sql); - $conn->close(); - if ($result->num_rows > 0) { - // output data for each row - while ($row = $result->fetch_assoc()) { - echo htmlspecialchars("id: " . $row['id']. " - Task: " . $row['task'])."
"; - } - return; - } - echo "0 results"; -} -/** -* generates new DB connection with given credentials -*/ -function newDbConnection() -{ - extract($GLOBALS); - $conn = new mysqli($db_host, $db_user, $db_password, $db_name, $db_port); - if ($conn->connect_error) { - die("Connection failed: " . $conn->connect_error); - } - return $conn; -} -?> - - - - - SimpleTaskApp - - - -

SimpleTaskApp

- -
- - -
- - - diff --git a/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/mysql-credentials.php b/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/mysql-credentials.php deleted file mode 100644 index 380ca89e0..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-input/my_app/mysql-credentials.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/server/src/test/resources/csars/yaml/valid/lamp-input/mysql_dbms/mysql_dbms_configure.sh b/server/src/test/resources/csars/yaml/valid/lamp-input/mysql_dbms/mysql_dbms_configure.sh deleted file mode 100644 index 87050fd58..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-input/mysql_dbms/mysql_dbms_configure.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -cat << EOF | mysql -u root --password=${database_password} -CREATE DATABASE ${database_name}; -USE ${database_name}; -create table tasks (id INT not null auto_increment,task varchar(255), primary key(id)); -EXIT -EOF diff --git a/server/src/test/resources/csars/yaml/valid/lamp-input/template.yaml b/server/src/test/resources/csars/yaml/valid/lamp-input/template.yaml deleted file mode 100644 index 4c4a76aac..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-input/template.yaml +++ /dev/null @@ -1,92 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1 -description: Template for deploying a LAMP stack. -metadata: - template_name: lamp-stack-template - template_author: stupro-toscana - template_version: 1.0 - - -topology_template: - inputs: - database_name: - type: string - database_port: - type: integer - database_password: - type: string - - node_templates: - my_app: - type: tosca.nodes.WebApplication - requirements: - - host: apache_web_server - - database_endpoint: my_db - interfaces: - Standard: - create: - implementation: - primary: my_app/create_myphpapp.sh - dependencies: - - my_app/myphpapp.php - - my_app/mysql-credentials.php - configure: - implementation: my_app/configure_myphpapp.sh - inputs: - database_host: { get_attribute: [ server, private_address ] } - database_password: { get_property: [ my_db, password ] } - database_name: { get_property: [ my_db, name ] } - database_port: { get_property: [ my_db, port ] } - - apache_web_server: - type: tosca.nodes.WebServer.Apache - requirements: - - host: server - - my_db: - type: tosca.nodes.Database.MySQL - properties: - name: { get_input: database_name } - password: { get_input: database_password } - port: { get_input: database_port } - capabilities: - database_endpoint: - properties: - port: { get_property: [ SELF, port ] } - requirements: - - host: mysql_dbms - - mysql_dbms: - type: tosca.nodes.DBMS.MySQL - properties: - root_password: { get_input: database_password } - port: { get_input: database_port } - requirements: - - host: server - interfaces: - Standard: - configure: - implementation: mysql_dbms/mysql_dbms_configure.sh - inputs: - db_root_password: { get_property: [ SELF, root_password ] } - - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 1 - disk_size: 25 GB - mem_size: 2048 MB - os: - properties: - type: linux - distribution: ubuntu - version: 16.04 - - outputs: - public_address: - description: Public address of the server - value: { get_attribute: [ server, public_address ] } - port: - description: Port of the server - value: { get_attribute: [ server, port ] } diff --git a/server/src/test/resources/csars/yaml/valid/lamp-noinput.csar b/server/src/test/resources/csars/yaml/valid/lamp-noinput.csar deleted file mode 100644 index c374e3c60..000000000 Binary files a/server/src/test/resources/csars/yaml/valid/lamp-noinput.csar and /dev/null differ diff --git a/server/src/test/resources/csars/yaml/valid/lamp-noinput/my_app/create_myphpapp.sh b/server/src/test/resources/csars/yaml/valid/lamp-noinput/my_app/create_myphpapp.sh deleted file mode 100644 index b0746ca72..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-noinput/my_app/create_myphpapp.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# install php on a linux machine with php-mysql -sudo apt-get update -y && sudo apt-get upgrade -y -sudo apt-get install -y php php-mysql libapache2-mod-php7.0 - -sudo mv myphpapp.php /var/www/html/ -sudo mv mysql-credentials.php /var/www/html/ diff --git a/server/src/test/resources/csars/yaml/valid/lamp-noinput/my_app/myphpapp.php b/server/src/test/resources/csars/yaml/valid/lamp-noinput/my_app/myphpapp.php deleted file mode 100644 index 0fb716ad7..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-noinput/my_app/myphpapp.php +++ /dev/null @@ -1,76 +0,0 @@ -query("INSERT INTO tasks(task) VALUES('".$task."')")) { - echo("Creating task failed"); - } - $conn->close(); -} -/** -* reads from db and prints it in html -*/ -function readFromDb() -{ - $sql = "select * from tasks"; - $conn = newDbConnection(); - $result = $conn->query($sql); - $conn->close(); - if ($result->num_rows > 0) { - // output data for each row - while ($row = $result->fetch_assoc()) { - echo htmlspecialchars("id: " . $row['id']. " - Task: " . $row['task'])."
"; - } - return; - } - echo "0 results"; -} -/** -* generates new DB connection with given credentials -*/ -function newDbConnection() -{ - extract($GLOBALS); - $conn = new mysqli($db_host, $db_user, $db_password, $db_name, $db_port); - if ($conn->connect_error) { - die("Connection failed: " . $conn->connect_error); - } - return $conn; -} -?> - - - - - SimpleTaskApp - - - -

SimpleTaskApp

- -
- - -
- - - diff --git a/server/src/test/resources/csars/yaml/valid/lamp-noinput/my_app/mysql-credentials.php b/server/src/test/resources/csars/yaml/valid/lamp-noinput/my_app/mysql-credentials.php deleted file mode 100644 index 1e4fd6878..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-noinput/my_app/mysql-credentials.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/server/src/test/resources/csars/yaml/valid/lamp-noinput/mysql_dbms/mysql_dbms_configure.sh b/server/src/test/resources/csars/yaml/valid/lamp-noinput/mysql_dbms/mysql_dbms_configure.sh deleted file mode 100644 index 6385adbc0..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-noinput/mysql_dbms/mysql_dbms_configure.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -cat << EOF | mysql -u root --password=abc -CREATE DATABASE mydb; -USE mydb; -create table tasks (id INT not null auto_increment,task varchar(255), primary key(id)); -EXIT -EOF diff --git a/server/src/test/resources/csars/yaml/valid/lamp-noinput/template.yaml b/server/src/test/resources/csars/yaml/valid/lamp-noinput/template.yaml deleted file mode 100644 index c59c91d14..000000000 --- a/server/src/test/resources/csars/yaml/valid/lamp-noinput/template.yaml +++ /dev/null @@ -1,76 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1 -description: Template for deploying a LAMP stack. -metadata: - template_name: lamp-stack-template - template_author: stupro-toscana - template_version: 1.0 - - -topology_template: - node_templates: - my_app: - type: tosca.nodes.WebApplication - requirements: - - host: apache_web_server - - database_endpoint: my_db - interfaces: - Standard: - create: - implementation: - primary: my_app/create_myphpapp.sh - dependencies: - - myphpapp.php - - mysql-credentials.php - - apache_web_server: - type: tosca.nodes.WebServer.Apache - requirements: - - host: server - - my_db: - type: tosca.nodes.Database.MySQL - properties: - name: mydb - user: root - password: abc - port: 3306 - capabilities: - database_endpoint: - properties: - port: 3306 - requirements: - - host: mysql_dbms - - mysql_dbms: - type: tosca.nodes.DBMS.MySQL - properties: - root_password: abc - port: 3306 - requirements: - - host: server - interfaces: - Standard: - configure: - implementation: mysql_dbms/mysql_dbms_configure.sh - - server: - type: tosca.nodes.Compute - capabilities: - host: - properties: - num_cpus: 1 - disk_size: 25 GB - mem_size: 2048 MB - os: - properties: - type: linux - distribution: ubuntu - version: 16.04 - - outputs: - public_address: - description: Public address of the server - value: { get_attribute: [ server, public_address ] } - port: - description: Port of the server - value: { get_attribute: [ server, port ] } diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerapp_create.sh b/server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerapp_create.sh old mode 100755 new mode 100644 similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerapp_create.sh rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerapp_create.sh diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerapp_delete.sh b/server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerapp_delete.sh old mode 100755 new mode 100644 similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerapp_delete.sh rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerapp_delete.sh diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerapp_start.sh b/server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerapp_start.sh old mode 100755 new mode 100644 similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerapp_start.sh rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerapp_start.sh diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerapp_stop.sh b/server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerapp_stop.sh old mode 100755 new mode 100644 similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerapp_stop.sh rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerapp_stop.sh diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerengine_create.sh b/server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerengine_create.sh old mode 100755 new mode 100644 similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerengine_create.sh rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerengine_create.sh diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerengine_start.sh b/server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerengine_start.sh old mode 100755 new mode 100644 similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerengine_start.sh rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerengine_start.sh diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerengine_stop.sh b/server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerengine_stop.sh old mode 100755 new mode 100644 similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/docker/dockerengine_stop.sh rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/docker/dockerengine_stop.sh diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/simple-task-app/Dockerfile b/server/src/test/resources/csars/yaml/valid/simple-task-csar/simple-task-app/Dockerfile similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/simple-task-app/Dockerfile rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/simple-task-app/Dockerfile diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/simple-task-app/createdb.sql b/server/src/test/resources/csars/yaml/valid/simple-task-csar/simple-task-app/createdb.sql similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/simple-task-app/createdb.sql rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/simple-task-app/createdb.sql diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/simple-task-app/index.php b/server/src/test/resources/csars/yaml/valid/simple-task-csar/simple-task-app/index.php similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/simple-task-app/index.php rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/simple-task-app/index.php diff --git a/server/src/test/resources/csars/yaml/invalid/dependencies_missing/simple-task-app/mysql-credentials.php b/server/src/test/resources/csars/yaml/valid/simple-task-csar/simple-task-app/mysql-credentials.php similarity index 100% rename from server/src/test/resources/csars/yaml/invalid/dependencies_missing/simple-task-app/mysql-credentials.php rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/simple-task-app/mysql-credentials.php diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/template.yaml b/server/src/test/resources/csars/yaml/valid/simple-task-csar/template.yaml similarity index 91% rename from server/src/test/resources/csars/yaml/valid/simple-task/template.yaml rename to server/src/test/resources/csars/yaml/valid/simple-task-csar/template.yaml index 6eb687794..403400252 100644 --- a/server/src/test/resources/csars/yaml/valid/simple-task/template.yaml +++ b/server/src/test/resources/csars/yaml/valid/simple-task-csar/template.yaml @@ -1,4 +1,4 @@ -tosca_definitions_version: tosca_simple_yaml_1_1 +tosca_definitions_version: tosca_simple_yaml_1_0 description: Template for deploying the simple-task-app via docker metadata: template_name: simple-task-docker-template @@ -46,7 +46,7 @@ node_types: create: implementation: docker/dockerapp_create.sh start: - implementation: docker/dockerapp_start.sh + implementation: docker/dockerapp_create.sh stop: implementation: docker/dockerapp_stop.sh delete: @@ -58,10 +58,14 @@ capability_types: SimplePublicWebEndpoint: derived_from: tosca.capabilities.Endpoint properties: - protocol: http - port: 80 - url_path: / - network_name: PUBLIC + protocol: + default: http + port: + default: 80 + url_path: + default: / + network_name: + default: PUBLIC topology_template: node_templates: @@ -100,5 +104,4 @@ topology_template: endpoint: description: the endpoint of the simple-task-app value: { get_attribute: [ simpleTaskApp, endpoint ] } - type: string diff --git a/server/src/test/resources/csars/yaml/valid/simple-task-csar/zip b/server/src/test/resources/csars/yaml/valid/simple-task-csar/zip new file mode 100644 index 000000000..1ad436c94 --- /dev/null +++ b/server/src/test/resources/csars/yaml/valid/simple-task-csar/zip @@ -0,0 +1,2 @@ +#!/bin/bash +zip ../simple-task.csar -r * diff --git a/server/src/test/resources/csars/yaml/valid/simple-task.csar b/server/src/test/resources/csars/yaml/valid/simple-task.csar index ccb5b7cfd..075dcbe78 100644 Binary files a/server/src/test/resources/csars/yaml/valid/simple-task.csar and b/server/src/test/resources/csars/yaml/valid/simple-task.csar differ diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_create.sh b/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_create.sh deleted file mode 100644 index 44336c750..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_create.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# IMPORTANT: don't simply run script like this: ./create -# instead, run it like this: . create -# This sources the script (executes commands in same shell); -# the exported endpoint will therefore be available afterwards -docker build -t $tag . -docker create -p 80:80 --name="$identifier" -i $tag && -export endpoint=$(curl -s http://whatismyip.akamai.com/) -echo "created container '$identifier' from image "$tag". endpoint is: '$endpoint'" diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_delete.sh b/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_delete.sh deleted file mode 100644 index ff3b70a0f..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_delete.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -docker rm simple-task-app-1 && -echo "deleted simple-task-app" diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_start.sh b/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_start.sh deleted file mode 100644 index fb8a128af..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_start.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -docker start $identifier > /dev/null && -echo "started $identifier" - diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_stop.sh b/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_stop.sh deleted file mode 100644 index c9d606fef..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerapp_stop.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -docker stop -t0 simple-task-app-1 > /dev/null && -echo 'stopped simple-task-app' diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerengine_create.sh b/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerengine_create.sh deleted file mode 100644 index f54500b53..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerengine_create.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -sudo apt-get update && sudo apt-get install -y docker-ce -sudo groupadd docker -sudo usermod -aG docker $USER diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerengine_start.sh b/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerengine_start.sh deleted file mode 100644 index a7d0ed4dc..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerengine_start.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -sudo systemctl start dockerd diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerengine_stop.sh b/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerengine_stop.sh deleted file mode 100644 index 83d30db99..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/docker/dockerengine_stop.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -sudo systemctl stop dockerd diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/Dockerfile b/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/Dockerfile deleted file mode 100644 index 95abd426a..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM janes/alpine-lamp -MAINTAINER hnicke -COPY index.php /www -COPY mysql-credentials.php /www -COPY createdb.sql / - -EXPOSE 80 - -RUN nohup mysqld --skip-grant-tables --bind-address 0.0.0.0 --user mysql > /dev/null 2>&1 & \ - sleep 10 && mysql -u root < /createdb.sql - -ENTRYPOINT httpd && \ - nohup mysqld --skip-grant-tables --bind-address 0.0.0.0 --user mysql > /dev/null 2>&1 & \ - tail -f /dev/null diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/createdb.sql b/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/createdb.sql deleted file mode 100644 index 4a62e2720..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/createdb.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE database mydb; -create table mydb.tasks - (id int not null unique auto_increment, - task varchar(255), - primary key (id) - ); - diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/index.php b/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/index.php deleted file mode 100644 index 0065fa98f..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/index.php +++ /dev/null @@ -1,79 +0,0 @@ -query("INSERT INTO tasks(task) VALUES('".$task."')")) { - echo("Creating task failed"); - } - $conn->close(); -} -/** -* reads from db and prints it in html -*/ -function readFromDb() -{ - $sql = "select * from tasks"; - $conn = newDbConnection(); - $result = $conn->query($sql); - $conn->close(); - if ($result->num_rows > 0) { - // output data for each row - while ($row = $result->fetch_assoc()) { - echo htmlspecialchars("id: " . $row['id']. " - Task: " . $row['task'])."
"; - } - return; - } - echo "0 results"; -} - -/** -* generates new DB connection with given credentials -*/ -function newDbConnection() -{ - extract($GLOBALS); - $conn = new mysqli($host, $username, $password, $database, $port); - if ($conn->connect_error) { - die("Connection failed: " . $conn->connect_error); - } - return $conn; -} -?> - - - - - SimpleTaskApp - - - -

SimpleTaskApp

- -
- - -
- - - diff --git a/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/mysql-credentials.php b/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/mysql-credentials.php deleted file mode 100644 index 5196befdb..000000000 --- a/server/src/test/resources/csars/yaml/valid/simple-task/simple-task-app/mysql-credentials.php +++ /dev/null @@ -1,7 +0,0 @@ -