|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2007 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 35-49
Link Here
|
| 35 |
|
35 |
|
| 36 |
import junit.framework.TestCase; |
36 |
import junit.framework.TestCase; |
| 37 |
|
37 |
|
|
|
38 |
import org.eclipse.core.runtime.FileLocator; |
| 39 |
import org.eclipse.core.runtime.Platform; |
| 38 |
import org.osgi.framework.Bundle; |
40 |
import org.osgi.framework.Bundle; |
| 39 |
import org.xml.sax.SAXException; |
|
|
| 40 |
|
| 41 |
import org.w3c.dom.Document; |
41 |
import org.w3c.dom.Document; |
| 42 |
import org.w3c.dom.Element; |
42 |
import org.w3c.dom.Element; |
| 43 |
import org.w3c.dom.NodeList; |
43 |
import org.w3c.dom.NodeList; |
| 44 |
|
44 |
import org.xml.sax.SAXException; |
| 45 |
import org.eclipse.core.runtime.FileLocator; |
|
|
| 46 |
import org.eclipse.core.runtime.Platform; |
| 47 |
|
45 |
|
| 48 |
public class BuildTests extends TestCase { |
46 |
public class BuildTests extends TestCase { |
| 49 |
|
47 |
|
|
Lines 52-57
Link Here
|
| 52 |
private static final int PROPERTIES = 1; |
50 |
private static final int PROPERTIES = 1; |
| 53 |
private static final int XML = 2; |
51 |
private static final int XML = 2; |
| 54 |
URL[] javadocLogs = null; |
52 |
URL[] javadocLogs = null; |
|
|
53 |
URL comparatorLogs = null; |
| 55 |
|
54 |
|
| 56 |
private static FileTool.IZipFilter getTrueFilter() { |
55 |
private static FileTool.IZipFilter getTrueFilter() { |
| 57 |
return new FileTool.IZipFilter() { |
56 |
return new FileTool.IZipFilter() { |
|
Lines 403-416
Link Here
|
| 403 |
*/ |
402 |
*/ |
| 404 |
protected void setUp() throws Exception { |
403 |
protected void setUp() throws Exception { |
| 405 |
|
404 |
|
| 406 |
// Autoamted Test |
405 |
// Automated Test |
| 407 |
logFileName = Platform.getInstallLocation().getURL().getPath() + ".." |
406 |
logFileName = Platform.getInstallLocation().getURL().getPath() + ".." |
| 408 |
+ File.separator + ".." + File.separator + "results" |
407 |
+ File.separator + ".." + File.separator + "results" |
| 409 |
+ File.separator + "chkpii"; // A tad bogus but this is where |
408 |
+ File.separator + "chkpii"; // A tad bogus but this is where |
| 410 |
// the build wants to copy the |
409 |
// the build wants to copy the |
| 411 |
// results from! |
410 |
// results from! |
| 412 |
|
411 |
|
| 413 |
String javadocUrls = System.getProperty("RELENGTEST.JAVADOC.URLS"); |
412 |
String javadocUrls = System.getProperty("RELENGTEST.JAVADOC.URLS"); |
|
|
413 |
String comparatorUrl = System.getProperty("RELENGTEST.COMPARATOR.URL"); |
| 414 |
|
| 414 |
if (javadocUrls != null) { |
415 |
if (javadocUrls != null) { |
| 415 |
String[] urls = javadocUrls.split(","); |
416 |
String[] urls = javadocUrls.split(","); |
| 416 |
javadocLogs = new URL[urls.length]; |
417 |
javadocLogs = new URL[urls.length]; |
|
Lines 418-424
Link Here
|
| 418 |
javadocLogs[i] = new URL(urls[i]); |
419 |
javadocLogs[i] = new URL(urls[i]); |
| 419 |
} |
420 |
} |
| 420 |
} |
421 |
} |
| 421 |
|
422 |
if (comparatorUrl != null) { |
|
|
423 |
comparatorLogs = new URL(comparatorUrl); |
| 424 |
} |
| 422 |
// Runtime Workbench - TODI Put me back to Automated status |
425 |
// Runtime Workbench - TODI Put me back to Automated status |
| 423 |
// logFileName = "d:\\results"; |
426 |
// logFileName = "d:\\results"; |
| 424 |
// sourceDirectoryName = "d:\\sourceFetch"; |
427 |
// sourceDirectoryName = "d:\\sourceFetch"; |
|
Lines 719-726
Link Here
|
| 719 |
} |
722 |
} |
| 720 |
} |
723 |
} |
| 721 |
} |
724 |
} |
|
|
725 |
} |
| 726 |
|
| 727 |
|
| 728 |
public void testComparatorLogs() { |
| 729 |
|
| 730 |
String os = System.getProperty("os.name"); |
| 731 |
|
| 732 |
// Only run compare tool on Linux to save time during tests |
| 733 |
if (!os.equalsIgnoreCase("Linux")) { |
| 734 |
return; |
| 735 |
} |
| 736 |
|
| 737 |
// load the configuration and ensure the mandatory parameters were |
| 738 |
// specified |
| 739 |
Properties properties = loadCompareConfiguration(); |
| 740 |
String compareOldPath = properties.getProperty("compare.old"); |
| 741 |
if (compareOldPath.indexOf("N2") > 0) { |
| 742 |
// if nightly build, skip test |
| 743 |
return; |
| 744 |
} |
| 745 |
// skip this test if there are no logs to check |
| 746 |
if (comparatorLogs == null) |
| 747 |
assertTrue("", true); |
| 748 |
else { |
| 749 |
ComparatorLog comparatorLog = new ComparatorLog(comparatorLogs); |
| 750 |
String message = "comparator warnings in: \n"; |
| 751 |
boolean problemLogsExist = comparatorLog.logs.size() > 0; |
| 752 |
message = message |
| 753 |
.concat("See the comparator logs linked from the test results page for details"); |
| 754 |
assertTrue(message, !problemLogsExist); |
| 755 |
} |
| 756 |
} |
| 757 |
|
| 758 |
private class ComparatorLog { |
| 759 |
private ArrayList logs = new ArrayList(); |
| 760 |
|
| 761 |
private ComparatorLog(URL comparatorLogs) { |
| 762 |
findProblems(comparatorLogs); |
| 763 |
} |
| 764 |
|
| 765 |
private void findProblems(URL ComparatorLogs) { |
| 766 |
|
| 767 |
String COMPARATOR_ERROR = "canonical:"; |
| 768 |
|
| 769 |
BufferedReader in = null; |
| 770 |
|
| 771 |
try { |
| 772 |
in = new BufferedReader(new InputStreamReader( |
| 773 |
comparatorLogs.openStream())); |
| 774 |
String tmp; |
| 775 |
while ((tmp = in.readLine()) != null) { |
| 776 |
tmp = tmp.toLowerCase(); |
| 777 |
if (tmp.indexOf(COMPARATOR_ERROR) != -1) { |
| 778 |
String fileName = new File(comparatorLogs.getFile()) |
| 779 |
.getName(); |
| 780 |
if (!logs.contains(fileName)) |
| 781 |
logs.add(fileName); |
| 782 |
} |
| 783 |
} |
| 784 |
in.close(); |
| 785 |
|
| 786 |
} catch (FileNotFoundException e) { |
| 787 |
logs.add("Unable to find " |
| 788 |
+ new File(comparatorLogs.getFile()).getName() |
| 789 |
+ " to read."); |
| 790 |
e.printStackTrace(); |
| 791 |
} catch (IOException e) { |
| 792 |
logs.add("Unable to read " |
| 793 |
+ new File(comparatorLogs.getFile()).getName()); |
| 794 |
e.printStackTrace(); |
| 795 |
} |
| 796 |
} |
| 722 |
} |
797 |
} |
| 723 |
|
798 |
|
|
|
799 |
|
| 800 |
|
| 724 |
/* |
801 |
/* |
| 725 |
* Load the configuration file which should be included in this bundle |
802 |
* Load the configuration file which should be included in this bundle |
| 726 |
*/ |
803 |
*/ |
|
Lines 862-869
Link Here
|
| 862 |
* Determine if the build is a nightly Nightly builds have qualifiers |
939 |
* Determine if the build is a nightly Nightly builds have qualifiers |
| 863 |
* identical the buildId - for instance N200612080010 which means that |
940 |
* identical the buildId - for instance N200612080010 which means that |
| 864 |
* they are lower than v20060921-1945 from an promoted integration build |
941 |
* they are lower than v20060921-1945 from an promoted integration build |
| 865 |
* and thus cannot be compared |
942 |
* and thus cannot be compared |
| 866 |
*/ |
943 |
*/ |
|
|
944 |
|
| 867 |
|
945 |
|
| 868 |
// disable temporarily |
946 |
// disable temporarily |
| 869 |
if (compareOldPath.indexOf("N2") > 0) { |
947 |
if (compareOldPath.indexOf("N2") > 0) { |
|
Lines 893-899
Link Here
|
| 893 |
|
971 |
|
| 894 |
String compareOptions = properties.getProperty("compare.options"); |
972 |
String compareOptions = properties.getProperty("compare.options"); |
| 895 |
|
973 |
|
| 896 |
/* |
974 |
/* |
| 897 |
* String outputFileName = |
975 |
* String outputFileName = |
| 898 |
* Platform.getInstallLocation().getURL().getPath() + ".." + |
976 |
* Platform.getInstallLocation().getURL().getPath() + ".." + |
| 899 |
* File.separator + ".." + File.separator + "results" + File.separator + |
977 |
* File.separator + ".." + File.separator + "results" + File.separator + |
|
Lines 904-911
Link Here
|
| 904 |
* File(outputFileName); boolean created = outputfile.createNewFile(); |
982 |
* File(outputFileName); boolean created = outputfile.createNewFile(); |
| 905 |
* if (created) { } else { msg = "Output dir could not be created."; |
983 |
* if (created) { } else { msg = "Output dir could not be created."; |
| 906 |
* assertTrue(msg, msg == null); } } catch (IOException e) { |
984 |
* assertTrue(msg, msg == null); } } catch (IOException e) { |
| 907 |
* e.printStackTrace(); } |
985 |
* e.printStackTrace(); } |
| 908 |
*/ |
986 |
*/ |
|
|
987 |
|
| 909 |
|
988 |
|
| 910 |
String command = buildCommandLine(compareNewPath, compareOldPath, |
989 |
String command = buildCommandLine(compareNewPath, compareOldPath, |
| 911 |
outputFileName, compareOptions); |
990 |
outputFileName, compareOptions); |