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
|
/*******************************************************************************
* Copyright (c) 2004, 2007 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.change;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeVersion;
import org.junit.Assert;
/**
* @author Roberto E. Escobar
*/
public final class ChangeTestUtility {
private ChangeTestUtility() {
// Utility Class
}
public static ChangeVersion createChange(Long long1, ModificationType mod1) {
return new ChangeVersion(long1, mod1);
}
public static void checkChange(String message, ChangeVersion expected, ChangeVersion actual) {
Assert.assertEquals(message, expected.getGammaId(), actual.getGammaId());
Assert.assertEquals(message, expected.getModType(), actual.getModType());
Assert.assertEquals(message, expected.getValue(), actual.getValue());
}
public static void checkChange(ChangeVersion expected, ChangeVersion actual) {
checkChange(null, expected, actual);
}
public static ChangeItem createItem(int itemId, ChangeVersion base, ChangeVersion first, ChangeVersion current, ChangeVersion destination, ChangeVersion net) {
ChangeItem change = new ChangeItem();
change.setItemId(itemId);
change.setItemTypeId(itemId * 10);
change.setArtId(itemId * 100);
ChangeVersion currentVersion = change.getCurrentVersion();
currentVersion.setGammaId(current.getGammaId());
currentVersion.setModType(current.getModType());
if (base != null) {
change.getBaselineVersion().copy(base);
}
if (first != null) {
change.getFirstNonCurrentChange().copy(first);
}
if (destination != null) {
change.getDestinationVersion().copy(destination);
}
if (net != null) {
change.getNetChange().copy(net);
}
Assert.assertNotNull(change);
Assert.assertNotNull(change.getBaselineVersion());
Assert.assertNotNull(change.getFirstNonCurrentChange());
Assert.assertNotNull(change.getCurrentVersion());
Assert.assertNotNull(change.getDestinationVersion());
Assert.assertNotNull(change.getNetChange());
return change;
}
}
|