target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testGetSum() throws Exception { NewValue victim = new NewValue(); Double[] testValues = new Double[]{1.0, 1.1, 2.0, -23.4, 0.0, 1.0, 2.1}; double sum = 0.0; for (Double value : testValues) { victim.push(value); sum += value; } assertEquals(sum,victim.getSum(), EPSILON); } | public double getSum() { return sum; } | NewValue { public double getSum() { return sum; } } | NewValue { public double getSum() { return sum; } } | NewValue { public double getSum() { return sum; } void clear(); void push(double x); long getNumDataValues(); double getMean(); double getVariance(); double getStandardDeviation(); double getSum(); } | NewValue { public double getSum() { return sum; } void clear(); void push(double x); long getNumDataValues(); double getMean(); double getVariance(); double getStandardDeviation(); double getSum(); } |
@Test public void testGetVariance() { NewValue victim = new NewValue(); Double[] testValues = new Double[]{1.0, -1.0, 2.0, 2.1, 0.0, 53.0, -27.5}; for (double value : testValues) { victim.push(value); } double variance = getVariance(testValues); assertEquals("Calculated variance should match variance from test object."... | public double getVariance() { return ((numDataValues > 1) ? newS /(numDataValues - 1) : Double.NaN); } | NewValue { public double getVariance() { return ((numDataValues > 1) ? newS /(numDataValues - 1) : Double.NaN); } } | NewValue { public double getVariance() { return ((numDataValues > 1) ? newS /(numDataValues - 1) : Double.NaN); } } | NewValue { public double getVariance() { return ((numDataValues > 1) ? newS /(numDataValues - 1) : Double.NaN); } void clear(); void push(double x); long getNumDataValues(); double getMean(); double getVariance(); double getStandardDeviation(); double getSum(); } | NewValue { public double getVariance() { return ((numDataValues > 1) ? newS /(numDataValues - 1) : Double.NaN); } void clear(); void push(double x); long getNumDataValues(); double getMean(); double getVariance(); double getStandardDeviation(); double getSum(); } |
@Test public void testAdd() throws Exception { Buckets<IHasShortcut> testSubject = makeTestBuckets(); testSubject.add(MetricKey.fromValue("", "", ""), 123, 1.234); testSubject.add(MetricKey.fromValue("My.Metric.Formal.Name", "MyMetric", "Foo=Bar"), 123, 4.567); Buckets.Bucket bucket = testSubject.getBucket(123); assert... | public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Buck... | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Buck... |
@Test public void testGetBucket() throws Exception { Buckets<IHasShortcut> testSubject = makeTestBuckets(); MetricKey key = MetricKey.fromValue("My.Metric.Formal.Name", "MyMetric", "Foo=Bar"); testSubject.add(key, 123, 4.567); Buckets<IHasShortcut>.Bucket bucket = testSubject.getBucket(123); assertEquals("getValue shou... | public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... |
@Test (expected = IllegalArgumentException.class) public void addWithNullKeyShouldThrowException() { Buckets<IHasShortcut> testSubject = makeTestBuckets(); testSubject.add(null,12345, 1.234); } | public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Buck... | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Buck... |
@Test (expected = IllegalArgumentException.class) public void addWithEmptyKeyShouldThrowException() { Buckets<IHasShortcut> testSubject = makeTestBuckets(); MetricKey emptyKey = new MetricKey(); testSubject.add(emptyKey, 123, 1.234); } | public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Buck... | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Buck... |
@Test (expected = IllegalArgumentException.class) public void addWithKeyHavingNullShortcutShouldThrowException() { Buckets<IHasShortcut> testSubject = makeTestBuckets(); MetricKey emptyKey = MetricKey.fromValue(null, "MyMetric", "Foo=Bar"); assertNull("getShortcut on this key should be null", emptyKey.getShortcut()); t... | public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Buck... | Buckets { public final void add(final P primaryKey, final long timestamp, final double value) { long ts = getBucketTimestamp(timestamp); Bucket b = bucketList.get(ts); if (b == null) { b = new Bucket(); bucketList.put(ts, b); } b.add(primaryKey, value); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Buck... |
@Test public void testGetTimestamps() throws Exception { Buckets<IHasShortcut> testSubject = makeTestBuckets(); assertTrue("GetTimestamps", null != testSubject.getTimestamps()); } | public final SortedSet<Long> getTimestamps() { SortedSet<Long> result = new TreeSet<>(bucketList.keySet()); return result; } | Buckets { public final SortedSet<Long> getTimestamps() { SortedSet<Long> result = new TreeSet<>(bucketList.keySet()); return result; } } | Buckets { public final SortedSet<Long> getTimestamps() { SortedSet<Long> result = new TreeSet<>(bucketList.keySet()); return result; } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final SortedSet<Long> getTimestamps() { SortedSet<Long> result = new TreeSet<>(bucketList.keySet()); return result; } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQueryStatus(P key); final void add(fi... | Buckets { public final SortedSet<Long> getTimestamps() { SortedSet<Long> result = new TreeSet<>(bucketList.keySet()); return result; } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQueryStatus(P key); final void add(fi... |
@Test public void testSetValue() throws Exception { QueryResultDataPoint subject = new QueryResultDataPoint(); Assert.assertEquals("Value of uninitialized QueryResultDataPoint should be zero.", subject.getValue(), 0.0, EPSILON); subject.setValue(initialValue); Assert.assertEquals("Value of initialized QueryResultDataPo... | public void setValue(double value) { this.value = value; } | QueryResultDataPoint { public void setValue(double value) { this.value = value; } } | QueryResultDataPoint { public void setValue(double value) { this.value = value; } QueryResultDataPoint(); QueryResultDataPoint(long timestamp, double value); } | QueryResultDataPoint { public void setValue(double value) { this.value = value; } QueryResultDataPoint(); QueryResultDataPoint(long timestamp, double value); long getTimestamp(); void setTimestamp(long timestamp); double getValue(); void setValue(double value); @Override boolean equals(Object o); @Override int hashCod... | QueryResultDataPoint { public void setValue(double value) { this.value = value; } QueryResultDataPoint(); QueryResultDataPoint(long timestamp, double value); long getTimestamp(); void setTimestamp(long timestamp); double getValue(); void setValue(double value); @Override boolean equals(Object o); @Override int hashCod... |
@Test public void testGetSecondsPerBucket() throws Exception { Buckets<IHasShortcut> testSubject = makeTestBuckets(); assertTrue("Buckets should default to 300 seconds per bucket.", 300 == testSubject.getSecondsPerBucket()); Buckets<IHasShortcut> testSubject2 = new Buckets<>(123); assertTrue("Buckets created with speci... | public final long getSecondsPerBucket() { return secondsPerBucket; } | Buckets { public final long getSecondsPerBucket() { return secondsPerBucket; } } | Buckets { public final long getSecondsPerBucket() { return secondsPerBucket; } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final long getSecondsPerBucket() { return secondsPerBucket; } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQueryStatus(P key); final void add(final P primaryKey, final long timestamp, final double val... | Buckets { public final long getSecondsPerBucket() { return secondsPerBucket; } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQueryStatus(P key); final void add(final P primaryKey, final long timestamp, final double val... |
@Test public void testDump() throws Exception { Buckets<IHasShortcut> testSubject = BucketTestUtilities.makeAndPopulateTestBuckets(); BucketTestUtilities.dumpBucketsToStdout(testSubject); } | public final void dump(PrintStream ps) { List<Long> keys = new ArrayList<>(bucketList.keySet()); Collections.sort(keys); for (long k : keys) { ps.format("BUCKET: %d (%d) (%s)%n", k, k * secondsPerBucket, new Date(k * secondsPerBucket * 1000)); for (P key : bucketList.get(k).values.keySet()) { Value value = bucketList.g... | Buckets { public final void dump(PrintStream ps) { List<Long> keys = new ArrayList<>(bucketList.keySet()); Collections.sort(keys); for (long k : keys) { ps.format("BUCKET: %d (%d) (%s)%n", k, k * secondsPerBucket, new Date(k * secondsPerBucket * 1000)); for (P key : bucketList.get(k).values.keySet()) { Value value = bu... | Buckets { public final void dump(PrintStream ps) { List<Long> keys = new ArrayList<>(bucketList.keySet()); Collections.sort(keys); for (long k : keys) { ps.format("BUCKET: %d (%d) (%s)%n", k, k * secondsPerBucket, new Date(k * secondsPerBucket * 1000)); for (P key : bucketList.get(k).values.keySet()) { Value value = bu... | Buckets { public final void dump(PrintStream ps) { List<Long> keys = new ArrayList<>(bucketList.keySet()); Collections.sort(keys); for (long k : keys) { ps.format("BUCKET: %d (%d) (%s)%n", k, k * secondsPerBucket, new Date(k * secondsPerBucket * 1000)); for (P key : bucketList.get(k).values.keySet()) { Value value = bu... | Buckets { public final void dump(PrintStream ps) { List<Long> keys = new ArrayList<>(bucketList.keySet()); Collections.sort(keys); for (long k : keys) { ps.format("BUCKET: %d (%d) (%s)%n", k, k * secondsPerBucket, new Date(k * secondsPerBucket * 1000)); for (P key : bucketList.get(k).values.keySet()) { Value value = bu... |
@Test public void testGetValuePastEndOfDataReturnsNaN() { Buckets<IHasShortcut> testSubject = BucketTestUtilities.makeAndPopulateTestBuckets(); final Buckets<IHasShortcut>.Bucket bucket = testSubject.getBucket(1500); assertNull("get bucket outside of time series should return null.", bucket); } | public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... |
@Test public void testGetValueNotInDataReturnsNaNByShortcut() { Buckets<IHasShortcut> testSubject = BucketTestUtilities.makeAndPopulateTestBuckets(); final Buckets<IHasShortcut>.Bucket bucket = testSubject.getBucket(1000); assertNotNull("get bucket in time series should return a bucket.", bucket); double valueForNonexi... | public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... |
@Test public void testGetValueNotInDataReturnsNaNByMetricKey() { Buckets<IHasShortcut> testSubject = BucketTestUtilities.makeAndPopulateTestBuckets(); final Buckets<IHasShortcut>.Bucket bucket = testSubject.getBucket(1000); assertNotNull("get bucket in time series should return a bucket.", bucket); MetricKey nonexisten... | public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... |
@Test public void specifyingNegativeBucketSizeDefaultsValue() { Buckets<IHasShortcut> testSubject = new Buckets<>(-25l); assertEquals("If a negative bucket is specified, buckets should have default bucket size.", Buckets.DEFAULT_BUCKET_SIZE, testSubject.getSecondsPerBucket()); } | public final long getSecondsPerBucket() { return secondsPerBucket; } | Buckets { public final long getSecondsPerBucket() { return secondsPerBucket; } } | Buckets { public final long getSecondsPerBucket() { return secondsPerBucket; } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final long getSecondsPerBucket() { return secondsPerBucket; } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQueryStatus(P key); final void add(final P primaryKey, final long timestamp, final double val... | Buckets { public final long getSecondsPerBucket() { return secondsPerBucket; } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQueryStatus(P key); final void add(final P primaryKey, final long timestamp, final double val... |
@Test(expected = IllegalArgumentException.class) public void getValueWithNullShouldThrowException() { Buckets<IHasShortcut> testSubject = BucketTestUtilities.makeAndPopulateTestBuckets(); final Buckets<IHasShortcut>.Bucket bucket = testSubject.getBucket(1000); bucket.getValue(null); } | public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... |
@Test(expected = IllegalArgumentException.class) public void getValueByShortcutWithNullShouldThrowException() { Buckets<IHasShortcut> testSubject = BucketTestUtilities.makeAndPopulateTestBuckets(); final Buckets<IHasShortcut>.Bucket bucket = testSubject.getBucket(1000); bucket.getValueByShortcut(null); } | public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); } | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... | Buckets { public final Buckets<P>.Bucket getBucket(long timestamp) { long bucketTimestamp = getBucketTimestamp(timestamp); return bucketList.get(bucketTimestamp); } Buckets(); Buckets(final long secondsPerBucket); Map<Long, Bucket> getBucketList(); void addQueryStatus(P key, QueryStatus status); QueryStatus getQuerySt... |
@Test public void testGetValue() { Value victim = new Value(); double test = victim.getValue(); assertTrue("getValue() on an uninitialized value should return NaN.", Double.isNaN(test)); double val1 = 1.1, val2 = 2.0; victim.add(val1); assertEquals("Value with one entry should return that entry for getValue", val1, vic... | public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } | Value { public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } } | Value { public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } } | Value { public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final b... | Value { public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final b... |
@Test public void testGetSum() throws Exception { Value victim = new Value(); Double[] testValues = new Double[]{1.0, 1.1, 2.0, -23.4, 0.0, 1.0, 2.1}; double sum = 0.0; for (Double value : testValues) { victim.add(value); sum += value; } assertEquals(sum,victim.getSum(), EPSILON); } | public final double getSum() { return sum; } | Value { public final double getSum() { return sum; } } | Value { public final double getSum() { return sum; } } | Value { public final double getSum() { return sum; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double value); } | Value { public final double getSum() { return sum; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double value); } |
@Test public void testEquals() throws Exception { String testMessage = "Message for Unit Test"; QueryStatus one = new QueryStatus(QueryStatus.QueryStatusEnum.WARNING, testMessage); Assert.assertEquals("A QueryStatus object should be equal to itself.", one, one); QueryStatus other = new QueryStatus(QueryStatus.QueryStat... | @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; QueryStatus that = (QueryStatus) o; if (message != null ? !message.equals(that.message) : that.message != null) return false; if (status != that.status) return false; return true; } | QueryStatus { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; QueryStatus that = (QueryStatus) o; if (message != null ? !message.equals(that.message) : that.message != null) return false; if (status != that.status) return false; return t... | QueryStatus { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; QueryStatus that = (QueryStatus) o; if (message != null ? !message.equals(that.message) : that.message != null) return false; if (status != that.status) return false; return t... | QueryStatus { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; QueryStatus that = (QueryStatus) o; if (message != null ? !message.equals(that.message) : that.message != null) return false; if (status != that.status) return false; return t... | QueryStatus { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; QueryStatus that = (QueryStatus) o; if (message != null ? !message.equals(that.message) : that.message != null) return false; if (status != that.status) return false; return t... |
@Test public void testGetCount() throws Exception { Value victim = new Value(); Double[] testValues = new Double[]{1.0, 1.1, 2.0, 2.1}; for (Double value : testValues) { victim.add(value); } assertTrue(testValues.length == victim.getCount()); } | public final long getCount() { return count; } | Value { public final long getCount() { return count; } } | Value { public final long getCount() { return count; } } | Value { public final long getCount() { return count; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double value); } | Value { public final long getCount() { return count; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double value); } |
@Test public void testAdd() throws Exception { Value victim = new Value(); Double[] testValues = new Double[]{1.0, -1.0, 2.0, 2.1, 0.0, 53.0, -27.5}; double sum = 0.0; for (Double value : testValues) { victim.add(value); sum += value; } assertEquals(sum,victim.getSum(), EPSILON); } | public final void add(final double value) { sum += value; count++; } | Value { public final void add(final double value) { sum += value; count++; } } | Value { public final void add(final double value) { sum += value; count++; } } | Value { public final void add(final double value) { sum += value; count++; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double value); } | Value { public final void add(final double value) { sum += value; count++; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double value); } |
@Test public void uninitializedValueShouldReturnNaNOnGet() { Value victim = new Value(); assertTrue("An Uninitialized Value should return NaN on getValue().", Double.isNaN(victim.getValue())); } | public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } | Value { public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } } | Value { public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } } | Value { public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final b... | Value { public final double getValue() { if (count != 0) { return sum / (double) count; } if (hasInterpolated) { return interpolated; } return Double.NaN; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final b... |
@Test public void uninitializedValueShouldReturnFalseForValueIsInterpolated() { Value victim = new Value(); assertEquals("An Uninitialized Value should return false on valueIsInterpolated().", false, victim.valueIsInterpolated()); } | public final boolean valueIsInterpolated() { return count == 0 && hasInterpolated; } | Value { public final boolean valueIsInterpolated() { return count == 0 && hasInterpolated; } } | Value { public final boolean valueIsInterpolated() { return count == 0 && hasInterpolated; } } | Value { public final boolean valueIsInterpolated() { return count == 0 && hasInterpolated; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double val... | Value { public final boolean valueIsInterpolated() { return count == 0 && hasInterpolated; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double val... |
@Test public void testRemove() throws Exception { Value victim = new Value(); Double[] testValues = new Double[]{1.0, -1.0, 2.0, 2.1, 0.0, 53.0, -27.5}; for (Double value : testValues) { victim.add(value); } double originalValue = victim.getValue(); double originalSum = victim.getSum(); long originalCount = victim.getC... | public final void remove(final double value) { sum -= value; count--; } | Value { public final void remove(final double value) { sum -= value; count--; } } | Value { public final void remove(final double value) { sum -= value; count--; } } | Value { public final void remove(final double value) { sum -= value; count--; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double value); } | Value { public final void remove(final double value) { sum -= value; count--; } final double getValue(); final double getSum(); final long getCount(); final void add(final double value); final void addInterpolated(final double value); final boolean valueIsInterpolated(); final void remove(final double value); } |
@Test public void testHashCode() throws Exception { String testMessage = "Message for Unit Test"; QueryStatus.QueryStatusEnum testStatus = QueryStatus.QueryStatusEnum.WARNING; QueryStatus one = new QueryStatus(testStatus, testMessage); Assert.assertEquals("A QueryStatus object should have the same hashcode as itself.",... | @Override public int hashCode() { int result = message != null ? message.hashCode() : 0; result = 31 * result + (status != null ? status.hashCode() : 0); return result; } | QueryStatus { @Override public int hashCode() { int result = message != null ? message.hashCode() : 0; result = 31 * result + (status != null ? status.hashCode() : 0); return result; } } | QueryStatus { @Override public int hashCode() { int result = message != null ? message.hashCode() : 0; result = 31 * result + (status != null ? status.hashCode() : 0); return result; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); } | QueryStatus { @Override public int hashCode() { int result = message != null ? message.hashCode() : 0; result = 31 * result + (status != null ? status.hashCode() : 0); return result; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); Quer... | QueryStatus { @Override public int hashCode() { int result = message != null ? message.hashCode() : 0; result = 31 * result + (status != null ? status.hashCode() : 0); return result; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); Quer... |
@Test public void testGetStatus() throws Exception { String testMessage = "Message for Unit Test"; QueryStatus.QueryStatusEnum testStatus = QueryStatus.QueryStatusEnum.WARNING; QueryStatus one = new QueryStatus(testStatus, testMessage); Assert.assertEquals("getStatus should return status passed to constructor.", testSt... | public QueryStatusEnum getStatus() { return status; } | QueryStatus { public QueryStatusEnum getStatus() { return status; } } | QueryStatus { public QueryStatusEnum getStatus() { return status; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); } | QueryStatus { public QueryStatusEnum getStatus() { return status; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); QueryStatusEnum getStatus(); void setStatus(QueryStatusEnum status); String getMessage(); void setMessage(String message)... | QueryStatus { public QueryStatusEnum getStatus() { return status; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); QueryStatusEnum getStatus(); void setStatus(QueryStatusEnum status); String getMessage(); void setMessage(String message)... |
@Test public void testSetStatus() throws Exception { String testMessage = "Message for Unit Test"; QueryStatus.QueryStatusEnum testStatus = QueryStatus.QueryStatusEnum.WARNING; QueryStatus.QueryStatusEnum newStatus = QueryStatus.QueryStatusEnum.ERROR; QueryStatus one = new QueryStatus(testStatus, testMessage); Assert.a... | public void setStatus(QueryStatusEnum status) { this.status = status; } | QueryStatus { public void setStatus(QueryStatusEnum status) { this.status = status; } } | QueryStatus { public void setStatus(QueryStatusEnum status) { this.status = status; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); } | QueryStatus { public void setStatus(QueryStatusEnum status) { this.status = status; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); QueryStatusEnum getStatus(); void setStatus(QueryStatusEnum status); String getMessage(); void setMessa... | QueryStatus { public void setStatus(QueryStatusEnum status) { this.status = status; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); QueryStatusEnum getStatus(); void setStatus(QueryStatusEnum status); String getMessage(); void setMessa... |
@Test public void testGetMessage() throws Exception { String testMessage = "Message for Unit Test"; QueryStatus.QueryStatusEnum testStatus = QueryStatus.QueryStatusEnum.WARNING; QueryStatus one = new QueryStatus(testStatus, testMessage); Assert.assertEquals("getMessage should return message passed to constructor.", tes... | public String getMessage() { return message; } | QueryStatus { public String getMessage() { return message; } } | QueryStatus { public String getMessage() { return message; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); } | QueryStatus { public String getMessage() { return message; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); QueryStatusEnum getStatus(); void setStatus(QueryStatusEnum status); String getMessage(); void setMessage(String message); } | QueryStatus { public String getMessage() { return message; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); QueryStatusEnum getStatus(); void setStatus(QueryStatusEnum status); String getMessage(); void setMessage(String message); } |
@Test public void testSetMessage() throws Exception { String testMessage = "Message for Unit Test"; String newMessage = "New Unit Test Message"; QueryStatus.QueryStatusEnum testStatus = QueryStatus.QueryStatusEnum.WARNING; QueryStatus one = new QueryStatus(testStatus, testMessage); Assert.assertEquals("getMessage shoul... | public void setMessage(String message) { this.message = message; } | QueryStatus { public void setMessage(String message) { this.message = message; } } | QueryStatus { public void setMessage(String message) { this.message = message; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); } | QueryStatus { public void setMessage(String message) { this.message = message; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); QueryStatusEnum getStatus(); void setStatus(QueryStatusEnum status); String getMessage(); void setMessage(St... | QueryStatus { public void setMessage(String message) { this.message = message; } QueryStatus(); QueryStatus(QueryStatusEnum status, String message); @Override boolean equals(Object o); @Override int hashCode(); QueryStatusEnum getStatus(); void setStatus(QueryStatusEnum status); String getMessage(); void setMessage(St... |
@Test public void testIterator() throws FileNotFoundException, IOException { iterateWithMaxMessage(DEFAULT_MESSAGE_SIZE); } | public Iterator<CharBufferWrapper> iterator() { return new MessageIterator(); } | MboxIterator implements Iterable<CharBufferWrapper>, Closeable { public Iterator<CharBufferWrapper> iterator() { return new MessageIterator(); } } | MboxIterator implements Iterable<CharBufferWrapper>, Closeable { public Iterator<CharBufferWrapper> iterator() { return new MessageIterator(); } private MboxIterator(final File mbox,
final Charset charset,
final String regexpPattern,
final int ... | MboxIterator implements Iterable<CharBufferWrapper>, Closeable { public Iterator<CharBufferWrapper> iterator() { return new MessageIterator(); } private MboxIterator(final File mbox,
final Charset charset,
final String regexpPattern,
final int ... | MboxIterator implements Iterable<CharBufferWrapper>, Closeable { public Iterator<CharBufferWrapper> iterator() { return new MessageIterator(); } private MboxIterator(final File mbox,
final Charset charset,
final String regexpPattern,
final int ... |
@Test public void testLevel2() { final Mapping m = new Mapping("/content:3"); assertEquals("bar1", m.getResourceType("/content/foo/bar1", "nt:unstructured")); assertEquals("bar2", m.getResourceType("/content/foo/bar2/wii", "nt:unstructured")); assertNull(m.getResourceType("/", "nt:unstructured")); assertNull(m.getResou... | String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... |
@Test public void testLevel3() { final Mapping m = new Mapping("/content:3"); assertEquals("bar1", m.getResourceType("/content/foo/bar1", "nt:unstructured")); assertEquals("bar2", m.getResourceType("/content/foo/bar2/wii", "nt:unstructured")); assertEquals("bar3", m.getResourceType("/content/foo/bar3/wii2/xx", "nt:unst... | String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... |
@Test public void testNodetypeString() { final Mapping m = new Mapping("/content:2:nt:file"); assertNotNull("nt:file must match", m.getResourceType("/content/foo1", "nt:file")); assertEquals("foo1", m.getResourceType("/content/foo1", "nt:file")); assertNull(m.getResourceType("/content/foo1", "nt:unstructured")); assert... | String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... |
@Test public void testNodetypeRegexp() { final Mapping m = new Mapping("/content:2:(nt:(file|test))"); assertNotNull("nt:file must match", m.getResourceType("/content/foo1", "nt:file")); assertEquals("foo1", m.getResourceType("/content/foo1", "nt:file")); assertNotNull("nt:test must match", m.getResourceType("/content/... | String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... |
@Test public void testGetThreadKey() { assertEquals(expected, generator.getThreadKey(input)); } | public String getThreadKey(String subject) { String wordCharsSubj; String noReSubj; if (subject != null) { noReSubj = removeRe(subject); wordCharsSubj = noReSubj.replaceAll("\\W", "_"); if (!isAddressable(wordCharsSubj)) { noReSubj = wordCharsSubj = UNADDRESSABLE_SUBJECT; } } else { noReSubj = wordCharsSubj = UNADDRESS... | ThreadKeyGeneratorImpl implements ThreadKeyGenerator { public String getThreadKey(String subject) { String wordCharsSubj; String noReSubj; if (subject != null) { noReSubj = removeRe(subject); wordCharsSubj = noReSubj.replaceAll("\\W", "_"); if (!isAddressable(wordCharsSubj)) { noReSubj = wordCharsSubj = UNADDRESSABLE_S... | ThreadKeyGeneratorImpl implements ThreadKeyGenerator { public String getThreadKey(String subject) { String wordCharsSubj; String noReSubj; if (subject != null) { noReSubj = removeRe(subject); wordCharsSubj = noReSubj.replaceAll("\\W", "_"); if (!isAddressable(wordCharsSubj)) { noReSubj = wordCharsSubj = UNADDRESSABLE_S... | ThreadKeyGeneratorImpl implements ThreadKeyGenerator { public String getThreadKey(String subject) { String wordCharsSubj; String noReSubj; if (subject != null) { noReSubj = removeRe(subject); wordCharsSubj = noReSubj.replaceAll("\\W", "_"); if (!isAddressable(wordCharsSubj)) { noReSubj = wordCharsSubj = UNADDRESSABLE_S... | ThreadKeyGeneratorImpl implements ThreadKeyGenerator { public String getThreadKey(String subject) { String wordCharsSubj; String noReSubj; if (subject != null) { noReSubj = removeRe(subject); wordCharsSubj = noReSubj.replaceAll("\\W", "_"); if (!isAddressable(wordCharsSubj)) { noReSubj = wordCharsSubj = UNADDRESSABLE_S... |
@Test public void testMboxParsing() throws IOException { Iterator<Message> iter = parser.parse(new FileInputStream(new File(TU.TEST_FOLDER, WRONGBODY_MBOX))); boolean fail = true; int i = 1; while (iter.hasNext()) { final Message message = iter.next(); File bodyFile = new File(TU.TEST_FOLDER, specialPathFromFilePath(WR... | @Override public Iterator<Message> parse(InputStream is) throws IOException { return new Mime4jParserIterator(is); } | Mime4jMboxParserImpl implements MboxParser { @Override public Iterator<Message> parse(InputStream is) throws IOException { return new Mime4jParserIterator(is); } } | Mime4jMboxParserImpl implements MboxParser { @Override public Iterator<Message> parse(InputStream is) throws IOException { return new Mime4jParserIterator(is); } } | Mime4jMboxParserImpl implements MboxParser { @Override public Iterator<Message> parse(InputStream is) throws IOException { return new Mime4jParserIterator(is); } @Override Iterator<Message> parse(InputStream is); } | Mime4jMboxParserImpl implements MboxParser { @Override public Iterator<Message> parse(InputStream is) throws IOException { return new Mime4jParserIterator(is); } @Override Iterator<Message> parse(InputStream is); } |
@Test public void getUserId_deepPath() { Resource resource = context.resourceResolver().getResource("/content/slingshot/users/admin/hobby"); assertThat(SlingshotUtil.getUserId(resource), equalTo("admin")); } | public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resource.getPath().ind... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... |
@Test public void getUserId_exactPath() { Resource resource = context.resourceResolver().getResource("/content/slingshot/users/admin"); assertThat(SlingshotUtil.getUserId(resource), equalTo("admin")); } | public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resource.getPath().ind... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... |
@Test public void getUserId_noMatch() { Resource resource = context.resourceResolver().getResource("/content/slingshot/users"); assertThat(SlingshotUtil.getUserId(resource), nullValue()); } | public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resource.getPath().ind... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... | SlingshotUtil { public static String getUserId(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/"; String id = null; if ( resource.getPath().startsWith(prefix) ) { final int areaEnd = resource.getPath().indexOf('/', prefix.length()); if ( areaEnd != -1 ) { final int userEnd = resour... |
@Test public void getContentPath_match() { Resource resource = context.resourceResolver().getResource("/content/slingshot/users/admin/hobby"); assertThat(SlingshotUtil.getContentPath(resource), equalTo("/hobby")); } | public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return null; } | SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return nul... | SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return nul... | SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return nul... | SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return nul... |
@Test public void getContentPath_noMatch() { Resource resource = context.resourceResolver().getResource("/content/slingshot/users/admin"); assertThat(SlingshotUtil.getContentPath(resource), nullValue()); } | public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return null; } | SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return nul... | SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return nul... | SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return nul... | SlingshotUtil { public static String getContentPath(final Resource resource) { final String prefix = SlingshotConstants.APP_ROOT_PATH + "/users/" + getUserId(resource) + "/"; final String path = resource.getPath(); if ( path != null && path.startsWith(prefix) ) { return path.substring(prefix.length() - 1); } return nul... |
@Test public void filter() { assertThat(output, equalTo(Util.filter(input))); } | public static String filter(final String rsrcname) { final StringBuilder sb = new StringBuilder(); char lastAdded = 0; final String name = rsrcname.toLowerCase(); for(int i=0; i < name.length(); i++) { final char c = name.charAt(i); char toAdd = c; if (ALLOWED_CHARS.indexOf(c) < 0) { if (lastAdded == REPLACEMENT_CHAR) ... | Util { public static String filter(final String rsrcname) { final StringBuilder sb = new StringBuilder(); char lastAdded = 0; final String name = rsrcname.toLowerCase(); for(int i=0; i < name.length(); i++) { final char c = name.charAt(i); char toAdd = c; if (ALLOWED_CHARS.indexOf(c) < 0) { if (lastAdded == REPLACEMENT... | Util { public static String filter(final String rsrcname) { final StringBuilder sb = new StringBuilder(); char lastAdded = 0; final String name = rsrcname.toLowerCase(); for(int i=0; i < name.length(); i++) { final char c = name.charAt(i); char toAdd = c; if (ALLOWED_CHARS.indexOf(c) < 0) { if (lastAdded == REPLACEMENT... | Util { public static String filter(final String rsrcname) { final StringBuilder sb = new StringBuilder(); char lastAdded = 0; final String name = rsrcname.toLowerCase(); for(int i=0; i < name.length(); i++) { final char c = name.charAt(i); char toAdd = c; if (ALLOWED_CHARS.indexOf(c) < 0) { if (lastAdded == REPLACEMENT... | Util { public static String filter(final String rsrcname) { final StringBuilder sb = new StringBuilder(); char lastAdded = 0; final String name = rsrcname.toLowerCase(); for(int i=0; i < name.length(); i++) { final char c = name.charAt(i); char toAdd = c; if (ALLOWED_CHARS.indexOf(c) < 0) { if (lastAdded == REPLACEMENT... |
@Test public void testSimpleMapping() { final Mapping m = new Mapping("/content:2"); final String[][] testCases = { { "/content/foo", "nt:unstructured", "foo" }, { "/content/foo/bar", "nt:unstructured", "foo" }, { "/not/content/foo/bar", "nt:unstructured", null }, { "/content/foo/bar", "nt:file", null } }; for(int i=0;... | String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } } | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... | Mapping { String getResourceType(String nodePath, String nodeType) { String result = null; if(path!=null && nodePath.startsWith(path) && nodeTypeMatches(nodeType)) { final String [] paths = nodePath.split("/"); if(paths.length >= resourceTypeIndex+1) { result = paths[resourceTypeIndex]; } } return result; } Mapping(Str... |
@Test public void getAssetDetailsEditorPath() { final String expected = "/assetdetails.html/content/dam/test.png"; ctx.currentResource("/content/editor-links"); final EditorLinks editorLinks = ctx.request().adaptTo(EditorLinks.class); assertEquals(expected, editorLinks.getAssetDetailsEditorPath()); } | @Override public String getAssetDetailsEditorPath() { return request.getResourceResolver().map(ASSET_DETAILS_PREFIX + asset.getPath()); } | EditorLinksImpl extends AbstractEmptyTextComponent implements EditorLinks { @Override public String getAssetDetailsEditorPath() { return request.getResourceResolver().map(ASSET_DETAILS_PREFIX + asset.getPath()); } } | EditorLinksImpl extends AbstractEmptyTextComponent implements EditorLinks { @Override public String getAssetDetailsEditorPath() { return request.getResourceResolver().map(ASSET_DETAILS_PREFIX + asset.getPath()); } } | EditorLinksImpl extends AbstractEmptyTextComponent implements EditorLinks { @Override public String getAssetDetailsEditorPath() { return request.getResourceResolver().map(ASSET_DETAILS_PREFIX + asset.getPath()); } @Override String getAssetDetailsEditorPath(); @Override String getAssetFolderEditorPath(); @Override bool... | EditorLinksImpl extends AbstractEmptyTextComponent implements EditorLinks { @Override public String getAssetDetailsEditorPath() { return request.getResourceResolver().map(ASSET_DETAILS_PREFIX + asset.getPath()); } @Override String getAssetDetailsEditorPath(); @Override String getAssetFolderEditorPath(); @Override bool... |
@Test public void getLabel() { final String expected = "Test Asset Rendition Resolver"; ctx.registerInjectActivateService(new ExternalRedirectRenditionDispatcherImpl(), "label", "Test Asset Rendition Resolver"); final AssetRenditionDispatcher assetRenditionDispatcher = ctx.getService(AssetRenditionDispatcher.class); fi... | @Override public String getLabel() { return cfg.label(); } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public String getLabel() { return cfg.label(); } } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public String getLabel() { return cfg.label(); } } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public String getLabel() { return cfg.label(); } @Override String getLabel(); @Override String getName(); @Override Map<String, String> getOptions(); @Override boolean isHidden(); @Override S... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public String getLabel() { return cfg.label(); } @Override String getLabel(); @Override String getName(); @Override Map<String, String> getOptions(); @Override boolean isHidden(); @Override S... |
@Test public void getName() { final String expected = "test"; ctx.registerInjectActivateService(new ExternalRedirectRenditionDispatcherImpl(), "name", "test"); final AssetRenditionDispatcher assetRenditionDispatcher = ctx.getService(AssetRenditionDispatcher.class); final String actual = assetRenditionDispatcher.getName... | @Override public String getName() { return cfg.name(); } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public String getName() { return cfg.name(); } } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public String getName() { return cfg.name(); } } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public String getName() { return cfg.name(); } @Override String getLabel(); @Override String getName(); @Override Map<String, String> getOptions(); @Override boolean isHidden(); @Override Set... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public String getName() { return cfg.name(); } @Override String getLabel(); @Override String getName(); @Override Map<String, String> getOptions(); @Override boolean isHidden(); @Override Set... |
@Test public void getOptions() { final Map<String, String> expected = ImmutableMap.<String, String>builder(). put("Foo", "foo"). put("Foo bar", "foo_bar"). put("Foo-bar", "foo-bar"). build(); ctx.registerInjectActivateService(new ExternalRedirectRenditionDispatcherImpl(), ImmutableMap.<String, Object>builder(). put("re... | @Override public Map<String, String> getOptions() { return assetRenditions.getOptions(mappings); } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public Map<String, String> getOptions() { return assetRenditions.getOptions(mappings); } } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public Map<String, String> getOptions() { return assetRenditions.getOptions(mappings); } } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public Map<String, String> getOptions() { return assetRenditions.getOptions(mappings); } @Override String getLabel(); @Override String getName(); @Override Map<String, String> getOptions(); @... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public Map<String, String> getOptions() { return assetRenditions.getOptions(mappings); } @Override String getLabel(); @Override String getName(); @Override Map<String, String> getOptions(); @... |
@Test public void getRenditionNames() { Set<String> expected = new HashSet<>(); expected.add("foo"); expected.add("test.ing-rendition"); ctx.registerInjectActivateService(new ExternalRedirectRenditionDispatcherImpl(), ImmutableMap.<String, Object>builder(). put("rendition.mappings", new String[]{ "foo=foo value", "test... | @Override public Set<String> getRenditionNames() { if (mappings == null) { return Collections.EMPTY_SET; } else { return mappings.keySet(); } } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public Set<String> getRenditionNames() { if (mappings == null) { return Collections.EMPTY_SET; } else { return mappings.keySet(); } } } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public Set<String> getRenditionNames() { if (mappings == null) { return Collections.EMPTY_SET; } else { return mappings.keySet(); } } } | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public Set<String> getRenditionNames() { if (mappings == null) { return Collections.EMPTY_SET; } else { return mappings.keySet(); } } @Override String getLabel(); @Override String getName(); ... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public Set<String> getRenditionNames() { if (mappings == null) { return Collections.EMPTY_SET; } else { return mappings.keySet(); } } @Override String getLabel(); @Override String getName(); ... |
@Test public void dispatch() throws IOException, ServletException { ctx.registerInjectActivateService(new ExternalRedirectRenditionDispatcherImpl(), ImmutableMap.<String, Object>builder(). put("rendition.mappings", new String[]{ "testing=${dm.domain}is/image/${dm.file}?$greyscale$"}). build()); final AssetRenditionDisp... | @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionParameters(request); final String expression = mappings.get(parameters.getRenditionName()); final String evaluatedExpres... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionPa... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionPa... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionPa... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionPa... |
@Test public void dispatch_WithSpacesInPath() throws IOException, ServletException { ctx.registerInjectActivateService(new ExternalRedirectRenditionDispatcherImpl(), ImmutableMap.<String, Object>builder(). put("rendition.mappings", new String[]{ "testing=${asset.path}.test.500.500.${asset.extension}"}). put("redirect",... | @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionParameters(request); final String expression = mappings.get(parameters.getRenditionName()); final String evaluatedExpres... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionPa... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionPa... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionPa... | ExternalRedirectRenditionDispatcherImpl extends AbstractRenditionDispatcherImpl implements AssetRenditionDispatcher { @Override public void dispatch(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { final AssetRenditionParameters parameters = new AssetRenditionPa... |
@Test public void doGet() throws IOException, ServletException { final AssetRenditionDispatcher assetRenditionDispatcher = Mockito.spy(new StaticRenditionDispatcherImpl()); final byte[] expectedOutputStream = IOUtils.toByteArray(this.getClass().getResourceAsStream("AssetRenditionServletTest__cq5dam.web.1280.1280.png"))... | public final void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { try { final AssetRenditionParameters parameters = new AssetRenditionParameters(request); if (acceptsAssetRenditionParameters(parameters)) { for (final AssetRenditionDispatcher assetRenditio... | AssetRenditionServlet extends SlingSafeMethodsServlet { public final void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { try { final AssetRenditionParameters parameters = new AssetRenditionParameters(request); if (acceptsAssetRenditionParameters(paramete... | AssetRenditionServlet extends SlingSafeMethodsServlet { public final void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { try { final AssetRenditionParameters parameters = new AssetRenditionParameters(request); if (acceptsAssetRenditionParameters(paramete... | AssetRenditionServlet extends SlingSafeMethodsServlet { public final void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { try { final AssetRenditionParameters parameters = new AssetRenditionParameters(request); if (acceptsAssetRenditionParameters(paramete... | AssetRenditionServlet extends SlingSafeMethodsServlet { public final void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException, ServletException { try { final AssetRenditionParameters parameters = new AssetRenditionParameters(request); if (acceptsAssetRenditionParameters(paramete... |
@Test public void setResponseHeaders() { ctx.requestPathInfo().setResourcePath("/content/dam/test.png"); ctx.requestPathInfo().setExtension("rendition"); ctx.requestPathInfo().setSuffix("testing/asset.rendition"); final AssetRenditionParameters params = new AssetRenditionParameters(ctx.request()); new AssetRenditionSer... | protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } else { response.setHeader("Content-Disposition", String.... | AssetRenditionServlet extends SlingSafeMethodsServlet { protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } ... | AssetRenditionServlet extends SlingSafeMethodsServlet { protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } ... | AssetRenditionServlet extends SlingSafeMethodsServlet { protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } ... | AssetRenditionServlet extends SlingSafeMethodsServlet { protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } ... |
@Test public void setResponseHeaders_AsAttachment() { ctx.requestPathInfo().setResourcePath("/content/dam/test.png"); ctx.requestPathInfo().setExtension("rendition"); ctx.requestPathInfo().setSuffix("testing/download/asset.rendition"); final AssetRenditionParameters params = new AssetRenditionParameters(ctx.request());... | protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } else { response.setHeader("Content-Disposition", String.... | AssetRenditionServlet extends SlingSafeMethodsServlet { protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } ... | AssetRenditionServlet extends SlingSafeMethodsServlet { protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } ... | AssetRenditionServlet extends SlingSafeMethodsServlet { protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } ... | AssetRenditionServlet extends SlingSafeMethodsServlet { protected void setResponseHeaders(final SlingHttpServletResponse response, final AssetRenditionParameters parameters) { if (parameters.isDownload()) { response.setHeader("Content-Disposition", String.format("attachment; filename=%s", parameters.getFileName())); } ... |
@Test public void accepts() { ctx.registerService(AssetRenditionsDownloadOrchestrator.class, new AssetRenditionsZipperImpl()); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getService(AssetRenditionsDownloadOrchestrator.class); ctx.request().setQueryString(AssetRenditionsDownloadOrchestrator.REQUES... | @Override public boolean accepts(SlingHttpServletRequest request, List<AssetModel> assets, List<String> renditionNames) { return NAME.equals(request.getRequestParameter(REQUEST_PARAMETER_NAME).getString()); } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { @Override public boolean accepts(SlingHttpServletRequest request, List<AssetModel> assets, List<String> renditionNames) { return NAME.equals(request.getRequestParameter(REQUEST_PARAMETER_NAME).getString()); } } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { @Override public boolean accepts(SlingHttpServletRequest request, List<AssetModel> assets, List<String> renditionNames) { return NAME.equals(request.getRequestParameter(REQUEST_PARAMETER_NAME).getString()); } } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { @Override public boolean accepts(SlingHttpServletRequest request, List<AssetModel> assets, List<String> renditionNames) { return NAME.equals(request.getRequestParameter(REQUEST_PARAMETER_NAME).getString()); } @Override void execute(final SlingH... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { @Override public boolean accepts(SlingHttpServletRequest request, List<AssetModel> assets, List<String> renditionNames) { return NAME.equals(request.getRequestParameter(REQUEST_PARAMETER_NAME).getString()); } @Override void execute(final SlingH... |
@Test public void getFormat_Date() { final String expected = "yyyy-MM-dd"; ctx.currentResource("/content/date"); final Metadata metadata = ctx.request().adaptTo(Metadata.class); assertEquals(expected, metadata.getFormat()); } | @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } @PostConstruct void init(); @Override DataType getType(); @Override Stri... | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } @PostConstruct void init(); @Override DataType getType(); @Override Stri... |
@Test public void getFileName_FromResource() { final String expected = "My Assets.zip"; ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "file.name", "OSGi value"); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getService(AssetRenditionsDownloadOrchestrator.class); assertEquals(ex... | protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... |
@Test public void getFileName_FromOSGiConfig() { final String expected = "Test Assets.zip"; ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "file.name", expected); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getService(AssetRenditionsDownloadOrchestrator.class); assertEquals(ex... | protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... |
@Test public void getFileName_Default() { final String expected = "Assets.zip"; ctx.registerInjectActivateService(new AssetRenditionsZipperImpl()); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getService(AssetRenditionsDownloadOrchestrator.class); assertEquals(expected, zipper.getFileName(new Valu... | protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getFileName(final ValueMap properties) { String fileName = properties.get(PN_FILE_NAME, StringUtils.defaultString(cfg.file_name(), DEFAULT_FILE_ATTACHMENT_NAME)); if (!StringUtils.endsWith(fileName, ZIP_EXTENSION)) { fileName +=... |
@Test public void checkForMaxSize_Under() throws AssetRenditionsException { final String expected = "Test Assets.zip"; ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "max.size", 10000); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getService(AssetRenditionsDownloadOrchestrator.... | protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } @Override void ... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } @Override void ... |
@Test(expected = AssetRenditionsException.class) public void checkForMaxSize_Over() throws AssetRenditionsException { final String expected = "Test Assets.zip"; ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "max.size", 10000); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getSe... | protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } } | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } @Override void ... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected void checkForMaxSize(long size) throws AssetRenditionsException { if (cfg.max_size() >= 0 && size > cfg.max_size() * BYTES_IN_MB) { throw new AssetRenditionsException("Selected assets exceed maximum allows size."); } } @Override void ... |
@Test public void getZipEntryName() { final String expected = "test__my-rendition.png"; ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "rendition.filename.expression", AssetRenditionsZipperImpl.VAR_ASSET_NAME + "__" + AssetRenditionsZipperImpl.VAR_RENDITION_NAME + "." + AssetRenditionsZipperImpl.VAR... | protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(responseContentType); final Map<String, String> variables = new HashMap<>(); variab... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(response... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(response... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(response... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(response... |
@Test public void getZipEntryName_GenerateUniqueZipFileNameEntry() { final String expected = "1-test__my-rendition.png"; final Set<String> zipEntryFileNames = new HashSet<>(); zipEntryFileNames.add("test__my-rendition.png"); ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "rendition.filename.expressi... | protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(responseContentType); final Map<String, String> variables = new HashMap<>(); variab... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(response... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(response... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(response... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(response... |
@Test public void pack() throws IOException, ServletException { final byte[] expectedOutputStream = IOUtils.toByteArray(this.getClass().getResourceAsStream("AssetRenditionsZipperImplTest__original.png")); doAnswer(invocation -> { Object[] args = invocation.getArguments(); ((AssetRenditionDownloadResponse) args[1]).getO... | @Override public void execute(final SlingHttpServletRequest request, final SlingHttpServletResponse response, final List<AssetModel> assets, final List<String> renditionNames) throws IOException { final String filename = StringUtils.defaultIfBlank(getFileName(request.getResource().getValueMap()), DEFAULT_FILE_ATTACHMEN... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { @Override public void execute(final SlingHttpServletRequest request, final SlingHttpServletResponse response, final List<AssetModel> assets, final List<String> renditionNames) throws IOException { final String filename = StringUtils.defaultIfBla... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { @Override public void execute(final SlingHttpServletRequest request, final SlingHttpServletResponse response, final List<AssetModel> assets, final List<String> renditionNames) throws IOException { final String filename = StringUtils.defaultIfBla... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { @Override public void execute(final SlingHttpServletRequest request, final SlingHttpServletResponse response, final List<AssetModel> assets, final List<String> renditionNames) throws IOException { final String filename = StringUtils.defaultIfBla... | AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { @Override public void execute(final SlingHttpServletRequest request, final SlingHttpServletResponse response, final List<AssetModel> assets, final List<String> renditionNames) throws IOException { final String filename = StringUtils.defaultIfBla... |
@Test public void getAssets() { ctx.registerInjectActivateService(new AssetRenditionsDownloadServlet()); AssetRenditionsDownloadServlet servlet = (AssetRenditionsDownloadServlet) ctx.getService(Servlet.class); ctx.request().setQueryString("path=/content/dam/test.png&path=/content/dam/test-2.png&path=/content/dam/test-3... | protected List<AssetModel> getAssets(final SlingHttpServletRequest request) { final RequestParameter[] requestParameters = request.getRequestParameters(REQ_KEY_ASSET_PATHS); if (requestParameters == null) { return EMPTY_LIST; } return Arrays.stream(requestParameters) .map(RequestParameter::getString) .map(path -> reque... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { protected List<AssetModel> getAssets(final SlingHttpServletRequest request) { final RequestParameter[] requestParameters = request.getRequestParameters(REQ_KEY_ASSET_PATHS); if (requestParameters == nul... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { protected List<AssetModel> getAssets(final SlingHttpServletRequest request) { final RequestParameter[] requestParameters = request.getRequestParameters(REQ_KEY_ASSET_PATHS); if (requestParameters == nul... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { protected List<AssetModel> getAssets(final SlingHttpServletRequest request) { final RequestParameter[] requestParameters = request.getRequestParameters(REQ_KEY_ASSET_PATHS); if (requestParameters == nul... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { protected List<AssetModel> getAssets(final SlingHttpServletRequest request) { final RequestParameter[] requestParameters = request.getRequestParameters(REQ_KEY_ASSET_PATHS); if (requestParameters == nul... |
@Test public void getRenditionNames() { ctx.registerInjectActivateService(new AssetRenditionsDownloadServlet()); AssetRenditionsDownloadServlet servlet = (AssetRenditionsDownloadServlet) ctx.getService(Servlet.class); ctx.currentResource("/content/allowed-rendition-names"); ctx.request().setQueryString("renditionName=o... | protected List<String> getRenditionNames(final SlingHttpServletRequest request) { final String[] allowedRenditionNames = request.getResource().getValueMap().get(PN_ALLOWED_RENDITION_NAMES, new String[]{}); if (allowedRenditionNames == null) { return EMPTY_LIST; } final RequestParameter[] requestParameters = request.get... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { protected List<String> getRenditionNames(final SlingHttpServletRequest request) { final String[] allowedRenditionNames = request.getResource().getValueMap().get(PN_ALLOWED_RENDITION_NAMES, new String[]{... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { protected List<String> getRenditionNames(final SlingHttpServletRequest request) { final String[] allowedRenditionNames = request.getResource().getValueMap().get(PN_ALLOWED_RENDITION_NAMES, new String[]{... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { protected List<String> getRenditionNames(final SlingHttpServletRequest request) { final String[] allowedRenditionNames = request.getResource().getValueMap().get(PN_ALLOWED_RENDITION_NAMES, new String[]{... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { protected List<String> getRenditionNames(final SlingHttpServletRequest request) { final String[] allowedRenditionNames = request.getResource().getValueMap().get(PN_ALLOWED_RENDITION_NAMES, new String[]{... |
@Test public void getFormat_Number() { final String expected = "#.###"; ctx.currentResource("/content/number"); final Metadata metadata = ctx.request().adaptTo(Metadata.class); assertEquals(expected, metadata.getFormat()); } | @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } @PostConstruct void init(); @Override DataType getType(); @Override Stri... | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } } @PostConstruct void init(); @Override DataType getType(); @Override Stri... |
@Test public void doPost() throws ServletException, IOException { final byte[] expectedOutputStream = IOUtils.toByteArray(this.getClass().getResourceAsStream("AssetRenditionsDownloadServletTest__original.png")); doAnswer(invocation -> { Object[] args = invocation.getArguments(); ((AssetRenditionDownloadResponse) args[1... | @Override protected final void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { servletHelper.addSlingBindings(request, response); final List<String> renditionNames = getRenditionNames(request); final List<AssetModel> assets = getAssets(request); final St... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { @Override protected final void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { servletHelper.addSlingBindings(request, response); final ... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { @Override protected final void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { servletHelper.addSlingBindings(request, response); final ... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { @Override protected final void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { servletHelper.addSlingBindings(request, response); final ... | AssetRenditionsDownloadServlet extends SlingAllMethodsServlet implements AssetRenditionsDownloadOrchestratorManager { @Override protected final void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { servletHelper.addSlingBindings(request, response); final ... |
@Test public void getByteArrayOutputStream() { baos.write(100); AssetRenditionDownloadResponse response = new AssetRenditionDownloadResponse(ctx.response(), stringWriter, baos); assertEquals(baos, response.getByteArrayOutputStream()); } | public ByteArrayOutputStream getByteArrayOutputStream() { return this.baos; } | AssetRenditionDownloadResponse extends BufferedSlingHttpServletResponse { public ByteArrayOutputStream getByteArrayOutputStream() { return this.baos; } } | AssetRenditionDownloadResponse extends BufferedSlingHttpServletResponse { public ByteArrayOutputStream getByteArrayOutputStream() { return this.baos; } AssetRenditionDownloadResponse(SlingHttpServletResponse wrappedResponse, StringWriter writer, ByteArrayOutputStream outputStream); } | AssetRenditionDownloadResponse extends BufferedSlingHttpServletResponse { public ByteArrayOutputStream getByteArrayOutputStream() { return this.baos; } AssetRenditionDownloadResponse(SlingHttpServletResponse wrappedResponse, StringWriter writer, ByteArrayOutputStream outputStream); boolean isRedirect(); String getRedir... | AssetRenditionDownloadResponse extends BufferedSlingHttpServletResponse { public ByteArrayOutputStream getByteArrayOutputStream() { return this.baos; } AssetRenditionDownloadResponse(SlingHttpServletResponse wrappedResponse, StringWriter writer, ByteArrayOutputStream outputStream); boolean isRedirect(); String getRedir... |
@Test public void getContentType() { AssetRenditionDownloadResponse response = new AssetRenditionDownloadResponse(ctx.response(), stringWriter, baos); response.setHeader("Content-Type", "application/test"); assertEquals("application/test", response.getContentType()); } | @Override public String getContentType() { return StringUtils.defaultIfEmpty(contentType, super.getContentType()); } | AssetRenditionDownloadResponse extends BufferedSlingHttpServletResponse { @Override public String getContentType() { return StringUtils.defaultIfEmpty(contentType, super.getContentType()); } } | AssetRenditionDownloadResponse extends BufferedSlingHttpServletResponse { @Override public String getContentType() { return StringUtils.defaultIfEmpty(contentType, super.getContentType()); } AssetRenditionDownloadResponse(SlingHttpServletResponse wrappedResponse, StringWriter writer, ByteArrayOutputStream outputStream)... | AssetRenditionDownloadResponse extends BufferedSlingHttpServletResponse { @Override public String getContentType() { return StringUtils.defaultIfEmpty(contentType, super.getContentType()); } AssetRenditionDownloadResponse(SlingHttpServletResponse wrappedResponse, StringWriter writer, ByteArrayOutputStream outputStream)... | AssetRenditionDownloadResponse extends BufferedSlingHttpServletResponse { @Override public String getContentType() { return StringUtils.defaultIfEmpty(contentType, super.getContentType()); } AssetRenditionDownloadResponse(SlingHttpServletResponse wrappedResponse, StringWriter writer, ByteArrayOutputStream outputStream)... |
@Test public void getAttribute() { final SlingHttpServletRequest request = new AssetRenditionDownloadRequest( ctx.request(), "GET", resource, new String[]{}, "html", "/my/suffix"); SlingBindings actual = (SlingBindings) request.getAttribute(SlingBindings.class.getName()); assertEquals(resource, actual.get(SlingBindings... | @Override public Object getAttribute(String name) { if (SlingBindings.class.getName().equals(name)) { return bindings; } else { return super.getAttribute(name); } } | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public Object getAttribute(String name) { if (SlingBindings.class.getName().equals(name)) { return bindings; } else { return super.getAttribute(name); } } } | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public Object getAttribute(String name) { if (SlingBindings.class.getName().equals(name)) { return bindings; } else { return super.getAttribute(name); } } AssetRenditionDownloadRequest(final SlingHttpServletRequest wrappedRequest,
... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public Object getAttribute(String name) { if (SlingBindings.class.getName().equals(name)) { return bindings; } else { return super.getAttribute(name); } } AssetRenditionDownloadRequest(final SlingHttpServletRequest wrappedRequest,
... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public Object getAttribute(String name) { if (SlingBindings.class.getName().equals(name)) { return bindings; } else { return super.getAttribute(name); } } AssetRenditionDownloadRequest(final SlingHttpServletRequest wrappedRequest,
... |
@Test public void getResource() { final Resource expected = resource; final SlingHttpServletRequest request = new AssetRenditionDownloadRequest( ctx.request(), "GET", expected, new String[]{}, "html", "/my/suffix"); final Resource actual = request.getResource(); assertEquals(expected, actual); } | @Override public Resource getResource() { return resource; } | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public Resource getResource() { return resource; } } | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public Resource getResource() { return resource; } AssetRenditionDownloadRequest(final SlingHttpServletRequest wrappedRequest,
final String method,
final Res... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public Resource getResource() { return resource; } AssetRenditionDownloadRequest(final SlingHttpServletRequest wrappedRequest,
final String method,
final Res... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public Resource getResource() { return resource; } AssetRenditionDownloadRequest(final SlingHttpServletRequest wrappedRequest,
final String method,
final Res... |
@Test public void getMethod() { final String expected = "HEAD"; final SlingHttpServletRequest request = new AssetRenditionDownloadRequest( ctx.request(), expected, resource, new String[]{}, "html", "/my/suffix"); final String actual = request.getMethod(); assertEquals(expected, actual); } | @Override public String getMethod() { return method; } | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public String getMethod() { return method; } } | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public String getMethod() { return method; } AssetRenditionDownloadRequest(final SlingHttpServletRequest wrappedRequest,
final String method,
final Resource ... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public String getMethod() { return method; } AssetRenditionDownloadRequest(final SlingHttpServletRequest wrappedRequest,
final String method,
final Resource ... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public String getMethod() { return method; } AssetRenditionDownloadRequest(final SlingHttpServletRequest wrappedRequest,
final String method,
final Resource ... |
@Test public void getRequestPathInfo() { final String expectedResourcePath = "/content/test"; final String expectedSuffix = "/content/my/suffix"; final String expectedExtension = "html"; final String[] expectedSelectors = new String[]{"foo", "bar"}; final String expectedSelectorString = StringUtils.join(expectedSelecto... | @Override public RequestPathInfo getRequestPathInfo() { return new RequestPathInfo() { @Nonnull @Override public String getResourcePath() { return getResource().getPath(); } @CheckForNull @Override public String getExtension() { return extension; } @CheckForNull @Override public String getSelectorString() { return Stri... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public RequestPathInfo getRequestPathInfo() { return new RequestPathInfo() { @Nonnull @Override public String getResourcePath() { return getResource().getPath(); } @CheckForNull @Override public String getExtension() { return extension; } ... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public RequestPathInfo getRequestPathInfo() { return new RequestPathInfo() { @Nonnull @Override public String getResourcePath() { return getResource().getPath(); } @CheckForNull @Override public String getExtension() { return extension; } ... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public RequestPathInfo getRequestPathInfo() { return new RequestPathInfo() { @Nonnull @Override public String getResourcePath() { return getResource().getPath(); } @CheckForNull @Override public String getExtension() { return extension; } ... | AssetRenditionDownloadRequest extends SlingHttpServletRequestWrapper { @Override public RequestPathInfo getRequestPathInfo() { return new RequestPathInfo() { @Nonnull @Override public String getResourcePath() { return getResource().getPath(); } @CheckForNull @Override public String getExtension() { return extension; } ... |
@Test public void collectExtraMetadataProperties() { ctx.registerInjectActivateService(new MetadataSchemaPropertiesImpl(), ImmutableMap.<String, Object>builder(). put("extra.metadata.properties", new String[]{ "jcr:content/foo=My Foo", "jcr:content/metadata/bar=My Bar", "./jcr:content/foo=My Foo 2" }). build()); Metada... | protected final Map<String, List<String>> collectExtraMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.extra_metadata_properties() != null) { for (final String entry : cfg.extra_metadata_properties()) { final String propertyName = StringUtils.substringBefore(entry, "="); fi... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final Map<String, List<String>> collectExtraMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.extra_metadata_properties() != null) { for (final String entry : cfg.extra_metadata_properties()) { final Stri... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final Map<String, List<String>> collectExtraMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.extra_metadata_properties() != null) { for (final String entry : cfg.extra_metadata_properties()) { final Stri... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final Map<String, List<String>> collectExtraMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.extra_metadata_properties() != null) { for (final String entry : cfg.extra_metadata_properties()) { final Stri... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final Map<String, List<String>> collectExtraMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.extra_metadata_properties() != null) { for (final String entry : cfg.extra_metadata_properties()) { final Stri... |
@Test public void removeMetadataProperties() { ctx.registerInjectActivateService(new MetadataSchemaPropertiesImpl(), ImmutableMap.<String, Object>builder(). put("blacklisted.metadata.properties", new String[]{ "jcr:content/foo" }). build()); MetadataSchemaPropertiesImpl metadataSchemaProperties = (MetadataSchemaPropert... | protected final Map<String, List<String>> removeBlacklistedMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.blacklisted_metadata_properties() != null) { for (String propertyName : cfg.blacklisted_metadata_properties()) { String withoutDotSlash = StringUtils.removeStart(prop... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final Map<String, List<String>> removeBlacklistedMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.blacklisted_metadata_properties() != null) { for (String propertyName : cfg.blacklisted_metadata_properti... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final Map<String, List<String>> removeBlacklistedMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.blacklisted_metadata_properties() != null) { for (String propertyName : cfg.blacklisted_metadata_properti... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final Map<String, List<String>> removeBlacklistedMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.blacklisted_metadata_properties() != null) { for (String propertyName : cfg.blacklisted_metadata_properti... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final Map<String, List<String>> removeBlacklistedMetadataProperties(final Map<String, List<String>> collectedMetadata) { if (cfg != null && cfg.blacklisted_metadata_properties() != null) { for (String propertyName : cfg.blacklisted_metadata_properti... |
@Test public void collectMetadataProperty() { } | protected final void collectMetadataProperty(final String fieldLabel, String propertyName, final Map<String, List<String>> metadata) { if (StringUtils.isNotBlank(fieldLabel) && StringUtils.isNotBlank(propertyName)) { propertyName = getRelativePropertyName(propertyName, metadata); if (metadata.containsKey(propertyName))... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final void collectMetadataProperty(final String fieldLabel, String propertyName, final Map<String, List<String>> metadata) { if (StringUtils.isNotBlank(fieldLabel) && StringUtils.isNotBlank(propertyName)) { propertyName = getRelativePropertyName(pro... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final void collectMetadataProperty(final String fieldLabel, String propertyName, final Map<String, List<String>> metadata) { if (StringUtils.isNotBlank(fieldLabel) && StringUtils.isNotBlank(propertyName)) { propertyName = getRelativePropertyName(pro... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final void collectMetadataProperty(final String fieldLabel, String propertyName, final Map<String, List<String>> metadata) { if (StringUtils.isNotBlank(fieldLabel) && StringUtils.isNotBlank(propertyName)) { propertyName = getRelativePropertyName(pro... | MetadataSchemaPropertiesImpl implements MetadataProperties { protected final void collectMetadataProperty(final String fieldLabel, String propertyName, final Map<String, List<String>> metadata) { if (StringUtils.isNotBlank(fieldLabel) && StringUtils.isNotBlank(propertyName)) { propertyName = getRelativePropertyName(pro... |
@Test public void getProperties() { } | @Override public ValueMap getProperties() { if (combinedProperties == null) { combinedProperties = asset.getProperties(); } return combinedProperties; } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public ValueMap getProperties() { if (combinedProperties == null) { combinedProperties = asset.getProperties(); } return combinedProperties; } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public ValueMap getProperties() { if (combinedProperties == null) { combinedProperties = asset.getProperties(); } return combinedProperties; } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public ValueMap getProperties() { if (combinedProperties == null) { combinedProperties = asset.getProperties(); } return combinedProperties; } @PostConstruct void init(); @Override DataType getType(); @Override String getLocale(); @Overrid... | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public ValueMap getProperties() { if (combinedProperties == null) { combinedProperties = asset.getProperties(); } return combinedProperties; } @PostConstruct void init(); @Override DataType getType(); @Override String getLocale(); @Overrid... |
@Test public void containsKey_WithoutParameters() { final boolean actual = combinedProperties.containsKey(TitleImpl.NAME); assertTrue(actual); } | @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyParameter.getName()); if (computedProperty != null) {... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... |
@Test public void containsKey_WithParameters() { final boolean actual = combinedProperties.containsKey(FileNameImpl.NAME + "?a=b&c=d"); assertTrue(actual); } | @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyParameter.getName()); if (computedProperty != null) {... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... |
@Test public void containsKey_NoMatch() { final boolean actual = combinedProperties.containsKey("unknown"); assertFalse(actual); } | @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyParameter.getName()); if (computedProperty != null) {... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... | CombinedProperties implements Map<String, Object> { @Override public final boolean containsKey(Object key) { final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); boolean result = false; final ComputedProperty computedProperty = computedProperties.get(computedPropertyP... |
@Test public void get_WithoutParameters() { final String expected = "Test Asset"; final String actual = (String) combinedProperties.get(TitleImpl.NAME); assertEquals(expected, actual); } | @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropertyParameter.getCacheId()); if (computedPropertyParame... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... |
@Test public void get_WithRequestAndWithParameters() { final String expected = "The asset [ /content/dam/test.png ] and Request and [ 3 ] parameters are provided"; final String actual = (String) combinedProperties.get("test/request" + "?a=b&c=d&testParameter=Hello World!"); assertEquals(expected, actual); } | @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropertyParameter.getCacheId()); if (computedPropertyParame... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... |
@Test public void get_WithoutRequestAndWithParameters() { final String expected = "The asset [ /content/dam/test.png ] and [ 0 ] parameters are provided"; final String actual = (String) combinedProperties.get("test/no-request" + "?a=b&c=d&testParameter=Hello World!"); assertEquals(expected, actual); } | @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropertyParameter.getCacheId()); if (computedPropertyParame... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... |
@Test public void get_CacheMiss() { final String expected = "Test Asset"; final String actual1 = (String) combinedProperties.get(TitleImpl.NAME); final String actual2 = (String) combinedProperties.get(TitleImpl.NAME + "?a=b"); final String actual3 = (String) combinedProperties.get(TitleImpl.NAME + "?a=b&c=d"); assertEq... | @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropertyParameter.getCacheId()); if (computedPropertyParame... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... |
@Test public void get_CacheHit() { final String expected = "Test Asset"; final String actual1 = (String) combinedProperties.get(TitleImpl.NAME + "?a=b"); final String actual2 = (String) combinedProperties.get(TitleImpl.NAME + "?a=b"); final String actual3 = (String) combinedProperties.get(TitleImpl.NAME + "?a=b"); asse... | @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropertyParameter.getCacheId()); if (computedPropertyParame... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... | CombinedProperties implements Map<String, Object> { @Override public final Object get(Object key) { if (key == null) { return null; } final ComputedPropertyParameter computedPropertyParameter = new ComputedPropertyParameter((String) key); log.trace("Getting value for key [ {} ] from CombinedProperties", computedPropert... |
@Test public void ComputedPropertyParameter_getParameterIsEmpty() { final String input = "test"; CombinedProperties.ComputedPropertyParameter computedPropertyParameter = new CombinedProperties.ComputedPropertyParameter(input); final ValueMap actual = computedPropertyParameter.getParameters(); assertTrue(actual.isEmpty(... | @Override public final boolean isEmpty() { return computedProperties.isEmpty(); } | CombinedProperties implements Map<String, Object> { @Override public final boolean isEmpty() { return computedProperties.isEmpty(); } } | CombinedProperties implements Map<String, Object> { @Override public final boolean isEmpty() { return computedProperties.isEmpty(); } CombinedProperties(final List<ComputedProperty> computedProperties,
final SlingHttpServletRequest request,
final Asset asset);... | CombinedProperties implements Map<String, Object> { @Override public final boolean isEmpty() { return computedProperties.isEmpty(); } CombinedProperties(final List<ComputedProperty> computedProperties,
final SlingHttpServletRequest request,
final Asset asset);... | CombinedProperties implements Map<String, Object> { @Override public final boolean isEmpty() { return computedProperties.isEmpty(); } CombinedProperties(final List<ComputedProperty> computedProperties,
final SlingHttpServletRequest request,
final Asset asset);... |
@Test public void getValues() { Predicate predicate = new Predicate("testing"); predicate.set("test", "zero"); predicate.set("1_test", "one"); predicate.set("2_test", "two"); predicate.set("_test", "no"); predicate.set("incorrect", "no"); predicate.set("1_incorrect", "no"); final List<String> actuals = PredicateEvaluat... | public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } | PredicateEvaluatorUtil { public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } } | PredicateEvaluatorUtil { public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } } | PredicateEvaluatorUtil { public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } static List<String> getValues(final Predicate predicate, final String parameterName); static List<String> getValues(final Predicate predicate, fina... | PredicateEvaluatorUtil { public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } static List<String> getValues(final Predicate predicate, final String parameterName); static List<String> getValues(final Predicate predicate, fina... |
@Test public void getAsset() { final String expected = "/content/dam/test.png"; ctx.currentResource("/content/metadata"); final Metadata metadata = ctx.request().adaptTo(Metadata.class); assertEquals(expected, metadata.getAsset().getPath()); } | @Override public AssetModel getAsset() { return asset; } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public AssetModel getAsset() { return asset; } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public AssetModel getAsset() { return asset; } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public AssetModel getAsset() { return asset; } @PostConstruct void init(); @Override DataType getType(); @Override String getLocale(); @Override String getFormat(); @Override ValueMap getProperties(); @Override AssetModel getAsset(); @Over... | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public AssetModel getAsset() { return asset; } @PostConstruct void init(); @Override DataType getType(); @Override String getLocale(); @Override String getFormat(); @Override ValueMap getProperties(); @Override AssetModel getAsset(); @Over... |
@Test public void getValues_nullify() { Predicate predicate = new Predicate("testing"); predicate.set("test", "zero"); predicate.set("1_test", "one"); predicate.set("2_test", "two"); predicate.set("_test", "no"); predicate.set("incorrect", "no"); predicate.set("1_incorrect", "no"); final List<String> actuals = Predicat... | public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } | PredicateEvaluatorUtil { public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } } | PredicateEvaluatorUtil { public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } } | PredicateEvaluatorUtil { public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } static List<String> getValues(final Predicate predicate, final String parameterName); static List<String> getValues(final Predicate predicate, fina... | PredicateEvaluatorUtil { public static List<String> getValues(final Predicate predicate, final String parameterName) { return getValues(predicate, parameterName, false); } static List<String> getValues(final Predicate predicate, final String parameterName); static List<String> getValues(final Predicate predicate, fina... |
@Test public void buildPredicate_WithAlreadyBuiltPredicate() { predicate.set("__asset-share-commons--predicate-built", "true"); final Predicate actual = propertyValuesPredicateEvaluator.buildPredicate(predicate); assertSame(predicate, actual); assertEquals(predicate, actual); } | protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... |
@Test public void buildPredicate_WithNoneDelimiter() { final Map<String, String> expectedParams = new HashMap<>(); expectedParams.put(JcrPropertyPredicateEvaluator.OPERATION, JcrPropertyPredicateEvaluator.OP_EQUALS); expectedParams.put(JcrPropertyPredicateEvaluator.PROPERTY, "jcr:content/metadata/property"); expectedPa... | protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... |
@Test public void buildPredicate_AsPropertyOperation() { final Map<String, String> expectedParams = new HashMap<>(); expectedParams.put(JcrPropertyPredicateEvaluator.OPERATION, JcrPropertyPredicateEvaluator.OP_EQUALS); expectedParams.put(JcrPropertyPredicateEvaluator.PROPERTY, "jcr:content/metadata/property"); expected... | protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... |
@Test public void buildPredicate_AsContainsOperation() { final Map<String, String> expectedParams = new HashMap<>(); expectedParams.put(FulltextPredicateEvaluator.FULLTEXT, "*foo* OR *bar*"); expectedParams.put(FulltextPredicateEvaluator.REL_PATH, "jcr:content/metadata/@property"); expectedParams.put("__asset-share-com... | protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... |
@Test public void buildPredicate_AsStartsWithOperation() { final Map<String, String> expectedParams = new HashMap<>(); expectedParams.put(FulltextPredicateEvaluator.FULLTEXT, "foo* OR bar* OR zip* OR zap*"); expectedParams.put(FulltextPredicateEvaluator.REL_PATH, "jcr:content/metadata/@property"); expectedParams.put("_... | protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... |
@Test public void buildPredicate_DefaultDelimiter() { predicate.set("values", "foo, bar"); predicate.set("1_values", "zip,zap"); Predicate actual = propertyValuesPredicateEvaluator.buildPredicate(predicate); assertEquals("foo", actual.get("0_value")); assertEquals("bar", actual.get("1_value")); assertEquals("zip", actu... | protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... |
@Test public void buildPredicate_CustomDelimiter() { predicate.set("values", "foo?bar"); predicate.set("delimiter", "?"); Predicate actual = propertyValuesPredicateEvaluator.buildPredicate(predicate); assertEquals("foo", actual.get("0_value")); assertEquals("bar", actual.get("1_value")); } | protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... |
@Test public void buildPredicate_MultiDelimiters() { predicate.set("values", "foo?bar, zip, zap"); predicate.set("1_values", "cat,dog,bird?turtle horse,cow chicken"); predicate.set("delimiter", "?"); predicate.set("1_delimiter", ","); predicate.set("2_delimiter", "__WS"); Predicate actual = propertyValuesPredicateEvalu... | protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... |
@Test public void buildPredicate_WhitespaceDelimiters() { predicate.set("values", "foo" + System.lineSeparator() + "bar zip zap"); predicate.set("delimiter", "__WS"); Predicate actual = propertyValuesPredicateEvaluator.buildPredicate(predicate); assertEquals("foo", actual.get("0_value")); assertEquals("bar", actual.get... | protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... | PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList... |
@Test public void getPropertyName() { final String expected = "./dc:title"; ctx.currentResource("/content/metadata"); final Metadata metadata = ctx.request().adaptTo(Metadata.class); assertEquals(expected, metadata.getPropertyName()); } | @Override public String getPropertyName() { if (Metadata.DataType.COMPUTED.equals(getType())) { return computedProperty; } else { return propertyName; } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getPropertyName() { if (Metadata.DataType.COMPUTED.equals(getType())) { return computedProperty; } else { return propertyName; } } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getPropertyName() { if (Metadata.DataType.COMPUTED.equals(getType())) { return computedProperty; } else { return propertyName; } } } | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getPropertyName() { if (Metadata.DataType.COMPUTED.equals(getType())) { return computedProperty; } else { return propertyName; } } @PostConstruct void init(); @Override DataType getType(); @Override String getLocale(); @Overr... | MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getPropertyName() { if (Metadata.DataType.COMPUTED.equals(getType())) { return computedProperty; } else { return propertyName; } } @PostConstruct void init(); @Override DataType getType(); @Override String getLocale(); @Overr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.