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
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/*******************************************************************************
* Copyright (c) 2010 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.column;
import java.util.Arrays;
import java.util.Date;
import org.eclipse.osee.ats.core.AtsTestUtil;
import org.eclipse.osee.ats.core.team.TeamState;
import org.eclipse.osee.ats.core.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.workflow.transition.TransitionHelper;
import org.eclipse.osee.ats.core.workflow.transition.TransitionManager;
import org.eclipse.osee.ats.core.workflow.transition.TransitionOption;
import org.eclipse.osee.ats.core.workflow.transition.TransitionResults;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.ats.util.DemoTestUtil;
import org.eclipse.osee.framework.jdk.core.util.DateUtil;
import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
import org.eclipse.osee.support.test.util.TestUtil;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
/**
* @tests CompletedDateColumn
* @author Donald G. Dunne
*/
public class CompletedDateColumnTest {
@AfterClass
@BeforeClass
public static void cleanup() throws Exception {
AtsTestUtil.cleanupSimpleTest(CompletedDateColumnTest.class.getSimpleName());
}
@org.junit.Test
public void testGetDateAndStrAndColumnText() throws Exception {
SevereLoggingMonitor loggingMonitor = TestUtil.severeLoggingStart();
SkynetTransaction transaction =
new SkynetTransaction(AtsUtil.getAtsBranch(), CompletedDateColumnTest.class.getSimpleName());
TeamWorkFlowArtifact teamArt =
DemoTestUtil.createSimpleAction(CompletedDateColumnTest.class.getSimpleName(), transaction);
transaction.execute();
Assert.assertEquals("", CompletedDateColumn.getInstance().getColumnText(teamArt, AssigneeColumn.getInstance(), 0));
Date date = CompletedDateColumn.getDate(teamArt);
Assert.assertNull(date);
Assert.assertEquals("", CompletedDateColumn.getDateStr(teamArt));
TransitionHelper helper =
new TransitionHelper("Transition to Completed", Arrays.asList(teamArt), TeamState.Completed.getPageName(),
null, null, TransitionOption.OverrideTransitionValidityCheck, TransitionOption.OverrideAssigneeCheck);
TransitionManager transitionMgr = new TransitionManager(helper);
TransitionResults results = transitionMgr.handleAll();
Assert.assertTrue(results.toString(), results.isEmpty());
transitionMgr.getTransaction().execute();
date = CompletedDateColumn.getDate(teamArt);
Assert.assertNotNull(date);
Assert.assertEquals(DateUtil.getMMDDYYHHMM(date), CompletedDateColumn.getDateStr(teamArt));
Assert.assertEquals(DateUtil.getMMDDYYHHMM(date),
CompletedDateColumn.getInstance().getColumnText(teamArt, AssigneeColumn.getInstance(), 0));
helper =
new TransitionHelper("Transition to Endorse", Arrays.asList(teamArt), TeamState.Endorse.getPageName(),
Arrays.asList(UserManager.getUser()), null, TransitionOption.OverrideTransitionValidityCheck,
TransitionOption.OverrideAssigneeCheck);
transitionMgr = new TransitionManager(helper);
results = transitionMgr.handleAll();
Assert.assertTrue(results.toString(), results.isEmpty());
transitionMgr.getTransaction().execute();
Assert.assertEquals("Cancelled date should be blank again", "",
CompletedDateColumn.getInstance().getColumnText(teamArt, AssigneeColumn.getInstance(), 0));
date = CompletedDateColumn.getDate(teamArt);
Assert.assertNull(date);
TestUtil.severeLoggingEnd(loggingMonitor);
}
}
|