blob: 15629a4da63aa07bcbf83fecd99d99b0d8c29b27 (
plain) (
blame)
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
|
/*******************************************************************************
* Copyright (c) 2011 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.ats.client.integration.tests.ats.config.copy;
import org.junit.Assert;
import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.client.demo.DemoActionableItems;
import org.eclipse.osee.ats.client.demo.DemoTeam;
import org.eclipse.osee.ats.client.integration.tests.util.DemoTestUtil;
import org.eclipse.osee.ats.config.copy.ConfigData;
import org.eclipse.osee.ats.config.copy.CopyAtsValidation;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.util.XResultData;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* Test case for {@link CopyAtsValidation}
*
* @author Donald G. Dunne
*/
public class CopyAtsValidationTest {
@BeforeClass
public static void setup() throws Exception {
DemoTestUtil.setUpTest();
}
@Test
public void testValidate() throws OseeCoreException {
// set name to one that can't be converted
ConfigData data = getConfigData();
IAtsActionableItem ai = data.getActionableItem();
String origName = ai.getName();
ai.setName("CSCI");
XResultData results = new XResultData(false);
data.setActionableItem(ai);
CopyAtsValidation validation = new CopyAtsValidation(data, results);
validation.validate();
Assert.assertTrue(results.isErrors());
Assert.assertEquals(1, results.getNumErrors());
// reset name to normal
ai.setName(origName);
results.clear();
validation.validate();
Assert.assertFalse(results.isErrors());
Assert.assertEquals(0, results.getNumErrors());
}
public static ConfigData getConfigData() throws OseeCoreException {
ConfigData data = new ConfigData();
data.setReplaceStr("CISv2");
data.setSearchStr("CIS");
IAtsTeamDefinition tda = DemoTestUtil.getTeamDef(DemoTeam.CIS_SW);
data.setTeamDef(tda);
IAtsActionableItem aiArt = DemoTestUtil.getActionableItem(DemoActionableItems.CIS_CSCI);
data.setActionableItem(aiArt);
data.setRetainTeamLeads(true);
data.setPersistChanges(true);
return data;
}
}
|