| 6914 |
dpurdie |
1 |
package com.erggroup.buildtool.utf;
|
|
|
2 |
|
|
|
3 |
import static org.junit.Assert.*;
|
|
|
4 |
|
|
|
5 |
import java.util.ArrayList;
|
|
|
6 |
import java.util.Map;
|
|
|
7 |
|
|
|
8 |
import org.apache.log4j.xml.DOMConfigurator;
|
|
|
9 |
import org.junit.After;
|
|
|
10 |
import org.junit.AfterClass;
|
|
|
11 |
import org.junit.Before;
|
|
|
12 |
import org.junit.BeforeClass;
|
|
|
13 |
import org.junit.Test;
|
|
|
14 |
import org.junit.runner.JUnitCore;
|
|
|
15 |
|
|
|
16 |
import com.erggroup.buildtool.ripple.ReleaseConfig;
|
|
|
17 |
import com.erggroup.buildtool.ripple.ReleaseConfigData;
|
|
|
18 |
|
|
|
19 |
@SuppressWarnings("unused")
|
|
|
20 |
public class ReleaseConfigDataTest
|
|
|
21 |
{
|
|
|
22 |
// Data item to test
|
|
|
23 |
ReleaseConfigData rcData = new ReleaseConfigData();;
|
|
|
24 |
|
|
|
25 |
/**
|
|
|
26 |
* Test Case main line
|
|
|
27 |
*/
|
|
|
28 |
public static void main(String[] args)
|
|
|
29 |
{
|
|
|
30 |
DOMConfigurator.configure("utf.xml");
|
|
|
31 |
JUnitCore.main("com.erggroup.buildtool.utf.ReleaseConfigDataTest");
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
@BeforeClass
|
|
|
35 |
public static void setUpBeforeClass() throws Exception
|
|
|
36 |
{
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
@AfterClass
|
|
|
40 |
public static void tearDownAfterClass() throws Exception
|
|
|
41 |
{
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
@Before
|
|
|
45 |
public void setUp() throws Exception
|
|
|
46 |
{
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
@After
|
|
|
50 |
public void tearDown() throws Exception
|
|
|
51 |
{
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
/** Test that the add operation will not create duplicate entries
|
|
|
55 |
*
|
|
|
56 |
*/
|
|
|
57 |
@Test
|
|
|
58 |
public void testAdd()
|
|
|
59 |
{
|
|
|
60 |
|
|
|
61 |
rcData.add(new ReleaseConfig(1, 2, 'M', "Host1", "Fillter1", "Machtype1", "MachClass1"));
|
|
|
62 |
rcData.add(new ReleaseConfig(1, 2, 'S', "Host2", "Fillter2", "Machtype2", "MachClass2"));
|
|
|
63 |
rcData.add(new ReleaseConfig(1, 2, 'S', "Host3", "Fillter3", "Machtype3", "MachClass2"));
|
|
|
64 |
rcData.add(new ReleaseConfig(1, 2, 'S', "Host4", "Fillter4", "Machtype3", "MachClass3"));
|
|
|
65 |
rcData.add(new ReleaseConfig(1, 2, 'S', "Host5", "Fillter5", "Machtype3", "MachClass3"));
|
|
|
66 |
rcData.add(new ReleaseConfig(1, 2, 'S', "Host6", "Fillter6", "Machtype3", "MachClass4"));
|
|
|
67 |
|
|
|
68 |
// for (String s : rcData.mMachineTypes)
|
|
|
69 |
// {
|
|
|
70 |
// System.out.println("MachType:" + s);
|
|
|
71 |
// }
|
|
|
72 |
//
|
|
|
73 |
// for (String s : rcData.mMachineClasses)
|
|
|
74 |
// {
|
|
|
75 |
// System.out.println("MachClass:" + s);
|
|
|
76 |
// }
|
|
|
77 |
//
|
|
|
78 |
// for (Map.Entry<String, ArrayList<String>> entry : rcData.mMachineHash.entrySet()) {
|
|
|
79 |
// String key = entry.getKey();
|
|
|
80 |
// ArrayList<String> value = entry.getValue();
|
|
|
81 |
//
|
|
|
82 |
// System.out.println("Key: " + key );
|
|
|
83 |
// for (String s : value)
|
|
|
84 |
// {
|
|
|
85 |
// System.out.println(" MachClass:" + s);
|
|
|
86 |
// }
|
|
|
87 |
// }
|
|
|
88 |
|
|
|
89 |
assertTrue(rcData.mMachineTypes.size() == 3);
|
|
|
90 |
assertTrue(rcData.mMachineClasses.size() == 4);
|
|
|
91 |
assertTrue(rcData.mReleaseConfig.size() == 6);
|
|
|
92 |
assertTrue(rcData.mMachineHash.size() == 4);
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
}
|