[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / openecomp-ui / test-utils / factories / softwareProduct / SoftwareProductAttachmentsFactories.js
1 /*!
2  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13  * or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  */
16 import {Factory} from 'rosie';
17 import randomstring from 'randomstring';
18
19 export const VSPAttachmentsErrorFactory = new Factory()
20         .attrs({
21                 level: 'WARNING'
22         })
23         .sequence('message', index => `error no. ${index}`);
24
25 export const VSPHeatFactory = new Factory()
26         .attrs({
27                 fileName: () => `${randomstring.generate()}.yaml`,
28                 env: {
29                         fileName: () => `${randomstring.generate()}.env`
30                 },
31                 errors: Factory.buildList(VSPAttachmentsErrorFactory)
32         });
33
34 export const VSPAttachmentTreeNodeFactory = new Factory()
35         .attrs({
36                 name: 'HEAT',
37                 type: 'heat'
38         });
39
40 export const VSPAttachmentTreeNodeWithChildrenFactory = new Factory()
41         .extend(VSPAttachmentTreeNodeFactory)
42         .attrs({
43                 expanded: true,
44                 children: []
45         });
46
47 export const VSPAttachmentDetailedError = new Factory()
48         .attrs({
49                 level: 'WARNING',
50                 errorMessage: 'Resource is not defined as output and thus cannot be Shared. resource id - network_4',
51                 name: () => `${randomstring.generate()}.yaml`,
52                 hasParent: false,
53                 parentName: 'HEAT',
54                 type: 'heat'
55         });
56
57 export const HeatSetupModuleBase = new Factory()
58         .option('name', 0)
59         .attr('name', ['name'], (name) => {
60                 return name ? randomstring.generate(5) : '';
61         })
62         .attrs({
63                 isBase: false,
64                 yaml: () => {return 'yaml_' + randomstring.generate(5) + '.yaml';},
65                 env: () => {return 'env_' + randomstring.generate(5) + '.env';},
66                 vol: () => {return 'vol_' + randomstring.generate(5) + '.vol';},
67                 volEnv: () => {return 'volEnv_' + randomstring.generate(5) + '.env';}
68         });
69
70 export const heatSetupManifest = new Factory()
71         .attrs({
72                 modules: [
73                         {
74                                 name: 'BASE_sdjflsjldfsd',
75                                 isBase: true,
76                                 yaml: 'yaml_filename9.yaml',
77                                 env: 'env_filename8.env',
78                                 vol: 'vol_filename5.vol',
79                                 volEnv: 'vol_env_filename1.8.vol',
80
81                         },
82                         {
83                                 name: 'MODULE_asdkjfhkajsf',
84                                 isBase: false,
85                                 yaml: 'yaml_filename.yaml',
86                                 env: 'env_filename.env',
87                                 vol: 'vol_filename.vol',
88                                 volEnv: 'vol_env_filename.vol',
89
90                         }
91                 ],
92                 unassigned: [
93                         'hot-nimbus-oam-volumes_v1.0.env',
94                         'hot-nimbus-oam_v1.0.env',
95                         'hot-nimbus-oam-volumes_v1.1.env',
96                         'hot-nimbus-oam-volumes_v2.0.env',
97                         'vol_filename2.vol',
98                         'hot-nimbus-oam-volumes_v4.0.env',
99                         'hot-nimbus-oam-volumes_v5.0.env',
100                         'hot-nimbus-oam_v6.0.env',
101                         'hot-nimbus-oam-volumes_v7.0.env',
102                         'vol_filename1.vol'
103                 ],
104                 artifacts: ['hot-nimbus-oam_v3.0.env'],
105                 nested: ['nested-ppd_v1.1.yaml', 'nested-ppd_v1.0.yaml', 'nested-ppd_v8.0.yaml']
106         });