summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductAttachmentsFactories.js
blob: eb010da790218f82844ee4562272565de9712043 (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
101
102
103
104
105
106
/*!
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
import {Factory} from 'rosie';
import randomstring from 'randomstring';

export const VSPAttachmentsErrorFactory = new Factory()
	.attrs({
		level: 'WARNING'
	})
	.sequence('message', index => `error no. ${index}`);

export const VSPHeatFactory = new Factory()
	.attrs({
		fileName: () => `${randomstring.generate()}.yaml`,
		env: {
			fileName: () => `${randomstring.generate()}.env`
		},
		errors: Factory.buildList(VSPAttachmentsErrorFactory)
	});

export const VSPAttachmentTreeNodeFactory = new Factory()
	.attrs({
		name: 'HEAT',
		type: 'heat'
	});

export const VSPAttachmentTreeNodeWithChildrenFactory = new Factory()
	.extend(VSPAttachmentTreeNodeFactory)
	.attrs({
		expanded: true,
		children: []
	});

export const VSPAttachmentDetailedError = new Factory()
	.attrs({
		level: 'WARNING',
		errorMessage: 'Resource is not defined as output and thus cannot be Shared. resource id - network_4',
		name: () => `${randomstring.generate()}.yaml`,
		hasParent: false,
		parentName: 'HEAT',
		type: 'heat'
	});

export const HeatSetupModuleBase = new Factory()
	.option('name', 0)
	.attr('name', ['name'], (name) => {
		return name ? randomstring.generate(5) : '';
	})
	.attrs({
		isBase: false,
		yaml: () => {return 'yaml_' + randomstring.generate(5) + '.yaml';},
		env: () => {return 'env_' + randomstring.generate(5) + '.env';},
		vol: () => {return 'vol_' + randomstring.generate(5) + '.vol';},
		volEnv: () => {return 'volEnv_' + randomstring.generate(5) + '.env';}
	});

export const heatSetupManifest = new Factory()
	.attrs({
		modules: [
			{
				name: 'BASE_sdjflsjldfsd',
				isBase: true,
				yaml: 'yaml_filename9.yaml',
				env: 'env_filename8.env',
				vol: 'vol_filename5.vol',
				volEnv: 'vol_env_filename1.8.vol',

			},
			{
				name: 'MODULE_asdkjfhkajsf',
				isBase: false,
				yaml: 'yaml_filename.yaml',
				env: 'env_filename.env',
				vol: 'vol_filename.vol',
				volEnv: 'vol_env_filename.vol',

			}
		],
		unassigned: [
			'hot-nimbus-oam-volumes_v1.0.env',
			'hot-nimbus-oam_v1.0.env',
			'hot-nimbus-oam-volumes_v1.1.env',
			'hot-nimbus-oam-volumes_v2.0.env',
			'vol_filename2.vol',
			'hot-nimbus-oam-volumes_v4.0.env',
			'hot-nimbus-oam-volumes_v5.0.env',
			'hot-nimbus-oam_v6.0.env',
			'hot-nimbus-oam-volumes_v7.0.env',
			'vol_filename1.vol'
		],
		artifacts: ['hot-nimbus-oam_v3.0.env'],
		nested: ['nested-ppd_v1.1.yaml', 'nested-ppd_v1.0.yaml', 'nested-ppd_v8.0.yaml']
	});