Lines 20-32
Link Here
|
20 |
import java.io.InputStream; |
20 |
import java.io.InputStream; |
21 |
import java.io.OutputStream; |
21 |
import java.io.OutputStream; |
22 |
import java.io.PrintWriter; |
22 |
import java.io.PrintWriter; |
|
|
23 |
import java.text.DecimalFormat; |
23 |
import java.text.NumberFormat; |
24 |
import java.text.NumberFormat; |
24 |
import java.util.ArrayList; |
25 |
import java.util.ArrayList; |
25 |
import java.util.Arrays; |
26 |
import java.util.Arrays; |
26 |
import java.util.Calendar; |
27 |
import java.util.Calendar; |
27 |
import java.util.HashMap; |
28 |
import java.util.HashMap; |
28 |
import java.util.Hashtable; |
29 |
import java.util.Hashtable; |
29 |
import java.util.Map; |
|
|
30 |
import java.util.StringTokenizer; |
30 |
import java.util.StringTokenizer; |
31 |
|
31 |
|
32 |
import junit.framework.AssertionFailedError; |
32 |
import junit.framework.AssertionFailedError; |
Lines 43-52
Link Here
|
43 |
import org.eclipse.test.internal.performance.data.Dim; |
43 |
import org.eclipse.test.internal.performance.data.Dim; |
44 |
import org.eclipse.test.internal.performance.db.DB; |
44 |
import org.eclipse.test.internal.performance.db.DB; |
45 |
import org.eclipse.test.internal.performance.db.Scenario; |
45 |
import org.eclipse.test.internal.performance.db.Scenario; |
|
|
46 |
import org.eclipse.test.internal.performance.db.SummaryEntry; |
46 |
import org.eclipse.test.internal.performance.db.TimeSeries; |
47 |
import org.eclipse.test.internal.performance.db.TimeSeries; |
47 |
import org.eclipse.test.internal.performance.db.Variations; |
48 |
import org.eclipse.test.internal.performance.db.Variations; |
48 |
import org.eclipse.test.internal.performance.eval.StatisticsUtil; |
|
|
49 |
import org.eclipse.test.internal.performance.eval.StatisticsUtil.Percentile; |
50 |
import org.eclipse.test.performance.Dimension; |
49 |
import org.eclipse.test.performance.Dimension; |
51 |
|
50 |
|
52 |
|
51 |
|
Lines 57-78
Link Here
|
57 |
static { |
56 |
static { |
58 |
PERCENT_FORMAT.setMaximumFractionDigits(1); |
57 |
PERCENT_FORMAT.setMaximumFractionDigits(1); |
59 |
} |
58 |
} |
60 |
static final NumberFormat DOUBLE_FORMAT = NumberFormat.getNumberInstance(); |
59 |
static final DecimalFormat DEVIATION_FORMAT = (DecimalFormat) NumberFormat.getPercentInstance(); |
61 |
static { |
60 |
static { |
62 |
DOUBLE_FORMAT.setMaximumIntegerDigits(2); |
61 |
DEVIATION_FORMAT.setMaximumFractionDigits(1); |
63 |
DOUBLE_FORMAT.setMaximumFractionDigits(1); |
62 |
DEVIATION_FORMAT.setMinimumFractionDigits(1); |
|
|
63 |
DEVIATION_FORMAT.setPositivePrefix("+"); |
64 |
DEVIATION_FORMAT.setNegativePrefix("- "); |
65 |
} |
66 |
static final DecimalFormat STDERR_FORMAT = (DecimalFormat) NumberFormat.getNumberInstance(); |
67 |
static { |
68 |
STDERR_FORMAT.setMaximumFractionDigits(1); |
69 |
STDERR_FORMAT.setMinimumFractionDigits(1); |
70 |
STDERR_FORMAT.setMultiplier(100); |
64 |
} |
71 |
} |
65 |
public final static String STANDARD_ERROR_THRESHOLD_STRING = PERCENT_FORMAT.format(STANDARD_ERROR_THRESHOLD); |
72 |
public final static String STANDARD_ERROR_THRESHOLD_STRING = PERCENT_FORMAT.format(STANDARD_ERROR_THRESHOLD); |
66 |
public final static String STANDARD_ERROR_MESSAGE="Standard error on this test is higher than "+STANDARD_ERROR_THRESHOLD_STRING; |
73 |
public final static String UNKNOWN_IMAGE="Unknown.gif"; |
67 |
public final static String OK_IMAGE="OK.gif"; |
74 |
public final static String OK_IMAGE="OK.gif"; |
68 |
public final static String OK_IMAGE_WARN="OK_caution.gif"; |
75 |
public final static String OK_IMAGE_WARN="OK_caution.gif"; |
69 |
public final static String FAIL_IMAGE="FAIL.gif"; |
76 |
public final static String FAIL_IMAGE="FAIL.gif"; |
70 |
public final static String FAIL_IMAGE_WARN="FAIL_caution.gif"; |
77 |
public final static String FAIL_IMAGE_WARN="FAIL_caution.gif"; |
71 |
public final static String FAIL_IMAGE_EXPLAINED="FAIL_greyed.gif"; |
78 |
public final static String FAIL_IMAGE_EXPLAINED="FAIL_greyed.gif"; |
72 |
public final static int OK = 0; |
79 |
public final static int OK = 0; |
73 |
public final static int SIGN = 0x1; |
80 |
public final static int NAN = 0x1; |
74 |
public final static int ERR = 0x2; |
81 |
public final static int ERR = 0x2; |
75 |
// public final static int TTEST = 0x2; |
|
|
76 |
public final static int DEV = 0x4; |
82 |
public final static int DEV = 0x4; |
77 |
|
83 |
|
78 |
/** |
84 |
/** |
Lines 207-213
Link Here
|
207 |
|
213 |
|
208 |
while (tokenizer.hasMoreTokens()) { |
214 |
while (tokenizer.hasMoreTokens()) { |
209 |
String labelDescriptor = tokenizer.nextToken(); |
215 |
String labelDescriptor = tokenizer.nextToken(); |
210 |
String[] elements = labelDescriptor.split(","); |
216 |
String[] elements = labelDescriptor.trim().split(","); |
211 |
ConfigDescriptor descriptor = new ConfigDescriptor(elements[0], elements[1]); |
217 |
ConfigDescriptor descriptor = new ConfigDescriptor(elements[0], elements[1]); |
212 |
configMap.put(elements[0], descriptor); |
218 |
configMap.put(elements[0], descriptor); |
213 |
} |
219 |
} |
Lines 268-278
Link Here
|
268 |
return componentNames; |
274 |
return componentNames; |
269 |
} |
275 |
} |
270 |
|
276 |
|
271 |
/** |
277 |
/* |
272 |
* @param fp - |
278 |
* @param fp - |
273 |
* a FingerPrint object |
279 |
* a FingerPrint object |
274 |
* @return - an html representation of the fingerprint. |
280 |
* @return - an html representation of the fingerprint. |
275 |
*/ |
281 |
* |
276 |
public static String getImageMap(FingerPrint fp) { |
282 |
public static String getImageMap(FingerPrint fp) { |
277 |
String componentDescription = fp.configDescriptor.description; |
283 |
String componentDescription = fp.configDescriptor.description; |
278 |
String areas = fp.bar.getAreas(); |
284 |
String areas = fp.bar.getAreas(); |
Lines 287-292
Link Here
|
287 |
} |
293 |
} |
288 |
return output; |
294 |
return output; |
289 |
} |
295 |
} |
|
|
296 |
*/ |
290 |
|
297 |
|
291 |
/** |
298 |
/** |
292 |
* Utility method to copy a file. |
299 |
* Utility method to copy a file. |
Lines 314-324
Link Here
|
314 |
} |
321 |
} |
315 |
} |
322 |
} |
316 |
public static void copyImages(File images, File output) { |
323 |
public static void copyImages(File images, File output) { |
317 |
copyFile(new File(images, Utils.FAIL_IMAGE), new File(output, Utils.FAIL_IMAGE)); |
324 |
copyFile(new File(images, FAIL_IMAGE), new File(output, FAIL_IMAGE)); |
318 |
copyFile(new File(images, Utils.FAIL_IMAGE_EXPLAINED), new File(output, Utils.FAIL_IMAGE_EXPLAINED)); |
325 |
copyFile(new File(images, FAIL_IMAGE_EXPLAINED), new File(output, FAIL_IMAGE_EXPLAINED)); |
319 |
copyFile(new File(images, Utils.FAIL_IMAGE_WARN), new File(output, Utils.FAIL_IMAGE_WARN)); |
326 |
copyFile(new File(images, FAIL_IMAGE_WARN), new File(output, FAIL_IMAGE_WARN)); |
320 |
copyFile(new File(images, Utils.OK_IMAGE), new File(output, Utils.OK_IMAGE)); |
327 |
copyFile(new File(images, OK_IMAGE), new File(output, OK_IMAGE)); |
321 |
copyFile(new File(images, Utils.OK_IMAGE_WARN), new File(output, Utils.OK_IMAGE_WARN)); |
328 |
copyFile(new File(images, OK_IMAGE_WARN), new File(output, OK_IMAGE_WARN)); |
|
|
329 |
copyFile(new File(images, UNKNOWN_IMAGE), new File(output, UNKNOWN_IMAGE)); |
322 |
} |
330 |
} |
323 |
public static void copyScripts(File scripts, File output) { |
331 |
public static void copyScripts(File scripts, File output) { |
324 |
copyFile(new File(scripts, "ToolTip.css"), new File(output, "ToolTip.css")); |
332 |
copyFile(new File(scripts, "ToolTip.css"), new File(output, "ToolTip.css")); |
Lines 433-439
Link Here
|
433 |
p.paint(image); |
441 |
p.paint(image); |
434 |
|
442 |
|
435 |
/* Downscale to 8 bit depth palette to save to gif */ |
443 |
/* Downscale to 8 bit depth palette to save to gif */ |
436 |
ImageData data = Utils.downSample(image); |
444 |
ImageData data = downSample(image); |
437 |
ImageLoader il = new ImageLoader(); |
445 |
ImageLoader il = new ImageLoader(); |
438 |
il.data = new ImageData[] { data }; |
446 |
il.data = new ImageData[] { data }; |
439 |
OutputStream out = null; |
447 |
OutputStream out = null; |
Lines 599-605
Link Here
|
599 |
* @return date/time in format YYYYMMDDHHMM, ie. 200504060010 |
607 |
* @return date/time in format YYYYMMDDHHMM, ie. 200504060010 |
600 |
*/ |
608 |
*/ |
601 |
public static long getDateFromBuildID(String buildId) { |
609 |
public static long getDateFromBuildID(String buildId) { |
602 |
return Utils.getDateFromBuildID(buildId, false); |
610 |
return getDateFromBuildID(buildId, false); |
603 |
} |
611 |
} |
604 |
|
612 |
|
605 |
public static long getDateFromBuildID(String buildId, boolean matchLast) { |
613 |
public static long getDateFromBuildID(String buildId, boolean matchLast) { |
Lines 656-662
Link Here
|
656 |
PrintWriter out=null; |
664 |
PrintWriter out=null; |
657 |
try { |
665 |
try { |
658 |
out = new PrintWriter(new FileWriter(new File(outputFile))); |
666 |
out = new PrintWriter(new FileWriter(new File(outputFile))); |
659 |
out.println(Utils.HTML_OPEN + "</head><body>\n"); |
667 |
out.println(HTML_OPEN + "</head><body>\n"); |
660 |
out.println("<h3>Summary of Elapsed Process Variation Coefficients</h3>\n"+ |
668 |
out.println("<h3>Summary of Elapsed Process Variation Coefficients</h3>\n"+ |
661 |
"<p> This table provides a bird's eye view of variability in elapsed process times\n"+ |
669 |
"<p> This table provides a bird's eye view of variability in elapsed process times\n"+ |
662 |
"for baseline and current build stream performance scenarios." + |
670 |
"for baseline and current build stream performance scenarios." + |
Lines 740-830
Link Here
|
740 |
out.close(); |
748 |
out.close(); |
741 |
} |
749 |
} |
742 |
} |
750 |
} |
743 |
|
751 |
|
744 |
public static double[] resultStats(Variations variations, String scenarioName, String baseline, String config) { |
752 |
public static double[] resultsStatistics(TimeSeries timeSeries) { |
745 |
String OS = "config"; |
753 |
try { |
746 |
|
754 |
double valueRef = timeSeries.getValue(0), value = timeSeries.getValue(1); |
747 |
Variations tmpVariations=(Variations)variations.clone(); |
755 |
long countRef = timeSeries.getCount(0), count = timeSeries.getCount(1); |
748 |
tmpVariations.put(OS,config); |
756 |
double stddevRef = timeSeries.getStddev(0), stddev = timeSeries.getStddev(1); |
749 |
Scenario[] currentScenarios = DB.queryScenarios(tmpVariations, scenarioName,OS, null); |
757 |
double stderr = (countRef == 1 || count == 1) |
750 |
Variations referenceVariations = (Variations) variations.clone(); |
758 |
? Double.NaN |
751 |
referenceVariations.put(PerformanceTestPlugin.BUILD, baseline); |
759 |
: (Double.isNaN(stddevRef) |
752 |
referenceVariations.put(OS, config); |
760 |
? Math.sqrt((stddev * stddev / count)) / valueRef |
753 |
Scenario[] refScenarios = DB.queryScenarios(referenceVariations, |
761 |
: Math.sqrt((stddevRef * stddevRef / countRef) + (stddev * stddev / count)) / valueRef); |
754 |
scenarioName, OS, null); |
762 |
return new double[] { |
755 |
|
763 |
(value - valueRef) / valueRef, |
756 |
Map referenceScenariosMap = new HashMap(); |
764 |
stderr, |
757 |
Map currentScenariosMap = new HashMap(); |
765 |
}; |
758 |
for (int i = 0; i < refScenarios.length; i++) { |
766 |
} |
759 |
Scenario scenario = refScenarios[i]; |
767 |
catch (ArrayIndexOutOfBoundsException aioobe) { |
760 |
String name = scenario.getScenarioName(); |
768 |
return null; |
761 |
referenceScenariosMap.put(name, scenario); |
769 |
} |
762 |
} |
|
|
763 |
|
764 |
for (int i = 0; i < currentScenarios.length; i++) { |
765 |
Scenario scenario = currentScenarios[i]; |
766 |
String name = scenario.getScenarioName(); |
767 |
currentScenariosMap.put(name, scenario); |
768 |
} |
769 |
Percentile percentile = StatisticsUtil.T90; |
770 |
Scenario scenario = (Scenario) currentScenariosMap.get(scenarioName); |
771 |
|
772 |
Scenario reference = (Scenario) referenceScenariosMap.get(scenarioName); |
773 |
if (reference != null) { |
774 |
// XXX have to find out the relevant dimension |
775 |
Dim significanceDimension = (Dim) Dimension.ELAPSED_PROCESS; |
776 |
TimeSeries currentSeries = scenario.getTimeSeries(significanceDimension); |
777 |
TimeSeries baselineSeries = reference.getTimeSeries(significanceDimension); |
778 |
if (currentSeries.getLength() > 0 && baselineSeries.getLength() > 0) { |
779 |
return StatisticsUtil.statisticsForTimeSeries(baselineSeries, 0, currentSeries, 0, percentile); |
780 |
} |
781 |
} |
782 |
return null; |
783 |
} |
770 |
} |
784 |
|
771 |
|
785 |
public static boolean hasConfidentResult(Variations variations, String scenarioName, String baseline, String config) { |
772 |
public static boolean hasConfidentResult(TimeSeries timeSeries) { |
786 |
double[] resultStats = resultStats(variations, scenarioName, baseline, config); |
773 |
double[] resultStats = resultsStatistics(timeSeries); |
787 |
return (confidenceLevel(resultStats) & ERR) == 0; |
774 |
return (confidenceLevel(resultStats) & ERR) == 0; |
788 |
} |
775 |
} |
789 |
public static String failureMessage(Variations variations, String scenarioName, String baseline, String config) { |
776 |
public static String failureMessage(Variations variations, String scenarioName, String baseline, String config) { |
790 |
return failureMessage(resultStats(variations, scenarioName, baseline, config), true); |
777 |
String current = (String) variations.get(PerformanceTestPlugin.BUILD); |
|
|
778 |
Dim significanceDimension = (Dim) Dimension.ELAPSED_PROCESS; |
779 |
Scenario newScenario= DB.getScenarioSeries(scenarioName, variations, PerformanceTestPlugin.BUILD, baseline, current, new Dim[] { significanceDimension }); |
780 |
TimeSeries timeSeries = newScenario.getTimeSeries(significanceDimension); |
781 |
double[] results = resultsStatistics(timeSeries); |
782 |
return failureMessage(results, true); |
791 |
} |
783 |
} |
792 |
public static String failureMessage(double[] resultStats, boolean full) { |
784 |
public static String failureMessage(double[] resultStats, boolean full) { |
793 |
StringBuffer buffer = new StringBuffer(); |
785 |
StringBuffer buffer = new StringBuffer(); |
794 |
int level = confidenceLevel(resultStats); |
786 |
int level = confidenceLevel(resultStats); |
795 |
boolean signal = (level & SIGN) != 0; |
787 |
// boolean isWarn = (level & WARN) != 0; |
796 |
boolean isErr = (level & ERR) != 0; |
788 |
boolean isErr = (level & ERR) != 0; |
797 |
if (full & isErr) { |
789 |
if (full) { |
798 |
buffer.append("*** WARNING *** "); |
790 |
if (isErr) { |
799 |
buffer.append(STANDARD_ERROR_MESSAGE); |
791 |
buffer.append("*** WARNING *** "); |
|
|
792 |
buffer.append(Messages.bind(Messages.standardError, PERCENT_FORMAT.format(resultStats[1]), STANDARD_ERROR_THRESHOLD_STRING)); |
793 |
} |
794 |
return buffer.toString(); |
800 |
} |
795 |
} |
801 |
if (!full) buffer.append("<font color=\"#0000FF\" size=\"1\"> "); |
|
|
802 |
if (resultStats != null) { |
796 |
if (resultStats != null) { |
803 |
double deviation = resultStats[3]==0 ? 0 : -resultStats[3]; |
797 |
double deviation = resultStats[0]; |
804 |
if (deviation > 0) { |
798 |
buffer.append("<font color=\"#0000FF\" size=\"1\">"); |
805 |
buffer.append('+'); |
799 |
if (Double.isNaN(deviation) || Double.isInfinite(deviation)) { |
806 |
} |
800 |
buffer.append(" [n/a]"); |
807 |
buffer.append(PERCENT_FORMAT.format(deviation)); |
801 |
} else { |
808 |
if (signal) { |
802 |
double stderr = resultStats[1]; |
809 |
buffer.append(" [±"); |
803 |
deviation = Math.abs(deviation)<0.001 ? 0 : -deviation; |
810 |
buffer.append(DOUBLE_FORMAT.format(resultStats[2]*100)); |
804 |
if (Double.isNaN(stderr) || Double.isInfinite(stderr)) { |
811 |
buffer.append(']'); |
805 |
buffer.append(DEVIATION_FORMAT.format(deviation)); |
|
|
806 |
buffer.append("</font><font color=\"#DDDD00\" size=\"1\"> "); |
807 |
buffer.append(" [n/a]"); |
808 |
} else { |
809 |
buffer.append(DEVIATION_FORMAT.format(deviation)); |
810 |
buffer.append(" [±"); |
811 |
buffer.append(STDERR_FORMAT.format(Math.abs(stderr))); |
812 |
buffer.append(']'); |
813 |
} |
812 |
} |
814 |
} |
|
|
815 |
buffer.append("</font>"); |
813 |
} |
816 |
} |
814 |
if (!full) buffer.append("</font>"); |
|
|
815 |
return buffer.toString(); |
817 |
return buffer.toString(); |
816 |
} |
818 |
} |
817 |
public static int confidenceLevel(double[] resultStats) { |
819 |
public static int confidenceLevel(double[] resultStats) { |
818 |
int level = OK; |
820 |
int level = OK; |
819 |
if (resultStats != null){ |
821 |
if (resultStats != null){ |
820 |
// if (resultStats[1] >= 0 && resultStats[0] >= resultStats[1]) { // invalid t-test |
822 |
if (Double.isNaN(resultStats[0]) || Double.isInfinite(resultStats[0])) { |
821 |
// level |= TTEST; |
823 |
level = NAN; |
822 |
// } |
824 |
} else { |
823 |
if (resultStats[2] > 0) { // signal standard error higher than 0% (only one iteration) |
825 |
// if (resultStats[1] >= (STANDARD_ERROR_THRESHOLD/2)) { // warns standard error higher than the half of authorized threshold |
824 |
level |= SIGN; |
826 |
// level |= WARN; |
825 |
} |
827 |
// } |
826 |
if (resultStats[2] >= Utils.STANDARD_ERROR_THRESHOLD) { // standard error higher than the authorized threshold |
828 |
if (resultStats[1] >= STANDARD_ERROR_THRESHOLD) { // standard error higher than the authorized threshold |
827 |
level |= ERR; |
829 |
level = ERR; |
|
|
830 |
} |
828 |
} |
831 |
} |
829 |
} |
832 |
} |
830 |
return level; |
833 |
return level; |
Lines 837-851
Link Here
|
837 |
String previous = ""; |
840 |
String previous = ""; |
838 |
while (tokenizer.hasMoreTokens()) { |
841 |
while (tokenizer.hasMoreTokens()) { |
839 |
String token = tokenizer.nextToken(); |
842 |
String token = tokenizer.nextToken(); |
840 |
if (token.equals("%")) { |
843 |
if (!token.equals("%") && !token.equals("_")) { |
841 |
start += previous.length(); |
|
|
842 |
} else if (token.equals("_")) { |
843 |
start++; |
844 |
} else { |
845 |
if (previous.equals("%")) { |
844 |
if (previous.equals("%")) { |
846 |
if (name.substring(start).indexOf(token) < 0) return false; |
845 |
int idx = name.substring(start).indexOf(token); |
|
|
846 |
if (idx < 0) return false; |
847 |
start += idx; |
847 |
} else if (previous.equals("_")) { |
848 |
} else if (previous.equals("_")) { |
848 |
if (!name.substring(start).startsWith(token)) return false; |
849 |
if (!name.substring(++start).startsWith(token)) return false; |
849 |
} |
850 |
} |
850 |
start += token.length(); |
851 |
start += token.length(); |
851 |
} |
852 |
} |
Lines 861-867
Link Here
|
861 |
return name.equals(pattern); |
862 |
return name.equals(pattern); |
862 |
} |
863 |
} |
863 |
|
864 |
|
864 |
public static String getImage(int confidence, double[] resultStats, boolean hasExplanation) { |
865 |
public static String getImage(int confidence, boolean hasExplanation) { |
865 |
boolean scenarioFailed = (confidence & DEV) != 0; |
866 |
boolean scenarioFailed = (confidence & DEV) != 0; |
866 |
String image = null; |
867 |
String image = null; |
867 |
|
868 |
|
Lines 873-878
Link Here
|
873 |
} else { |
874 |
} else { |
874 |
image = FAIL_IMAGE; |
875 |
image = FAIL_IMAGE; |
875 |
} |
876 |
} |
|
|
877 |
} else if ((confidence & NAN) != 0) { |
878 |
image = UNKNOWN_IMAGE; |
876 |
} else if ((confidence & ERR) != 0) { |
879 |
} else if ((confidence & ERR) != 0) { |
877 |
image = OK_IMAGE_WARN; |
880 |
image = OK_IMAGE_WARN; |
878 |
} else { |
881 |
} else { |
Lines 880-883
Link Here
|
880 |
} |
883 |
} |
881 |
return image; |
884 |
return image; |
882 |
} |
885 |
} |
883 |
} |
886 |
|
|
|
887 |
public static boolean hasSummary(SummaryEntry[] summaries, String scenarioName) { |
888 |
int length = summaries == null ? 0 : summaries.length; |
889 |
for (int i=0; i<length; i++) { |
890 |
SummaryEntry summary = summaries[i]; |
891 |
if (summary.scenarioName.equals(scenarioName)) { |
892 |
return true; |
893 |
} |
894 |
} |
895 |
return false; |
896 |
} |
897 |
|
898 |
public static String getScenarioShortName(String scenarioName, int max) { |
899 |
|
900 |
// Remove class name qualification |
901 |
int testSeparator = scenarioName.indexOf('#'); |
902 |
boolean hasClassName = testSeparator >= 0; |
903 |
if (!hasClassName) { |
904 |
testSeparator = scenarioName.lastIndexOf('.'); |
905 |
if (testSeparator <= 0) { |
906 |
if (max > 0 && scenarioName.length() > max) { |
907 |
return "*"+scenarioName.substring(0, max); |
908 |
} |
909 |
return scenarioName; |
910 |
} |
911 |
} |
912 |
int classSeparator = scenarioName.substring(0, testSeparator).lastIndexOf('.'); |
913 |
if (classSeparator < 0) { |
914 |
if (max > 0 && scenarioName.length() > max) { |
915 |
return "*"+scenarioName.substring(0, max); |
916 |
} |
917 |
return scenarioName; |
918 |
} |
919 |
int length = scenarioName.length(); |
920 |
String shortName = scenarioName.substring(classSeparator+1, length); |
921 |
if (!hasClassName && shortName.startsWith("test.")) { // specific case for swt... |
922 |
shortName = shortName.substring(5); |
923 |
} |
924 |
|
925 |
// Remove qualification from test name |
926 |
StringTokenizer tokenizer = new StringTokenizer(shortName, " :,", true); |
927 |
StringBuffer buffer = new StringBuffer(tokenizer.nextToken()); |
928 |
while (tokenizer.hasMoreTokens()) { |
929 |
String token = tokenizer.nextToken(); |
930 |
char fc = token.charAt(0); |
931 |
while (fc == ' ' || fc == ',' || fc == ':') { |
932 |
buffer.append(token); // add the separator |
933 |
token = tokenizer.nextToken(); |
934 |
fc = token.charAt(0); |
935 |
} |
936 |
int last = token .lastIndexOf('.'); |
937 |
if (last >= 3) { |
938 |
int first = token .indexOf('.'); |
939 |
if (first == last) { |
940 |
buffer.append(token); |
941 |
} else { |
942 |
// buffer.append(token.substring(0, first)); |
943 |
// buffer.append("..."); |
944 |
buffer.append(token.substring(last+1)); |
945 |
} |
946 |
} else { |
947 |
buffer.append(token); |
948 |
} |
949 |
} |
950 |
if (max > 0 && buffer.length() > max) { |
951 |
return "*"+buffer.substring(0, max); |
952 |
} |
953 |
return buffer.toString(); |
954 |
} |
955 |
} |