org.jfree.data.gantt.TaskSeriesCollection Java Examples
The following examples show how to use
org.jfree.data.gantt.TaskSeriesCollection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScheduleReport.java From ezScrum with GNU General Public License v2.0 | 6 votes |
private IntervalCategoryDataset createDataset() { SprintBacklogLogic sprintBacklogLogic = new SprintBacklogLogic( mProject, mIteration); SprintBacklogMapper sb = sprintBacklogLogic.getSprintBacklogMapper(); TaskSeriesCollection collection = null; if (mIteration == -1) { mIteration = sb.getSprintId(); } if (sb != null) { // 設定抓取iter 時間 mStartDate = sb.getSprintStartDate(); mEndDate = sb.getSprintEndDate(); mSprintGoal = sb.getSprintGoal(); collection = initTaskCollection(sprintBacklogLogic, sb); } return collection; }
Example #2
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some basic tests for the getSeries() methods. */ public void testGetSeries() { TaskSeries s1 = new TaskSeries("S1"); TaskSeries s2 = new TaskSeries("S2"); TaskSeriesCollection c = new TaskSeriesCollection(); c.add(s1); assertEquals(c.getSeries(0), s1); assertEquals(c.getSeries("S1"), s1); assertEquals(c.getSeries("XX"), null); c.add(s2); assertEquals(c.getSeries(1), s2); assertEquals(c.getSeries("S2"), s2); boolean pass = false; try { c.getSeries(null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
Example #3
Source File: XYTaskDatasetTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Confirm that cloning works. */ public void testCloning() { TaskSeries s1 = new TaskSeries("Series"); s1.add(new Task("Task 1", new Date(0L), new Date(1L))); TaskSeriesCollection u1 = new TaskSeriesCollection(); u1.add(s1); XYTaskDataset d1 = new XYTaskDataset(u1); XYTaskDataset d2 = null; try { d2 = (XYTaskDataset) d1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(d1 != d2); assertTrue(d1.getClass() == d2.getClass()); assertTrue(d1.equals(d2)); // basic check for independence s1.add(new Task("Task 2", new Date(10L), new Date(11L))); assertFalse(d1.equals(d2)); TaskSeriesCollection u2 = d2.getTasks(); TaskSeries s2 = u2.getSeries("Series"); s2.add(new Task("Task 2", new Date(10L), new Date(11L))); assertTrue(d1.equals(d2)); }
Example #4
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some tests for the getEndValue() method for sub-intervals. */ public void testGetEndValue2() { TaskSeriesCollection c = createCollection2(); assertEquals(new Long(15L), c.getEndValue("S1", "Task 1", 0)); assertEquals(new Long(20L), c.getEndValue("S1", "Task 1", 1)); assertEquals(new Long(35L), c.getEndValue("S1", "Task 2", 0)); assertEquals(new Long(40L), c.getEndValue("S1", "Task 2", 1)); assertEquals(new Long(55L), c.getEndValue("S2", "Task 3", 0)); assertEquals(new Long(60L), c.getEndValue("S2", "Task 3", 1)); assertEquals(new Long(15L), c.getEndValue(0, 0, 0)); assertEquals(new Long(20L), c.getEndValue(0, 0, 1)); assertEquals(new Long(35L), c.getEndValue(0, 1, 0)); assertEquals(new Long(40L), c.getEndValue(0, 1, 1)); assertEquals(new Long(55L), c.getEndValue(1, 2, 0)); assertEquals(new Long(60L), c.getEndValue(1, 2, 1)); TaskSeriesCollection c3 = createCollection3(); assertEquals(new Long(111), c3.getEndValue(0, 0, 0)); assertEquals(new Long(222), c3.getEndValue(0, 1, 0)); assertEquals(new Long(333), c3.getEndValue(0, 1, 1)); assertTrue(c3.getEndValue(1, 0, 0) == null); assertEquals(new Long(444), c3.getEndValue(1, 1, 0)); assertEquals(new Long(555), c3.getEndValue(1, 1, 1)); assertEquals(new Long(666), c3.getEndValue(1, 1, 2)); }
Example #5
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some tests for the getEndValue() method. */ public void testGetEndValue() { TaskSeriesCollection c = createCollection1(); assertEquals(new Long(2L), c.getEndValue("S1", "Task 1")); assertEquals(new Long(4L), c.getEndValue("S1", "Task 2")); assertEquals(new Long(6L), c.getEndValue("S2", "Task 3")); assertEquals(new Long(2L), c.getEndValue(0, 0)); assertEquals(new Long(4L), c.getEndValue(0, 1)); assertEquals(null, c.getEndValue(0, 2)); assertEquals(null, c.getEndValue(1, 0)); assertEquals(null, c.getEndValue(1, 1)); assertEquals(new Long(6L), c.getEndValue(1, 2)); // test collection 3, which doesn't define all tasks in all series TaskSeriesCollection c3 = createCollection3(); assertEquals(new Long(200), c3.getEndValue(0, 0)); assertEquals(new Long(350), c3.getEndValue(0, 1)); assertTrue(c3.getEndValue(1, 0) == null); assertEquals(new Long(3350), c3.getEndValue(1, 1)); }
Example #6
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some tests for the getStartValue() method for sub-intervals. */ public void testGetStartValue2() { TaskSeriesCollection c = createCollection2(); assertEquals(new Long(10L), c.getStartValue("S1", "Task 1", 0)); assertEquals(new Long(16L), c.getStartValue("S1", "Task 1", 1)); assertEquals(new Long(30L), c.getStartValue("S1", "Task 2", 0)); assertEquals(new Long(36L), c.getStartValue("S1", "Task 2", 1)); assertEquals(new Long(50L), c.getStartValue("S2", "Task 3", 0)); assertEquals(new Long(56L), c.getStartValue("S2", "Task 3", 1)); assertEquals(new Long(10L), c.getStartValue(0, 0, 0)); assertEquals(new Long(16L), c.getStartValue(0, 0, 1)); assertEquals(new Long(30L), c.getStartValue(0, 1, 0)); assertEquals(new Long(36L), c.getStartValue(0, 1, 1)); assertEquals(new Long(50L), c.getStartValue(1, 2, 0)); assertEquals(new Long(56L), c.getStartValue(1, 2, 1)); TaskSeriesCollection c3 = createCollection3(); assertEquals(new Long(11), c3.getStartValue(0, 0, 0)); assertEquals(new Long(22), c3.getStartValue(0, 1, 0)); assertEquals(new Long(33), c3.getStartValue(0, 1, 1)); assertTrue(c3.getStartValue(1, 0, 0) == null); assertEquals(new Long(44), c3.getStartValue(1, 1, 0)); assertEquals(new Long(55), c3.getStartValue(1, 1, 1)); assertEquals(new Long(66), c3.getStartValue(1, 1, 2)); }
Example #7
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some tests for the getStartValue() method. */ public void testGetStartValue() { TaskSeriesCollection c = createCollection1(); assertEquals(new Long(1L), c.getStartValue("S1", "Task 1")); assertEquals(new Long(3L), c.getStartValue("S1", "Task 2")); assertEquals(new Long(5L), c.getStartValue("S2", "Task 3")); assertEquals(new Long(1L), c.getStartValue(0, 0)); assertEquals(new Long(3L), c.getStartValue(0, 1)); assertEquals(null, c.getStartValue(0, 2)); assertEquals(null, c.getStartValue(1, 0)); assertEquals(null, c.getStartValue(1, 1)); assertEquals(new Long(5L), c.getStartValue(1, 2)); // test collection 3, which doesn't define all tasks in all series TaskSeriesCollection c3 = createCollection3(); assertEquals(new Long(100), c3.getStartValue(0, 0)); assertEquals(new Long(220), c3.getStartValue(0, 1)); assertTrue(c3.getStartValue(1, 0) == null); assertEquals(new Long(2220), c3.getStartValue(1, 1)); }
Example #8
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Creates a sample collection for testing purposes. * * @return A sample collection. */ private TaskSeriesCollection createCollection2() { TaskSeriesCollection result = new TaskSeriesCollection(); TaskSeries s1 = new TaskSeries("S1"); Task t1 = new Task("Task 1", new Date(10), new Date(20)); t1.addSubtask(new Task("Task 1A", new Date(10), new Date(15))); t1.addSubtask(new Task("Task 1B", new Date(16), new Date(20))); t1.setPercentComplete(0.10); s1.add(t1); Task t2 = new Task("Task 2", new Date(30), new Date(40)); t2.addSubtask(new Task("Task 2A", new Date(30), new Date(35))); t2.addSubtask(new Task("Task 2B", new Date(36), new Date(40))); t2.setPercentComplete(0.20); s1.add(t2); result.add(s1); TaskSeries s2 = new TaskSeries("S2"); Task t3 = new Task("Task 3", new Date(50), new Date(60)); t3.addSubtask(new Task("Task 3A", new Date(50), new Date(55))); t3.addSubtask(new Task("Task 3B", new Date(56), new Date(60))); t3.setPercentComplete(0.30); s2.add(t3); result.add(s2); return result; }
Example #9
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some tests for the getStartValue() method. */ public void testGetStartValue() { TaskSeriesCollection c = createCollection1(); assertEquals(new Long(1L), c.getStartValue("S1", "Task 1")); assertEquals(new Long(3L), c.getStartValue("S1", "Task 2")); assertEquals(new Long(5L), c.getStartValue("S2", "Task 3")); assertEquals(new Long(1L), c.getStartValue(0, 0)); assertEquals(new Long(3L), c.getStartValue(0, 1)); assertEquals(null, c.getStartValue(0, 2)); assertEquals(null, c.getStartValue(1, 0)); assertEquals(null, c.getStartValue(1, 1)); assertEquals(new Long(5L), c.getStartValue(1, 2)); // test collection 3, which doesn't define all tasks in all series TaskSeriesCollection c3 = createCollection3(); assertEquals(new Long(100), c3.getStartValue(0, 0)); assertEquals(new Long(220), c3.getStartValue(0, 1)); assertTrue(c3.getStartValue(1, 0) == null); assertEquals(new Long(2220), c3.getStartValue(1, 1)); }
Example #10
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some tests for the getStartValue() method for sub-intervals. */ public void testGetStartValue2() { TaskSeriesCollection c = createCollection2(); assertEquals(new Long(10L), c.getStartValue("S1", "Task 1", 0)); assertEquals(new Long(16L), c.getStartValue("S1", "Task 1", 1)); assertEquals(new Long(30L), c.getStartValue("S1", "Task 2", 0)); assertEquals(new Long(36L), c.getStartValue("S1", "Task 2", 1)); assertEquals(new Long(50L), c.getStartValue("S2", "Task 3", 0)); assertEquals(new Long(56L), c.getStartValue("S2", "Task 3", 1)); assertEquals(new Long(10L), c.getStartValue(0, 0, 0)); assertEquals(new Long(16L), c.getStartValue(0, 0, 1)); assertEquals(new Long(30L), c.getStartValue(0, 1, 0)); assertEquals(new Long(36L), c.getStartValue(0, 1, 1)); assertEquals(new Long(50L), c.getStartValue(1, 2, 0)); assertEquals(new Long(56L), c.getStartValue(1, 2, 1)); TaskSeriesCollection c3 = createCollection3(); assertEquals(new Long(11), c3.getStartValue(0, 0, 0)); assertEquals(new Long(22), c3.getStartValue(0, 1, 0)); assertEquals(new Long(33), c3.getStartValue(0, 1, 1)); assertTrue(c3.getStartValue(1, 0, 0) == null); assertEquals(new Long(44), c3.getStartValue(1, 1, 0)); assertEquals(new Long(55), c3.getStartValue(1, 1, 1)); assertEquals(new Long(66), c3.getStartValue(1, 1, 2)); }
Example #11
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some tests for the getEndValue() method. */ public void testGetEndValue() { TaskSeriesCollection c = createCollection1(); assertEquals(new Long(2L), c.getEndValue("S1", "Task 1")); assertEquals(new Long(4L), c.getEndValue("S1", "Task 2")); assertEquals(new Long(6L), c.getEndValue("S2", "Task 3")); assertEquals(new Long(2L), c.getEndValue(0, 0)); assertEquals(new Long(4L), c.getEndValue(0, 1)); assertEquals(null, c.getEndValue(0, 2)); assertEquals(null, c.getEndValue(1, 0)); assertEquals(null, c.getEndValue(1, 1)); assertEquals(new Long(6L), c.getEndValue(1, 2)); // test collection 3, which doesn't define all tasks in all series TaskSeriesCollection c3 = createCollection3(); assertEquals(new Long(200), c3.getEndValue(0, 0)); assertEquals(new Long(350), c3.getEndValue(0, 1)); assertTrue(c3.getEndValue(1, 0) == null); assertEquals(new Long(3350), c3.getEndValue(1, 1)); }
Example #12
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Creates a sample collection for testing purposes. * * @return A sample collection. */ private TaskSeriesCollection createCollection2() { TaskSeriesCollection result = new TaskSeriesCollection(); TaskSeries s1 = new TaskSeries("S1"); Task t1 = new Task("Task 1", new Date(10), new Date(20)); t1.addSubtask(new Task("Task 1A", new Date(10), new Date(15))); t1.addSubtask(new Task("Task 1B", new Date(16), new Date(20))); t1.setPercentComplete(0.10); s1.add(t1); Task t2 = new Task("Task 2", new Date(30), new Date(40)); t2.addSubtask(new Task("Task 2A", new Date(30), new Date(35))); t2.addSubtask(new Task("Task 2B", new Date(36), new Date(40))); t2.setPercentComplete(0.20); s1.add(t2); result.add(s1); TaskSeries s2 = new TaskSeries("S2"); Task t3 = new Task("Task 3", new Date(50), new Date(60)); t3.addSubtask(new Task("Task 3A", new Date(50), new Date(55))); t3.addSubtask(new Task("Task 3B", new Date(56), new Date(60))); t3.setPercentComplete(0.30); s2.add(t3); result.add(s2); return result; }
Example #13
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some tests for the getEndValue() method for sub-intervals. */ public void testGetEndValue2() { TaskSeriesCollection c = createCollection2(); assertEquals(new Long(15L), c.getEndValue("S1", "Task 1", 0)); assertEquals(new Long(20L), c.getEndValue("S1", "Task 1", 1)); assertEquals(new Long(35L), c.getEndValue("S1", "Task 2", 0)); assertEquals(new Long(40L), c.getEndValue("S1", "Task 2", 1)); assertEquals(new Long(55L), c.getEndValue("S2", "Task 3", 0)); assertEquals(new Long(60L), c.getEndValue("S2", "Task 3", 1)); assertEquals(new Long(15L), c.getEndValue(0, 0, 0)); assertEquals(new Long(20L), c.getEndValue(0, 0, 1)); assertEquals(new Long(35L), c.getEndValue(0, 1, 0)); assertEquals(new Long(40L), c.getEndValue(0, 1, 1)); assertEquals(new Long(55L), c.getEndValue(1, 2, 0)); assertEquals(new Long(60L), c.getEndValue(1, 2, 1)); TaskSeriesCollection c3 = createCollection3(); assertEquals(new Long(111), c3.getEndValue(0, 0, 0)); assertEquals(new Long(222), c3.getEndValue(0, 1, 0)); assertEquals(new Long(333), c3.getEndValue(0, 1, 1)); assertTrue(c3.getEndValue(1, 0, 0) == null); assertEquals(new Long(444), c3.getEndValue(1, 1, 0)); assertEquals(new Long(555), c3.getEndValue(1, 1, 1)); assertEquals(new Long(666), c3.getEndValue(1, 1, 2)); }
Example #14
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some basic tests for the getSeries() methods. */ public void testGetSeries() { TaskSeries s1 = new TaskSeries("S1"); TaskSeries s2 = new TaskSeries("S2"); TaskSeriesCollection c = new TaskSeriesCollection(); c.add(s1); assertEquals(c.getSeries(0), s1); assertEquals(c.getSeries("S1"), s1); assertEquals(c.getSeries("XX"), null); c.add(s2); assertEquals(c.getSeries(1), s2); assertEquals(c.getSeries("S2"), s2); boolean pass = false; try { c.getSeries(null); } catch (NullPointerException e) { pass = true; } assertTrue(pass); }
Example #15
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * A test for bug report 697153. */ public void test697153() { TaskSeries s1 = new TaskSeries("S1"); s1.add(new Task("Task 1", new SimpleTimePeriod(new Date(), new Date()))); s1.add(new Task("Task 2", new SimpleTimePeriod(new Date(), new Date()))); s1.add(new Task("Task 3", new SimpleTimePeriod(new Date(), new Date()))); TaskSeries s2 = new TaskSeries("S2"); s2.add(new Task("Task 2", new SimpleTimePeriod(new Date(), new Date()))); s2.add(new Task("Task 3", new SimpleTimePeriod(new Date(), new Date()))); s2.add(new Task("Task 4", new SimpleTimePeriod(new Date(), new Date()))); TaskSeriesCollection tsc = new TaskSeriesCollection(); tsc.add(s1); tsc.add(s2); s1.removeAll(); int taskCount = tsc.getColumnCount(); assertEquals(3, taskCount); }
Example #16
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the bug report 1099331. We create a TaskSeriesCollection * with two series - the first series has two tasks, but the second has * only one. The key is to ensure that the methods in TaskSeriesCollection * translate the index values to key values *before* accessing the tasks * in the series. */ public void testGetSubIntervalCount() { TaskSeriesCollection tsc = createCollection3(); assertEquals(1, tsc.getSubIntervalCount(0, 0)); assertEquals(2, tsc.getSubIntervalCount(0, 1)); assertEquals(0, tsc.getSubIntervalCount(1, 0)); assertEquals(3, tsc.getSubIntervalCount(1, 1)); }
Example #17
Source File: XYTaskDatasetTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the equals() method. */ public void testEquals() { TaskSeries s1 = new TaskSeries("Series"); s1.add(new Task("Task 1", new Date(0L), new Date(1L))); s1.add(new Task("Task 2", new Date(10L), new Date(11L))); s1.add(new Task("Task 3", new Date(20L), new Date(21L))); TaskSeriesCollection u1 = new TaskSeriesCollection(); u1.add(s1); XYTaskDataset d1 = new XYTaskDataset(u1); TaskSeries s2 = new TaskSeries("Series"); s2.add(new Task("Task 1", new Date(0L), new Date(1L))); s2.add(new Task("Task 2", new Date(10L), new Date(11L))); s2.add(new Task("Task 3", new Date(20L), new Date(21L))); TaskSeriesCollection u2 = new TaskSeriesCollection(); u2.add(s2); XYTaskDataset d2 = new XYTaskDataset(u2); assertTrue(d1.equals(d2)); d1.setSeriesWidth(0.123); assertFalse(d1.equals(d2)); d2.setSeriesWidth(0.123); assertTrue(d1.equals(d2)); d1.setTransposed(true); assertFalse(d1.equals(d2)); d2.setTransposed(true); assertTrue(d1.equals(d2)); s1.add(new Task("Task 2", new Date(10L), new Date(11L))); assertFalse(d1.equals(d2)); s2.add(new Task("Task 2", new Date(10L), new Date(11L))); assertTrue(d1.equals(d2)); }
Example #18
Source File: XYTaskDatasetTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ public void testSerialization() { TaskSeries s1 = new TaskSeries("Series"); s1.add(new Task("Task 1", new Date(0L), new Date(1L))); TaskSeriesCollection u1 = new TaskSeriesCollection(); u1.add(s1); XYTaskDataset d1 = new XYTaskDataset(u1); XYTaskDataset d2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(d1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); d2 = (XYTaskDataset) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(d1, d2); // basic check for independence s1.add(new Task("Task 2", new Date(10L), new Date(11L))); assertFalse(d1.equals(d2)); TaskSeriesCollection u2 = d2.getTasks(); TaskSeries s2 = u2.getSeries("Series"); s2.add(new Task("Task 2", new Date(10L), new Date(11L))); assertTrue(d1.equals(d2)); }
Example #19
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the bug report 1099331. We create a TaskSeriesCollection * with two series - the first series has two tasks, but the second has * only one. The key is to ensure that the methods in TaskSeriesCollection * translate the index values to key values *before* accessing the tasks * in the series. */ public void testGetSubIntervalCount() { TaskSeriesCollection tsc = createCollection3(); assertEquals(1, tsc.getSubIntervalCount(0, 0)); assertEquals(2, tsc.getSubIntervalCount(0, 1)); assertEquals(0, tsc.getSubIntervalCount(1, 0)); assertEquals(3, tsc.getSubIntervalCount(1, 1)); }
Example #20
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * A test for bug report 697153. */ public void test697153() { TaskSeries s1 = new TaskSeries("S1"); s1.add(new Task("Task 1", new SimpleTimePeriod(new Date(), new Date()))); s1.add(new Task("Task 2", new SimpleTimePeriod(new Date(), new Date()))); s1.add(new Task("Task 3", new SimpleTimePeriod(new Date(), new Date()))); TaskSeries s2 = new TaskSeries("S2"); s2.add(new Task("Task 2", new SimpleTimePeriod(new Date(), new Date()))); s2.add(new Task("Task 3", new SimpleTimePeriod(new Date(), new Date()))); s2.add(new Task("Task 4", new SimpleTimePeriod(new Date(), new Date()))); TaskSeriesCollection tsc = new TaskSeriesCollection(); tsc.add(s1); tsc.add(s2); s1.removeAll(); int taskCount = tsc.getColumnCount(); assertEquals(3, taskCount); }
Example #21
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample collection for testing purposes. * * @return A sample collection. */ private TaskSeriesCollection createCollection1() { TaskSeriesCollection result = new TaskSeriesCollection(); TaskSeries s1 = new TaskSeries("S1"); s1.add(new Task("Task 1", new Date(1), new Date(2))); s1.add(new Task("Task 2", new Date(3), new Date(4))); result.add(s1); TaskSeries s2 = new TaskSeries("S2"); s2.add(new Task("Task 3", new Date(5), new Date(6))); result.add(s2); return result; }
Example #22
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ public void testEquals() { TaskSeries s1 = new TaskSeries("S"); s1.add(new Task("T1", new Date(1), new Date(2))); s1.add(new Task("T2", new Date(11), new Date(22))); TaskSeries s2 = new TaskSeries("S"); s2.add(new Task("T1", new Date(1), new Date(2))); s2.add(new Task("T2", new Date(11), new Date(22))); TaskSeriesCollection c1 = new TaskSeriesCollection(); c1.add(s1); c1.add(s2); TaskSeries s1b = new TaskSeries("S"); s1b.add(new Task("T1", new Date(1), new Date(2))); s1b.add(new Task("T2", new Date(11), new Date(22))); TaskSeries s2b = new TaskSeries("S"); s2b.add(new Task("T1", new Date(1), new Date(2))); s2b.add(new Task("T2", new Date(11), new Date(22))); TaskSeriesCollection c2 = new TaskSeriesCollection(); c2.add(s1b); c2.add(s2b); assertTrue(c1.equals(c2)); assertTrue(c2.equals(c1)); }
Example #23
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the getColumnIndex() method. */ public void testGetColumnIndex() { TaskSeriesCollection c = createCollection1(); assertEquals(0, c.getColumnIndex("Task 1")); assertEquals(1, c.getColumnIndex("Task 2")); assertEquals(2, c.getColumnIndex("Task 3")); }
Example #24
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the getColumnKey() method. */ public void testGetColumnKey() { TaskSeriesCollection c = createCollection1(); assertEquals("Task 1", c.getColumnKey(0)); assertEquals("Task 2", c.getColumnKey(1)); assertEquals("Task 3", c.getColumnKey(2)); }
Example #25
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the getValue() method. */ public void testGetValue() { TaskSeriesCollection c = createCollection1(); assertEquals(new Long(1L), c.getValue("S1", "Task 1")); assertEquals(new Long(3L), c.getValue("S1", "Task 2")); assertEquals(new Long(5L), c.getValue("S2", "Task 3")); assertEquals(new Long(1L), c.getValue(0, 0)); assertEquals(new Long(3L), c.getValue(0, 1)); assertEquals(null, c.getValue(0, 2)); assertEquals(null, c.getValue(1, 0)); assertEquals(null, c.getValue(1, 1)); assertEquals(new Long(5L), c.getValue(1, 2)); }
Example #26
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the getPercentComplete() method. */ public void testGetPercentComplete() { TaskSeriesCollection c = createCollection2(); assertEquals(new Double(0.10), c.getPercentComplete("S1", "Task 1")); assertEquals(new Double(0.20), c.getPercentComplete("S1", "Task 2")); assertEquals(new Double(0.30), c.getPercentComplete("S2", "Task 3")); assertEquals(new Double(0.10), c.getPercentComplete(0, 0)); assertEquals(new Double(0.20), c.getPercentComplete(0, 1)); assertEquals(null, c.getPercentComplete(0, 2)); assertEquals(null, c.getPercentComplete(1, 0)); assertEquals(null, c.getPercentComplete(1, 1)); assertEquals(new Double(0.30), c.getPercentComplete(1, 2)); // test collection 3, which doesn't define all tasks in all series TaskSeriesCollection c3 = createCollection3(); assertEquals(new Double(0.1), c3.getPercentComplete(0, 0)); assertEquals(new Double(0.2), c3.getPercentComplete(0, 1)); assertTrue(c3.getPercentComplete(1, 0) == null); assertEquals(new Double(0.3), c3.getPercentComplete(1, 1)); assertEquals(new Double(0.111), c3.getPercentComplete(0, 0, 0)); assertEquals(new Double(0.222), c3.getPercentComplete(0, 1, 0)); assertEquals(new Double(0.333), c3.getPercentComplete(0, 1, 1)); assertEquals(new Double(0.444), c3.getPercentComplete(1, 1, 0)); assertEquals(new Double(0.555), c3.getPercentComplete(1, 1, 1)); assertEquals(new Double(0.666), c3.getPercentComplete(1, 1, 2)); }
Example #27
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * A check for a null task duration. */ public void testGetEndValue3() { TaskSeriesCollection c = new TaskSeriesCollection(); TaskSeries s = new TaskSeries("Series 1"); s.add(new Task("Task with null duration", null)); c.add(s); Number millis = c.getEndValue("Series 1", "Task with null duration"); assertTrue(millis == null); }
Example #28
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * A check for a null task duration. */ public void testGetStartValue3() { TaskSeriesCollection c = new TaskSeriesCollection(); TaskSeries s = new TaskSeries("Series 1"); s.add(new Task("Task with null duration", null)); c.add(s); Number millis = c.getStartValue("Series 1", "Task with null duration"); assertTrue(millis == null); }
Example #29
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the getColumnIndex() method. */ public void testGetColumnIndex() { TaskSeriesCollection c = createCollection1(); assertEquals(0, c.getColumnIndex("Task 1")); assertEquals(1, c.getColumnIndex("Task 2")); assertEquals(2, c.getColumnIndex("Task 3")); }
Example #30
Source File: TaskSeriesCollectionTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ public void testEquals() { TaskSeries s1 = new TaskSeries("S"); s1.add(new Task("T1", new Date(1), new Date(2))); s1.add(new Task("T2", new Date(11), new Date(22))); TaskSeries s2 = new TaskSeries("S"); s2.add(new Task("T1", new Date(1), new Date(2))); s2.add(new Task("T2", new Date(11), new Date(22))); TaskSeriesCollection c1 = new TaskSeriesCollection(); c1.add(s1); c1.add(s2); TaskSeries s1b = new TaskSeries("S"); s1b.add(new Task("T1", new Date(1), new Date(2))); s1b.add(new Task("T2", new Date(11), new Date(22))); TaskSeries s2b = new TaskSeries("S"); s2b.add(new Task("T1", new Date(1), new Date(2))); s2b.add(new Task("T2", new Date(11), new Date(22))); TaskSeriesCollection c2 = new TaskSeriesCollection(); c2.add(s1b); c2.add(s2b); assertTrue(c1.equals(c2)); assertTrue(c2.equals(c1)); }