2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 import {Factory} from 'rosie';
17 import SequenceDiagramFactory from './SequenceDiagramFactory.js';
18 import ParticipantFactory from './ParticipantFactory.js';
19 import UUID from 'uuid-js';
21 const serviceIDByArtifactType = {
22 NETWORK_CALL_FLOW: '338d75f0-aec8-4eb4-89c9-8733fcd9bf3b',
23 WORKFLOW: '338d75f0-aec8-4eb4-89c9-8733fcd9bf3b',
24 PUPPET: '0280b577-2c7b-426e-b7a2-f0dc16508c37'
27 const defaultServiceId = '338d75f0-aec8-4eb4-89c9-8733fcd9bf3b';
29 Factory.define('FlowBaseFactory')
31 artifactName: 'zizizi',
32 artifactType: 'WORKFLOW',
33 description: 'aslkjdfl asfdasdf',
36 Factory.define('FlowBaseWithServiceIdFactory')
37 .extend('FlowBaseFactory')
39 'serviceID', ['artifactType'], artifactType => serviceIDByArtifactType[artifactType] || defaultServiceId
42 Factory.define('FlowBaseWithUniqueIdFactory')
43 .extend('FlowBaseFactory')
44 .attr('uniqueId', ['artifactType', 'artifactName'], (artifactType, artifactName) => `${serviceIDByArtifactType[artifactType] || defaultServiceId}.${artifactName}`);
46 Factory.define('FlowBaseFetchAndDeleteFactory')
47 .extend('FlowBaseWithServiceIdFactory')
48 .extend('FlowBaseWithUniqueIdFactory')
53 Factory.define('FlowBaseWithEsIdFactory')
54 .extend('FlowBaseWithUniqueIdFactory')
55 .attr('esId', ['uniqueId'], uniqueId => uniqueId);
57 export const FlowBasicFactory = new Factory()
58 .extend('FlowBaseFactory').attrs({uniqueId: () => UUID.create(4)});
60 export const FlowCreateFactory = new Factory()
61 .extend('FlowBaseWithServiceIdFactory');
63 export const FlowPostRequestFactory = new Factory()
64 .extend('FlowBaseFactory')
66 artifactGroupType: 'INFORMATIONAL',
67 payloadData: 'eyJWRVJTSU9OIjp7Im1ham9yIjoxLCJtaW5vciI6MH0sImRlc2NyaXB0aW9uIjoiYXNsa2pkZmwgYXNmZGFzZGYifQ=='
69 .attr('artifactLabel', ['artifactName'], name => name);
71 Factory.define('FlowPostResponeAndUpdateBaseFactory')
72 .extend('FlowBaseFactory')
73 .extend('FlowBaseWithUniqueIdFactory')
74 .extend('FlowBaseWithEsIdFactory')
76 artifactGroupType: 'INFORMATIONAL',
77 artifactUUID: () => UUID.create(4),
79 creationDate: 1470144601623,
80 lastUpdateDate: 1470144601623,
83 artifactChecksum: 'NjBmYjc4NGM5MWIwNmNkMDhmMThhMDAwYmQxYjBiZTU='
85 .attr('artifactLabel', ['artifactName'], name => name)
86 .attr('artifactDisplayName', ['artifactName'], name => name);
88 export const FlowPostResponseFactory = new Factory()
89 .extend('FlowPostResponeAndUpdateBaseFactory')
91 attUidLastUpdater: 'cs0008',
92 payloadUpdateDate: 1470144602131,
94 updaterFullName: 'Carlos Santana',
95 artifactCreator: 'cs0008'
98 export const FlowUpdateRequestFactory = new Factory()
99 .extend('FlowPostResponeAndUpdateBaseFactory')
100 .extend('FlowBaseFetchAndDeleteFactory')
101 .extend('FlowBaseWithEsIdFactory')
104 participants: ParticipantFactory.buildList(10)
106 .attr('sequenceDiagramModel', ['participants'], participants => SequenceDiagramFactory.build({}, {participants}));
108 export const FlowFetchRequestFactory = new Factory()
109 .extend('FlowBaseFetchAndDeleteFactory');
111 export const FlowDeleteRequestFactory = new Factory()
112 .extend('FlowBaseFetchAndDeleteFactory');
114 export const FlowFetchResponseFactory = new Factory()
115 .extend('FlowBaseFactory')
117 base64Contents: 'eyJWRVJTSU9OIjp7Im1ham9yIjoxLCJtaW5vciI6MH0sImRlc2NyaXB0aW9uIjoiYXNsa2pkZmwgYXNmZGFzZGYifQ=='