Skip to content

Package: MigrationManager

MigrationManager

nameinstructionbranchcomplexitylinemethod
MigrationManager()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
migrate(Version, Version)
M: 58 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 19 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package migration;
2:
3: import java.io.FileNotFoundException;
4: import java.io.IOException;
5:
6: import org.tmatesoft.svn.core.SVNException;
7:
8: import migration.difffile.DiffFile;
9: import migration.processeddifffile.ProcessedDiffFile;
10: import migration.processor.ConcreteDiffFileProcessor;
11: import migration.processor.DiffFileProcessor;
12: import model.type.TypeDoesNotExistException;
13: import model.type.TypeExceptions;
14: import model.type.ValueNotInRangeOfTypeException;
15: import parser.ParserException;
16: import scanner.ScannerException;
17:
18: /**
19: * @author Jannik
20: *
21: */
22: public class MigrationManager {
23:         /**
24:          *
25:          * Die Methode migriert die Benutzerangepasste Konfigurationsdatei der Variablenzuweiseung von
26:          * der alten Version auf die neue.
27:          *
28:          * @param oldVersion
29:          * Dies ist die alte Version
30:          *
31:          * @param newVersion
32:          * Dies ist die neue Version
33:          *
34:          * @throws SVNException
35:          * if an error has occurred in the svn-kit.
36:          * @throws FileNotFoundException
37:          * if a file was not found.
38:          * @throws IllegalArgumentException
39:          * when an Illegal argument occurs.
40:          * @throws InterruptedException
41:          * from the buffer.
42:          * @throws ScannerException
43:          * if there is any problem during the scan.
44:          * @throws ParserException
45:          * if there is any problem during the pars.
46:          * @throws IOException
47:          * if an IO error occurs.
48:          * @throws ValueNotInRangeOfTypeException
49:          * if the value is not in the range of the type.
50:          * @throws TypeDoesNotExistException
51:          * TypeDoesNotExistException
52:          * @throws TypeExceptions
53:          * if an error occurs in a type.
54:          */
55:         void migrate(final Version oldVersion, final Version newVersion)
56:                         throws SVNException, FileNotFoundException, IllegalArgumentException,
57:                         InterruptedException, ParserException, ScannerException, IOException,
58:                         ValueNotInRangeOfTypeException, TypeDoesNotExistException, TypeExceptions {
59:
60:                 // TODO for-Schleife für jede Zwischenversion zwischen oldVersion und newVersion
61:
62:                 // 1) GENERATE DIFF FILES
63:                 // ------------------------------------------------------------------------------------
64:
65:                 final DiffFileGenerator diffFileGenerator = new DiffFileGenerator();
66:
67:                 // Example values for package name
68:                 final String sampleValuePackageName = "base";
69:                 // Example values for assignementfile path
70:                 final String sampleValueAssignementfilePath = "config/base.txt";
71:                 // Example values for definitionfile path
72:                 final String sampleValueDefinitionfilePath = "check/base.txt";
73:
74:                 // => DIFF FILES ASSIGNEMENTFILES (AF)
75:                 final FilePackage assignmentFile =
76:                                 new FilePackage(sampleValuePackageName, sampleValueAssignementfilePath);
77:                 // -> DIFF FILE OAFO + NAFO (ADF1)
78:                 final String assignementDiffFile1 =
79:                                 diffFileGenerator.generateDiffFile(assignmentFile, oldVersion, newVersion);
80:                 // -> DIFF FILE OAFO + OAFA (ADF2)
81:                 // TODO FEHLT NOCH
82:
83:                 // => DIFF FILE DEFINITIONFILE (DF)
84:                 final FilePackage definitionFile =
85:                                 new FilePackage(sampleValuePackageName, sampleValueDefinitionfilePath);
86:
87:                 // -> DIFF FILE ODFO + NDFO (DDF)
88:                 final String definitionDiffFile =
89:                                 diffFileGenerator.generateDiffFile(definitionFile, oldVersion, newVersion);
90:                 System.out.println(definitionDiffFile);
91:                 // ------------------------------------------------------------------------------------
92:                 //
93:                 //
94:                 //
95:                 //
96:                 //
97:                 // 2) SCAN AND PARSE DIFF FILES
98:                 // ------------------------------------------------------------------------------------
99:
100:                 final DiffFileScanParser diffFileScanParser = new DiffFileScanParser();
101:
102:                 // => S&P ASSIGNEMENTDIFFFILES (ADF)
103:                 // -> S&P ADF1
104:                 final DiffFile processedAssignmentDiffFile1 =
105:                                 diffFileScanParser.scanParse(assignementDiffFile1);
106:
107:                 // -> S&P ADF2
108:                 // DiffFile PADF2 = diffFileScanParser.scanParse(ADF2);
109:
110:                 // => S&P DEFINITIONDIFFFILE (DDF)
111:                 // -> S&P DDF
112:                 // TODO: Implementation of the scanner and parser for definition files.
113:                 // ------------------------------------------------------------------------------------
114:                 //
115:                 //
116:                 //
117:                 //
118:                 //
119:                 //
120:                 // 3) PROCESS DIFF FILES
121:                 // ------------------------------------------------------------------------------------
122:
123:                 final DiffFileProcessor diffFileProcessor = new ConcreteDiffFileProcessor();
124:                 // => PROCESS DEFINITIONDIFFFILE (DDF)
125:                 // -> PROCESS PDDF
126:                 // ProcessedDiffFile PPDDF = diffFileProcessor.function(PDDF);
127:
128:                 // => PROCESS ASSIGNEMENTDIFFFILES (ADF)
129:                 // -> PROCESS PADF1
130:                 @SuppressWarnings("unused")
131:                 final ProcessedDiffFile processedAssignmentDiffFile2 =
132:                                 diffFileProcessor.process(processedAssignmentDiffFile1);
133:                 // -> PROCESS PADF2
134:                 // ProcessedDiffFile PPADF2 = diffFileProcessor.function(PADF2);
135:
136:                 // ------------------------------------------------------------------------------------
137:                 //
138:                 //
139:                 // 4) COMPOSE PROCESSEDDIFFFILE (ab hier nicht mehr Teil der for Schleife für zwischen
140:                 // Versionen)
141:                 // Es sollen die INformationen der Zwischenschritte zusammengefasst werdeb
142:                 // TODO: Neue Klasse oder in Code integrieren
143:                 //
144:                 //
145:                 // 5) ADAPT FILE
146:                 // ------------------------------------------------------------------------------------
147:                 //
148:                 @SuppressWarnings("unused")
149:                 final MigrationFileAdapter fileAdapter = new MigrationFileAdapter();
150:                 // TODO fileAdapter.function(newOriginFile, endProcessedFile, oldAdaptedFile)
151:
152:         }
153:
154: }