aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_msb
blob: 1a8fbe82b61ac56bfe4d39194ae23a6123e0eb70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2017-2018
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#############################################################################

source /var/onap_tests/_test_base
source /var/onap/msb

covered_functions=(
"clone_all_msb_repos" "compile_all_msb_repos" "get_msb_images" "install_msb"
)

# test_clone_all_msb_repos() - Verify the source code retrieve of Microservice Bus project
function test_clone_all_msb_repos {
    clone_repos "msb"

    asserts_file_exist ${src_folders[msb]}/apigateway/pom.xml
    asserts_file_exist ${src_folders[msb]}/discovery/pom.xml
    asserts_file_exist ${src_folders[msb]}/java-sdk/pom.xml
    asserts_file_exist ${src_folders[msb]}/swagger-sdk/pom.xml
}

# test_compile_all_msb_repos() - Verify the correct compilation of MSB project
function test_compile_all_msb_repos {
    clone_repos "msb"
    compile_repos "msb"

    asserts_file_exist ${src_folders[msb]}/apigateway/apiroute/apiroute-service/target/original-apiroute-service-1.1.0-SNAPSHOT.jar
    asserts_file_exist ${src_folders[msb]}/apigateway/apiroute/apiroute-standalone/target/apiroute-1.1.0-SNAPSHOT.zip
    asserts_file_exist ${src_folders[msb]}/discovery/discovery-ui/target/discovery-ui-1.1.0-SNAPSHOT.jar
    asserts_file_exist ${src_folders[msb]}/discovery/sdclient/discovery-service/target/original-discovery-service-1.1.0-SNAPSHOT.jar
    asserts_file_exist ${src_folders[msb]}/java-sdk/target/msb-java-sdk-1.1.0-SNAPSHOT.jar
    asserts_file_exist ${src_folders[msb]}/swagger-sdk/target/swagger-sdk-1.1.0-SNAPSHOT.jar
}

# test_get_msb_images() - Verify the creation of MSB Docker images
function test_get_msb_images {
    clone_repos "msb"
    get_msb_images

    for image in base apigateway discovery; do
        asserts_image $nexus_docker_repo/onap/msb/msb_$image
    done
}

# test_install_msb - Verify the execution of MSB Docker images
function test_install_msb {
    clone_repos "msb"
    get_msb_images
    install_msb

    for image in apigateway discovery; do
        asserts_image_running $nexus_docker_repo/onap/msb/msb_$image
    done

    asserts_http_status_code "http://127.0.0.1:10081/api/microservices/v1/services"
    asserts_http_status_code "http://127.0.0.1/api/aai/v8/cloud-infrastructure/cloud-regions"
}

if [ "$1" != '*' ]; then
    unset covered_functions
    covered_functions=$1
fi
main "${covered_functions[@]}"