Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Johnson2018-11-28 16:30:12 -0500
committerAndrew Johnson2018-11-28 16:37:53 -0500
commitd5823fc7e5dd03e3c454e1db6a8778ea77498727 (patch)
tree3de643d91e5751d7c3376d514d0464b5330f3cc2
parentf6aa6674ff450d07c70113a1f02b87d2e76fc663 (diff)
downloadorg.eclipse.mat-d5823fc7e5dd03e3c454e1db6a8778ea77498727.tar.gz
org.eclipse.mat-d5823fc7e5dd03e3c454e1db6a8778ea77498727.tar.xz
org.eclipse.mat-d5823fc7e5dd03e3c454e1db6a8778ea77498727.zip
[541539] Simple batch mode comparison of two snapshots
Improve localisation of filters. Change-Id: Ic4e3abf157c16bc3d2327dbfef930855aff46239
-rw-r--r--plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/BytesFormat.java95
-rw-r--r--plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/Column.java9
-rw-r--r--plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/quantize/Quantize.java15
-rw-r--r--plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/refined/Filter.java75
-rw-r--r--plugins/org.eclipse.mat.report/src/org/eclipse/mat/report/internal/messages.properties8
-rw-r--r--plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/TestSnapshots.java36
-rw-r--r--plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/GeneralSnapshotTests.java2
-rw-r--r--plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/QueriesTest.java49
8 files changed, 238 insertions, 51 deletions
diff --git a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/BytesFormat.java b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/BytesFormat.java
index 8858080f..1131a6c5 100644
--- a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/BytesFormat.java
+++ b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/BytesFormat.java
@@ -16,7 +16,6 @@ import java.text.Format;
import java.text.ParsePosition;
import org.eclipse.mat.report.internal.Messages;
-import org.eclipse.mat.util.MessageUtil;
import com.ibm.icu.text.DecimalFormat;
import com.ibm.icu.text.NumberFormat;
@@ -153,30 +152,52 @@ public class BytesFormat extends Format
obj = target;
BytesDisplay currentDisplay = BytesDisplay.getCurrentValue();
+ StringBuffer ret;
switch (currentDisplay)
{
case Kilobytes:
- return formatKb(toAppendTo, target);
+ pos.setBeginIndex(toAppendTo.length());
+ ret = formatKb(toAppendTo, target);
+ pos.setEndIndex(toAppendTo.length());
+ return ret;
case Megabytes:
- return formatMb(toAppendTo, target);
+ pos.setBeginIndex(toAppendTo.length());
+ ret = formatMb(toAppendTo, target);
+ pos.setEndIndex(toAppendTo.length());
+ return ret;
case Gigabytes:
- return formatGb(toAppendTo, target);
+ pos.setBeginIndex(toAppendTo.length());
+ ret = formatGb(toAppendTo, target);
+ pos.setEndIndex(toAppendTo.length());
+ return ret;
case Smart:
if (target >= GB || target <= NEGGB)
{
- return formatGb(toAppendTo, target);
+ pos.setBeginIndex(toAppendTo.length());
+ ret = formatGb(toAppendTo, target);
+ pos.setEndIndex(toAppendTo.length());
+ return ret;
}
else if (target >= MB || target <= NEGMB)
{
- return formatMb(toAppendTo, target);
+ pos.setBeginIndex(toAppendTo.length());
+ ret = formatMb(toAppendTo, target);
+ pos.setEndIndex(toAppendTo.length());
+ return ret;
}
else if (target >= KB || target <= NEGKB)
{
- return formatKb(toAppendTo, target);
+ pos.setBeginIndex(toAppendTo.length());
+ ret = formatKb(toAppendTo, target);
+ pos.setEndIndex(toAppendTo.length());
+ return ret;
}
else
{
- return formatB(toAppendTo, target);
+ pos.setBeginIndex(toAppendTo.length());
+ ret = formatB(toAppendTo, target);
+ pos.setEndIndex(toAppendTo.length());
+ return ret;
}
default:
// fall through
@@ -200,34 +221,82 @@ public class BytesFormat extends Format
private StringBuffer formatGb(StringBuffer toAppendTo, double val)
{
double gb = (double) val / GB;
- toAppendTo.append(MessageUtil.format(Messages.BytesFormat_GB, getDetailedFormat().format(gb)));
+ toAppendTo.append(getDetailedFormat().format(gb)).append(Messages.BytesFormat_GB);
return toAppendTo;
}
private StringBuffer formatMb(StringBuffer toAppendTo, double val)
{
double mb = (double) val / MB;
- toAppendTo.append(MessageUtil.format(Messages.BytesFormat_MB, getDetailedFormat().format(mb)));
+ toAppendTo.append(getDetailedFormat().format(mb)).append(Messages.BytesFormat_MB);
return toAppendTo;
}
private StringBuffer formatKb(StringBuffer toAppendTo, double val)
{
double kb = (double) val / KB;
- toAppendTo.append(MessageUtil.format(Messages.BytesFormat_KB, getDetailedFormat().format(kb)));
+ toAppendTo.append(getDetailedFormat().format(kb)).append(Messages.BytesFormat_KB);
return toAppendTo;
}
private StringBuffer formatB(StringBuffer toAppendTo, double val)
{
- toAppendTo.append(MessageUtil.format(Messages.BytesFormat_B, getDefaultFormat().format(val)));
+ toAppendTo.append(getDefaultFormat().format(val)).append(Messages.BytesFormat_KB);
return toAppendTo;
}
+ /**
+ * Parses the input string according to the display mode.
+ * Returns a {@ Bytes} object
+ */
@Override
public Object parseObject(String source, ParsePosition pos)
{
- return getDefaultFormat().parseObject(source, pos);
+ BytesDisplay currentDisplay = BytesDisplay.getCurrentValue();
+ if (currentDisplay != BytesDisplay.Bytes)
+ {
+ // Output formatting has units, so input should
+ Object o1 = this.getDetailedFormat().parseObject(source, pos);
+ if (o1 instanceof Number)
+ {
+ Number n1 = (Number)o1;
+
+ if (currentDisplay == BytesDisplay.Smart &&
+ source.regionMatches(pos.getIndex(), Messages.BytesFormat_B, 0, 2))
+ {
+ pos.setIndex(pos.getIndex() + 2);
+ return new Bytes(n1.longValue());
+ }
+ if ((currentDisplay == BytesDisplay.Kilobytes || currentDisplay == BytesDisplay.Smart) &&
+ source.regionMatches(pos.getIndex(), Messages.BytesFormat_KB, 0, 3))
+ {
+ pos.setIndex(pos.getIndex() + 3);
+ return new Bytes((long)(n1.longValue() * KB));
+ }
+ if ((currentDisplay == BytesDisplay.Megabytes || currentDisplay == BytesDisplay.Smart) &&
+ source.regionMatches(pos.getIndex(), Messages.BytesFormat_MB, 0, 3))
+ {
+ pos.setIndex(pos.getIndex() + 3);
+ return new Bytes((long)(n1.longValue() * MB));
+ }
+ if ((currentDisplay == BytesDisplay.Gigabytes || currentDisplay == BytesDisplay.Smart) &&
+ source.regionMatches(pos.getIndex(), Messages.BytesFormat_GB, 0, 3))
+ {
+ pos.setIndex(pos.getIndex() + 3);
+ return new Bytes((long)(n1.longValue() * GB));
+ }
+ // Given a format, but no suffix given
+ return null;
+ }
+ return null;
+ }
+ else
+ {
+ Object ret = getDefaultFormat().parseObject(source, pos);
+ if (ret instanceof Number)
+ return new Bytes(((Number)ret).longValue());
+ return ret;
+ }
}
/**
diff --git a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/Column.java b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/Column.java
index 93bb77a0..bef00801 100644
--- a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/Column.java
+++ b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/Column.java
@@ -148,6 +148,15 @@ public final class Column
this.calculateTotals = calculateTotals(type);
}
+ /**
+ * Build a column with the given label.
+ * @param label the top of the column
+ * @param type a type of the column, such as float, int, Double
+ * @param align cell alignment - see {@link Column.Alignment} for the choices
+ * @param direction sorting direction
+ * @param formatter how to display items
+ * @param comparator how to sort the items
+ */
public Column(String label, Class<?> type, Alignment align, SortDirection direction, Format formatter,
Comparator<?> comparator)
{
diff --git a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/quantize/Quantize.java b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/quantize/Quantize.java
index e7d9db30..7b9ed858 100644
--- a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/quantize/Quantize.java
+++ b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/quantize/Quantize.java
@@ -202,8 +202,10 @@ public final class Quantize
{
// Use the locale formatter
DecimalFormat df = (DecimalFormat)nf;
- df.setMinimumFractionDigits(2);
- df.setMaximumFractionDigits(2);
+ // Want 2 digits for step of 0.2, more for much smaller steps
+ int digits = Math.max(0, (int)Math.log10(20 / step));
+ df.setMinimumFractionDigits(digits);
+ df.setMaximumFractionDigits(digits);
df.setPositivePrefix(lessEq+df.getPositivePrefix());
df.setNegativePrefix(lessEq+df.getNegativePrefix());
format = df;
@@ -225,14 +227,17 @@ public final class Quantize
*/
public static Builder linearFrequencyDistribution(String label, long lowerBound, long upperBound, long step)
{
- DecimalFormat format = new DecimalFormat("<= #,##0.00"); //$NON-NLS-1$
+ String lessEq = Messages.Quantize_LessEq_Prefix; //$NON-NLS-1$
+ DecimalFormat format = new DecimalFormat("#,##0"); //$NON-NLS-1$
+ format.setPositivePrefix(lessEq+format.getPositivePrefix());
+ format.setNegativePrefix(lessEq+format.getNegativePrefix());
NumberFormat nf = NumberFormat.getIntegerInstance();
if (nf instanceof DecimalFormat)
{
// Use the locale formatter
DecimalFormat df = (DecimalFormat)nf;
- df.setPositivePrefix("<= "+df.getPositivePrefix()); //$NON-NLS-1$
- df.setNegativePrefix("<= "+df.getNegativePrefix()); //$NON-NLS-1$
+ df.setPositivePrefix(lessEq+df.getPositivePrefix()); //$NON-NLS-1$
+ df.setNegativePrefix(lessEq+df.getNegativePrefix()); //$NON-NLS-1$
format = df;
}
return new Builder(new Quantize(new KeyCalculator.LinearDistributionLong(lowerBound, upperBound, step)))
diff --git a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/refined/Filter.java b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/refined/Filter.java
index e55fcd74..a3e886b7 100644
--- a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/refined/Filter.java
+++ b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/query/refined/Filter.java
@@ -36,7 +36,7 @@ public abstract class Filter
* it is tested in a filter or displayed.
* An example is where approximate retained sizes are stored as negative
* numbers, but need the positive value for display.
- * See {@link Column#setData(Object, Object) and see {@link Column#getData(Object)},
+ * See {@link Column#setData(Object, Object)} and see {@link Column#getData(Object)},
* as used in
* and {@link org.eclipse.mat.snapshot.query.RetainedSizeDerivedData#columnFor(org.eclipse.mat.query.DerivedColumn, org.eclipse.mat.query.IResult, org.eclipse.mat.query.ContextProvider)}
*/
@@ -60,8 +60,8 @@ public abstract class Filter
boolean isPercentage = formatter instanceof DecimalFormat
&& ((DecimalFormat) formatter).toPattern().indexOf('%') >= 0;
- return isPercentage ? new PercentageFilter(listener, converter)
- : new NumericFilter(listener, converter);
+ return isPercentage ? new PercentageFilter(listener, converter, formatter)
+ : new NumericFilter(listener, converter, formatter);
}
else
{
@@ -125,11 +125,13 @@ public abstract class Filter
Test test;
ValueConverter converter;
+ Format format;
- public NumericFilter(FilterChangeListener listener, ValueConverter converter)
+ public NumericFilter(FilterChangeListener listener, ValueConverter converter, Format format)
{
super(listener);
this.converter = converter;
+ this.format = format;
}
@Override
@@ -256,8 +258,24 @@ public abstract class Filter
return null;
ParsePosition pos = new ParsePosition(0);
- NumberFormat f = DecimalFormat.getInstance();
- Number nresult = f.parse(string, pos);
+ // Try to parse the filter with column formatter
+ Object oresult = format.parseObject(string, pos);
+ Number nresult;
+ if (oresult instanceof Number)
+ {
+ nresult = (Number)oresult;
+ }
+ else if (oresult instanceof Bytes)
+ {
+ nresult = ((Bytes)(oresult)).getValue();
+ }
+ else
+ {
+ // Old way - just use a decimal formatter
+ pos = new ParsePosition(0);
+ NumberFormat f = DecimalFormat.getInstance();
+ nresult = f.parse(string, pos);
+ }
if (pos.getIndex() < string.length())
throw new ParseException(MessageUtil.format(Messages.Filter_Error_IllegalCharacters, //
@@ -415,9 +433,9 @@ public abstract class Filter
private static class PercentageFilter extends NumericFilter
{
- public PercentageFilter(FilterChangeListener listener, ValueConverter converter)
+ public PercentageFilter(FilterChangeListener listener, ValueConverter converter, Format format)
{
- super(listener, converter);
+ super(listener, converter, format);
}
@Override
@@ -426,15 +444,48 @@ public abstract class Filter
if (string.length() == 0)
return null;
- if (string.charAt(string.length() - 1) == '%')
+ ParsePosition pos = new ParsePosition(0);
+ // Try to parse the filter with column formatter
+ Object oresult = format.parseObject(string, pos);
+ Number nresult;
+ if (oresult instanceof Number)
{
- String substring = string.substring(0, string.length() - 1);
- return super.number(substring) / 100;
+ nresult = (Number)oresult;
}
else
{
- return super.number(string);
+ // Old way - just use a percent formatter
+ pos = new ParsePosition(0);
+ NumberFormat f = DecimalFormat.getPercentInstance();
+ nresult = f.parse(string, pos);
+ if (nresult == null)
+ {
+ // Also allow a simple decimal format
+ ParsePosition p2 = new ParsePosition(0);
+ f = DecimalFormat.getNumberInstance();
+ nresult = f.parse(string, p2);
+ // Only report the pos if this was successful
+ /// otherwise report the failure from the percent formatter
+ if (nresult != null)
+ {
+ if (string.charAt(p2.getIndex()) == '%' && nresult instanceof Number)
+ {
+ // Old way with trailing % (no space)
+ // - some locale formatters just parse "12.34 %"
+ nresult = ((Number)nresult).doubleValue() / 100;
+ p2.setIndex(p2.getIndex() + 1);
+ }
+ pos = p2;
+ }
+ }
}
+
+ if (pos.getIndex() < string.length())
+ throw new ParseException(MessageUtil.format(Messages.Filter_Error_IllegalCharacters, //
+ string.substring(pos.getIndex())), pos.getIndex());
+
+ Double result = nresult.doubleValue();
+ return result;
}
}
diff --git a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/report/internal/messages.properties b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/report/internal/messages.properties
index 06f6064d..a737911d 100644
--- a/plugins/org.eclipse.mat.report/src/org/eclipse/mat/report/internal/messages.properties
+++ b/plugins/org.eclipse.mat.report/src/org/eclipse/mat/report/internal/messages.properties
@@ -18,10 +18,10 @@ ArgumentSet_Error_SetField=Unable to set field of {0}
ArgumentSet_Msg_NullValue=Setting null value for: {0}
ArrayInt_Error_LengthExceeded=Requested length of new int[{0}] exceeds limit of {1}
ArrayLong_Error_LengthExceeded=Requested length of new long[{0}] exceeds limit of {1}
-BytesFormat_B={0} B
-BytesFormat_GB={0} GB
-BytesFormat_KB={0} KB
-BytesFormat_MB={0} MB
+BytesFormat_B=\ B
+BytesFormat_GB=\ GB
+BytesFormat_KB=\ KB
+BytesFormat_MB=\ MB
CategoryDescriptor_Label_NoCategory=<uncategorized>
CommandLine_Error_AssignmentFailed=''{0}'' cannot be assigned. Argument ''{1}'' is already set.
CommandLine_Error_InvalidCommand=Invalid command line: {0}
diff --git a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/TestSnapshots.java b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/TestSnapshots.java
index ebe9c0b5..bbefcedd 100644
--- a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/TestSnapshots.java
+++ b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/TestSnapshots.java
@@ -25,6 +25,7 @@ import java.net.URL;
import java.net.URLConnection;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -32,8 +33,10 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.mat.SnapshotException;
import org.eclipse.mat.snapshot.ISnapshot;
import org.eclipse.mat.snapshot.SnapshotFactory;
+import org.eclipse.mat.snapshot.model.IClass;
import org.eclipse.mat.util.VoidProgressListener;
import org.osgi.framework.Version;
@@ -383,6 +386,39 @@ public class TestSnapshots
{
SnapshotFactory.dispose(sn);
}
+ // Perhaps the snapshot has been as been opened as a secondary snapshot and not been closed
+ // The usage count in SnapshotFactory would then be incorrect, so force a close here.
+ for (ISnapshot sn : snapshots.values())
+ {
+ try
+ {
+ Collection<IClass>cls = sn.getClassesByName("java.lang.Object", false);
+ if (cls != null && !cls.isEmpty())
+ System.out.println("snapshot "+sn.getSnapshotInfo().getPath()+" hasn't been disposed at the factory");
+ }
+ catch (SnapshotException e)
+ {
+ // Expected when disposed
+ }
+ sn.dispose();
+ }
+ for (ISnapshot sn : pristineSnapshots)
+ {
+ try
+ {
+ Collection<IClass>cls = sn.getClassesByName("java.lang.Object", false);
+ if (cls != null && !cls.isEmpty())
+ System.out.println("snapshot "+sn.getSnapshotInfo().getPath()+" hasn't been disposed at the factory");
+ }
+ catch (SnapshotException e)
+ {
+ // Expected when disposed
+ }
+ sn.dispose();
+ }
+ // Just in case some other file handles have not been closed
+ System.gc();
+ System.runFinalization();
for (File dir : dirList)
deleteDirectory(dir);
}
diff --git a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/GeneralSnapshotTests.java b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/GeneralSnapshotTests.java
index 061e1c37..1cfdc5ea 100644
--- a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/GeneralSnapshotTests.java
+++ b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/GeneralSnapshotTests.java
@@ -448,7 +448,7 @@ public class GeneralSnapshotTests
// Only seems to apply for IBM 1.4.2 SDFF dumps with 'double', 'long' classes not as system class roots
assertEquals("GC Roots", oldInfo.getNumberOfGCRoots() + (bootcls - systemclsroot), newInfo.getNumberOfGCRoots());
} finally {
- newSnapshot.dispose();
+ SnapshotFactory.dispose(newSnapshot);
}
} finally {
newSnapshotFile.delete();
diff --git a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/QueriesTest.java b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/QueriesTest.java
index 076b8500..c0833605 100644
--- a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/QueriesTest.java
+++ b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/QueriesTest.java
@@ -43,6 +43,7 @@ import org.eclipse.mat.query.IResultTable;
import org.eclipse.mat.query.IResultTree;
import org.eclipse.mat.query.refined.RefinedResultBuilder;
import org.eclipse.mat.query.refined.RefinedTable;
+import org.eclipse.mat.query.refined.RefinedTree;
import org.eclipse.mat.snapshot.ClassHistogramRecord;
import org.eclipse.mat.snapshot.Histogram;
import org.eclipse.mat.snapshot.ISnapshot;
@@ -223,7 +224,7 @@ public class QueriesTest
* @throws SnapshotException
*/
@Test
- public void testOQLFiltering10() throws SnapshotException
+ public void testFiltering10() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -248,7 +249,7 @@ public class QueriesTest
* @throws SnapshotException
*/
@Test
- public void testOQLFiltering11ge() throws SnapshotException
+ public void testFiltering11ge() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -280,7 +281,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11gt() throws SnapshotException
+ public void testFiltering11gt() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -308,7 +309,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11lt() throws SnapshotException
+ public void testFiltering11lt() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -336,7 +337,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11le() throws SnapshotException
+ public void testFiltering11le() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -368,7 +369,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11eq() throws SnapshotException
+ public void testFiltering11eq() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -396,7 +397,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11ne() throws SnapshotException
+ public void testFiltering11ne() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -424,7 +425,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11ne2() throws SnapshotException
+ public void testFiltering11ne2() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -452,7 +453,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11rangea() throws SnapshotException
+ public void testFiltering11rangea() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -484,7 +485,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11rangeb() throws SnapshotException
+ public void testFiltering11rangeb() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -516,7 +517,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11rangeab() throws SnapshotException
+ public void testFiltering11rangeab() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -554,7 +555,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11urangea() throws SnapshotException
+ public void testFiltering11urangea() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -586,7 +587,7 @@ public class QueriesTest
}
@Test
- public void testOQLFiltering11urangeb() throws SnapshotException
+ public void testFiltering11urangeb() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -619,7 +620,7 @@ public class QueriesTest
@Test
- public void testOQLFiltering11urangeab() throws SnapshotException
+ public void testFiltering11urangeab() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -738,9 +739,9 @@ public class QueriesTest
assertThat(eqb, equalTo(0));
assertThat(nan, greaterThanOrEqualTo(1));
}
-
+
@Test
- public void testOQLFiltering11regex() throws SnapshotException
+ public void testFiltering11regex() throws SnapshotException
{
SnapshotQuery query = SnapshotQuery.parse("histogram", snapshot);
RefinedResultBuilder builder = query.refine(new VoidProgressListener());
@@ -759,6 +760,22 @@ public class QueriesTest
assertThat(found, greaterThanOrEqualTo(1));
}
+ @Test
+ public void testFiltering12percent() throws SnapshotException
+ {
+ SnapshotQuery query = SnapshotQuery.parse("dominator_tree", snapshot);
+ RefinedResultBuilder builder = query.refine(new VoidProgressListener());
+ // Check percentage is filterable
+
+ builder.setFilter(3, ">=3.0%");
+ RefinedTree table = (RefinedTree) builder.build();
+ for (Object row : table.getElements())
+ {
+ Object val = table.getColumnValue(row, 0);
+ assertThat((Double)val, greaterThanOrEqualTo(0.03));
+ }
+ }
+
/**
* Test for sorting of incompatible items
* @throws SnapshotException

Back to the top