summaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/tests/test_policy
blob: 08231fc7a420c0f5fe757cab30f32207c23c182b (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash

source /var/onap_tests/_test_base
source /var/onap/policy

covered_functions=(
"clone_all_policy_repos"
"compile_all_policy_repos"
"get_policy_images"
"install_policy"
)

# test_clone_all_policy_repos() - Verify cloning of Policy source code
function test_clone_all_policy_repos {
    clone_all_policy_repos

    asserts_file_exist $policy_src_folder/api/pom.xml
    asserts_file_exist $policy_src_folder/common/pom.xml
    asserts_file_exist $policy_src_folder/docker/pom.xml
    asserts_file_exist $policy_src_folder/drools-applications/pom.xml
    asserts_file_exist $policy_src_folder/drools-pdp/pom.xml
    asserts_file_exist $policy_src_folder/engine/pom.xml
    asserts_file_exist $policy_src_folder/gui/pom.xml
    asserts_file_exist $policy_src_folder/pap/pom.xml
    asserts_file_exist $policy_src_folder/pdp/pom.xml
}

# test_compile_all_policy_repos() - Verify compiling of Policy source code
function test_compile_all_policy_repos {
    clone_all_policy_repos
    compile_all_policy_repos

    asserts_file_exist $policy_src_folder/common/common-logging/target/ONAP-Logging-1.1.0-SNAPSHOT.jar
    asserts_file_exist $policy_src_folder/common/integrity-audit/target/integrity-audit-1.1.0-SNAPSHOT.jar
    asserts_file_exist $policy_src_folder/common/integrity-monitor/target/integrity-monitor-1.1.0-SNAPSHOT.jar
    asserts_file_exist $policy_src_folder/common/site-manager/target/site-manager-1.1.0-SNAPSHOT.jar
    for actor in appc appclcm so test vfc; do
        asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/actors/actor.$actor/target/actor.$actor-1.1.0-SNAPSHOT.jar
    done
    asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/actors/actorServiceProvider/target/actorServiceProvider-1.1.0-SNAPSHOT.jar
    asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/eventmanager/target/eventmanager-1.1.0-SNAPSHOT.jar
    asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/guard/target/guard-1.1.0-SNAPSHOT.jar
    for module in aai appc appclcm events rest sdc so trafficgenerator vfc; do
        asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/model-impl/$module/target/$module-1.1.0-SNAPSHOT.jar
    done
    asserts_file_exist $policy_src_folder/drools-applications/controlloop/common/policy-yaml/target/policy-yaml-1.1.0-SNAPSHOT.jar
    for package in apps artifacts; do
        asserts_file_exist $policy_src_folder/drools-applications/controlloop/packages/$package/target/$package-1.1.0-SNAPSHOT.zip
    done
    asserts_file_exist $policy_src_folder/drools-applications/controlloop/packages/basex/target/basex-1.1.0-SNAPSHOT.tar.gz
    asserts_file_exist $policy_src_folder/drools-applications/controlloop/templates/template.demo/target/template.demo-1.1.0-SNAPSHOT.jar
    asserts_file_exist $policy_src_folder/drools-applications/controlloop/templates/template.demo/target/template.demo-1.1.0-SNAPSHOT.jar
    for feature in eelf healthcheck session-persistence; do
        asserts_file_exist $policy_src_folder/drools-pdp/feature-$feature/target/feature-$feature-1.1.0-SNAPSHOT.jar
    done
    asserts_file_exist $policy_src_folder/drools-pdp/packages/base/target/base-1.1.0-SNAPSHOT.tar.gz
    asserts_file_exist $policy_src_folder/drools-pdp/packages/install/target/install-drools-1.1.0-SNAPSHOT.zip
    for policy in core endpoints management utils; do
        asserts_file_exist $policy_src_folder/drools-pdp/policy-$policy/target/policy-$policy-1.1.0-SNAPSHOT.jar
    done
    for engine in BRMSGateway LogParser ONAP-PDP ONAP-XACML ONAP-REST; do
        asserts_file_exist $policy_src_folder/engine/$engine/target/$engine-1.1.0-SNAPSHOT.jar
    done
    for engine in ONAP-PAP-REST ONAP-PDP-REST ONAP-SDK-APP; do
        asserts_file_exist $policy_src_folder/engine/$engine/target/$engine-1.1.0-SNAPSHOT.war
    done
    asserts_file_exist $policy_src_folder/engine/packages/base/target/base-1.1.0-SNAPSHOT.tar.gz
    asserts_file_exist $policy_src_folder/engine/packages/install/target/install-1.1.0-SNAPSHOT.zip
    asserts_file_exist $policy_src_folder/engine/POLICY-SDK-APP/target/POLICY-SDK-APP-1.1.0-SNAPSHOT.war
    asserts_file_exist $policy_src_folder/engine/PolicyEngineAPI/target/PolicyEngineAPI-1.1.0-SNAPSHOT.jar
    asserts_file_exist $policy_src_folder/engine/PolicyEngineClient/target/PolicyEngineClient-1.1.0-SNAPSHOT.jar
    asserts_file_exist $policy_src_folder/engine/PolicyEngineUtils/target/PolicyEngineUtils-1.1.0-SNAPSHOT.jar
}

# test_get_policy_images() - Verify that Policy Docker images are retrieved properly
function test_get_policy_images {
    clone_all_policy_repos
    get_policy_images

    for image in os nexus db base drools pe; do
        asserts_image onap/policy/policy-$image
    done
}

# test_install_policy() - Verify that Policy services are started properly
function test_install_policy {
    clone_all_policy_repos
    get_policy_images
    install_policy

    for image in pe drools db nexus; do
        asserts_image_running onap/policy/policy-$image
    done
}

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