Added oparent to sdc main
[sdc.git] / asdctool / src / test / java / org / openecomp / sdc / asdctool / migration / DummyMigrationFactory.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.asdctool.migration;
22
23
24 import org.openecomp.sdc.asdctool.migration.core.DBVersion;
25 import org.openecomp.sdc.asdctool.migration.core.task.Migration;
26 import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult;
27
28 public class DummyMigrationFactory {
29
30     public static Migration SUCCESSFUL_MIGRATION = new Migration() {
31         @Override
32         public String description() {
33             return "success mig";
34         }
35
36         @Override
37         public DBVersion getVersion() {
38             return DBVersion.fromString("1710.22");
39         }
40
41         @Override
42         public MigrationResult migrate() {
43             MigrationResult migrationResult = new MigrationResult();
44             migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.COMPLETED);
45             migrationResult.setMsg("myMsg");
46             return migrationResult;
47         }
48     };
49
50     public static Migration FAILED_MIGRATION = new Migration() {
51         @Override
52         public String description() {
53             return "failed mig";
54         }
55
56         @Override
57         public DBVersion getVersion() {
58             return DBVersion.fromString("1710.22");
59         }
60
61         @Override
62         public MigrationResult migrate() {
63             MigrationResult migrationResult = new MigrationResult();
64             migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.FAILED);
65             migrationResult.setMsg("myMsg");
66             return migrationResult;
67         }
68     };
69
70     public static Migration getMigration(String version, MigrationResult.MigrationStatus status) {
71         return new Migration() {
72             @Override
73             public String description() {
74                 return "success mig";
75             }
76
77             @Override
78             public DBVersion getVersion() {
79                 return DBVersion.fromString(version);
80             }
81
82             @Override
83             public MigrationResult migrate() {
84                 MigrationResult migrationResult = new MigrationResult();
85                 migrationResult.setMigrationStatus(status);
86                 migrationResult.setMsg("myMsg");
87                 return migrationResult;
88             }
89         };
90     }
91
92 }