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 testAddGridset() throws GeoWebCacheException, IOException { String gridsetName = "EPSG:3005"; GridSet epsg3005 = GridSetFactory.createGridSet( gridsetName, SRS.getSRS(gridsetName), new BoundingBox(35043.6538, 440006.8768, 1885895.3117, 1735643.8497), false, null, new double[] {25000000, 1250000, 50000...
public void addGridSet(GridSet gridSet) { log.debug("Adding " + gridSet.getName()); getConfigurations() .stream() .filter(c -> c.canSave(gridSet)) .findFirst() .orElseThrow( () -> new UnsupportedOperationException( "No Configuration is able to save gridset " + gridSet.getName())) .addGridSet(gridSet); }
GridSetBroker implements ConfigurationAggregator<GridSetConfiguration>, ApplicationContextAware, InitializingBean { public void addGridSet(GridSet gridSet) { log.debug("Adding " + gridSet.getName()); getConfigurations() .stream() .filter(c -> c.canSave(gridSet)) .findFirst() .orElseThrow...
GridSetBroker implements ConfigurationAggregator<GridSetConfiguration>, ApplicationContextAware, InitializingBean { public void addGridSet(GridSet gridSet) { log.debug("Adding " + gridSet.getName()); getConfigurations() .stream() .filter(c -> c.canSave(gridSet)) .findFirst() .orElseThrow...
GridSetBroker implements ConfigurationAggregator<GridSetConfiguration>, ApplicationContextAware, InitializingBean { public void addGridSet(GridSet gridSet) { log.debug("Adding " + gridSet.getName()); getConfigurations() .stream() .filter(c -> c.canSave(gridSet)) .findFirst() .orElseThrow...
GridSetBroker implements ConfigurationAggregator<GridSetConfiguration>, ApplicationContextAware, InitializingBean { public void addGridSet(GridSet gridSet) { log.debug("Adding " + gridSet.getName()); getConfigurations() .stream() .filter(c -> c.canSave(gridSet)) .findFirst() .orElseThrow...
@Test public void testRemoveGridset() throws IOException { String gridsetToRemove = GWCConfigIntegrationTestData.GRIDSET_EPSG2163; gridSetBroker.removeGridSet(gridsetToRemove); assertThat(gridSetBroker.getGridSetNames(), not(hasItem(gridsetToRemove))); assertThat(gridSetBroker.getGridSet(gridsetToRemove), notPresent())...
public synchronized void removeGridSet(final String gridSetName) { getConfigurations() .stream() .filter(c -> c.getGridSet(gridSetName).isPresent()) .forEach( c -> { c.removeGridSet(gridSetName); }); }
GridSetBroker implements ConfigurationAggregator<GridSetConfiguration>, ApplicationContextAware, InitializingBean { public synchronized void removeGridSet(final String gridSetName) { getConfigurations() .stream() .filter(c -> c.getGridSet(gridSetName).isPresent()) .forEach( c -> { c.remo...
GridSetBroker implements ConfigurationAggregator<GridSetConfiguration>, ApplicationContextAware, InitializingBean { public synchronized void removeGridSet(final String gridSetName) { getConfigurations() .stream() .filter(c -> c.getGridSet(gridSetName).isPresent()) .forEach( c -> { c.remo...
GridSetBroker implements ConfigurationAggregator<GridSetConfiguration>, ApplicationContextAware, InitializingBean { public synchronized void removeGridSet(final String gridSetName) { getConfigurations() .stream() .filter(c -> c.getGridSet(gridSetName).isPresent()) .forEach( c -> { c.remo...
GridSetBroker implements ConfigurationAggregator<GridSetConfiguration>, ApplicationContextAware, InitializingBean { public synchronized void removeGridSet(final String gridSetName) { getConfigurations() .stream() .filter(c -> c.getGridSet(gridSetName).isPresent()) .forEach( c -> { c.remo...
@Test public void testCreateTileRange() throws IOException, GeoWebCacheException { WMSLayer tl = createWMSLayer(); String gridSet = tl.getGridSubsets().iterator().next(); GridSubset gridSubSet = tl.getGridSubset(gridSet); BoundingBox bounds = new BoundingBox(0d, 0d, 1d, 1d); long[][] result = gridSubSet.getCoverageInte...
public long[][] getCoverageIntersections(BoundingBox reqBounds) { final int zoomStart = getZoomStart(); final int zoomStop = getZoomStop(); long[][] ret = new long[1 + zoomStop - zoomStart][5]; for (int level = zoomStart; level <= zoomStop; level++) { ret[level - zoomStart] = getCoverageIntersection(level, reqBounds); ...
GridSubset { public long[][] getCoverageIntersections(BoundingBox reqBounds) { final int zoomStart = getZoomStart(); final int zoomStop = getZoomStop(); long[][] ret = new long[1 + zoomStop - zoomStart][5]; for (int level = zoomStart; level <= zoomStop; level++) { ret[level - zoomStart] = getCoverageIntersection(level,...
GridSubset { public long[][] getCoverageIntersections(BoundingBox reqBounds) { final int zoomStart = getZoomStart(); final int zoomStop = getZoomStop(); long[][] ret = new long[1 + zoomStop - zoomStart][5]; for (int level = zoomStart; level <= zoomStop; level++) { ret[level - zoomStart] = getCoverageIntersection(level,...
GridSubset { public long[][] getCoverageIntersections(BoundingBox reqBounds) { final int zoomStart = getZoomStart(); final int zoomStop = getZoomStop(); long[][] ret = new long[1 + zoomStop - zoomStart][5]; for (int level = zoomStart; level <= zoomStop; level++) { ret[level - zoomStart] = getCoverageIntersection(level,...
GridSubset { public long[][] getCoverageIntersections(BoundingBox reqBounds) { final int zoomStart = getZoomStart(); final int zoomStop = getZoomStop(); long[][] ret = new long[1 + zoomStop - zoomStart][5]; for (int level = zoomStart; level <= zoomStop; level++) { ret[level - zoomStart] = getCoverageIntersection(level,...
@Test public void testBoundsFromIndex() throws Exception { long[] index = {0, 0, 1}; BoundingBox bboxTL = gridSetTL.boundsFromIndex(index); BoundingBox bboxBL = gridSetBL.boundsFromIndex(index); BoundingBox bboxTLswap = gridSetTLswap.boundsFromIndex(index); BoundingBox bboxBLswap = gridSetBLswap.boundsFromIndex(index);...
public BoundingBox boundsFromIndex(long[] tileIndex) { final int tileZ = (int) tileIndex[2]; Grid grid = getGrid(tileZ); final long tileX = tileIndex[0]; final long tileY; if (yBaseToggle) { tileY = tileIndex[1] - grid.getNumTilesHigh(); } else { tileY = tileIndex[1]; } double width = grid.getResolution() * getTileWidt...
GridSet implements Info { public BoundingBox boundsFromIndex(long[] tileIndex) { final int tileZ = (int) tileIndex[2]; Grid grid = getGrid(tileZ); final long tileX = tileIndex[0]; final long tileY; if (yBaseToggle) { tileY = tileIndex[1] - grid.getNumTilesHigh(); } else { tileY = tileIndex[1]; } double width = grid.get...
GridSet implements Info { public BoundingBox boundsFromIndex(long[] tileIndex) { final int tileZ = (int) tileIndex[2]; Grid grid = getGrid(tileZ); final long tileX = tileIndex[0]; final long tileY; if (yBaseToggle) { tileY = tileIndex[1] - grid.getNumTilesHigh(); } else { tileY = tileIndex[1]; } double width = grid.get...
GridSet implements Info { public BoundingBox boundsFromIndex(long[] tileIndex) { final int tileZ = (int) tileIndex[2]; Grid grid = getGrid(tileZ); final long tileX = tileIndex[0]; final long tileY; if (yBaseToggle) { tileY = tileIndex[1] - grid.getNumTilesHigh(); } else { tileY = tileIndex[1]; } double width = grid.get...
GridSet implements Info { public BoundingBox boundsFromIndex(long[] tileIndex) { final int tileZ = (int) tileIndex[2]; Grid grid = getGrid(tileZ); final long tileX = tileIndex[0]; final long tileY; if (yBaseToggle) { tileY = tileIndex[1] - grid.getNumTilesHigh(); } else { tileY = tileIndex[1]; } double width = grid.get...
@Test public void testBounds() throws Exception { BoundingBox bboxTL = gridSetTL.getBounds(); BoundingBox bboxBL = gridSetBL.getBounds(); BoundingBox bboxTLswap = gridSetTLswap.getBounds(); BoundingBox bboxBLswap = gridSetBLswap.getBounds(); BoundingBox solution = new BoundingBox(-180.0, -90.0, 180, 90); assertThat(bbo...
public BoundingBox getBounds() { int i; long tilesWide, tilesHigh; for (i = (getNumLevels() - 1); i > 0; i--) { tilesWide = getGrid(i).getNumTilesWide(); tilesHigh = getGrid(i).getNumTilesHigh(); if (tilesWide == 1 && tilesHigh == 0) { break; } } tilesWide = getGrid(i).getNumTilesWide(); tilesHigh = getGrid(i).getNumTi...
GridSet implements Info { public BoundingBox getBounds() { int i; long tilesWide, tilesHigh; for (i = (getNumLevels() - 1); i > 0; i--) { tilesWide = getGrid(i).getNumTilesWide(); tilesHigh = getGrid(i).getNumTilesHigh(); if (tilesWide == 1 && tilesHigh == 0) { break; } } tilesWide = getGrid(i).getNumTilesWide(); tiles...
GridSet implements Info { public BoundingBox getBounds() { int i; long tilesWide, tilesHigh; for (i = (getNumLevels() - 1); i > 0; i--) { tilesWide = getGrid(i).getNumTilesWide(); tilesHigh = getGrid(i).getNumTilesHigh(); if (tilesWide == 1 && tilesHigh == 0) { break; } } tilesWide = getGrid(i).getNumTilesWide(); tiles...
GridSet implements Info { public BoundingBox getBounds() { int i; long tilesWide, tilesHigh; for (i = (getNumLevels() - 1); i > 0; i--) { tilesWide = getGrid(i).getNumTilesWide(); tilesHigh = getGrid(i).getNumTilesHigh(); if (tilesWide == 1 && tilesHigh == 0) { break; } } tilesWide = getGrid(i).getNumTilesWide(); tiles...
GridSet implements Info { public BoundingBox getBounds() { int i; long tilesWide, tilesHigh; for (i = (getNumLevels() - 1); i > 0; i--) { tilesWide = getGrid(i).getNumTilesWide(); tilesHigh = getGrid(i).getNumTilesHigh(); if (tilesWide == 1 && tilesHigh == 0) { break; } } tilesWide = getGrid(i).getNumTilesWide(); tiles...
@Test public void testProxyDefaultWhitelistLimitedWhenSecure() throws Exception { SecurityDispatcher secDisp = mock(SecurityDispatcher.class); when(secDisp.isSecurityEnabled()).thenReturn(true); GeoWebCacheDispatcher gwcd = mock(GeoWebCacheDispatcher.class); when(gwcd.getServletPrefix()).thenReturn(null); service = new...
public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; }
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } }
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } protected WMSService(); WMSService(StorageBroker sb, TileLayerDispatcher tld, RuntimeStats stats); WMSService( StorageBroker sb, TileLayerDis...
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } protected WMSService(); WMSService(StorageBroker sb, TileLayerDispatcher tld, RuntimeStats stats); WMSService( StorageBroker sb, TileLayerDis...
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } protected WMSService(); WMSService(StorageBroker sb, TileLayerDispatcher tld, RuntimeStats stats); WMSService( StorageBroker sb, TileLayerDis...
@Test public void testBoundsFromRectangle() throws Exception { long[] rect = {0, 0, 0, 0, 0}; BoundingBox bboxTL = gridSetTL.boundsFromRectangle(rect); BoundingBox bboxBL = gridSetBL.boundsFromRectangle(rect); BoundingBox bboxTLswap = gridSetTLswap.boundsFromRectangle(rect); BoundingBox bboxBLswap = gridSetBLswap.bound...
protected BoundingBox boundsFromRectangle(long[] rectangleExtent) { Grid grid = getGrid((int) rectangleExtent[4]); double width = grid.getResolution() * getTileWidth(); double height = grid.getResolution() * getTileHeight(); long bottomY = rectangleExtent[1]; long topY = rectangleExtent[3]; if (yBaseToggle) { bottomY =...
GridSet implements Info { protected BoundingBox boundsFromRectangle(long[] rectangleExtent) { Grid grid = getGrid((int) rectangleExtent[4]); double width = grid.getResolution() * getTileWidth(); double height = grid.getResolution() * getTileHeight(); long bottomY = rectangleExtent[1]; long topY = rectangleExtent[3]; if...
GridSet implements Info { protected BoundingBox boundsFromRectangle(long[] rectangleExtent) { Grid grid = getGrid((int) rectangleExtent[4]); double width = grid.getResolution() * getTileWidth(); double height = grid.getResolution() * getTileHeight(); long bottomY = rectangleExtent[1]; long topY = rectangleExtent[3]; if...
GridSet implements Info { protected BoundingBox boundsFromRectangle(long[] rectangleExtent) { Grid grid = getGrid((int) rectangleExtent[4]); double width = grid.getResolution() * getTileWidth(); double height = grid.getResolution() * getTileHeight(); long bottomY = rectangleExtent[1]; long topY = rectangleExtent[3]; if...
GridSet implements Info { protected BoundingBox boundsFromRectangle(long[] rectangleExtent) { Grid grid = getGrid((int) rectangleExtent[4]); double width = grid.getResolution() * getTileWidth(); double height = grid.getResolution() * getTileHeight(); long bottomY = rectangleExtent[1]; long topY = rectangleExtent[3]; if...
@Test public void testClosestIndex() throws Exception { BoundingBox box = new BoundingBox(-180.0, -90.0, -90.0, 0); long[] idxTL = gridSetTL.closestIndex(box); long[] idxBL = gridSetBL.closestIndex(box); long[] solution = {0, 0, 1}; assertTrue(Arrays.equals(idxTL, solution)); assertTrue(Arrays.equals(idxBL, solution));...
protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); double error = Math.abs(wRe...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
@Test public void testClosestRectangle() throws Exception { BoundingBox box = new BoundingBox(-180.0, -90.0, 0.0, 0.0); long[] rectTL = gridSetTL.closestRectangle(box); long[] rectBL = gridSetBL.closestRectangle(box); long[] solution = {0, 0, 1, 0, 1}; assertTrue(Arrays.equals(rectTL, solution)); assertTrue(Arrays.equa...
public long[] closestRectangle(BoundingBox rectangleBounds) { double rectWidth = rectangleBounds.getWidth(); double rectHeight = rectangleBounds.getHeight(); double bestError = Double.MAX_VALUE; int bestLevel = -1; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); double countX = rectWidth / (grid.getR...
GridSet implements Info { public long[] closestRectangle(BoundingBox rectangleBounds) { double rectWidth = rectangleBounds.getWidth(); double rectHeight = rectangleBounds.getHeight(); double bestError = Double.MAX_VALUE; int bestLevel = -1; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); double count...
GridSet implements Info { public long[] closestRectangle(BoundingBox rectangleBounds) { double rectWidth = rectangleBounds.getWidth(); double rectHeight = rectangleBounds.getHeight(); double bestError = Double.MAX_VALUE; int bestLevel = -1; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); double count...
GridSet implements Info { public long[] closestRectangle(BoundingBox rectangleBounds) { double rectWidth = rectangleBounds.getWidth(); double rectHeight = rectangleBounds.getHeight(); double bestError = Double.MAX_VALUE; int bestLevel = -1; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); double count...
GridSet implements Info { public long[] closestRectangle(BoundingBox rectangleBounds) { double rectWidth = rectangleBounds.getWidth(); double rectHeight = rectangleBounds.getHeight(); double bestError = Double.MAX_VALUE; int bestLevel = -1; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); double count...
@Test public void testGetLeftTopCorner() throws Exception { double[] tlTL = gridSetTL.getOrderedTopLeftCorner(1); double[] tlBL = gridSetBL.getOrderedTopLeftCorner(1); assertThat(tlBL[1], Matchers.closeTo(90.0, 0.01)); assertThat(tlTL[1], Matchers.closeTo(90.0, 0.01)); }
public double[] getOrderedTopLeftCorner(int gridIndex) { double[] leftTop = new double[2]; if (yBaseToggle) { leftTop[0] = tileOrigin()[0]; leftTop[1] = tileOrigin()[1]; } else { Grid grid = getGrid(gridIndex); double dTileHeight = getTileHeight(); double dGridExtent = grid.getNumTilesHigh(); double top = tileOrigin()[...
GridSet implements Info { public double[] getOrderedTopLeftCorner(int gridIndex) { double[] leftTop = new double[2]; if (yBaseToggle) { leftTop[0] = tileOrigin()[0]; leftTop[1] = tileOrigin()[1]; } else { Grid grid = getGrid(gridIndex); double dTileHeight = getTileHeight(); double dGridExtent = grid.getNumTilesHigh(); ...
GridSet implements Info { public double[] getOrderedTopLeftCorner(int gridIndex) { double[] leftTop = new double[2]; if (yBaseToggle) { leftTop[0] = tileOrigin()[0]; leftTop[1] = tileOrigin()[1]; } else { Grid grid = getGrid(gridIndex); double dTileHeight = getTileHeight(); double dGridExtent = grid.getNumTilesHigh(); ...
GridSet implements Info { public double[] getOrderedTopLeftCorner(int gridIndex) { double[] leftTop = new double[2]; if (yBaseToggle) { leftTop[0] = tileOrigin()[0]; leftTop[1] = tileOrigin()[1]; } else { Grid grid = getGrid(gridIndex); double dTileHeight = getTileHeight(); double dGridExtent = grid.getNumTilesHigh(); ...
GridSet implements Info { public double[] getOrderedTopLeftCorner(int gridIndex) { double[] leftTop = new double[2]; if (yBaseToggle) { leftTop[0] = tileOrigin()[0]; leftTop[1] = tileOrigin()[1]; } else { Grid grid = getGrid(gridIndex); double dTileHeight = getTileHeight(); double dGridExtent = grid.getNumTilesHigh(); ...
@Test public void testClosestIndexInvalidBounds1() throws Exception { BoundingBox box = new BoundingBox(0, -180, 180.0, 0); exception.expect(GridAlignmentMismatchException.class); gridSetTL.closestIndex(box); }
protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); double error = Math.abs(wRe...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
@Test public void testClosestIndexInvalidBounds2() throws Exception { BoundingBox box = new BoundingBox(0, 0, 180.0, 180); exception.expect(GridAlignmentMismatchException.class); gridSetTL.closestIndex(box); }
protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); double error = Math.abs(wRe...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
GridSet implements Info { protected long[] closestIndex(BoundingBox tileBounds) throws GridMismatchException { double wRes = tileBounds.getWidth() / getTileWidth(); double bestError = Double.MAX_VALUE; int bestLevel = -1; double bestResolution = -1.0; for (int i = 0; i < getNumLevels(); i++) { Grid grid = getGrid(i); d...
@Test public void testAddLayer() throws GeoWebCacheException { String layerName = "newLayer"; WMSLayer layer = new WMSLayer( layerName, new String[] {"http: null, null, null, null, null, null, null, false, null); tileLayerDispatcher.addLayer(layer); assertTrue(tileLayerDispatcher.getLayerNames().contains(layerName)); a...
public synchronized void addLayer(final TileLayer tl) throws IllegalArgumentException { for (TileLayerConfiguration c : configs) { if (c.canSave(tl)) { c.addLayer(tl); return; } } throw new IllegalArgumentException("No configuration found capable of saving " + tl); }
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addLayer(final TileLayer tl) throws IllegalArgumentException { for (TileLayerConfiguration c : configs) { i...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addLayer(final TileLayer tl) throws IllegalArgumentException { for (TileLayerConfiguration c : configs) { i...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addLayer(final TileLayer tl) throws IllegalArgumentException { for (TileLayerConfiguration c : configs) { i...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addLayer(final TileLayer tl) throws IllegalArgumentException { for (TileLayerConfiguration c : configs) { i...
@Test public void testRemoveLayer() { String layerToRemove = GWCConfigIntegrationTestData.LAYER_TOPP_STATES; tileLayerDispatcher.removeLayer(layerToRemove); assertFalse(tileLayerDispatcher.getLayerNames().contains(layerToRemove)); try { tileLayerDispatcher.getTileLayer(layerToRemove); fail("Expected exception when tryi...
public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : configs) { if (config.containsLayer(layerName)) { config.removeLayer(layerName); return; } } throw new NoSuchElementException("No configuration found containing layer " + layerName); }
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : ...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : ...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : ...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : ...
@Test public void testRemoveLayerException() { try { tileLayerDispatcher.removeLayer(null); fail("Expected failure when trying to remove null layer"); } catch (Exception e) { } try { tileLayerDispatcher.removeLayer("nonexistantLayer"); fail("Expected failure when trying to remove nonexistant layer"); } catch (Exception...
public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : configs) { if (config.containsLayer(layerName)) { config.removeLayer(layerName); return; } } throw new NoSuchElementException("No configuration found containing layer " + layerName); }
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : ...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : ...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : ...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeLayer(final String layerName) throws IllegalArgumentException { for (TileLayerConfiguration config : ...
@Test public void testModifyBadLayer() { String layerName = "newLayer"; WMSLayer layer = new WMSLayer( layerName, new String[] {"http: null, null, null, null, null, null, null, false, null); try { tileLayerDispatcher.modify(layer); fail("Expected exception when modifiying nonexistant layer"); } catch (IllegalArgumentEx...
public synchronized void modify(final TileLayer tl) throws IllegalArgumentException { TileLayerConfiguration config = getConfiguration(tl); config.modifyLayer(tl); }
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void modify(final TileLayer tl) throws IllegalArgumentException { TileLayerConfiguration config = getConfigurati...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void modify(final TileLayer tl) throws IllegalArgumentException { TileLayerConfiguration config = getConfigurati...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void modify(final TileLayer tl) throws IllegalArgumentException { TileLayerConfiguration config = getConfigurati...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void modify(final TileLayer tl) throws IllegalArgumentException { TileLayerConfiguration config = getConfigurati...
@Test public void testProxyRequestSecuredDefaultAllowGetLegendGraphic() throws Exception { SecurityDispatcher secDisp = mock(SecurityDispatcher.class); when(secDisp.isSecurityEnabled()).thenReturn(true); GeoWebCacheDispatcher gwcd = mock(GeoWebCacheDispatcher.class); when(gwcd.getServletPrefix()).thenReturn(null); serv...
public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; }
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } }
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } protected WMSService(); WMSService(StorageBroker sb, TileLayerDispatcher tld, RuntimeStats stats); WMSService( StorageBroker sb, TileLayerDis...
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } protected WMSService(); WMSService(StorageBroker sb, TileLayerDispatcher tld, RuntimeStats stats); WMSService( StorageBroker sb, TileLayerDis...
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } protected WMSService(); WMSService(StorageBroker sb, TileLayerDispatcher tld, RuntimeStats stats); WMSService( StorageBroker sb, TileLayerDis...
@Test public void testAddGridset() throws GeoWebCacheException, IOException { String gridsetName = "EPSG:3005"; GridSet epsg3005 = GridSetFactory.createGridSet( gridsetName, SRS.getSRS(gridsetName), new BoundingBox(35043.6538, 440006.8768, 1885895.3117, 1735643.8497), false, null, new double[] {25000000, 1250000, 50000...
public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker.get(gridSet.getName())) { throw new IllegalArgumentException("GridSet " + gridSet.getName() + " already exists"); } saveGridSet(gridSet); }
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker....
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker....
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker....
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker....
@Test public void testAddBadGridset() throws IOException { GridSet existingGridSet = gridSetBroker.get(GWCConfigIntegrationTestData.GRIDSET_EPSG2163); try { tileLayerDispatcher.addGridSet(existingGridSet); fail("Expected exception adding existing gridset"); } catch (IllegalArgumentException e) { } try { tileLayerDispat...
public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker.get(gridSet.getName())) { throw new IllegalArgumentException("GridSet " + gridSet.getName() + " already exists"); } saveGridSet(gridSet); }
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker....
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker....
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker....
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void addGridSet(final GridSet gridSet) throws IllegalArgumentException, IOException { if (null != gridSetBroker....
@Test public void testRemoveGridset() throws IOException { String gridsetToRemove = GWCConfigIntegrationTestData.GRIDSET_EPSG2163; tileLayerDispatcher.removeLayer(GWCConfigIntegrationTestData.LAYER_TOPP_STATES); tileLayerDispatcher.removeGridSet(gridsetToRemove); assertFalse(gridSetBroker.getNames().contains(gridsetToR...
public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMatch(g -> Objects.nonNull(g.getGridSubset(gridsetToRemove)))) { throw new IllegalStateException( "Can not remove gridset " + gridsetToRemove + " as it is used by layers"); } gridSetBroker.r...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMa...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMa...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMa...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMa...
@Test public void testRemoveGridsetException() throws IOException { String gridsetToRemove = GWCConfigIntegrationTestData.GRIDSET_EPSG2163; try { tileLayerDispatcher.removeGridSet(gridsetToRemove); fail("Expected exception removing a gridset referenced by a layer"); } catch (IllegalStateException e) { } }
public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMatch(g -> Objects.nonNull(g.getGridSubset(gridsetToRemove)))) { throw new IllegalStateException( "Can not remove gridset " + gridsetToRemove + " as it is used by layers"); } gridSetBroker.r...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMa...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMa...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMa...
TileLayerDispatcher implements DisposableBean, InitializingBean, ApplicationContextAware, ConfigurationAggregator<TileLayerConfiguration> { public synchronized void removeGridSet(String gridsetToRemove) { if (StreamSupport.stream(getLayerList().spliterator(), true) .anyMa...
@Test public void test() { Clock clock = EasyMock.createMock("Clock", Clock.class); EasyMock.expect(clock.millis()).andStubAnswer(() -> time); EasyMock.replay(clock); time = 0; RuntimeStats stats = new RuntimeStats(1, Arrays.asList(60), Arrays.asList("Minutes"), clock); time += 500; stats.getHTMLStats(); EasyMock.verif...
public String getHTMLStats() { long runningTime = (clock.millis() - startTime) / 1000; StringBuilder str = new StringBuilder(); str.append("<table border=\"0\" cellspacing=\"5\" class=\"stats\">"); synchronized (bytes) { if (runningTime > 0) { str.append("<tbody>"); str.append("<tr><th colspan=\"2\" scope=\"row\">Start...
RuntimeStats { public String getHTMLStats() { long runningTime = (clock.millis() - startTime) / 1000; StringBuilder str = new StringBuilder(); str.append("<table border=\"0\" cellspacing=\"5\" class=\"stats\">"); synchronized (bytes) { if (runningTime > 0) { str.append("<tbody>"); str.append("<tr><th colspan=\"2\" scop...
RuntimeStats { public String getHTMLStats() { long runningTime = (clock.millis() - startTime) / 1000; StringBuilder str = new StringBuilder(); str.append("<table border=\"0\" cellspacing=\"5\" class=\"stats\">"); synchronized (bytes) { if (runningTime > 0) { str.append("<tbody>"); str.append("<tr><th colspan=\"2\" scop...
RuntimeStats { public String getHTMLStats() { long runningTime = (clock.millis() - startTime) / 1000; StringBuilder str = new StringBuilder(); str.append("<table border=\"0\" cellspacing=\"5\" class=\"stats\">"); synchronized (bytes) { if (runningTime > 0) { str.append("<tbody>"); str.append("<tr><th colspan=\"2\" scop...
RuntimeStats { public String getHTMLStats() { long runningTime = (clock.millis() - startTime) / 1000; StringBuilder str = new StringBuilder(); str.append("<table border=\"0\" cellspacing=\"5\" class=\"stats\">"); synchronized (bytes) { if (runningTime > 0) { str.append("<tbody>"); str.append("<tr><th colspan=\"2\" scop...
@Test public void testGetLayerAssociatedFilesWithMultipleLevels() throws Exception { String pathTemplate = Utils.buildPath( "tiles", "{format}", "{style}", "zoom-{z}", "{layer}", "ranges-{x}-{y}.sqlite"); File fileAsiaA = createFileInRootDir( Utils.buildPath( "tiles", "png", "default", "zoom-10", "asia", "ranges-0-500....
List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); }
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } }
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
@Test public void testGetLayerAssociatedFilesWithNoLayer() throws Exception { String pathTemplate = Utils.buildPath("tiles", "{z}", "tiles-{x}.sqlite"); File fileA = createFileInRootDir(Utils.buildPath("tiles", "10", "tiles-0.sqlite")); File fileB = createFileInRootDir(Utils.buildPath("tiles", "10", "tiles-500.sqlite")...
List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); }
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } }
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
@Test public void testLayerAssociatedFilesWithOnlyOneLevel() throws Exception { String pathTemplate = "{layer}.sqlite"; File asiaFile = createFileInRootDir("asia.sqlite"); File americaFile = createFileInRootDir("america.sqlite"); File africaFile = createFileInRootDir("africa.sqlite"); File australiaFile = createFileInR...
List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); }
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } }
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
@Test public void testGetGridSetAndLayerAssociatedFiles() throws Exception { String pathTemplate = Utils.buildPath( "tiles", "{grid}", "{format}", "{style}", "zoom-{z}", "{layer}", "ranges-{x}-{y}.sqlite"); File fileAsiaGrid1A = createFileInRootDir( Utils.buildPath( "tiles", "grid1", "png", "default", "zoom-10", "asia"...
List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); }
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } }
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
FileManager { List<File> getFiles(String layerName) { String[] pathBuilderCopy = getPathBuilderCopy(); if (replaceLayerName.first) pathBuilderCopy[replaceLayerName.second] = layerName; return getFiles(pathBuilderCopy); } FileManager( File rootDirectory, String pathTemplate, long rowRangeCount, long columnRa...
@Test public void testPathTemplateWithTileObject() throws Exception { TileObject tile = TileObject.createCompleteTileObject( "africa", new long[] {7050, 5075, 11}, "wgs84", "jpeg", tuplesToMap(tuple("style", "dark borders"), tuple("background", "blue")), null); String pathTemplate = Utils.buildPath( "{format}-tiles", "...
File getFile(TileObject tile) { if (tile.getParametersId() == null && tile.getParameters() != null) { tile.setParametersId(ParametersUtils.getId(tile.getParameters())); } return getFile( tile.getParametersId(), tile.getXYZ(), tile.getLayerName(), tile.getGridSetId(), tile.getBlobFormat(), tile.getParameters()); }
FileManager { File getFile(TileObject tile) { if (tile.getParametersId() == null && tile.getParameters() != null) { tile.setParametersId(ParametersUtils.getId(tile.getParameters())); } return getFile( tile.getParametersId(), tile.getXYZ(), tile.getLayerName(), tile.getGridSetId(), tile.getBlobFormat(), tile.getParamete...
FileManager { File getFile(TileObject tile) { if (tile.getParametersId() == null && tile.getParameters() != null) { tile.setParametersId(ParametersUtils.getId(tile.getParameters())); } return getFile( tile.getParametersId(), tile.getXYZ(), tile.getLayerName(), tile.getGridSetId(), tile.getBlobFormat(), tile.getParamete...
FileManager { File getFile(TileObject tile) { if (tile.getParametersId() == null && tile.getParameters() != null) { tile.setParametersId(ParametersUtils.getId(tile.getParameters())); } return getFile( tile.getParametersId(), tile.getXYZ(), tile.getLayerName(), tile.getGridSetId(), tile.getBlobFormat(), tile.getParamete...
FileManager { File getFile(TileObject tile) { if (tile.getParametersId() == null && tile.getParameters() != null) { tile.setParametersId(ParametersUtils.getId(tile.getParameters())); } return getFile( tile.getParametersId(), tile.getXYZ(), tile.getLayerName(), tile.getGridSetId(), tile.getBlobFormat(), tile.getParamete...
@Test public void testProxyRequestDefaultWhitelistRestrictedByFilter() throws Exception { SecurityDispatcher secDisp = mock(SecurityDispatcher.class); when(secDisp.isSecurityEnabled()).thenReturn(true); GeoWebCacheDispatcher gwcd = mock(GeoWebCacheDispatcher.class); when(gwcd.getServletPrefix()).thenReturn(null); Strin...
public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; }
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } }
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } protected WMSService(); WMSService(StorageBroker sb, TileLayerDispatcher tld, RuntimeStats stats); WMSService( StorageBroker sb, TileLayerDis...
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } protected WMSService(); WMSService(StorageBroker sb, TileLayerDispatcher tld, RuntimeStats stats); WMSService( StorageBroker sb, TileLayerDis...
WMSService extends Service { public void setSecurityDispatcher(SecurityDispatcher securityDispatcher) { this.securityDispatcher = securityDispatcher; } protected WMSService(); WMSService(StorageBroker sb, TileLayerDispatcher tld, RuntimeStats stats); WMSService( StorageBroker sb, TileLayerDis...
@Test public void shouldReturnHelloSomkiat() { Person somkiat = new Person("somkiat", "pui"); given(personRepository.findByFirstName("somkiat")) .willReturn(Optional.of(somkiat)); Hello hello = controllerWithRepository.sayHi("somkiat"); assertEquals("Hello somkiat", hello.getMessage()); }
@GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> foundPerson = personRepository.findByFirstName(name); String result = foundPerson .map(person -> String.format("Hello %s", person.getFirstName())) .orElse("Data not found"); return new Hello(result); }
HelloControllerWithRepository { @GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> foundPerson = personRepository.findByFirstName(name); String result = foundPerson .map(person -> String.format("Hello %s", person.getFirstName())) .orElse("Data not found"); return new Hell...
HelloControllerWithRepository { @GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> foundPerson = personRepository.findByFirstName(name); String result = foundPerson .map(person -> String.format("Hello %s", person.getFirstName())) .orElse("Data not found"); return new Hell...
HelloControllerWithRepository { @GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> foundPerson = personRepository.findByFirstName(name); String result = foundPerson .map(person -> String.format("Hello %s", person.getFirstName())) .orElse("Data not found"); return new Hell...
HelloControllerWithRepository { @GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> foundPerson = personRepository.findByFirstName(name); String result = foundPerson .map(person -> String.format("Hello %s", person.getFirstName())) .orElse("Data not found"); return new Hell...
@Test public void success_to_create_model_with_constructor() { Hello hello = new Hello("Somkiat"); assertEquals("Somkiat", hello.getMessage()); }
public String getMessage() { return message; }
Hello { public String getMessage() { return message; } }
Hello { public String getMessage() { return message; } Hello(String message); }
Hello { public String getMessage() { return message; } Hello(String message); String getMessage(); void setMessage(String message); }
Hello { public String getMessage() { return message; } Hello(String message); String getMessage(); void setMessage(String message); }
@Test public void shouldReturnHelloSomkiat() { Person somkiat = new Person("somkiat", "pui"); given(personRepository.findByFirstName("somkiat")) .willReturn(Optional.of(somkiat)); Hello hello = controller.sayHi("somkiat"); assertEquals("Hello somkiat", hello.getMessage()); }
@GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> person = personRepository.findByFirstName(name); String message = person.map(person1 -> String.format("Hello %s", person1.getFirstName())) .orElse("Data not found"); return new Hello(message); }
HelloWithRepositoryController { @GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> person = personRepository.findByFirstName(name); String message = person.map(person1 -> String.format("Hello %s", person1.getFirstName())) .orElse("Data not found"); return new Hello(messag...
HelloWithRepositoryController { @GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> person = personRepository.findByFirstName(name); String message = person.map(person1 -> String.format("Hello %s", person1.getFirstName())) .orElse("Data not found"); return new Hello(messag...
HelloWithRepositoryController { @GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> person = personRepository.findByFirstName(name); String message = person.map(person1 -> String.format("Hello %s", person1.getFirstName())) .orElse("Data not found"); return new Hello(messag...
HelloWithRepositoryController { @GetMapping("/hello/data/{name}") public Hello sayHi(@PathVariable String name) { Optional<Person> person = personRepository.findByFirstName(name); String message = person.map(person1 -> String.format("Hello %s", person1.getFirstName())) .orElse("Data not found"); return new Hello(messag...
@Test public void shouldReturnSomkiat() { Hello hello = new Hello("somkiat"); assertEquals("somkiat", hello.getMessage()); }
public String getMessage() { return message; }
Hello { public String getMessage() { return message; } }
Hello { public String getMessage() { return message; } Hello(String message); }
Hello { public String getMessage() { return message; } Hello(String message); String getMessage(); }
Hello { public String getMessage() { return message; } Hello(String message); String getMessage(); }
@Test public void lambdaVariant() { LambdaRecommendations recommendations = new LambdaRecommendations(makePurchases()); Map<Integer, List<Integer>> results = recommendations.calculateRecommendations(); assertTrue("product 5 is similar to 4", recommendations.alsoBought(4, 1, results).contains(5)); assertTrue("product 4 ...
public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; }
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } }
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } }
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } void setPurchases(Purchases purchases); Map<Inte...
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } void setPurchases(Purchases purchases); Map<Inte...
@Test public void imperativeVariant() { ImperativeRecommendations recommendations = new ImperativeRecommendations(makePurchases()); Map<Integer, List<Integer>> results = recommendations.calculateRecommendations(); List<Integer> similarTo4 = recommendations.alsoBought(4, 1, results); assertTrue("product 5 is similar to ...
public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; }
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } }
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } }
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } void setPurchases(Purchases purchases); Map<Inte...
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } void setPurchases(Purchases purchases); Map<Inte...
@Ignore @Test public void gsVariant() { GSLambdaRecommendations recommendations = new GSLambdaRecommendations(makePurchases()); MutableMap<Integer, MutableList<Integer>> results = recommendations.calculateRecommendations(); Assert.assertEquals(4, results.get(5).get(0).intValue()); Assert.assertEquals(5, results.get(4)....
public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; }
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } }
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } }
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } void setPurchases(Purchases purchases); Map<Inte...
Recommendations extends SimpleBenchmark { public Map<Integer, List<Integer>> calculateRecommendations(int reps) { Map<Integer, List<Integer>> results = null; for (int i = 0; i < reps; i++) { results = lambdaRecommendations.calculateRecommendations(); } return results; } void setPurchases(Purchases purchases); Map<Inte...
@Test public void setView() { DummyView dummyView = (DummyView) dummyController.onCreateView(null, null); Assert.assertEquals(dummyController, dummyView.getController()); }
@NonNull @Override protected final View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { U view = createView(inflater, container); view.setController(getThis()); return view; }
BaseController extends Controller { @NonNull @Override protected final View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { U view = createView(inflater, container); view.setController(getThis()); return view; } }
BaseController extends Controller { @NonNull @Override protected final View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { U view = createView(inflater, container); view.setController(getThis()); return view; } BaseController(); BaseController(@Nullable Bundle args); }
BaseController extends Controller { @NonNull @Override protected final View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { U view = createView(inflater, container); view.setController(getThis()); return view; } BaseController(); BaseController(@Nullable Bundle args); }
BaseController extends Controller { @NonNull @Override protected final View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { U view = createView(inflater, container); view.setController(getThis()); return view; } BaseController(); BaseController(@Nullable Bundle args); }
@Test public void testServerLoginSuccess() { String email = "dummy@gmail.com"; String password = "password"; LoginResponse loginResponse = new LoginResponse(); doReturn(Observable.just(loginResponse)) .when(mMockLoginMvpInteractor) .doServerLoginApiCall(new LoginRequest .ServerLoginRequest(email, password)); mLoginPres...
@Override public void onServerLoginClick(String email, String password) { if (email == null || email.isEmpty()) { getMvpView().onError(R.string.empty_email); return; } if (!CommonUtils.isEmailValid(email)) { getMvpView().onError(R.string.invalid_email); return; } if (password == null || password.isEmpty()) { getMvpView...
LoginPresenter extends BasePresenter<V, I> implements LoginMvpPresenter<V, I> { @Override public void onServerLoginClick(String email, String password) { if (email == null || email.isEmpty()) { getMvpView().onError(R.string.empty_email); return; } if (!CommonUtils.isEmailValid(email)) { getMvpView().onError(R.string.in...
LoginPresenter extends BasePresenter<V, I> implements LoginMvpPresenter<V, I> { @Override public void onServerLoginClick(String email, String password) { if (email == null || email.isEmpty()) { getMvpView().onError(R.string.empty_email); return; } if (!CommonUtils.isEmailValid(email)) { getMvpView().onError(R.string.in...
LoginPresenter extends BasePresenter<V, I> implements LoginMvpPresenter<V, I> { @Override public void onServerLoginClick(String email, String password) { if (email == null || email.isEmpty()) { getMvpView().onError(R.string.empty_email); return; } if (!CommonUtils.isEmailValid(email)) { getMvpView().onError(R.string.in...
LoginPresenter extends BasePresenter<V, I> implements LoginMvpPresenter<V, I> { @Override public void onServerLoginClick(String email, String password) { if (email == null || email.isEmpty()) { getMvpView().onError(R.string.empty_email); return; } if (!CommonUtils.isEmailValid(email)) { getMvpView().onError(R.string.in...
@Test public void getTask_requestsSingleTaskFromLocalDataSource() { mTasksRepository.getTask(TASK_TITLE, mGetTaskCallback); verify(mTasksLocalDataSource).getTask(eq(TASK_TITLE), any( TasksDataSource.GetTaskCallback.class)); }
@Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDataSource.getTask(taskId, new GetTaskCallback()...
TasksRepository implements TasksDataSource { @Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDat...
TasksRepository implements TasksDataSource { @Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDat...
TasksRepository implements TasksDataSource { @Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDat...
TasksRepository implements TasksDataSource { @Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDat...
@Test public void getTaskWithBothDataSourcesUnavailable_firesOnDataUnavailable() { final String taskId = "123"; mTasksRepository.getTask(taskId, mGetTaskCallback); setTaskNotAvailable(mTasksLocalDataSource, taskId); setTaskNotAvailable(mTasksRemoteDataSource, taskId); verify(mGetTaskCallback).onDataNotAvailable(); }
@Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDataSource.getTask(taskId, new GetTaskCallback()...
TasksRepository implements TasksDataSource { @Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDat...
TasksRepository implements TasksDataSource { @Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDat...
TasksRepository implements TasksDataSource { @Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDat...
TasksRepository implements TasksDataSource { @Override public void getTask(@NonNull final String taskId, @NonNull final GetTaskCallback callback) { checkNotNull(taskId); checkNotNull(callback); Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { callback.onTaskLoaded(cachedTask); return; } mTasksLocalDat...
@Test public void clickOnFab_ShowsAddTaskUi() { mTasksPresenter.addNewTask(); verify(mTasksView).showAddTask(); }
@Override public void addNewTask() { if (mTasksView != null) { mTasksView.showAddTask(); } }
TasksPresenter implements TasksContract.Presenter { @Override public void addNewTask() { if (mTasksView != null) { mTasksView.showAddTask(); } } }
TasksPresenter implements TasksContract.Presenter { @Override public void addNewTask() { if (mTasksView != null) { mTasksView.showAddTask(); } } @Inject TasksPresenter(TasksRepository tasksRepository); }
TasksPresenter implements TasksContract.Presenter { @Override public void addNewTask() { if (mTasksView != null) { mTasksView.showAddTask(); } } @Inject TasksPresenter(TasksRepository tasksRepository); @Override void result(int requestCode, int resultCode); @Override void loadTasks(boolean forceUpdate); @Override void...
TasksPresenter implements TasksContract.Presenter { @Override public void addNewTask() { if (mTasksView != null) { mTasksView.showAddTask(); } } @Inject TasksPresenter(TasksRepository tasksRepository); @Override void result(int requestCode, int resultCode); @Override void loadTasks(boolean forceUpdate); @Override void...
@Test public void clickOnTask_ShowsDetailUi() { Task requestedTask = new Task("Details Requested", "For this task"); mTasksPresenter.openTaskDetails(requestedTask); verify(mTasksView).showTaskDetailsUi(any(String.class)); }
@Override public void openTaskDetails(@NonNull Task requestedTask) { checkNotNull(requestedTask, "requestedTask cannot be null!"); if (mTasksView != null) { mTasksView.showTaskDetailsUi(requestedTask.getId()); } }
TasksPresenter implements TasksContract.Presenter { @Override public void openTaskDetails(@NonNull Task requestedTask) { checkNotNull(requestedTask, "requestedTask cannot be null!"); if (mTasksView != null) { mTasksView.showTaskDetailsUi(requestedTask.getId()); } } }
TasksPresenter implements TasksContract.Presenter { @Override public void openTaskDetails(@NonNull Task requestedTask) { checkNotNull(requestedTask, "requestedTask cannot be null!"); if (mTasksView != null) { mTasksView.showTaskDetailsUi(requestedTask.getId()); } } @Inject TasksPresenter(TasksRepository tasksRepositor...
TasksPresenter implements TasksContract.Presenter { @Override public void openTaskDetails(@NonNull Task requestedTask) { checkNotNull(requestedTask, "requestedTask cannot be null!"); if (mTasksView != null) { mTasksView.showTaskDetailsUi(requestedTask.getId()); } } @Inject TasksPresenter(TasksRepository tasksRepositor...
TasksPresenter implements TasksContract.Presenter { @Override public void openTaskDetails(@NonNull Task requestedTask) { checkNotNull(requestedTask, "requestedTask cannot be null!"); if (mTasksView != null) { mTasksView.showTaskDetailsUi(requestedTask.getId()); } } @Inject TasksPresenter(TasksRepository tasksRepositor...
@Test public void completeTask_ShowsTaskMarkedComplete() { Task task = new Task("Details Requested", "For this task"); mTasksPresenter.completeTask(task); verify(mTasksRepository).completeTask(task); verify(mTasksView).showTaskMarkedComplete(); }
@Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); if (mTasksView != null) { mTasksView.showTaskMarkedComplete(); } loadTasks(false, false); }
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); if (mTasksView != null) { mTasksView.showTaskMarkedComplete(); } loadTasks(false, false); } }
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); if (mTasksView != null) { mTasksView.showTaskMarkedComplete(); } loadTasks(false, false); } @I...
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); if (mTasksView != null) { mTasksView.showTaskMarkedComplete(); } loadTasks(false, false); } @I...
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); if (mTasksView != null) { mTasksView.showTaskMarkedComplete(); } loadTasks(false, false); } @I...
@Test public void getActiveTaskFromRepositoryAndLoadIntoView() { mTaskDetailPresenter = new TaskDetailPresenter( ACTIVE_TASK.getId(), mTasksRepository); mTaskDetailPresenter.takeView(mTaskDetailView); verify(mTasksRepository).getTask(eq(ACTIVE_TASK.getId()), mGetTaskCallbackCaptor.capture()); InOrder inOrder = inOrder(...
@Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } @Inject TaskDetailPresenter(@Nullable String taskId, TasksRepository tasksRepository); }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } @Inject TaskDetailPresenter(@Nullable String taskId, TasksRepository tasksRepository); @Override void editTask()...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } @Inject TaskDetailPresenter(@Nullable String taskId, TasksRepository tasksRepository); @Override void editTask()...
@Test public void getCompletedTaskFromRepositoryAndLoadIntoView() { mTaskDetailPresenter = new TaskDetailPresenter( COMPLETED_TASK.getId(), mTasksRepository); mTaskDetailPresenter.takeView(mTaskDetailView); verify(mTasksRepository).getTask( eq(COMPLETED_TASK.getId()), mGetTaskCallbackCaptor.capture()); InOrder inOrder ...
@Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } @Inject TaskDetailPresenter(@Nullable String taskId, TasksRepository tasksRepository); }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } @Inject TaskDetailPresenter(@Nullable String taskId, TasksRepository tasksRepository); @Override void editTask()...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } @Inject TaskDetailPresenter(@Nullable String taskId, TasksRepository tasksRepository); @Override void editTask()...
@Test public void getUnknownTaskFromRepositoryAndLoadIntoView() { mTaskDetailPresenter = new TaskDetailPresenter( INVALID_TASK_ID, mTasksRepository); mTaskDetailPresenter.takeView(mTaskDetailView); verify(mTaskDetailView).showMissingTask(); }
@Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } @Inject TaskDetailPresenter(@Nullable String taskId, TasksRepository tasksRepository); }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } @Inject TaskDetailPresenter(@Nullable String taskId, TasksRepository tasksRepository); @Override void editTask()...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void takeView(TaskDetailContract.View taskDetailView) { mTaskDetailView = taskDetailView; openTask(); } @Inject TaskDetailPresenter(@Nullable String taskId, TasksRepository tasksRepository); @Override void editTask()...
@Test public void deleteTask() { Task task = new Task(TITLE_TEST, DESCRIPTION_TEST); mTaskDetailPresenter = new TaskDetailPresenter( task.getId(), mTasksRepository); mTaskDetailPresenter.takeView(mTaskDetailView); mTaskDetailPresenter.deleteTask(); verify(mTasksRepository).deleteTask(task.getId()); verify(mTaskDetailVi...
@Override public void deleteTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.deleteTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskDeleted(); } }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void deleteTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.deleteTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskDeleted(); }...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void deleteTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.deleteTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskDeleted(); }...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void deleteTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.deleteTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskDeleted(); }...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void deleteTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.deleteTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskDeleted(); }...
@Test public void completeTask() { Task task = new Task(TITLE_TEST, DESCRIPTION_TEST); mTaskDetailPresenter = new TaskDetailPresenter( task.getId(), mTasksRepository); mTaskDetailPresenter.takeView(mTaskDetailView); mTaskDetailPresenter.completeTask(); verify(mTasksRepository).completeTask(task.getId()); verify(mTaskDe...
@Override public void completeTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.completeTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedComplete(); } }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void completeTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.completeTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedCo...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void completeTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.completeTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedCo...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void completeTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.completeTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedCo...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void completeTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.completeTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedCo...
@Test public void activateTask() { Task task = new Task(TITLE_TEST, DESCRIPTION_TEST, true); mTaskDetailPresenter = new TaskDetailPresenter( task.getId(), mTasksRepository); mTaskDetailPresenter.takeView(mTaskDetailView); mTaskDetailPresenter.activateTask(); verify(mTasksRepository).activateTask(task.getId()); verify(m...
@Override public void activateTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.activateTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedActive(); } }
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void activateTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.activateTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedAc...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void activateTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.activateTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedAc...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void activateTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.activateTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedAc...
TaskDetailPresenter implements TaskDetailContract.Presenter { @Override public void activateTask() { if (Strings.isNullOrEmpty(mTaskId)) { if (mTaskDetailView != null) { mTaskDetailView.showMissingTask(); } return; } mTasksRepository.activateTask(mTaskId); if (mTaskDetailView != null) { mTaskDetailView.showTaskMarkedAc...
@Test public void getTasks_repositoryCachesAfterFirstSubscription_whenTasksAvailableInLocalStorage() { setTasksAvailable(mTasksLocalDataSource, TASKS); setTasksNotAvailable(mTasksRemoteDataSource); TestSubscriber<List<Task>> testSubscriber1 = new TestSubscriber<>(); mTasksRepository.getTasks().subscribe(testSubscriber1...
@Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteTasks = getAndSaveRemoteTasks(); if (mCacheIsD...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
@Test public void getTasks_repositoryCachesAfterFirstSubscription_whenTasksAvailableInRemoteStorage() { setTasksAvailable(mTasksRemoteDataSource, TASKS); setTasksNotAvailable(mTasksLocalDataSource); TestSubscriber<List<Task>> testSubscriber1 = new TestSubscriber<>(); mTasksRepository.getTasks().subscribe(testSubscriber...
@Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteTasks = getAndSaveRemoteTasks(); if (mCacheIsD...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
@Test public void getTasks_requestsAllTasksFromLocalDataSource() { setTasksAvailable(mTasksLocalDataSource, TASKS); setTasksNotAvailable(mTasksRemoteDataSource); mTasksRepository.getTasks().subscribe(mTasksTestSubscriber); verify(mTasksLocalDataSource).getTasks(); mTasksTestSubscriber.assertValue(TASKS); }
@Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteTasks = getAndSaveRemoteTasks(); if (mCacheIsD...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
@Test public void saveTask_savesTaskToServiceAPI() { Task newTask = new Task(TASK_TITLE, "Some Task Description"); mTasksRepository.saveTask(newTask); verify(mTasksRemoteDataSource).saveTask(newTask); verify(mTasksLocalDataSource).saveTask(newTask); assertThat(mTasksRepository.mCachedTasks.size(), is(1)); }
@Override public void saveTask(@NonNull Task task) { checkNotNull(task); mTasksRemoteDataSource.saveTask(task); mTasksLocalDataSource.saveTask(task); if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } mCachedTasks.put(task.getId(), task); }
TasksRepository implements TasksDataSource { @Override public void saveTask(@NonNull Task task) { checkNotNull(task); mTasksRemoteDataSource.saveTask(task); mTasksLocalDataSource.saveTask(task); if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } mCachedTasks.put(task.getId(), task); } }
TasksRepository implements TasksDataSource { @Override public void saveTask(@NonNull Task task) { checkNotNull(task); mTasksRemoteDataSource.saveTask(task); mTasksLocalDataSource.saveTask(task); if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } mCachedTasks.put(task.getId(), task); } private TasksRep...
TasksRepository implements TasksDataSource { @Override public void saveTask(@NonNull Task task) { checkNotNull(task); mTasksRemoteDataSource.saveTask(task); mTasksLocalDataSource.saveTask(task); if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } mCachedTasks.put(task.getId(), task); } private TasksRep...
TasksRepository implements TasksDataSource { @Override public void saveTask(@NonNull Task task) { checkNotNull(task); mTasksRemoteDataSource.saveTask(task); mTasksLocalDataSource.saveTask(task); if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } mCachedTasks.put(task.getId(), task); } private TasksRep...
@Test public void getTask_requestsSingleTaskFromLocalDataSource() { Task task = new Task(TASK_TITLE, "Some Task Description", true); Optional<Task> taskOptional = Optional.of(task); setTaskAvailable(mTasksLocalDataSource, taskOptional); setTaskNotAvailable(mTasksRemoteDataSource, taskOptional.get().getId()); TestSubscr...
@Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<Optional<Task>> l...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
@Test public void getTask_whenDataNotLocal_fails() { Task task = new Task(TASK_TITLE, "Some Task Description", true); Optional<Task> taskOptional = Optional.of(task); setTaskAvailable(mTasksRemoteDataSource, taskOptional); setTaskNotAvailable(mTasksLocalDataSource, task.getId()); TestSubscriber<Optional<Task>> testSubs...
@Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<Optional<Task>> l...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
@Test public void getTasksWithLocalDataSourceUnavailable_tasksAreRetrievedFromRemote() { setTasksNotAvailable(mTasksLocalDataSource); setTasksAvailable(mTasksRemoteDataSource, TASKS); mTasksRepository.getTasks().subscribe(mTasksTestSubscriber); verify(mTasksRemoteDataSource).getTasks(); mTasksTestSubscriber.assertValue...
@Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteTasks = getAndSaveRemoteTasks(); if (mCacheIsD...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
@Test public void getTasksWithBothDataSourcesUnavailable_firesOnDataUnavailable() { setTasksNotAvailable(mTasksLocalDataSource); setTasksNotAvailable(mTasksRemoteDataSource); mTasksRepository.getTasks().subscribe(mTasksTestSubscriber); mTasksTestSubscriber.assertNoValues(); mTasksTestSubscriber.assertError(NoSuchElemen...
@Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteTasks = getAndSaveRemoteTasks(); if (mCacheIsD...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
TasksRepository implements TasksDataSource { @Override public Flowable<List<Task>> getTasks() { if (mCachedTasks != null && !mCacheIsDirty) { return Flowable.fromIterable(mCachedTasks.values()).toList().toFlowable(); } else if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<List<Task>> remoteT...
@Test public void getTaskWithBothDataSourcesUnavailable_firesOnError() { final String taskId = "123"; setTaskNotAvailable(mTasksLocalDataSource, taskId); setTaskNotAvailable(mTasksRemoteDataSource, taskId); TestSubscriber<Optional<Task>> testSubscriber = new TestSubscriber<>(); mTasksRepository.getTask(taskId).subscrib...
@Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new LinkedHashMap<>(); } Flowable<Optional<Task>> l...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
TasksRepository implements TasksDataSource { @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId) { checkNotNull(taskId); final Task cachedTask = getTaskWithId(taskId); if (cachedTask != null) { return Flowable.just(Optional.of(cachedTask)); } if (mCachedTasks == null) { mCachedTasks = new Li...
@Test public void completeTask_ShowsTaskMarkedComplete() { Task task = new Task("Details Requested", "For this task"); when(mTasksRepository.getTasks()).thenReturn(Flowable.empty()); mTasksPresenter.completeTask(task); verify(mTasksRepository).completeTask(task); verify(mTasksView).showTaskMarkedComplete(); }
@Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); mTasksView.showTaskMarkedComplete(); loadTasks(false, false); }
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); mTasksView.showTaskMarkedComplete(); loadTasks(false, false); } }
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); mTasksView.showTaskMarkedComplete(); loadTasks(false, false); } TasksPresenter(@NonNull TasksR...
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); mTasksView.showTaskMarkedComplete(); loadTasks(false, false); } TasksPresenter(@NonNull TasksR...
TasksPresenter implements TasksContract.Presenter { @Override public void completeTask(@NonNull Task completedTask) { checkNotNull(completedTask, "completedTask cannot be null!"); mTasksRepository.completeTask(completedTask); mTasksView.showTaskMarkedComplete(); loadTasks(false, false); } TasksPresenter(@NonNull TasksR...
@Test public void populateTask_callsRepoAndUpdatesViewOnAbsentTask() { Task testTask = new Task("TITLE", "DESCRIPTION"); when(mTasksRepository.getTask(testTask.getId())).thenReturn(Flowable.just(Optional.absent())); mAddEditTaskPresenter = new AddEditTaskPresenter(testTask.getId(), mTasksRepository, mAddEditTaskView, t...
@Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSchedulerProvider.ui()) .subscribe( taskOptional -> { if (taskOptio...
AddEditTaskPresenter implements AddEditTaskContract.Presenter { @Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSch...
AddEditTaskPresenter implements AddEditTaskContract.Presenter { @Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSch...
AddEditTaskPresenter implements AddEditTaskContract.Presenter { @Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSch...
AddEditTaskPresenter implements AddEditTaskContract.Presenter { @Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSch...
@Test public void populateTask_callsRepoAndUpdatesViewOnError() { Task testTask = new Task("TITLE", "DESCRIPTION"); when(mTasksRepository.getTask(testTask.getId())).thenReturn(Flowable.error(new Throwable("Some error"))); mAddEditTaskPresenter = new AddEditTaskPresenter(testTask.getId(), mTasksRepository, mAddEditTaskV...
@Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSchedulerProvider.ui()) .subscribe( taskOptional -> { if (taskOptio...
AddEditTaskPresenter implements AddEditTaskContract.Presenter { @Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSch...
AddEditTaskPresenter implements AddEditTaskContract.Presenter { @Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSch...
AddEditTaskPresenter implements AddEditTaskContract.Presenter { @Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSch...
AddEditTaskPresenter implements AddEditTaskContract.Presenter { @Override public void populateTask() { if (isNewTask()) { throw new RuntimeException("populateTask() was called but task is new."); } mCompositeDisposable.add(mTasksRepository .getTask(mTaskId) .subscribeOn(mSchedulerProvider.computation()) .observeOn(mSch...
@Test public void testCombineArrays() { for (int i = 0; i < 200; i++) { push("ABCDEFGH"); push("IJK"); assertEquals("ABCDE", pop(5)); assertEquals("FGHIJK", pop(6)); } }
public void push(byte[] src) { push(src, 0, src.length); }
ByteArrayDequeue { public void push(byte[] src) { push(src, 0, src.length); } }
ByteArrayDequeue { public void push(byte[] src) { push(src, 0, src.length); } ByteArrayDequeue(); ByteArrayDequeue(int initalCapacity); }
ByteArrayDequeue { public void push(byte[] src) { push(src, 0, src.length); } ByteArrayDequeue(); ByteArrayDequeue(int initalCapacity); int getRemaining(); void push(byte[] src); void push(byte[] src, int srcOffset, int srcLengthToPush); void pushLast(byte[] src); void pushLast(byte[] src, int srcOffset, int srcLengt...
ByteArrayDequeue { public void push(byte[] src) { push(src, 0, src.length); } ByteArrayDequeue(); ByteArrayDequeue(int initalCapacity); int getRemaining(); void push(byte[] src); void push(byte[] src, int srcOffset, int srcLengthToPush); void pushLast(byte[] src); void pushLast(byte[] src, int srcOffset, int srcLengt...
@Test public void testGetFieldsReturnsCorrectString_forAutoValueClass() { String detectedAVFields = ClassUtils.getMethodsList(ComicVolumeInfoList.class); String actualFields = "count_of_issues,id,image,name,publisher,start_year"; assertEquals("getMethodsList method returned incorrect list!", actualFields, detectedAVFie...
public static String getMethodsList(Class<?> type) { final String SEPARATOR = ","; final List<Method> methods = Arrays.asList(type.getDeclaredMethods()); StringBuilder result = new StringBuilder(); Collections.sort(methods, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName())); for (Method method : methods) { int...
ClassUtils { public static String getMethodsList(Class<?> type) { final String SEPARATOR = ","; final List<Method> methods = Arrays.asList(type.getDeclaredMethods()); StringBuilder result = new StringBuilder(); Collections.sort(methods, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName())); for (Method method : m...
ClassUtils { public static String getMethodsList(Class<?> type) { final String SEPARATOR = ","; final List<Method> methods = Arrays.asList(type.getDeclaredMethods()); StringBuilder result = new StringBuilder(); Collections.sort(methods, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName())); for (Method method : m...
ClassUtils { public static String getMethodsList(Class<?> type) { final String SEPARATOR = ","; final List<Method> methods = Arrays.asList(type.getDeclaredMethods()); StringBuilder result = new StringBuilder(); Collections.sort(methods, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName())); for (Method method : m...
ClassUtils { public static String getMethodsList(Class<?> type) { final String SEPARATOR = ","; final List<Method> methods = Arrays.asList(type.getDeclaredMethods()); StringBuilder result = new StringBuilder(); Collections.sort(methods, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName())); for (Method method : m...
@Test public void testGetFormattedIssueName() { assertEquals("getFormattedIssueName method returned incorrect string!", FORMATTED_NAME_FULL, IssueTextUtils.getFormattedIssueName(ISSUE_NAME, VOLUME_NAME, ISSUE_NUMBER)); assertEquals("getFormattedIssueName method returned incorrect string!", FORMATTED_NAME_SHORT, IssueTe...
public static String getFormattedIssueName(String issue, String volume, int number) { String name; if (issue != null) { name = String.format(Locale.US, "%s #%d - %s", volume, number, issue); } else { name = String.format(Locale.US, "%s #%d", volume, number); } return name; }
IssueTextUtils { public static String getFormattedIssueName(String issue, String volume, int number) { String name; if (issue != null) { name = String.format(Locale.US, "%s #%d - %s", volume, number, issue); } else { name = String.format(Locale.US, "%s #%d", volume, number); } return name; } }
IssueTextUtils { public static String getFormattedIssueName(String issue, String volume, int number) { String name; if (issue != null) { name = String.format(Locale.US, "%s #%d - %s", volume, number, issue); } else { name = String.format(Locale.US, "%s #%d", volume, number); } return name; } }
IssueTextUtils { public static String getFormattedIssueName(String issue, String volume, int number) { String name; if (issue != null) { name = String.format(Locale.US, "%s #%d - %s", volume, number, issue); } else { name = String.format(Locale.US, "%s #%d", volume, number); } return name; } static String getFormatted...
IssueTextUtils { public static String getFormattedIssueName(String issue, String volume, int number) { String name; if (issue != null) { name = String.format(Locale.US, "%s #%d - %s", volume, number, issue); } else { name = String.format(Locale.US, "%s #%d", volume, number); } return name; } static String getFormatted...
@Test public void testGetFormattedIssueDetailsTitle() { assertEquals("getFormattedIssueTitle method returned incorrect string!", FORMATTED_NAME_SHORT, IssueTextUtils.getFormattedIssueTitle(VOLUME_NAME, ISSUE_NUMBER)); }
public static String getFormattedIssueTitle(String volume, int number) { return String.format(Locale.US, "%s #%d", volume, number); }
IssueTextUtils { public static String getFormattedIssueTitle(String volume, int number) { return String.format(Locale.US, "%s #%d", volume, number); } }
IssueTextUtils { public static String getFormattedIssueTitle(String volume, int number) { return String.format(Locale.US, "%s #%d", volume, number); } }
IssueTextUtils { public static String getFormattedIssueTitle(String volume, int number) { return String.format(Locale.US, "%s #%d", volume, number); } static String getFormattedIssueName(String issue, String volume, int number); static String getFormattedIssueTitle(String volume, int number); }
IssueTextUtils { public static String getFormattedIssueTitle(String volume, int number) { return String.format(Locale.US, "%s #%d", volume, number); } static String getFormattedIssueName(String issue, String volume, int number); static String getFormattedIssueTitle(String volume, int number); }
@Test public void test() { List<Schema.Field> fields = Arrays.asList( new Schema.Field(Schema.Type.ARRAY.getName(), Schema.createArray(Schema.create(Schema.Type.BOOLEAN)), null, null), new Schema.Field(Schema.Type.RECORD.getName(), Schema.createRecord(Collections.emptyList()), null, null), new Schema.Field(Schema.Type....
List<String> getColumns(List<Schema.Field> fields) { List<String> columns = new ArrayList<>(fields.size()); for (Schema.Field field : fields) { switch (field.schema().getType()) { case RECORD: case MAP: case ARRAY: break; default: columns.add(field.name()); } } return columns; }
AvroHeadersFunction implements Function<AvroWrapper, List<String>> { List<String> getColumns(List<Schema.Field> fields) { List<String> columns = new ArrayList<>(fields.size()); for (Schema.Field field : fields) { switch (field.schema().getType()) { case RECORD: case MAP: case ARRAY: break; default: columns.add(field.na...
AvroHeadersFunction implements Function<AvroWrapper, List<String>> { List<String> getColumns(List<Schema.Field> fields) { List<String> columns = new ArrayList<>(fields.size()); for (Schema.Field field : fields) { switch (field.schema().getType()) { case RECORD: case MAP: case ARRAY: break; default: columns.add(field.na...
AvroHeadersFunction implements Function<AvroWrapper, List<String>> { List<String> getColumns(List<Schema.Field> fields) { List<String> columns = new ArrayList<>(fields.size()); for (Schema.Field field : fields) { switch (field.schema().getType()) { case RECORD: case MAP: case ARRAY: break; default: columns.add(field.na...
AvroHeadersFunction implements Function<AvroWrapper, List<String>> { List<String> getColumns(List<Schema.Field> fields) { List<String> columns = new ArrayList<>(fields.size()); for (Schema.Field field : fields) { switch (field.schema().getType()) { case RECORD: case MAP: case ARRAY: break; default: columns.add(field.na...
@Test public void getMaximumNumberOfGroups() { Assert.assertEquals(1, SparkVerifier.getMaximumNumberOfGroups(new BoundedDouble(100.0, 50.0, 0.0, 200.0), 10_000)); Assert.assertEquals(5, SparkVerifier.getMaximumNumberOfGroups(new BoundedDouble(100.0, 50.0, 0.0, 200.0), 20)); Assert.assertEquals(100, SparkVerifier.getMax...
static int getMaximumNumberOfGroups(BoundedDouble approxCountBoundedDouble, int maxGroupSize) { long countApprox = Math.round(approxCountBoundedDouble.mean()); LOGGER.info("Approximate count of expected results: " + countApprox); LOGGER.info("Maximum group size: " + maxGroupSize); long maximumNumberOfGroups = Math.max(...
SparkVerifier { static int getMaximumNumberOfGroups(BoundedDouble approxCountBoundedDouble, int maxGroupSize) { long countApprox = Math.round(approxCountBoundedDouble.mean()); LOGGER.info("Approximate count of expected results: " + countApprox); LOGGER.info("Maximum group size: " + maxGroupSize); long maximumNumberOfGr...
SparkVerifier { static int getMaximumNumberOfGroups(BoundedDouble approxCountBoundedDouble, int maxGroupSize) { long countApprox = Math.round(approxCountBoundedDouble.mean()); LOGGER.info("Approximate count of expected results: " + countApprox); LOGGER.info("Maximum group size: " + maxGroupSize); long maximumNumberOfGr...
SparkVerifier { static int getMaximumNumberOfGroups(BoundedDouble approxCountBoundedDouble, int maxGroupSize) { long countApprox = Math.round(approxCountBoundedDouble.mean()); LOGGER.info("Approximate count of expected results: " + countApprox); LOGGER.info("Maximum group size: " + maxGroupSize); long maximumNumberOfGr...
SparkVerifier { static int getMaximumNumberOfGroups(BoundedDouble approxCountBoundedDouble, int maxGroupSize) { long countApprox = Math.round(approxCountBoundedDouble.mean()); LOGGER.info("Approximate count of expected results: " + countApprox); LOGGER.info("Maximum group size: " + maxGroupSize); long maximumNumberOfGr...
@Test public void withoutPartialMatchTimeout() { this.verifier.starting(this.description.get()); this.verifier.withoutPartialMatchTimeout().verify("table1", TableTestUtils.ACTUAL, TableTestUtils.ACTUAL); this.verifier.succeeded(this.description.get()); }
public final TableVerifier withoutPartialMatchTimeout() { return this.withPartialMatchTimeoutMillis(0); }
TableVerifier extends TestWatcher { public final TableVerifier withoutPartialMatchTimeout() { return this.withPartialMatchTimeoutMillis(0); } }
TableVerifier extends TestWatcher { public final TableVerifier withoutPartialMatchTimeout() { return this.withPartialMatchTimeoutMillis(0); } }
TableVerifier extends TestWatcher { public final TableVerifier withoutPartialMatchTimeout() { return this.withPartialMatchTimeoutMillis(0); } final TableVerifier withExpectedDir(String expectedDirPath); final TableVerifier withExpectedDir(File expectedDir); final TableVerifier withOutputDir(String outputDirPath); fina...
TableVerifier extends TestWatcher { public final TableVerifier withoutPartialMatchTimeout() { return this.withPartialMatchTimeoutMillis(0); } final TableVerifier withExpectedDir(String expectedDirPath); final TableVerifier withExpectedDir(File expectedDir); final TableVerifier withOutputDir(String outputDirPath); fina...
@Test public void testAllRows() { this.verify( TableTestUtils.createTable(1, "C", 1, 2, 3, 4, 5), TableAdapters.withRows(TableTestUtils.createTable(1, "C", 1, 2, 3, 4, 5), i -> true)); }
public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); }
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } }
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } private TableAdapters(); }
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(VerifiableTable d...
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(VerifiableTable d...
@Test public void testNoRows() { VerifiableTable table = TableTestUtils.createTable(1, "C", 1, 2, 3, 4, 5); this.verify( TableTestUtils.createTable(1, "C"), TableAdapters.withRows(table, i -> false)); }
public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); }
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } }
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } private TableAdapters(); }
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(VerifiableTable d...
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(VerifiableTable d...
@Test public void testSomeRows() { VerifiableTable table = TableTestUtils.createTable(1, "C", 1, 2, 3, 4, 5); this.verify( TableTestUtils.createTable(1, "C", 2, 4), TableAdapters.withRows(table, i -> (Integer) table.getValueAt(i, 0) % 2 == 0)); }
public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); }
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } }
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } private TableAdapters(); }
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(VerifiableTable d...
TableAdapters { public static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter) { return new RowFilterAdapter(delegate, rowFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(VerifiableTable d...
@Test public void testAllColumns() { this.verify( TableTestUtils.createTable(5, "C1", "C2", "C3", "C4", "C5"), TableAdapters.withColumns(TableTestUtils.createTable(5, "C1", "C2", "C3", "C4", "C5"), name -> true)); }
public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); }
TableAdapters { public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); } }
TableAdapters { public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); } private TableAdapters(); }
TableAdapters { public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(...
TableAdapters { public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(...
@Test public void testSomeColumns() { this.verify( TableTestUtils.createTable(3, "C1", "C3", "C5"), TableAdapters.withColumns(TableTestUtils.createTable(5, "C1", "C2", "C3", "C4", "C5"), name -> name.matches("C[135]"))); }
public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); }
TableAdapters { public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); } }
TableAdapters { public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); } private TableAdapters(); }
TableAdapters { public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(...
TableAdapters { public static VerifiableTable withColumns(VerifiableTable delegate, Predicate<String> columnFilter) { return new ColumnFilterAdapter(delegate, columnFilter); } private TableAdapters(); static VerifiableTable withRows(VerifiableTable delegate, IntPredicate rowFilter); static VerifiableTable withColumns(...
@Test public void testParse() { File expected = new File(TableTestUtils.getExpectedDirectory(), ExpectedResultsParserTest.class.getSimpleName() + ".txt"); ExpectedResults results = new ExpectedResultsParser(new FileSystemExpectedResultsLoader(), expected).parse(); VerifiableTable summary = results.getTable("Summary"); ...
public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e) { throw new RuntimeExce...
ExpectedResultsParser { public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e)...
ExpectedResultsParser { public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e)...
ExpectedResultsParser { public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e)...
ExpectedResultsParser { public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e)...
@Test public void testCache() { File expected = new File(TableTestUtils.getExpectedDirectory(), ExpectedResultsParserTest.class.getSimpleName() + ".txt"); Map<ExpectedResults, String> results = new IdentityHashMap<>(); for (int i = 0; i < 10; i++) { results.put(ExpectedResultsCache.getExpectedResults(new FileSystemExpe...
ExpectedResults getExpectedResults() { return this.results; }
ExpectedResultsParser { ExpectedResults getExpectedResults() { return this.results; } }
ExpectedResultsParser { ExpectedResults getExpectedResults() { return this.results; } ExpectedResultsParser(ExpectedResultsLoader loader, File file); }
ExpectedResultsParser { ExpectedResults getExpectedResults() { return this.results; } ExpectedResultsParser(ExpectedResultsLoader loader, File file); ExpectedResults parse(); }
ExpectedResultsParser { ExpectedResults getExpectedResults() { return this.results; } ExpectedResultsParser(ExpectedResultsLoader loader, File file); ExpectedResults parse(); }
@Test public void testMissingExpectedResultsFileResultsInClearErrorMessage() { String missingFileName = "missing-expected-results.txt"; try { new ExpectedResultsParser(new FileSystemExpectedResultsLoader(), new File(missingFileName)).parse(); Assert.fail("Should have failed looking for non-existent file"); } catch (Ill...
public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e) { throw new RuntimeExce...
ExpectedResultsParser { public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e)...
ExpectedResultsParser { public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e)...
ExpectedResultsParser { public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e)...
ExpectedResultsParser { public ExpectedResults parse() { this.results = new ExpectedResults(); try (InputStream inputStream = this.loader.load(this.file)) { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); parse(reader); return this.results; } catch (IOException e)...
@Test public void runTestFail() throws IOException { runTest(AVRO, AVRO_X, false, newSparkVerifier(Arrays.asList("k2", "k1")) .withMaxGroupSize(2)); }
public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; }
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } }
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } SparkVerifier(List<String> groupKeyColumns); }
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } SparkVerifier(List<String> groupKeyColumns); final SparkVerifier withMetadata(String name, String value); SparkVerifier withIgnoreSurplusColumns(boolean ignoreSurplusColumns); SparkVerifier withCol...
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } SparkVerifier(List<String> groupKeyColumns); final SparkVerifier withMetadata(String name, String value); SparkVerifier withIgnoreSurplusColumns(boolean ignoreSurplusColumns); SparkVerifier withCol...
@Test public void testCompareToleranceStringInputsFail() { Assert.assertFalse(this.varianceCellComparator.compare("ActualAndExpected", "ActualAndExpected")); Assert.assertFalse(this.varianceCellComparator.compare("Actual", "Expected")); }
protected abstract boolean compare(Object actual, Object expected);
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
@Test public void testCompareNumbersWithinTolerance() { Assert.assertTrue("Results match expected. Actual(20.0) and Expected(20.09) within Tolerance range(0.1).",this.toleranceCellComparator.compare(new Double(20.0), new Double(20.09))); Assert.assertTrue("Results match expected. Actual(7894.87) and Expected(7894.79) w...
protected abstract boolean compare(Object actual, Object expected);
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
@Test public void testCompareNumbersOutsideTolerance() { Assert.assertFalse("Results mismatch expected. Actual(20.0) and Expected(20.11) outside Tolerance range(0.1). ", this.toleranceCellComparator.compare(new Double(20.0), new Double(20.11))); Assert.assertFalse("Results mismatch expected. Actual(7894.87) and Expecte...
protected abstract boolean compare(Object actual, Object expected);
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
@Test public void testCompareVarianceStringInputsFail() { Assert.assertFalse(this.varianceCellComparator.compare("ActualAndExpected", "ActualAndExpected")); Assert.assertFalse(this.varianceCellComparator.compare("Actual", "Expected")); }
protected abstract boolean compare(Object actual, Object expected);
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
@Test public void testCompareNumbersWithinVariance() { Assert.assertTrue("Results match expected. Actual(2000.0) and Expected(2100.0) within Variance range(5%).", this.varianceCellComparator.compare(new Double(2000.0), new Double(2100.0))); Assert.assertTrue("Results match expected. Actual(735.0) and Expected(772.0) wi...
protected abstract boolean compare(Object actual, Object expected);
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
@Test public void testCompareNumbersOutsideVariance() { Assert.assertFalse("Results mismatch expected. Actual(2000.0) and Expected(2110.0) outside Variance range(5%).", this.varianceCellComparator.compare(new Double(2000.0), new Double(2110))); Assert.assertFalse("Results mismatch expected. Actual(735.0) and Expected(7...
protected abstract boolean compare(Object actual, Object expected);
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
@Test public void testActualExpectedMismatchedTypes() { Assert.assertFalse("Results mismatch expected. Actual(390.0) and Expected(expected) outside Variance range(5%).", this.varianceCellComparator.compare(new Double(390.0),"expected")); Assert.assertFalse("Results mismatch expected. Actual(actual) and Expected(1045.0)...
protected abstract boolean compare(Object actual, Object expected);
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
CellComparator implements Serializable { protected abstract boolean compare(Object actual, Object expected); CellComparator(CellFormatter formatter); CellFormatter getFormatter(); static boolean isFloatingPoint(Object object); boolean equals(Object actual, Object expected); int computeHashCode(Object object); }
@Test public void create() throws SQLException { SimpleResultSet resultSet = new SimpleResultSet(); resultSet.addColumn("Name", Types.VARCHAR, 0, 0); resultSet.addColumn("Age", Types.INTEGER, 0, 0); resultSet.addColumn("Height", Types.DOUBLE, 0, 0); resultSet.addColumn("DoB", Types.DATE, 0, 0); resultSet.addRow("Joe", ...
public static VerifiableTable create(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); List<String> headers = new ArrayList<>(columnCount); for (int n = 1; n <= columnCount; n++) { headers.add(metaData.getColumnName(n)); } List<...
ResultSetTable { public static VerifiableTable create(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); List<String> headers = new ArrayList<>(columnCount); for (int n = 1; n <= columnCount; n++) { headers.add(metaData.getColumn...
ResultSetTable { public static VerifiableTable create(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); List<String> headers = new ArrayList<>(columnCount); for (int n = 1; n <= columnCount; n++) { headers.add(metaData.getColumn...
ResultSetTable { public static VerifiableTable create(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); List<String> headers = new ArrayList<>(columnCount); for (int n = 1; n <= columnCount; n++) { headers.add(metaData.getColumn...
ResultSetTable { public static VerifiableTable create(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); List<String> headers = new ArrayList<>(columnCount); for (int n = 1; n <= columnCount; n++) { headers.add(metaData.getColumn...
@Test public void testHeaderTypes() throws Exception { List<Object> headersAsObjects = Collections.singletonList("Col"); List<List<Object>> headersAndDataAsObjects = Arrays.asList(headersAsObjects, Collections.<Object>singletonList("Val")); Assert.assertEquals("Test constructor with headers and rows in one List<List<Ob...
@Override public int getRowCount() { return this.data.size(); }
ListVerifiableTable implements VerifiableTable { @Override public int getRowCount() { return this.data.size(); } }
ListVerifiableTable implements VerifiableTable { @Override public int getRowCount() { return this.data.size(); } ListVerifiableTable(List<List<Object>> headersAndData); ListVerifiableTable(List<?> headers, List<List<Object>> data); }
ListVerifiableTable implements VerifiableTable { @Override public int getRowCount() { return this.data.size(); } ListVerifiableTable(List<List<Object>> headersAndData); ListVerifiableTable(List<?> headers, List<List<Object>> data); static VerifiableTable create(Iterable<List> headersAndRows); static VerifiableTable cr...
ListVerifiableTable implements VerifiableTable { @Override public int getRowCount() { return this.data.size(); } ListVerifiableTable(List<List<Object>> headersAndData); ListVerifiableTable(List<?> headers, List<List<Object>> data); static VerifiableTable create(Iterable<List> headersAndRows); static VerifiableTable cr...
@Test(expected = IllegalArgumentException.class) public void createList_headersNotStrings() { ListVerifiableTable.create(Arrays.asList(Arrays.asList('A', 'B'), Arrays.asList(1, 2))); }
public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verifyRowSize(headers).andThen(rowList::add)); return n...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
@Test public void runTestPass() throws IOException { runTest(AVRO, AVRO, true, newSparkVerifier(Collections.emptyList()) .withMaxGroupSize(2)); }
public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; }
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } }
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } SparkVerifier(List<String> groupKeyColumns); }
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } SparkVerifier(List<String> groupKeyColumns); final SparkVerifier withMetadata(String name, String value); SparkVerifier withIgnoreSurplusColumns(boolean ignoreSurplusColumns); SparkVerifier withCol...
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } SparkVerifier(List<String> groupKeyColumns); final SparkVerifier withMetadata(String name, String value); SparkVerifier withIgnoreSurplusColumns(boolean ignoreSurplusColumns); SparkVerifier withCol...
@Test(expected = IllegalArgumentException.class) public void createList_wrongRowSize() { ListVerifiableTable.create(Arrays.asList(Arrays.asList("A", "B"), Arrays.asList(1, 2), Collections.singletonList(3))); }
public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verifyRowSize(headers).andThen(rowList::add)); return n...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
@Test(expected = IllegalArgumentException.class) public void createHeadersAndList_wrongRowSize() { ListVerifiableTable.create(Arrays.asList("A", "B"), Arrays.asList(Arrays.asList(1, 2), Arrays.asList(3, 4, 5))); }
public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verifyRowSize(headers).andThen(rowList::add)); return n...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
@Test(expected = IllegalArgumentException.class) public void createHeadersAndIterable_wrongRowSize() { ListVerifiableTable.create(Arrays.asList("A", "B"), new LinkedHashSet<>(Arrays.asList(Arrays.asList(1, 2), Arrays.asList(3, 4, 5)))); }
public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verifyRowSize(headers).andThen(rowList::add)); return n...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
ListVerifiableTable implements VerifiableTable { public static VerifiableTable create(Iterable<List> headersAndRows) { Iterator<List> iterator = headersAndRows.iterator(); List headers = iterator.next(); headers.forEach(ListVerifiableTable::verifyHeader); List rowList = new ArrayList(); iterator.forEachRemaining(verify...
@Test public void formatNumbers() { CellFormatter formatter = new CellFormatter(0.01, true); Assert.assertEquals("1", formatter.format(1.0d)); Assert.assertEquals("1.1", formatter.format(1.10d)); Assert.assertEquals("1.11", formatter.format(1.11d)); Assert.assertEquals("1.11", formatter.format(1.111d)); Assert.assertEq...
public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } return formatted; } if (value instanceof Date) { return this.dateFo...
CellFormatter implements Function<Object, String>, Serializable { public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } r...
CellFormatter implements Function<Object, String>, Serializable { public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } r...
CellFormatter implements Function<Object, String>, Serializable { public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } r...
CellFormatter implements Function<Object, String>, Serializable { public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } r...
@Test public void formatDate() { CellFormatter formatter = new CellFormatter(0, false); Assert.assertEquals("2009-02-13 23:31:30", formatter.format(Timestamp.valueOf("2009-02-13 23:31:30.0001"))); }
public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } return formatted; } if (value instanceof Date) { return this.dateFo...
CellFormatter implements Function<Object, String>, Serializable { public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } r...
CellFormatter implements Function<Object, String>, Serializable { public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } r...
CellFormatter implements Function<Object, String>, Serializable { public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } r...
CellFormatter implements Function<Object, String>, Serializable { public String format(Object value) { if (isNumber(value)) { if (value.equals(Double.NaN) || value.equals(Float.NaN)) { return "NaN"; } String formatted = this.numberFormat.format(value); if (isNegativeZero(formatted)) { return formatted.substring(1); } r...
@Test public void formatString() { CellFormatter formatter = new CellFormatter(0, false); Assert.assertEquals("", formatter.format("")); Assert.assertEquals("foo", formatter.format("foo")); Assert.assertEquals("foo", formatter.format(" foo ")); Assert.assertEquals("foo bar", formatter.format("foo bar")); Assert.assertE...
private String formatString(String untrimmedValue) { String value = untrimmedValue.trim(); this.builder.setLength(0); boolean changed = false; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (Character.isWhitespace(c)) { this.builder.append(' '); if (c != ' ') { changed = true; } } else { this.b...
CellFormatter implements Function<Object, String>, Serializable { private String formatString(String untrimmedValue) { String value = untrimmedValue.trim(); this.builder.setLength(0); boolean changed = false; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (Character.isWhitespace(c)) { this.buil...
CellFormatter implements Function<Object, String>, Serializable { private String formatString(String untrimmedValue) { String value = untrimmedValue.trim(); this.builder.setLength(0); boolean changed = false; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (Character.isWhitespace(c)) { this.buil...
CellFormatter implements Function<Object, String>, Serializable { private String formatString(String untrimmedValue) { String value = untrimmedValue.trim(); this.builder.setLength(0); boolean changed = false; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (Character.isWhitespace(c)) { this.buil...
CellFormatter implements Function<Object, String>, Serializable { private String formatString(String untrimmedValue) { String value = untrimmedValue.trim(); this.builder.setLength(0); boolean changed = false; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (Character.isWhitespace(c)) { this.buil...
@Test public void testException() throws IOException { String stackTraceToString = ExceptionHtml.stackTraceToString(new RuntimeException(new IllegalArgumentException(new UnsupportedOperationException()))); List<Map.Entry<String, List<String>>> stackTraces = getStackLineCount(stackTraceToString); Assert.assertEquals(3, ...
static String stackTraceToString(Throwable e) throws UnsupportedEncodingException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); PrintStream out = new PrintStream(bytes, false, "UTF-8"); stackTraceToString(e, out); out.close(); return bytes.toString("UTF-8"); }
ExceptionHtml { static String stackTraceToString(Throwable e) throws UnsupportedEncodingException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); PrintStream out = new PrintStream(bytes, false, "UTF-8"); stackTraceToString(e, out); out.close(); return bytes.toString("UTF-8"); } }
ExceptionHtml { static String stackTraceToString(Throwable e) throws UnsupportedEncodingException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); PrintStream out = new PrintStream(bytes, false, "UTF-8"); stackTraceToString(e, out); out.close(); return bytes.toString("UTF-8"); } private ExceptionHtml(); }
ExceptionHtml { static String stackTraceToString(Throwable e) throws UnsupportedEncodingException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); PrintStream out = new PrintStream(bytes, false, "UTF-8"); stackTraceToString(e, out); out.close(); return bytes.toString("UTF-8"); } private ExceptionHtml(); st...
ExceptionHtml { static String stackTraceToString(Throwable e) throws UnsupportedEncodingException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); PrintStream out = new PrintStream(bytes, false, "UTF-8"); stackTraceToString(e, out); out.close(); return bytes.toString("UTF-8"); } private ExceptionHtml(); st...
@Test(expected = IllegalArgumentException.class) public void testAddPartialMatchFailsIfSelf() { this.unmatched.addMatch(2, this.unmatched); }
public void addMatch(int matchScore, UnmatchedIndexMap match) { if (this.equals(match)) { throw new IllegalArgumentException("Cannot add this as partial match"); } if (this.partialMatches == null) { this.partialMatches = new TreeSet<>(); } if (match.partialMatches == null) { match.partialMatches = new TreeSet<>(); } if...
UnmatchedIndexMap extends IndexMap { public void addMatch(int matchScore, UnmatchedIndexMap match) { if (this.equals(match)) { throw new IllegalArgumentException("Cannot add this as partial match"); } if (this.partialMatches == null) { this.partialMatches = new TreeSet<>(); } if (match.partialMatches == null) { match.p...
UnmatchedIndexMap extends IndexMap { public void addMatch(int matchScore, UnmatchedIndexMap match) { if (this.equals(match)) { throw new IllegalArgumentException("Cannot add this as partial match"); } if (this.partialMatches == null) { this.partialMatches = new TreeSet<>(); } if (match.partialMatches == null) { match.p...
UnmatchedIndexMap extends IndexMap { public void addMatch(int matchScore, UnmatchedIndexMap match) { if (this.equals(match)) { throw new IllegalArgumentException("Cannot add this as partial match"); } if (this.partialMatches == null) { this.partialMatches = new TreeSet<>(); } if (match.partialMatches == null) { match.p...
UnmatchedIndexMap extends IndexMap { public void addMatch(int matchScore, UnmatchedIndexMap match) { if (this.equals(match)) { throw new IllegalArgumentException("Cannot add this as partial match"); } if (this.partialMatches == null) { this.partialMatches = new TreeSet<>(); } if (match.partialMatches == null) { match.p...
@Test public void testInitialState() { Assert.assertNull(this.unmatched.getBestMutualMatch()); }
public UnmatchedIndexMap getBestMutualMatch() { return this.bestMutualMatch; }
UnmatchedIndexMap extends IndexMap { public UnmatchedIndexMap getBestMutualMatch() { return this.bestMutualMatch; } }
UnmatchedIndexMap extends IndexMap { public UnmatchedIndexMap getBestMutualMatch() { return this.bestMutualMatch; } UnmatchedIndexMap(int expectedIndex, int actualIndex); }
UnmatchedIndexMap extends IndexMap { public UnmatchedIndexMap getBestMutualMatch() { return this.bestMutualMatch; } UnmatchedIndexMap(int expectedIndex, int actualIndex); void addMatch(int matchScore, UnmatchedIndexMap match); boolean match(); UnmatchedIndexMap getBestMutualMatch(); }
UnmatchedIndexMap extends IndexMap { public UnmatchedIndexMap getBestMutualMatch() { return this.bestMutualMatch; } UnmatchedIndexMap(int expectedIndex, int actualIndex); void addMatch(int matchScore, UnmatchedIndexMap match); boolean match(); UnmatchedIndexMap getBestMutualMatch(); }
@Test public void executionTimesOut() { try { PartialMatcher endlessMatcher = (allMissingRows, allSurplusRows, matchedColumns) -> { while (true); }; new TimeBoundPartialMatcher(endlessMatcher, 1L).match(null, null, null); Assert.fail("timeout expected"); } catch (RuntimeException e) { Assert.assertTrue(e.getCause() ins...
@Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<?> result = executorService.submit(() -> Ti...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
@Test public void runTestWithSingleShardColumn() throws IOException { runTest(AVRO, AVRO_X, false, newSparkVerifier(Collections.singletonList("k2")) .withMaxGroupSize(2)); }
public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; }
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } }
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } SparkVerifier(List<String> groupKeyColumns); }
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } SparkVerifier(List<String> groupKeyColumns); final SparkVerifier withMetadata(String name, String value); SparkVerifier withIgnoreSurplusColumns(boolean ignoreSurplusColumns); SparkVerifier withCol...
SparkVerifier { public SparkVerifier withMaxGroupSize(int maxGroupSize) { this.maxGroupSize = maxGroupSize; return this; } SparkVerifier(List<String> groupKeyColumns); final SparkVerifier withMetadata(String name, String value); SparkVerifier withIgnoreSurplusColumns(boolean ignoreSurplusColumns); SparkVerifier withCol...
@Test(expected = IndexOutOfBoundsException.class) public void matchingExceptionPropagates() { PartialMatcher dyingMatcher = (allMissingRows, allSurplusRows, matchedColumns) -> Collections.singletonList("foo").get(2); new TimeBoundPartialMatcher(dyingMatcher, Long.MAX_VALUE).match(null, null, null); }
@Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<?> result = executorService.submit(() -> Ti...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
@Test public void matchingErrorPropagates() { PartialMatcher dyingMatcher = (allMissingRows, allSurplusRows, matchedColumns) -> { throw new NoSuchMethodError(); }; try { new TimeBoundPartialMatcher(dyingMatcher, Long.MAX_VALUE).match(null, null, null); Assert.fail(); } catch (RuntimeException e) { Assert.assertTrue(e.g...
@Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<?> result = executorService.submit(() -> Ti...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...
TimeBoundPartialMatcher implements PartialMatcher { @Override public void match(final List<UnmatchedIndexMap> allMissingRows, final List<UnmatchedIndexMap> allSurplusRows, final List<IndexMap> matchedColumns) { LOGGER.debug("Starting partial match"); ExecutorService executorService = Executors.newSingleThreadExecutor()...