blob: 528b51569c0757f38f2346144bb9f24f813161f8 (
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
76
77
|
/*******************************************************************************
* 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 java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.client.integration.tests.AtsClientService;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.AtsTestUtil;
import org.eclipse.osee.ats.config.copy.ConfigData;
import org.eclipse.osee.ats.config.copy.CopyAtsConfigurationOperation;
import org.eclipse.osee.ats.core.config.TeamDefinitions;
import org.eclipse.osee.ats.health.ValidateAtsDatabase;
import org.eclipse.osee.ats.health.ValidateResults;
import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.core.util.XResultData;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* @author Donald G. Dunne
*/
public class CopyAtsConfigurationOperationTest {
@BeforeClass
@AfterClass
public static void cleanup() throws Exception {
AtsTestUtil.cleanupSimpleTest("CISv2");
}
@Test
public void testDoWork() throws OseeCoreException {
ConfigData data = CopyAtsValidationTest.getConfigData();
XResultData rd = new XResultData(false);
CopyAtsConfigurationOperation operation = new CopyAtsConfigurationOperation(data, rd);
Operations.executeWork(operation);
Assert.assertFalse(rd.isErrors());
Collection<IAtsTeamDefinition> teamDefs =
TeamDefinitions.getTeamDefinitionsNameStartsWith("CISv2", AtsClientService.get().getConfig());
Assert.assertEquals(5, teamDefs.size());
Collection<IAtsActionableItem> ais = getActionableItemsNameStartsWith("CISv2");
Assert.assertEquals(5, ais.size());
ValidateResults results = new ValidateResults();
Collection<Artifact> aiaArts = AtsClientService.get().getConfigArtifacts(ais);
ValidateAtsDatabase.testActionableItemToTeamDefinition(aiaArts, results);
Assert.assertEquals(0, results.getTestNameToResultsMap().size());
}
public static Set<IAtsActionableItem> getActionableItemsNameStartsWith(String prefix) throws OseeCoreException {
Set<IAtsActionableItem> artifacts = new HashSet<IAtsActionableItem>();
for (IAtsActionableItem aia : AtsClientService.get().getConfig().get(IAtsActionableItem.class)) {
if (aia.getName().startsWith(prefix)) {
artifacts.add(aia);
}
}
return artifacts;
}
}
|