aboutsummaryrefslogtreecommitdiff
path: root/basebuilder-3.6.2/org.eclipse.releng.basebuilder/plugins/org.eclipse.build.tools/src/org/eclipse/releng/generators/EclipseTestResultsGeneratorNoMail.java
blob: 98be942036a52bd8d068b14bd836a9fc9f455074 (plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 * Created on Apr 8, 2003
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package org.eclipse.releng.generators;
import java.io.File;



/**
 * @author SDimitrov
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class EclipseTestResultsGeneratorNoMail extends TestResultsGenerator {
 
	
	// buildType used to determine if mail should be sent on
	// successful build completion
	private String buildType;
	private boolean sendMail=true;
	/**
	 * @return
	 */
	public String getBuildType() {
		return buildType;
	}

	/**
	 * @param buildType
	 */
	public void setBuildType(String buildType) {
		this.buildType = buildType;
	}

	public static void main(String[] args) {
		String publishingContent="C:\\Documents and Settings\\IBMEmployee\\workspace\\org.eclipse.releng.eclipsebuilder\\eclipse\\publishingFiles";

		EclipseTestResultsGeneratorNoMail test = new EclipseTestResultsGeneratorNoMail();
		test.buildType="N";
		test.setIsBuildTested(true);
		test.setDropTokenList(
		"%sdk%,%tests%,%example%,%rcpruntime%,%rcpsdk%,%deltapack%,%icubase%,%runtime%,%platformsdk%,%jdt%,%jdtsdk%,%jdtc%,%jarprocessor%,%pde%,%pdesdk%,%cvs%,%cvssdk%,%teamextras%,%swt%,%relengtools%");
		test.getDropTokensFromList(test.getDropTokenList());
		test.setXmlDirectoryName("C:\\junk\\testresults\\xml");
		test.setHtmlDirectoryName("C:\\junk\\testresults\\html");
		test.setDropDirectoryName("C:\\junk");
		test.setTestResultsTemplateFileName(
				publishingContent+"\\templateFiles\\testResults.php.template");
		test.setDropTemplateFileName(
				publishingContent+"\\templateFiles\\index.php.template");
		test.setTestResultsHtmlFileName("testResults.php");
		test.setDropHtmlFileName("index.php");
		//test.setDropHtmlFileName("index.html");
		test.setPlatformIdentifierToken("%platform%");
	
		test.setPlatformSpecificTemplateList("Windows,"+publishingContent+"/templateFiles/platform.php.template,winPlatform.php;Linux,"+publishingContent+"/templateFiles/platform.php.template,linPlatform.php;Solaris,"+publishingContent+"/templateFiles/platform.php.template,solPlatform.php;AIX,"+publishingContent+"/templateFiles/platform.php.template,aixPlatform.php;Macintosh,"+publishingContent+"/templateFiles/platform.php.template,macPlatform.php;Source Build,"+publishingContent+"/templateFiles/sourceBuilds.php.template,sourceBuilds.php");
		/*<property name="platformIdentifierToken" value="%platform%" />
			<property name="platformSpecificTemplateList" value="Windows,${publishingContent}/templateFiles/platform.php.template,winPlatform.php;Linux,${publishingContent}/templateFiles/platform.php.template,linPlatform.php;Solaris,${publishingContent}/templateFiles/platform.php.template,solPlatform.php;AIX,${publishingContent}/templateFiles/platform.php.template,aixPlatform.php;Macintosh,${publishingContent}/templateFiles/platform.php.template,macPlatform.php;Source Build,${publishingContent}/templateFiles/sourceBuilds.php.template,sourceBuilds.php" />
			*/
		
		test.setHrefTestResultsTargetPath("testresults");
		test.setCompileLogsDirectoryName(
			"C:\\junk\\compilelogs");
		test.setHrefCompileLogsTargetPath("compilelogs");
		test.setTestManifestFileName("C:\\junk\\testManifest.xml");
		test.execute();
	}
	
	public void execute() {
		super.execute();
//		if (sendMail)
//			mailResults();
	}
	
	protected String processDropRow(PlatformStatus aPlatform) {
		String imageName = "";

		if (aPlatform.hasErrors()) {
			imageName =
				"<a href=\"" + getTestResultsHtmlFileName() + "\"><img src = \"FAIL.gif\" width=19 height=23></a>";
			testResultsStatus = "failed";		
			
		} else {
			if (testsRan()) {
				imageName = "<img src = \"OK.gif\" width=19 height=23>";
			} else {
				if (isBuildTested()) {
					imageName =
						"<font size=\"-1\" color=\"#FF0000\">pending</font>";
					testResultsStatus = "pending";
				} else {
					imageName = "<img src = \"OK.gif\" width=19 height=23>";
				}
			}
		}

		String result = "<tr>";

		result = result + "<td><div align=left>" + imageName + "</div></td>\n";
		result = result + "<td>" + aPlatform.getName() + "</td>";
		
		//generate http, md5 and sha1 links by calling php functions in the template		
		result = result + "<td><?php genLinks($_SERVER[\"SERVER_NAME\"],\"@buildlabel@\",\"" + aPlatform.getFileName() +"\"); ?></td>\n";		
		result = result + "</tr>\n";

		return result;
	}
	
//	private void mailResults() {
//		//send a different message for the following cases:
//		//build is not tested at all
//		//build is tested, tests have not run
//		//build is tested, tests have run with error and or failures
//		//build is tested, tests have run with no errors or failures
//		try {
//			mailer = new Mailer();
//		} catch (NoClassDefFoundError e) {
//			return;
//		}
//		String buildLabel = mailer.getBuildProperties().getBuildLabel();
//		String httpUrl = mailer.getBuildProperties().getHttpUrl()+"/"+buildLabel;
////		String ftpUrl = mailer.getBuildProperties().getftpUrl()+"/"+buildLabel;
//		
//		String subject = "Build is complete.  ";
//		
//		String downloadLinks="\n\nHTTP Download:\n\n\t"+httpUrl+" \n\n";
//	/*	downloadLinks=downloadLinks.concat("FTP Download:\n\n");
//		downloadLinks=downloadLinks.concat("\tuser: anonymous\n\tpassword: (e-mail address or leave blank)\n\tserver:  download.eclipse.org\n\tcd to directory:  "+buildLabel);
//		downloadLinks=downloadLinks.concat("\n\n\tor");
//		downloadLinks=downloadLinks.concat("\n\n\t"+ftpUrl);*/
//		
//		//provide http links
//		String message = "The build is complete."+downloadLinks;
//
//		if (testsRan()) {
//			subject = "Automated JUnit testing complete.  ";
//			message = "Automated JUnit testing is complete.  ";
//			subject =
//				subject.concat(
//					(getTestResultsWithProblems().endsWith("\n"))
//						? "All tests pass."
//						: "Test failures/errors occurred.");
//			message =
//				message.concat(
//					(getTestResultsWithProblems().endsWith("\n"))
//						? "All tests pass."
//						: "Test failures/errors occurred in the following:  "
//							+ getTestResultsWithProblems())+downloadLinks;
//		} else if (isBuildTested() && (!buildType.equals("N"))) {
//			subject = subject.concat("Automated JUnit testing is starting.");
//			message = "The " + subject+downloadLinks;
//		}
//
//		if (subject.endsWith("Test failures/errors occurred."))
//			mailer.sendMessage(subject, message);
//		else if (!buildType.equals("N"))
//			mailer.sendMessage(subject, message);
//
//	}

	public boolean isSendMail() {
		return sendMail;
	}

	public void setSendMail(boolean sendMail) {
		this.sendMail = sendMail;
	}

}