1   /**
2    * BSD-style license; for more info see http://xradar.sourceforge.net/license.html
3    */
4   package org.sourceforge.xradar.dynamics;
5   
6   import static org.junit.Assert.assertTrue;
7   
8   import java.io.File;
9   import java.io.IOException;
10  import java.net.MalformedURLException;
11  
12  import org.junit.Ignore;
13  import org.junit.Test;
14  import org.sourceforge.xradar.AbstractTestForCommandLine;
15  import org.sourceforge.xradar.XRadarException;
16  /**
17   * @author Zahir NUCKCHADY
18   **/
19  
20  public class BasicRunScenario extends AbstractTestForCommandLine {
21  
22  	public BasicRunScenario() {
23  		super();
24  		testProductsDirectory = "targetDynamics";
25  		target  = targetDirectory + File.separator + testProductsDirectory;
26  	}
27  
28  	/**
29  	 * Basic compulsory arguments needed to run XRadar 
30  	 * and generate Dynamic Reports
31  	 * @throws XRadarException 
32  	 * @throws IOException 
33  	 * @throws MalformedURLException 
34  	 */
35  	@Test
36  	public void successfulRunFromFirstVersionToSecond() throws MalformedURLException, IOException, XRadarException {
37  
38  		int max = 25;
39  		int id = 0;
40  		String arg[]  = new String[max];
41          arg[id++]="dynamic";
42          arg[id++]="--config";
43          arg[id++]="src/test/resources/radar-config.xml";
44          arg[id++]="--target";
45          arg[id++] = this.target;
46          arg[id++]="--release1";
47          arg[id++]="--daysSinceLast";
48          arg[id++]="4";
49          arg[id++]="--reportToMerge";
50          arg[id++]="src/test/resources/radar_report_normalized.xml";
51          arg[id++]="--qualityReportPath";
52          arg[id++]="src/test/resources/reports";
53          arg[id++]="--masterFinal";
54          arg[id++]="dynamics-master-final.xml";
55          arg[id++]="--release2";
56          arg[id++]="--daysSinceLast";
57          arg[id++]="5";
58          arg[id++]="--previousReport";
59          arg[id++]= this.target + "/dynamics-master-final.xml";
60          arg[id++]="--reportToMerge";
61          arg[id++]="src/test/resources/release2/radar_report_normalized.xml";
62          arg[id++]="--qualityReportPath";
63          arg[id++]="src/test/resources/release2/reports";
64          arg[id++]="--masterFinal";
65          arg[id++]="src/test/resources/release2/masterreport_final.xml";
66          assertTrue(id == max);
67  		assertTrue(this.runRadar(arg,""));
68  	}
69  	
70  	/**
71  	 * <p>Test case: generate a third report based on the two last runs.</p>
72  	 * @throws XRadarException 
73  	 * @throws IOException 
74  	 * @throws MalformedURLException 
75  	 */
76  	@Ignore	//FIXME: Not ready yet !
77  	@Test
78  	public void successfulRunFromSecondVersionToNext() throws MalformedURLException, IOException, XRadarException {
79  		// rerun previous scenario to get the properfile
80  		this.successfulRunFromFirstVersionToSecond();
81  		int max = 18;
82  		int id = 0;
83  		
84  		String arg[]  = new String[max];
85          arg[id++]="dynamic";
86          arg[id++]="--config";
87          arg[id++]="src/test/resources/radar-config.xml";
88          arg[id++]="--target";
89          arg[id++] = this.target;
90          arg[id++]="--release3";
91          arg[id++]="--daysSinceLast";
92          arg[id++]="4";
93          arg[id++]="--previousReport";
94          arg[id++]="etc/config/dynamics/dynamics-master-base.xml";
95          arg[id++]="--reportToMerge";
96          arg[id++]="src/test/resources/radar_report_normalized.xml";
97          arg[id++]="--qualityReportPath";
98          arg[id++]="src/test/projects/testproject/release2/docs/xml/reports";
99          arg[id++]="--staticsRoot";
100         arg[id++]="src/test/projects/testproject/release2/docs";
101         arg[id++]="--masterFinal";
102         arg[id++]="src/test/resources/masterreport_final.xml"; 
103 		assertTrue(id == max);
104         assertTrue(this.runRadar(arg,""));
105 	}
106 
107 }