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 getReasonableSmallerEvenDistance() throws Exception { long actual = DistanceUtil.getReasonableSmallerEvenDistance(1); assertEquals(1, actual); actual = DistanceUtil.getReasonableSmallerEvenDistance(12); assertEquals(10, actual); actual = DistanceUtil.getReasonableSmallerEvenDistance(52); assertEquals(...
public static long getReasonableSmallerEvenDistance(double distance) { return getClosestEvenDistance(distance, getMaximumEvenIncrement(distance)); }
DistanceUtil { public static long getReasonableSmallerEvenDistance(double distance) { return getClosestEvenDistance(distance, getMaximumEvenIncrement(distance)); } }
DistanceUtil { public static long getReasonableSmallerEvenDistance(double distance) { return getClosestEvenDistance(distance, getMaximumEvenIncrement(distance)); } }
DistanceUtil { public static long getReasonableSmallerEvenDistance(double distance) { return getClosestEvenDistance(distance, getMaximumEvenIncrement(distance)); } static long getClosestEvenDistance(double distance, int evenIncrement); static long getReasonableSmallerEvenDistance(double distance); static int getMaximu...
DistanceUtil { public static long getReasonableSmallerEvenDistance(double distance) { return getClosestEvenDistance(distance, getMaximumEvenIncrement(distance)); } static long getClosestEvenDistance(double distance, int evenIncrement); static long getReasonableSmallerEvenDistance(double distance); static int getMaximu...
@Test public void getTopLeftLocation() { Location topLeftLocation = new Location(52.512653658536856, 13.390293996004692); assertEquals(0, topLeftLocation.getDistanceTo(beaconMapBackground.getTopLeftLocation()), 0.001); }
public Location getTopLeftLocation() { return topLeftLocation; }
BeaconMapBackground { public Location getTopLeftLocation() { return topLeftLocation; } }
BeaconMapBackground { public Location getTopLeftLocation() { return topLeftLocation; } private BeaconMapBackground(Bitmap imageBitmap); }
BeaconMapBackground { public Location getTopLeftLocation() { return topLeftLocation; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point firstRe...
BeaconMapBackground { public Location getTopLeftLocation() { return topLeftLocation; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point firstRe...
@Test public void getMaximumEvenIncrement() throws Exception { int actual = DistanceUtil.getMaximumEvenIncrement(1); assertEquals(1, actual); actual = DistanceUtil.getMaximumEvenIncrement(12); assertEquals(10, actual); actual = DistanceUtil.getMaximumEvenIncrement(52); assertEquals(10, actual); actual = DistanceUtil.ge...
public static int getMaximumEvenIncrement(double distance) { if (distance < 10) { return 1; } return (int) Math.pow(10, Math.floor(Math.log10(distance))); }
DistanceUtil { public static int getMaximumEvenIncrement(double distance) { if (distance < 10) { return 1; } return (int) Math.pow(10, Math.floor(Math.log10(distance))); } }
DistanceUtil { public static int getMaximumEvenIncrement(double distance) { if (distance < 10) { return 1; } return (int) Math.pow(10, Math.floor(Math.log10(distance))); } }
DistanceUtil { public static int getMaximumEvenIncrement(double distance) { if (distance < 10) { return 1; } return (int) Math.pow(10, Math.floor(Math.log10(distance))); } static long getClosestEvenDistance(double distance, int evenIncrement); static long getReasonableSmallerEvenDistance(double distance); static int g...
DistanceUtil { public static int getMaximumEvenIncrement(double distance) { if (distance < 10) { return 1; } return (int) Math.pow(10, Math.floor(Math.log10(distance))); } static long getClosestEvenDistance(double distance, int evenIncrement); static long getReasonableSmallerEvenDistance(double distance); static int g...
@Test public void getClosestEvenDistance() throws Exception { long actual = DistanceUtil.getClosestEvenDistance(96, 10); assertEquals(100, actual); actual = DistanceUtil.getClosestEvenDistance(94, 10); assertEquals(90, actual); actual = DistanceUtil.getClosestEvenDistance(99, 100); assertEquals(100, actual); actual = D...
public static long getClosestEvenDistance(double distance, int evenIncrement) { return Math.round(distance / evenIncrement) * evenIncrement; }
DistanceUtil { public static long getClosestEvenDistance(double distance, int evenIncrement) { return Math.round(distance / evenIncrement) * evenIncrement; } }
DistanceUtil { public static long getClosestEvenDistance(double distance, int evenIncrement) { return Math.round(distance / evenIncrement) * evenIncrement; } }
DistanceUtil { public static long getClosestEvenDistance(double distance, int evenIncrement) { return Math.round(distance / evenIncrement) * evenIncrement; } static long getClosestEvenDistance(double distance, int evenIncrement); static long getReasonableSmallerEvenDistance(double distance); static int getMaximumEvenI...
DistanceUtil { public static long getClosestEvenDistance(double distance, int evenIncrement) { return Math.round(distance / evenIncrement) * evenIncrement; } static long getClosestEvenDistance(double distance, int evenIncrement); static long getReasonableSmallerEvenDistance(double distance); static int getMaximumEvenI...
@Test public void calculateDistanceBetween_soccerFieldCorners_correctFieldDimensions() throws Exception { final double tolerableDelta = 1; double calculatedFieldWidth = LocationDistanceCalculator.calculateDistanceBetween(LocationTest.SOCCER_FIELD_TOP_LEFT, LocationTest.SOCCER_FIELD_TOP_RIGHT); assertEquals(LocationTest...
public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); }
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
@Test public void calculateDistanceBetween_newYorkBerlin_correctDistance() throws Exception { final double tolerableDelta = 5000; double calculatedDistance = LocationDistanceCalculator.calculateDistanceBetween(LocationTest.NEW_YORK_CITY, LocationTest.BERLIN); assertEquals(LocationTest.DISTANCE_NYC_BERLIN, calculatedDis...
public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); }
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
@Test public void calculateDistanceBetween_swappedLocations_sameDistance() throws Exception { double calculatedDistance1 = LocationDistanceCalculator.calculateDistanceBetween(LocationTest.NEW_YORK_CITY, LocationTest.BERLIN); double calculatedDistance2 = LocationDistanceCalculator.calculateDistanceBetween(LocationTest.B...
public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); }
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
@Test public void calculateDistanceBetween_locationsWithElevation_correctDistance() throws Exception { Location lowLocation = new Location(0, 0, 0, 0); Location highLocation = new Location(0, 0, 0, 10); double calculatedDistance = LocationDistanceCalculator.calculateDistanceBetween(lowLocation, highLocation); assertEqu...
public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); }
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
@Test public void calculateDistanceBetween_locationsWithAltitude_correctDistance() throws Exception { Location lowLocation = new Location(0, 0, 0, 0); Location highLocation = new Location(0, 0, 10, 0); double calculatedDistance = LocationDistanceCalculator.calculateDistanceBetween(lowLocation, highLocation); assertEqua...
public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); }
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
@Test public void calculateDistanceBetween_locationsWithAltitudeAndElevation_correctDistance() throws Exception { Location lowLocation = new Location(0, 0, 0, 0); Location highLocation = new Location(0, 0, 10, 10); double calculatedDistance = LocationDistanceCalculator.calculateDistanceBetween(lowLocation, highLocation...
public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); }
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.getAltitude() ); ...
@Test public void meanLocation_multipleLocations_correctMeanLocation() throws Exception { List<Location> locationList = new ArrayList<>(Arrays.asList( LocationTest.NEW_YORK_CITY, LocationTest.BERLIN )); Location expectedLocation = new Location(46.61639095, -30.3005094); Location actualLocation = LocationUtil.calculateM...
public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } static Location calculateMeanLocationFromLast(List<Location> locationList, long amount, TimeUnit timeUnit); static Location calculateMeanLocation(Location... locations); static...
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } static Location calculateMeanLocationFromLast(List<Location> locationList, long amount, TimeUnit timeUnit); static Location calculateMeanLocation(Location... locations); static...
@Test public void meanLocation_multipleLocationsCloseDistances_correctMeanLocation() throws Exception { List<Location> locationList = new ArrayList<>(Arrays.asList( LocationTest.SOCCER_FIELD_BOTTOM_LEFT, LocationTest.SOCCER_FIELD_BOTTOM_RIGHT, LocationTest.SOCCER_FIELD_TOP_LEFT, LocationTest.SOCCER_FIELD_TOP_RIGHT, Loc...
public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } static Location calculateMeanLocationFromLast(List<Location> locationList, long amount, TimeUnit timeUnit); static Location calculateMeanLocation(Location... locations); static...
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } static Location calculateMeanLocationFromLast(List<Location> locationList, long amount, TimeUnit timeUnit); static Location calculateMeanLocation(Location... locations); static...
@Test public void getBottomRightLocation() { Location bottomRightLocation = new Location(52.512295922346524, 13.391304257299764); assertEquals(0, bottomRightLocation.getDistanceTo(beaconMapBackground.getBottomRightLocation()), 0.001); }
public Location getBottomRightLocation() { return bottomRightLocation; }
BeaconMapBackground { public Location getBottomRightLocation() { return bottomRightLocation; } }
BeaconMapBackground { public Location getBottomRightLocation() { return bottomRightLocation; } private BeaconMapBackground(Bitmap imageBitmap); }
BeaconMapBackground { public Location getBottomRightLocation() { return bottomRightLocation; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point...
BeaconMapBackground { public Location getBottomRightLocation() { return bottomRightLocation; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point...
@Test public void meanLocation_singleLocation_correctLocation() throws Exception { List<Location> singleLocationList = new ArrayList<>(Arrays.asList( LocationTest.BERLIN )); Location expectedLocation = new Location(LocationTest.BERLIN); Location actualLocation = LocationUtil.calculateMeanLocation(singleLocationList); a...
public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } static Location calculateMeanLocationFromLast(List<Location> locationList, long amount, TimeUnit timeUnit); static Location calculateMeanLocation(Location... locations); static...
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } static Location calculateMeanLocationFromLast(List<Location> locationList, long amount, TimeUnit timeUnit); static Location calculateMeanLocation(Location... locations); static...
@Test public void meanLocation_emptyLocationList_correctMeanLocation() throws Exception { List<Location> emptyLocationList = new ArrayList<>(); Location expectedLocation = null; Location actualLocation = LocationUtil.calculateMeanLocation(emptyLocationList); assertEquals(expectedLocation, actualLocation); }
public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } }
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } static Location calculateMeanLocationFromLast(List<Location> locationList, long amount, TimeUnit timeUnit); static Location calculateMeanLocation(Location... locations); static...
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } static Location calculateMeanLocationFromLast(List<Location> locationList, long amount, TimeUnit timeUnit); static Location calculateMeanLocation(Location... locations); static...
@Test public void getLocationsBetween_locationListWithTimestamps_correctTimestampFilteredLocations() throws Exception { final Location firstLocation = LocationTest.SOCCER_FIELD_TOP_LEFT; final Location secondLocation = LocationTest.SOCCER_FIELD_TOP_RIGHT; final Location thirdLocation = LocationTest.SOCCER_FIELD_BOTTOM_...
public static List<Location> getLocationsBetween(List<Location> locationList, long minimumTimestamp, long maximumTimestamp) { List<Location> matchingLocations = new ArrayList<>(); for (Location location : locationList) { if (location.getTimestamp() < minimumTimestamp || location.getTimestamp() >= maximumTimestamp) { co...
LocationUtil { public static List<Location> getLocationsBetween(List<Location> locationList, long minimumTimestamp, long maximumTimestamp) { List<Location> matchingLocations = new ArrayList<>(); for (Location location : locationList) { if (location.getTimestamp() < minimumTimestamp || location.getTimestamp() >= maximum...
LocationUtil { public static List<Location> getLocationsBetween(List<Location> locationList, long minimumTimestamp, long maximumTimestamp) { List<Location> matchingLocations = new ArrayList<>(); for (Location location : locationList) { if (location.getTimestamp() < minimumTimestamp || location.getTimestamp() >= maximum...
LocationUtil { public static List<Location> getLocationsBetween(List<Location> locationList, long minimumTimestamp, long maximumTimestamp) { List<Location> matchingLocations = new ArrayList<>(); for (Location location : locationList) { if (location.getTimestamp() < minimumTimestamp || location.getTimestamp() >= maximum...
LocationUtil { public static List<Location> getLocationsBetween(List<Location> locationList, long minimumTimestamp, long maximumTimestamp) { List<Location> matchingLocations = new ArrayList<>(); for (Location location : locationList) { if (location.getTimestamp() < minimumTimestamp || location.getTimestamp() >= maximum...
@Test public void calculateAngleMean_validAngles_correctAngle() throws Exception { double angles[] = {10, 350, 0, 20, 340}; double expectedAngle = 0; double actualAngle = calculateMeanAngle(angles); assertEquals(expectedAngle, actualAngle, 0.00001); angles = new double[]{10}; expectedAngle = 10; actualAngle = calculate...
public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angle)); } retur...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
@Test public void calculateAngleMean_invalidAngles_correctAngle() throws Exception { double angles[] = null; double expectedAngle = 0; double actualAngle = calculateMeanAngle(angles); assertEquals(expectedAngle, actualAngle, 0); angles = new double[]{}; expectedAngle = 0; actualAngle = calculateMeanAngle(angles); asser...
public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angle)); } retur...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
@Test public void calculateAngleMean_negativeAngles_unequalAngles() throws Exception { double angles[] = new double[]{-90}; double negativeAngle = calculateMeanAngle(angles); angles = new double[]{270}; double positiveAngle = calculateMeanAngle(angles); assertNotEquals(negativeAngle, positiveAngle); }
public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angle)); } retur...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.toRadians(angl...
@Test public void getTopLeftPoint() { assertPointEquals(new Point(0, 0), beaconMapBackground.getTopLeftPoint(), 0); }
public Point getTopLeftPoint() { return topLeftPoint; }
BeaconMapBackground { public Point getTopLeftPoint() { return topLeftPoint; } }
BeaconMapBackground { public Point getTopLeftPoint() { return topLeftPoint; } private BeaconMapBackground(Bitmap imageBitmap); }
BeaconMapBackground { public Point getTopLeftPoint() { return topLeftPoint; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point firstReferencePo...
BeaconMapBackground { public Point getTopLeftPoint() { return topLeftPoint; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point firstReferencePo...
@Test public void getBottomRightPoint() { assertPointEquals(new Point(backgroundImage.getWidth(), backgroundImage.getHeight()), beaconMapBackground.getBottomRightPoint(), 0); }
public Point getBottomRightPoint() { return bottomRightPoint; }
BeaconMapBackground { public Point getBottomRightPoint() { return bottomRightPoint; } }
BeaconMapBackground { public Point getBottomRightPoint() { return bottomRightPoint; } private BeaconMapBackground(Bitmap imageBitmap); }
BeaconMapBackground { public Point getBottomRightPoint() { return bottomRightPoint; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point firstRef...
BeaconMapBackground { public Point getBottomRightPoint() { return bottomRightPoint; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point firstRef...
@Test public void canCreateAdvertisingPacket_validData_returnsTrue() { IBeaconAdvertisingPacketFactory advertisingPacketFactory = new IBeaconAdvertisingPacketFactory(); assertTrue(advertisingPacketFactory.canCreateAdvertisingPacketWithSubFactories(BeaconTest.IBEACON_ADVERTISING_DATA)); }
protected boolean canCreateAdvertisingPacketWithSubFactories(byte[] advertisingData) { for (AdvertisingPacketFactory<AP> advertisingPacketFactory : subFactoryMap.values()) { if (advertisingPacketFactory.canCreateAdvertisingPacketWithSubFactories(advertisingData)) { return true; } } return canCreateAdvertisingPacket(adv...
AdvertisingPacketFactory { protected boolean canCreateAdvertisingPacketWithSubFactories(byte[] advertisingData) { for (AdvertisingPacketFactory<AP> advertisingPacketFactory : subFactoryMap.values()) { if (advertisingPacketFactory.canCreateAdvertisingPacketWithSubFactories(advertisingData)) { return true; } } return can...
AdvertisingPacketFactory { protected boolean canCreateAdvertisingPacketWithSubFactories(byte[] advertisingData) { for (AdvertisingPacketFactory<AP> advertisingPacketFactory : subFactoryMap.values()) { if (advertisingPacketFactory.canCreateAdvertisingPacketWithSubFactories(advertisingData)) { return true; } } return can...
AdvertisingPacketFactory { protected boolean canCreateAdvertisingPacketWithSubFactories(byte[] advertisingData) { for (AdvertisingPacketFactory<AP> advertisingPacketFactory : subFactoryMap.values()) { if (advertisingPacketFactory.canCreateAdvertisingPacketWithSubFactories(advertisingData)) { return true; } } return can...
AdvertisingPacketFactory { protected boolean canCreateAdvertisingPacketWithSubFactories(byte[] advertisingData) { for (AdvertisingPacketFactory<AP> advertisingPacketFactory : subFactoryMap.values()) { if (advertisingPacketFactory.canCreateAdvertisingPacketWithSubFactories(advertisingData)) { return true; } } return can...
@Test public void canCreateAdvertisingPacket_invalidData_returnsFalse() { IBeaconAdvertisingPacketFactory advertisingPacketFactory = new IBeaconAdvertisingPacketFactory(); assertFalse(advertisingPacketFactory.canCreateAdvertisingPacket(new byte[5])); }
abstract boolean canCreateAdvertisingPacket(byte[] advertisingData);
AdvertisingPacketFactory { abstract boolean canCreateAdvertisingPacket(byte[] advertisingData); }
AdvertisingPacketFactory { abstract boolean canCreateAdvertisingPacket(byte[] advertisingData); AdvertisingPacketFactory(Class<AP> packetClass); }
AdvertisingPacketFactory { abstract boolean canCreateAdvertisingPacket(byte[] advertisingData); AdvertisingPacketFactory(Class<AP> packetClass); AdvertisingPacketFactory<AP> getAdvertisingPacketFactory(Class advertisingPacketClass); AdvertisingPacketFactory<AP> getAdvertisingPacketFactory(byte[] advertisingData); void ...
AdvertisingPacketFactory { abstract boolean canCreateAdvertisingPacket(byte[] advertisingData); AdvertisingPacketFactory(Class<AP> packetClass); AdvertisingPacketFactory<AP> getAdvertisingPacketFactory(Class advertisingPacketClass); AdvertisingPacketFactory<AP> getAdvertisingPacketFactory(byte[] advertisingData); void ...
@Test public void decideNextActivity_UserNotLoggedIn_OpenLoginActivity() throws InterruptedException { when(dataManager.getCurrentUserLoggedInMode()). thenReturn(DataManager.LoggedInMode.LOGGED_IN_MODE_LOGGED_OUT.getType()); splashPresenter.onAttach(splashMvpView); Thread.sleep(2000); verify(splashMvpView).openLoginAct...
@Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); }
SplashPresenter extends BasePresenter<V> implements SplashMvpPresenter<V> { @Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); } }
SplashPresenter extends BasePresenter<V> implements SplashMvpPresenter<V> { @Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); } @Inject SplashPresenter(SchedulerProvider schedulerProvider, CompositeDisposable compositeDisposable, Data...
SplashPresenter extends BasePresenter<V> implements SplashMvpPresenter<V> { @Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); } @Inject SplashPresenter(SchedulerProvider schedulerProvider, CompositeDisposable compositeDisposable, Data...
SplashPresenter extends BasePresenter<V> implements SplashMvpPresenter<V> { @Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); } @Inject SplashPresenter(SchedulerProvider schedulerProvider, CompositeDisposable compositeDisposable, Data...
@Test public void getNegativeLong_NegativeInt_PositiveLong() { assertThat(CommonUtils.getNegativeLong(-2), is(2l)); }
public static Long getNegativeLong(int number) { return ( - (long) number); }
CommonUtils { public static Long getNegativeLong(int number) { return ( - (long) number); } }
CommonUtils { public static Long getNegativeLong(int number) { return ( - (long) number); } private CommonUtils(); }
CommonUtils { public static Long getNegativeLong(int number) { return ( - (long) number); } private CommonUtils(); static ProgressDialog showLoadingDialog(Context context); static boolean isEmailValid(String email); static String getTimeStamp(); static Long getNegativeLong(int number); }
CommonUtils { public static Long getNegativeLong(int number) { return ( - (long) number); } private CommonUtils(); static ProgressDialog showLoadingDialog(Context context); static boolean isEmailValid(String email); static String getTimeStamp(); static Long getNegativeLong(int number); }
@Test public void decideNextActivity_UserLoggedIn_OpenMainActivity() throws InterruptedException { when(dataManager.getCurrentUserLoggedInMode()). thenReturn(DataManager.LoggedInMode.LOGGED_IN_MODE_LOGGED_SERVER.getType()); splashPresenter.onAttach(splashMvpView); Thread.sleep(2500); verify(splashMvpView).openMainActiv...
@Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); }
SplashPresenter extends BasePresenter<V> implements SplashMvpPresenter<V> { @Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); } }
SplashPresenter extends BasePresenter<V> implements SplashMvpPresenter<V> { @Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); } @Inject SplashPresenter(SchedulerProvider schedulerProvider, CompositeDisposable compositeDisposable, Data...
SplashPresenter extends BasePresenter<V> implements SplashMvpPresenter<V> { @Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); } @Inject SplashPresenter(SchedulerProvider schedulerProvider, CompositeDisposable compositeDisposable, Data...
SplashPresenter extends BasePresenter<V> implements SplashMvpPresenter<V> { @Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); } @Inject SplashPresenter(SchedulerProvider schedulerProvider, CompositeDisposable compositeDisposable, Data...
@Test public void isEmailValid_NoAtTheRate_False() { assertFalse(CommonUtils.isEmailValid(NO_AT_THE_RATE)); }
public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matches(); }
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
@Test public void isEmailValid_NoDomain_False() { assertFalse(CommonUtils.isEmailValid(NO_DOMAIN)); }
public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matches(); }
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
@Test public void isEmailValid_NoAtTheRateAndDomain_False() { assertFalse(CommonUtils.isEmailValid(NO_AT_THE_RATE_AND_DOMAIN)); }
public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matches(); }
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
@Test public void isEmailValid_UnAllowedSpecialCharacters1_False() { assertFalse(CommonUtils.isEmailValid(UN_ALLOWED_SPECIAL_CHARACTERS1)); }
public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matches(); }
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
@Test public void isEmailValid_UnAllowedSpecialCharacters2_False() { assertFalse(CommonUtils.isEmailValid(UN_ALLOWED_SPECIAL_CHARACTERS2)); }
public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matches(); }
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
@Test public void isEmailValid_UnAllowedSpecialCharacters3_False() { assertFalse(CommonUtils.isEmailValid(UN_ALLOWED_SPECIAL_CHARACTERS3)); }
public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matches(); }
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
@Test public void isEmailValid_CorrectInput_True() { assertTrue(CommonUtils.isEmailValid(CORRECT_INPUT)); }
public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matches(); }
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); return matcher.matc...
@Test public void getNegativeLong_PositiveInt_NegativeLong() { assertThat(CommonUtils.getNegativeLong(2), is(-2l)); }
public static Long getNegativeLong(int number) { return ( - (long) number); }
CommonUtils { public static Long getNegativeLong(int number) { return ( - (long) number); } }
CommonUtils { public static Long getNegativeLong(int number) { return ( - (long) number); } private CommonUtils(); }
CommonUtils { public static Long getNegativeLong(int number) { return ( - (long) number); } private CommonUtils(); static ProgressDialog showLoadingDialog(Context context); static boolean isEmailValid(String email); static String getTimeStamp(); static Long getNegativeLong(int number); }
CommonUtils { public static Long getNegativeLong(int number) { return ( - (long) number); } private CommonUtils(); static ProgressDialog showLoadingDialog(Context context); static boolean isEmailValid(String email); static String getTimeStamp(); static Long getNegativeLong(int number); }
@Test public void printHelp() { StringWriter writer = new StringWriter(); PrintWriter out = new PrintWriter(writer); AardvarkHelpMode.printHelp(out); String eol = System.getProperty("line.separator"); assertEquals( "Usage:" + eol + " vark [-f FILE] [options] [targets...]" + eol + "" + eol + "Options:" + eol + " -f, -fi...
static void printHelp(PrintWriter out) { out.println("Usage:"); out.println(" vark [-f FILE] [options] [targets...]"); out.println(); out.println("Options:"); IArgKeyList keys = Launch.factory().createArgKeyList(); for (IArgKey key : AardvarkOptions.getArgKeys()) { keys.register(key); } keys.printHelp(out); }
AardvarkHelpMode extends GosuMode { static void printHelp(PrintWriter out) { out.println("Usage:"); out.println(" vark [-f FILE] [options] [targets...]"); out.println(); out.println("Options:"); IArgKeyList keys = Launch.factory().createArgKeyList(); for (IArgKey key : AardvarkOptions.getArgKeys()) { keys.register(key)...
AardvarkHelpMode extends GosuMode { static void printHelp(PrintWriter out) { out.println("Usage:"); out.println(" vark [-f FILE] [options] [targets...]"); out.println(); out.println("Options:"); IArgKeyList keys = Launch.factory().createArgKeyList(); for (IArgKey key : AardvarkOptions.getArgKeys()) { keys.register(key)...
AardvarkHelpMode extends GosuMode { static void printHelp(PrintWriter out) { out.println("Usage:"); out.println(" vark [-f FILE] [options] [targets...]"); out.println(); out.println("Options:"); IArgKeyList keys = Launch.factory().createArgKeyList(); for (IArgKey key : AardvarkOptions.getArgKeys()) { keys.register(key)...
AardvarkHelpMode extends GosuMode { static void printHelp(PrintWriter out) { out.println("Usage:"); out.println(" vark [-f FILE] [options] [targets...]"); out.println(); out.println("Options:"); IArgKeyList keys = Launch.factory().createArgKeyList(); for (IArgKey key : AardvarkOptions.getArgKeys()) { keys.register(key)...
@Test(expected = ClosedWatchServiceException.class) public void testRegisterPath_whenNotRunning() { watchService.setRunning(false); GlusterPath mockPath = mock(GlusterPath.class); watchService.registerPath(mockPath); }
public WatchKey registerPath(GlusterPath path, WatchEvent.Kind... kinds) { if (!running) { throw new ClosedWatchServiceException(); } for (GlusterWatchKey k : paths) { if (k.getPath().equals(path)) { k.setKinds(kinds); return k; } } GlusterWatchKey key = new GlusterWatchKey(path, kinds); paths.add(key); return key; }
GlusterWatchService implements WatchService { public WatchKey registerPath(GlusterPath path, WatchEvent.Kind... kinds) { if (!running) { throw new ClosedWatchServiceException(); } for (GlusterWatchKey k : paths) { if (k.getPath().equals(path)) { k.setKinds(kinds); return k; } } GlusterWatchKey key = new GlusterWatchKey...
GlusterWatchService implements WatchService { public WatchKey registerPath(GlusterPath path, WatchEvent.Kind... kinds) { if (!running) { throw new ClosedWatchServiceException(); } for (GlusterWatchKey k : paths) { if (k.getPath().equals(path)) { k.setKinds(kinds); return k; } } GlusterWatchKey key = new GlusterWatchKey...
GlusterWatchService implements WatchService { public WatchKey registerPath(GlusterPath path, WatchEvent.Kind... kinds) { if (!running) { throw new ClosedWatchServiceException(); } for (GlusterWatchKey k : paths) { if (k.getPath().equals(path)) { k.setKinds(kinds); return k; } } GlusterWatchKey key = new GlusterWatchKey...
GlusterWatchService implements WatchService { public WatchKey registerPath(GlusterPath path, WatchEvent.Kind... kinds) { if (!running) { throw new ClosedWatchServiceException(); } for (GlusterWatchKey k : paths) { if (k.getPath().equals(path)) { k.setKinds(kinds); return k; } } GlusterWatchKey key = new GlusterWatchKey...
@Test public void testIsOpen_whenClosed() { fileSystem.setVolptr(-1); assertEquals(false, fileSystem.isOpen()); }
@Override public boolean isOpen() { return volptr > 0; }
GlusterFileSystem extends FileSystem { @Override public boolean isOpen() { return volptr > 0; } }
GlusterFileSystem extends FileSystem { @Override public boolean isOpen() { return volptr > 0; } }
GlusterFileSystem extends FileSystem { @Override public boolean isOpen() { return volptr > 0; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Iterable...
GlusterFileSystem extends FileSystem { @Override public boolean isOpen() { return volptr > 0; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Iterable...
@Test public void testIsReadOnly() { assertFalse(fileSystem.isReadOnly()); }
@Override public boolean isReadOnly() { return false; }
GlusterFileSystem extends FileSystem { @Override public boolean isReadOnly() { return false; } }
GlusterFileSystem extends FileSystem { @Override public boolean isReadOnly() { return false; } }
GlusterFileSystem extends FileSystem { @Override public boolean isReadOnly() { return false; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Iterable<...
GlusterFileSystem extends FileSystem { @Override public boolean isReadOnly() { return false; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Iterable<...
@Test public void testGetSeparator() { assertEquals("/", fileSystem.getSeparator()); }
@Override public String getSeparator() { return SEPARATOR; }
GlusterFileSystem extends FileSystem { @Override public String getSeparator() { return SEPARATOR; } }
GlusterFileSystem extends FileSystem { @Override public String getSeparator() { return SEPARATOR; } }
GlusterFileSystem extends FileSystem { @Override public String getSeparator() { return SEPARATOR; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Iter...
GlusterFileSystem extends FileSystem { @Override public String getSeparator() { return SEPARATOR; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Iter...
@Test public void testGetRootDirectories() { Iterable<Path> pi = fileSystem.getRootDirectories(); Iterator<Path> iterator = pi.iterator(); Path path = new GlusterPath(fileSystem, "/"); assertEquals(path, iterator.next()); assertFalse(iterator.hasNext()); }
@Override public Iterable<Path> getRootDirectories() { GlusterPath root = new GlusterPath(this, "/"); List<Path> list = new ArrayList<Path>(1); list.add(root); return Collections.unmodifiableList(list); }
GlusterFileSystem extends FileSystem { @Override public Iterable<Path> getRootDirectories() { GlusterPath root = new GlusterPath(this, "/"); List<Path> list = new ArrayList<Path>(1); list.add(root); return Collections.unmodifiableList(list); } }
GlusterFileSystem extends FileSystem { @Override public Iterable<Path> getRootDirectories() { GlusterPath root = new GlusterPath(this, "/"); List<Path> list = new ArrayList<Path>(1); list.add(root); return Collections.unmodifiableList(list); } }
GlusterFileSystem extends FileSystem { @Override public Iterable<Path> getRootDirectories() { GlusterPath root = new GlusterPath(this, "/"); List<Path> list = new ArrayList<Path>(1); list.add(root); return Collections.unmodifiableList(list); } @Override FileSystemProvider provider(); @Override void close(); @Override ...
GlusterFileSystem extends FileSystem { @Override public Iterable<Path> getRootDirectories() { GlusterPath root = new GlusterPath(this, "/"); List<Path> list = new ArrayList<Path>(1); list.add(root); return Collections.unmodifiableList(list); } @Override FileSystemProvider provider(); @Override void close(); @Override ...
@Test public void testGetFileStores() { GlusterFileStore correctStore = new GlusterFileStore(fileSystem); Iterable<FileStore> stores = fileSystem.getFileStores(); Iterator<FileStore> iterator = stores.iterator(); assertEquals(correctStore, iterator.next()); assertFalse(iterator.hasNext()); }
@Override public Iterable<FileStore> getFileStores() { GlusterFileStore store = new GlusterFileStore(this); List<FileStore> stores = new ArrayList<FileStore>(1); stores.add(store); return Collections.unmodifiableList(stores); }
GlusterFileSystem extends FileSystem { @Override public Iterable<FileStore> getFileStores() { GlusterFileStore store = new GlusterFileStore(this); List<FileStore> stores = new ArrayList<FileStore>(1); stores.add(store); return Collections.unmodifiableList(stores); } }
GlusterFileSystem extends FileSystem { @Override public Iterable<FileStore> getFileStores() { GlusterFileStore store = new GlusterFileStore(this); List<FileStore> stores = new ArrayList<FileStore>(1); stores.add(store); return Collections.unmodifiableList(stores); } }
GlusterFileSystem extends FileSystem { @Override public Iterable<FileStore> getFileStores() { GlusterFileStore store = new GlusterFileStore(this); List<FileStore> stores = new ArrayList<FileStore>(1); stores.add(store); return Collections.unmodifiableList(stores); } @Override FileSystemProvider provider(); @Override v...
GlusterFileSystem extends FileSystem { @Override public Iterable<FileStore> getFileStores() { GlusterFileStore store = new GlusterFileStore(this); List<FileStore> stores = new ArrayList<FileStore>(1); stores.add(store); return Collections.unmodifiableList(stores); } @Override FileSystemProvider provider(); @Override v...
@Test public void testGetPath() { Path correctPath = new GlusterPath(fileSystem, "/foo/bar/baz"); Path returnedPath = fileSystem.getPath("/foo", "bar", "baz"); assertEquals(correctPath, returnedPath); }
@Override public Path getPath(String s, String... strings) { boolean absolute = s.startsWith("/"); if (absolute) { s = s.substring(1); } String[] parts; if (null != strings && strings.length > 0) { parts = new String[1 + strings.length]; parts[0] = s; System.arraycopy(strings, 0, parts, 1, strings.length); } else { par...
GlusterFileSystem extends FileSystem { @Override public Path getPath(String s, String... strings) { boolean absolute = s.startsWith("/"); if (absolute) { s = s.substring(1); } String[] parts; if (null != strings && strings.length > 0) { parts = new String[1 + strings.length]; parts[0] = s; System.arraycopy(strings, 0, ...
GlusterFileSystem extends FileSystem { @Override public Path getPath(String s, String... strings) { boolean absolute = s.startsWith("/"); if (absolute) { s = s.substring(1); } String[] parts; if (null != strings && strings.length > 0) { parts = new String[1 + strings.length]; parts[0] = s; System.arraycopy(strings, 0, ...
GlusterFileSystem extends FileSystem { @Override public Path getPath(String s, String... strings) { boolean absolute = s.startsWith("/"); if (absolute) { s = s.substring(1); } String[] parts; if (null != strings && strings.length > 0) { parts = new String[1 + strings.length]; parts[0] = s; System.arraycopy(strings, 0, ...
GlusterFileSystem extends FileSystem { @Override public Path getPath(String s, String... strings) { boolean absolute = s.startsWith("/"); if (absolute) { s = s.substring(1); } String[] parts; if (null != strings && strings.length > 0) { parts = new String[1 + strings.length]; parts[0] = s; System.arraycopy(strings, 0, ...
@Test public void testToString() { doReturn("gluster").when(mockFileSystemProvider).getScheme(); String string = "gluster: assertEquals(string, fileSystem.toString()); verify(mockFileSystemProvider).getScheme(); }
public String toString() { return provider.getScheme() + ": }
GlusterFileSystem extends FileSystem { public String toString() { return provider.getScheme() + ": } }
GlusterFileSystem extends FileSystem { public String toString() { return provider.getScheme() + ": } }
GlusterFileSystem extends FileSystem { public String toString() { return provider.getScheme() + ": } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Ite...
GlusterFileSystem extends FileSystem { public String toString() { return provider.getScheme() + ": } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Override Ite...
@Test(expected = IllegalArgumentException.class) public void testGetPathMatcher_whenBadInput() { fileSystem.getPathMatcher("foo"); }
@Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(parts[1]); } else if ("regex".equals(parts...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
@Test(expected = UnsupportedOperationException.class) public void testGetPathMatcher_whenBadSyntax() { fileSystem.getPathMatcher("foo:bar"); }
@Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(parts[1]); } else if ("regex".equals(parts...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
@Test(expected = PatternSyntaxException.class) public void testGetPathMatcher_whenBadExpression() { fileSystem.getPathMatcher("regex:["); }
@Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(parts[1]); } else if ("regex".equals(parts...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPattern.compile(par...
@Test public void testPollTimeout() throws InterruptedException { long timeout = 150L; TimeUnit unit = TimeUnit.MILLISECONDS; WatchKey mockKey = mock(WatchKey.class); PowerMockito.when(watchService.poll()).thenReturn(null).thenReturn(mockKey); PowerMockito.spy(Thread.class); PowerMockito.doThrow(new InterruptedExceptio...
@Override public WatchKey poll() { if (!running) { throw new ClosedWatchServiceException(); } WatchKey pending = popPending(); if (null != pending) { return pending; } for (GlusterWatchKey k : paths) { if (k.isValid() && k.isReady() && k.update()) { pendingPaths.add(k); } } return popPending(); }
GlusterWatchService implements WatchService { @Override public WatchKey poll() { if (!running) { throw new ClosedWatchServiceException(); } WatchKey pending = popPending(); if (null != pending) { return pending; } for (GlusterWatchKey k : paths) { if (k.isValid() && k.isReady() && k.update()) { pendingPaths.add(k); } }...
GlusterWatchService implements WatchService { @Override public WatchKey poll() { if (!running) { throw new ClosedWatchServiceException(); } WatchKey pending = popPending(); if (null != pending) { return pending; } for (GlusterWatchKey k : paths) { if (k.isValid() && k.isReady() && k.update()) { pendingPaths.add(k); } }...
GlusterWatchService implements WatchService { @Override public WatchKey poll() { if (!running) { throw new ClosedWatchServiceException(); } WatchKey pending = popPending(); if (null != pending) { return pending; } for (GlusterWatchKey k : paths) { if (k.isValid() && k.isReady() && k.update()) { pendingPaths.add(k); } }...
GlusterWatchService implements WatchService { @Override public WatchKey poll() { if (!running) { throw new ClosedWatchServiceException(); } WatchKey pending = popPending(); if (null != pending) { return pending; } for (GlusterWatchKey k : paths) { if (k.isValid() && k.isReady() && k.update()) { pendingPaths.add(k); } }...
@Test(expected = NoSuchElementException.class) public void testNext_whenNoNext() { iterator.next(); }
@Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; } }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; } }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; } @Override boolean hasNext(); @Override GlusterPath next(); @Override void remove(); }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; } @Override boolean hasNext(); @Override GlusterPath next(); @Override void remove(); }
@Test public void testNext() { iterator.setNextPath(fakeResultPath); GlusterPath path = iterator.next(); assertEquals(fakeResultPath, path); }
@Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; } }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; } }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; } @Override boolean hasNext(); @Override GlusterPath next(); @Override void remove(); }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; } @Override boolean hasNext(); @Override GlusterPath next(); @Override void remove(); }
@Test(expected = UnsupportedOperationException.class) public void testRemove() { iterator.remove(); }
@Override public void remove() { throw new UnsupportedOperationException(); }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public void remove() { throw new UnsupportedOperationException(); } }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public void remove() { throw new UnsupportedOperationException(); } }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public void remove() { throw new UnsupportedOperationException(); } @Override boolean hasNext(); @Override GlusterPath next(); @Override void remove(); }
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public void remove() { throw new UnsupportedOperationException(); } @Override boolean hasNext(); @Override GlusterPath next(); @Override void remove(); }
@Test public void testIsAbsolute() { Path p = new GlusterPath(mockFileSystem, "foo/bar"); assertFalse(p.isAbsolute()); p = new GlusterPath(mockFileSystem, "/foo/bar"); assertTrue(p.isAbsolute()); }
@Override public boolean isAbsolute() { return absolute; }
GlusterPath implements Path { @Override public boolean isAbsolute() { return absolute; } }
GlusterPath implements Path { @Override public boolean isAbsolute() { return absolute; } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); }
GlusterPath implements Path { @Override public boolean isAbsolute() { return absolute; } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override Path getFileName(); @Overrid...
GlusterPath implements Path { @Override public boolean isAbsolute() { return absolute; } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override Path getFileName(); @Overrid...
@Test public void testGetRoot_absolute() { List<Path> paths = new LinkedList<Path>(); GlusterPath root = new GlusterPath(mockFileSystem, "/"); paths.add(root); doReturn(paths).when(mockFileSystem).getRootDirectories(); Path p = new GlusterPath(mockFileSystem, "/foo/bar"); Path returned = p.getRoot(); verify(mockFileSys...
@Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } }
GlusterPath implements Path { @Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } } }
GlusterPath implements Path { @Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); }
GlusterPath implements Path { @Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isA...
GlusterPath implements Path { @Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isA...
@Test public void testGetRoot_relative() { Path p = new GlusterPath(mockFileSystem, "foo/bar"); Path returned = p.getRoot(); verify(mockFileSystem, times(0)).getRootDirectories(); assertEquals(null, returned); }
@Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } }
GlusterPath implements Path { @Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } } }
GlusterPath implements Path { @Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); }
GlusterPath implements Path { @Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isA...
GlusterPath implements Path { @Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isA...
@Test public void testToUri() throws URISyntaxException { GlusterFileSystemProvider mockProvider = mock(GlusterFileSystemProvider.class); String scheme = GlusterFileSystemProvider.GLUSTER; doReturn(scheme).when(mockProvider).getScheme(); doReturn(mockProvider).when(mockFileSystem).provider(); String host = "localhost";...
@Override public URI toUri() { try { GlusterFileSystem fs = getFileSystem(); String authority = fs.getHost() + ":" + fs.getVolname(); return new URI(fs.provider().getScheme(), authority, toString(), null, null); } catch (URISyntaxException e) { throw new IllegalStateException(e); } }
GlusterPath implements Path { @Override public URI toUri() { try { GlusterFileSystem fs = getFileSystem(); String authority = fs.getHost() + ":" + fs.getVolname(); return new URI(fs.provider().getScheme(), authority, toString(), null, null); } catch (URISyntaxException e) { throw new IllegalStateException(e); } } }
GlusterPath implements Path { @Override public URI toUri() { try { GlusterFileSystem fs = getFileSystem(); String authority = fs.getHost() + ":" + fs.getVolname(); return new URI(fs.provider().getScheme(), authority, toString(), null, null); } catch (URISyntaxException e) { throw new IllegalStateException(e); } } Glust...
GlusterPath implements Path { @Override public URI toUri() { try { GlusterFileSystem fs = getFileSystem(); String authority = fs.getHost() + ":" + fs.getVolname(); return new URI(fs.provider().getScheme(), authority, toString(), null, null); } catch (URISyntaxException e) { throw new IllegalStateException(e); } } Glust...
GlusterPath implements Path { @Override public URI toUri() { try { GlusterFileSystem fs = getFileSystem(); String authority = fs.getHost() + ":" + fs.getVolname(); return new URI(fs.provider().getScheme(), authority, toString(), null, null); } catch (URISyntaxException e) { throw new IllegalStateException(e); } } Glust...
@Test public void testGetFileName() { Path p = new GlusterPath(mockFileSystem, "/"); assertEquals(null, p.getFileName()); p = new GlusterPath(mockFileSystem, "/bar"); assertEquals(new GlusterPath(mockFileSystem, "bar"), p.getFileName()); p = new GlusterPath(mockFileSystem, "foo/bar"); assertEquals(new GlusterPath(mockF...
@Override public Path getFileName() { if (parts.length == 0 || parts[0].isEmpty()) { return null; } else { return new GlusterPath(fileSystem, parts[parts.length - 1]); } }
GlusterPath implements Path { @Override public Path getFileName() { if (parts.length == 0 || parts[0].isEmpty()) { return null; } else { return new GlusterPath(fileSystem, parts[parts.length - 1]); } } }
GlusterPath implements Path { @Override public Path getFileName() { if (parts.length == 0 || parts[0].isEmpty()) { return null; } else { return new GlusterPath(fileSystem, parts[parts.length - 1]); } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, bo...
GlusterPath implements Path { @Override public Path getFileName() { if (parts.length == 0 || parts[0].isEmpty()) { return null; } else { return new GlusterPath(fileSystem, parts[parts.length - 1]); } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, bo...
GlusterPath implements Path { @Override public Path getFileName() { if (parts.length == 0 || parts[0].isEmpty()) { return null; } else { return new GlusterPath(fileSystem, parts[parts.length - 1]); } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, bo...
@Test public void testGetParent() { List<Path> roots = new LinkedList<Path>(); roots.add(mockGlusterPath); doReturn(roots).when(mockFileSystem).getRootDirectories(); Path p = new GlusterPath(mockFileSystem, "/"); assertEquals(mockGlusterPath, p.getParent()); p = new GlusterPath(mockFileSystem, "/bar"); assertEquals(moc...
@Override public Path getParent() { if (parts.length <= 1 || parts[0].isEmpty()) { if (absolute) { return getRoot(); } else { return null; } } else { return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, parts.length - 1), absolute); } }
GlusterPath implements Path { @Override public Path getParent() { if (parts.length <= 1 || parts[0].isEmpty()) { if (absolute) { return getRoot(); } else { return null; } } else { return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, parts.length - 1), absolute); } } }
GlusterPath implements Path { @Override public Path getParent() { if (parts.length <= 1 || parts[0].isEmpty()) { if (absolute) { return getRoot(); } else { return null; } } else { return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, parts.length - 1), absolute); } } GlusterPath(GlusterFileSystem fileSystem, ...
GlusterPath implements Path { @Override public Path getParent() { if (parts.length <= 1 || parts[0].isEmpty()) { if (absolute) { return getRoot(); } else { return null; } } else { return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, parts.length - 1), absolute); } } GlusterPath(GlusterFileSystem fileSystem, ...
GlusterPath implements Path { @Override public Path getParent() { if (parts.length <= 1 || parts[0].isEmpty()) { if (absolute) { return getRoot(); } else { return null; } } else { return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, parts.length - 1), absolute); } } GlusterPath(GlusterFileSystem fileSystem, ...
@Test public void testGetNameCount() { Path p = new GlusterPath(mockFileSystem, "/"); assertEquals(0, p.getNameCount()); p = new GlusterPath(mockFileSystem, "/bar"); assertEquals(1, p.getNameCount()); p = new GlusterPath(mockFileSystem, "/foo/bar"); assertEquals(2, p.getNameCount()); p = new GlusterPath(mockFileSystem,...
@Override public int getNameCount() { if (parts.length <= 1 && parts[0].isEmpty()) { if (absolute) { return 0; } else { throw new IllegalStateException("Only the root path should have one empty part"); } } else { return parts.length; } }
GlusterPath implements Path { @Override public int getNameCount() { if (parts.length <= 1 && parts[0].isEmpty()) { if (absolute) { return 0; } else { throw new IllegalStateException("Only the root path should have one empty part"); } } else { return parts.length; } } }
GlusterPath implements Path { @Override public int getNameCount() { if (parts.length <= 1 && parts[0].isEmpty()) { if (absolute) { return 0; } else { throw new IllegalStateException("Only the root path should have one empty part"); } } else { return parts.length; } } GlusterPath(GlusterFileSystem fileSystem, String pat...
GlusterPath implements Path { @Override public int getNameCount() { if (parts.length <= 1 && parts[0].isEmpty()) { if (absolute) { return 0; } else { throw new IllegalStateException("Only the root path should have one empty part"); } } else { return parts.length; } } GlusterPath(GlusterFileSystem fileSystem, String pat...
GlusterPath implements Path { @Override public int getNameCount() { if (parts.length <= 1 && parts[0].isEmpty()) { if (absolute) { return 0; } else { throw new IllegalStateException("Only the root path should have one empty part"); } } else { return parts.length; } } GlusterPath(GlusterFileSystem fileSystem, String pat...
@Test(expected = ClosedWatchServiceException.class) public void testTake_whenClosed() { watchService.setRunning(false); watchService.take(); }
@Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); }
GlusterWatchService implements WatchService { @Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); } }
GlusterWatchService implements WatchService { @Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); } }
GlusterWatchService implements WatchService { @Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); } WatchKey registerPath(GlusterPath path, WatchEvent.Kin...
GlusterWatchService implements WatchService { @Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); } WatchKey registerPath(GlusterPath path, WatchEvent.Kin...
@Test(expected = IllegalArgumentException.class) public void testGetName_noName() { Path p = new GlusterPath(mockFileSystem, "/"); p.getName(0); }
@Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
@Test(expected = IllegalArgumentException.class) public void testGetName_negative() { Path p = new GlusterPath(mockFileSystem, "/foo"); p.getName(-1); }
@Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
@Test(expected = IllegalArgumentException.class) public void testGetName_excessive() { Path p = new GlusterPath(mockFileSystem, "/foo"); p.getName(4); }
@Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
@Test public void testGetName() { Path p = new GlusterPath(mockFileSystem, "/foo/bar/baz"); assertEquals(new GlusterPath(mockFileSystem, new String[]{"foo"}, true), p.getName(0)); assertEquals(new GlusterPath(mockFileSystem, new String[]{"foo", "bar"}, true), p.getName(1)); assertEquals(new GlusterPath(mockFileSystem, ...
@Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
@Test(expected = IllegalArgumentException.class) public void testSubpath_noName() { Path p = new GlusterPath(mockFileSystem, "/"); p.getName(0); }
@Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } }
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } GlusterPath(Glust...
@Test(expected = IllegalArgumentException.class) public void testSubpath_negativeStart() { Path p = new GlusterPath(mockFileSystem, "/foo"); p.subpath(-1, 0); }
@Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, i, i2), absolute); }
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
@Test(expected = IllegalArgumentException.class) public void testSubpath_negativeEnd() { Path p = new GlusterPath(mockFileSystem, "/foo"); p.subpath(0, -1); }
@Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, i, i2), absolute); }
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
@Test(expected = IllegalArgumentException.class) public void testSubpath_excessiveStart() { Path p = new GlusterPath(mockFileSystem, "/foo"); p.subpath(4, 5); }
@Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, i, i2), absolute); }
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
@Test(expected = IllegalArgumentException.class) public void testSubpath_excessiveEnd() { Path p = new GlusterPath(mockFileSystem, "/foo"); p.subpath(0, 4); }
@Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, i, i2), absolute); }
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
@Test(expected = IllegalArgumentException.class) public void testSubpath_Inverted() { Path p = new GlusterPath(mockFileSystem, "/foo"); p.subpath(2, 1); }
@Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, i, i2), absolute); }
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
@Test public void testTake() throws Exception { WatchKey mockKey = mock(WatchKey.class); doReturn(null).doReturn(mockKey).when(watchService).poll(); PowerMockito.spy(Thread.class); PowerMockito.doThrow(new InterruptedException()).when(Thread.class); Thread.sleep(GlusterWatchService.PERIOD); WatchKey key = watchService....
@Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); }
GlusterWatchService implements WatchService { @Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); } }
GlusterWatchService implements WatchService { @Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); } }
GlusterWatchService implements WatchService { @Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); } WatchKey registerPath(GlusterPath path, WatchEvent.Kin...
GlusterWatchService implements WatchService { @Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); } WatchKey registerPath(GlusterPath path, WatchEvent.Kin...
@Test public void testSubpath() { Path p = new GlusterPath(mockFileSystem, "/foo/bar/baz"); assertEquals(new GlusterPath(mockFileSystem, new String[]{"foo"}, true), p.subpath(0, 1)); assertEquals(new GlusterPath(mockFileSystem, new String[]{"bar"}, true), p.subpath(1, 2)); assertEquals(new GlusterPath(mockFileSystem, n...
@Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, i, i2), absolute); }
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(pa...
@Test public void testStartsWith() { Path p1 = new GlusterPath(mockFileSystem, "/"); assertTrue(p1.startsWith(p1)); Path p2 = new GlusterPath(mockFileSystem, "/foo"); assertFalse(p1.startsWith(p2)); assertTrue(p2.startsWith(p1)); p1 = new GlusterPath(mockFileSystem, "/bar"); assertFalse(p1.startsWith(p2)); }
@Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return true; } String[] thisPrefix = ...
GlusterPath implements Path { @Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return ...
GlusterPath implements Path { @Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return ...
GlusterPath implements Path { @Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return ...
GlusterPath implements Path { @Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return ...
@Test public void testStartsWith_String() { Path p1 = new GlusterPath(mockFileSystem, "/"); assertTrue(p1.startsWith("/")); Path p2 = new GlusterPath(mockFileSystem, "/foo"); assertFalse(p1.startsWith("/foo")); assertTrue(p2.startsWith("/")); p1 = new GlusterPath(mockFileSystem, "/bar"); assertFalse(p1.startsWith("/foo...
@Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return true; } String[] thisPrefix = ...
GlusterPath implements Path { @Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return ...
GlusterPath implements Path { @Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return ...
GlusterPath implements Path { @Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return ...
GlusterPath implements Path { @Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return ...
@Test public void testEndsWith() { Path p1 = new GlusterPath(mockFileSystem, "/"); assertTrue(p1.endsWith(p1)); Path p2 = new GlusterPath(mockFileSystem, "/foo"); assertFalse(p1.endsWith(p2)); p1 = new GlusterPath(mockFileSystem, "/foo"); assertTrue(p1.endsWith(p2)); p2 = new GlusterPath(mockFileSystem, "foo"); assertT...
@Override public boolean endsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return true; } String[] thisSuffix = Ar...
GlusterPath implements Path { @Override public boolean endsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return tr...
GlusterPath implements Path { @Override public boolean endsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return tr...
GlusterPath implements Path { @Override public boolean endsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return tr...
GlusterPath implements Path { @Override public boolean endsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty()) { return tr...
@Test public void testNormalize() { Path p = new GlusterPath(mockFileSystem, "foo assertEquals(new GlusterPath(mockFileSystem, "foo/bar"), p.normalize()); p = new GlusterPath(mockFileSystem, "foo/./bar"); assertEquals(new GlusterPath(mockFileSystem, "foo/bar"), p.normalize()); p = new GlusterPath(mockFileSystem, "foo/....
@Override public Path normalize() { List<String> newParts = new LinkedList<String>(); for (String part : parts) { if (part.equals("..")) { newParts.remove(newParts.size() - 1); } else if (!part.equals(".") && !part.isEmpty()) { newParts.add(part); } } return new GlusterPath(fileSystem, newParts.toArray(new String[]{}),...
GlusterPath implements Path { @Override public Path normalize() { List<String> newParts = new LinkedList<String>(); for (String part : parts) { if (part.equals("..")) { newParts.remove(newParts.size() - 1); } else if (!part.equals(".") && !part.isEmpty()) { newParts.add(part); } } return new GlusterPath(fileSystem, new...
GlusterPath implements Path { @Override public Path normalize() { List<String> newParts = new LinkedList<String>(); for (String part : parts) { if (part.equals("..")) { newParts.remove(newParts.size() - 1); } else if (!part.equals(".") && !part.isEmpty()) { newParts.add(part); } } return new GlusterPath(fileSystem, new...
GlusterPath implements Path { @Override public Path normalize() { List<String> newParts = new LinkedList<String>(); for (String part : parts) { if (part.equals("..")) { newParts.remove(newParts.size() - 1); } else if (!part.equals(".") && !part.isEmpty()) { newParts.add(part); } } return new GlusterPath(fileSystem, new...
GlusterPath implements Path { @Override public Path normalize() { List<String> newParts = new LinkedList<String>(); for (String part : parts) { if (part.equals("..")) { newParts.remove(newParts.size() - 1); } else if (!part.equals(".") && !part.isEmpty()) { newParts.add(part); } } return new GlusterPath(fileSystem, new...
@Test public void testResolve() { Path path = new GlusterPath(mockFileSystem, "/"); Path otherPath = new GlusterPath(mockFileSystem, "/bar"); assertEquals(otherPath, path.resolve(otherPath)); otherPath = new GlusterPath(mockFileSystem, "bar"); assertEquals(new GlusterPath(mockFileSystem, "/bar"), path.resolve(otherPath...
@Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && parts.length == 1 && parts[0]....
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && ...
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && ...
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && ...
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && ...
@Test public void testResolve_string() { Path path = new GlusterPath(mockFileSystem, "/"); assertEquals(new GlusterPath(mockFileSystem, "/bar"), path.resolve("/bar")); assertEquals(new GlusterPath(mockFileSystem, "/bar"), path.resolve("bar")); assertEquals(path, path.resolve("")); path = new GlusterPath(mockFileSystem,...
@Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && parts.length == 1 && parts[0]....
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && ...
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && ...
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && ...
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() || (absolute && ...
@Test public void testResolveSibling() { Path p = new GlusterPath(mockFileSystem, "foo/bar"); Path other = new GlusterPath(mockFileSystem, "baz"); Path finalPath = p.resolveSibling(other); assertEquals(new GlusterPath(mockFileSystem, "foo/baz"), finalPath); }
@Override public Path resolveSibling(Path path) { return getParent().resolve(path); }
GlusterPath implements Path { @Override public Path resolveSibling(Path path) { return getParent().resolve(path); } }
GlusterPath implements Path { @Override public Path resolveSibling(Path path) { return getParent().resolve(path); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); }
GlusterPath implements Path { @Override public Path resolveSibling(Path path) { return getParent().resolve(path); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override P...
GlusterPath implements Path { @Override public Path resolveSibling(Path path) { return getParent().resolve(path); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override P...
@Test public void testResolveSibling_string() { Path p = new GlusterPath(mockFileSystem, "foo/bar"); Path finalPath = p.resolveSibling("baz"); assertEquals(new GlusterPath(mockFileSystem, "foo/baz"), finalPath); }
@Override public Path resolveSibling(Path path) { return getParent().resolve(path); }
GlusterPath implements Path { @Override public Path resolveSibling(Path path) { return getParent().resolve(path); } }
GlusterPath implements Path { @Override public Path resolveSibling(Path path) { return getParent().resolve(path); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); }
GlusterPath implements Path { @Override public Path resolveSibling(Path path) { return getParent().resolve(path); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override P...
GlusterPath implements Path { @Override public Path resolveSibling(Path path) { return getParent().resolve(path); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override P...
@Test(expected = IllegalArgumentException.class) public void testRelativize_otherIsRelative() { Path p = new GlusterPath(mockFileSystem, "/foo/bar"); Path other = new GlusterPath(mockFileSystem, "foo/baz"); p.relativize(other); }
@Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Can only relativize when both pa...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
@Test public void testTimeoutToMillis() { long time = 12345L; Assert.assertEquals(-1, watchService.timeoutToMillis(time, TimeUnit.NANOSECONDS)); Assert.assertEquals(-1, watchService.timeoutToMillis(time, TimeUnit.MICROSECONDS)); Assert.assertEquals(time, watchService.timeoutToMillis(time, TimeUnit.MILLISECONDS)); Asser...
long timeoutToMillis(long timeout, TimeUnit unit) { switch (unit) { case DAYS: return (timeout * MILLIS_PER_DAY); case HOURS: return (timeout * MILLIS_PER_HOUR); case MINUTES: return (timeout * MILLIS_PER_MINUTE); case SECONDS: return (timeout * MILLIS_PER_SECOND); case MILLISECONDS: return timeout; default: return -1;...
GlusterWatchService implements WatchService { long timeoutToMillis(long timeout, TimeUnit unit) { switch (unit) { case DAYS: return (timeout * MILLIS_PER_DAY); case HOURS: return (timeout * MILLIS_PER_HOUR); case MINUTES: return (timeout * MILLIS_PER_MINUTE); case SECONDS: return (timeout * MILLIS_PER_SECOND); case MIL...
GlusterWatchService implements WatchService { long timeoutToMillis(long timeout, TimeUnit unit) { switch (unit) { case DAYS: return (timeout * MILLIS_PER_DAY); case HOURS: return (timeout * MILLIS_PER_HOUR); case MINUTES: return (timeout * MILLIS_PER_MINUTE); case SECONDS: return (timeout * MILLIS_PER_SECOND); case MIL...
GlusterWatchService implements WatchService { long timeoutToMillis(long timeout, TimeUnit unit) { switch (unit) { case DAYS: return (timeout * MILLIS_PER_DAY); case HOURS: return (timeout * MILLIS_PER_HOUR); case MINUTES: return (timeout * MILLIS_PER_MINUTE); case SECONDS: return (timeout * MILLIS_PER_SECOND); case MIL...
GlusterWatchService implements WatchService { long timeoutToMillis(long timeout, TimeUnit unit) { switch (unit) { case DAYS: return (timeout * MILLIS_PER_DAY); case HOURS: return (timeout * MILLIS_PER_HOUR); case MINUTES: return (timeout * MILLIS_PER_MINUTE); case SECONDS: return (timeout * MILLIS_PER_SECOND); case MIL...
@Test(expected = IllegalArgumentException.class) public void testRelativize_thisIsRelative() { Path p = new GlusterPath(mockFileSystem, "foo/bar"); Path other = new GlusterPath(mockFileSystem, "/foo/baz"); p.relativize(other); }
@Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Can only relativize when both pa...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
@Test(expected = IllegalArgumentException.class) public void testRelativize_bothAreRelative() { Path p = new GlusterPath(mockFileSystem, "foo/bar"); Path other = new GlusterPath(mockFileSystem, "foo/baz"); p.relativize(other); }
@Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Can only relativize when both pa...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
@Test public void testRelativize() { Path p = new GlusterPath(mockFileSystem, "/foo/bar"); Path other = new GlusterPath(mockFileSystem, "/foo/baz"); Path relativePath = p.relativize(other); assertEquals(new GlusterPath(mockFileSystem, "../baz"), relativePath); other = new GlusterPath(mockFileSystem, "/foo/bar/baz"); re...
@Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Can only relativize when both pa...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
GlusterPath implements Path { @Override public Path relativize(Path path) { if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not relativize other path because it's on a different filesystem"); } if (!this.isAbsolute() || !path.isAbsolute()) { throw new IllegalArgumentException("Ca...
@Test(expected = UnsupportedOperationException.class) public void testToAbsolutePath_whenRelative() { Path p = new GlusterPath(mockFileSystem, "foo"); p.toAbsolutePath(); }
@Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } }
GlusterPath implements Path { @Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } } }
GlusterPath implements Path { @Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); }
GlusterPath implements Path { @Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute...
GlusterPath implements Path { @Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute...
@Test public void testToAbsolutePath() { Path p = new GlusterPath(mockFileSystem, "/foo"); assertEquals(p, p.toAbsolutePath()); }
@Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } }
GlusterPath implements Path { @Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } } }
GlusterPath implements Path { @Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); }
GlusterPath implements Path { @Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute...
GlusterPath implements Path { @Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute...
@Test public void testIterator() { Path p = new GlusterPath(mockFileSystem, "/foo/bar"); Iterator<Path> it = p.iterator(); assertEquals(new GlusterPath(mockFileSystem, "foo"), it.next()); assertEquals(new GlusterPath(mockFileSystem, "bar"), it.next()); p = new GlusterPath(mockFileSystem, "/"); it = p.iterator(); assert...
@Override public Iterator<Path> iterator() { List<Path> list = new ArrayList<Path>(parts.length); if (parts.length >= 1 && !parts[0].isEmpty()) { for (String p : parts) { list.add(new GlusterPath(fileSystem, p)); } } return Collections.unmodifiableList(list).iterator(); }
GlusterPath implements Path { @Override public Iterator<Path> iterator() { List<Path> list = new ArrayList<Path>(parts.length); if (parts.length >= 1 && !parts[0].isEmpty()) { for (String p : parts) { list.add(new GlusterPath(fileSystem, p)); } } return Collections.unmodifiableList(list).iterator(); } }
GlusterPath implements Path { @Override public Iterator<Path> iterator() { List<Path> list = new ArrayList<Path>(parts.length); if (parts.length >= 1 && !parts[0].isEmpty()) { for (String p : parts) { list.add(new GlusterPath(fileSystem, p)); } } return Collections.unmodifiableList(list).iterator(); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Iterator<Path> iterator() { List<Path> list = new ArrayList<Path>(parts.length); if (parts.length >= 1 && !parts[0].isEmpty()) { for (String p : parts) { list.add(new GlusterPath(fileSystem, p)); } } return Collections.unmodifiableList(list).iterator(); } GlusterPath(Glust...
GlusterPath implements Path { @Override public Iterator<Path> iterator() { List<Path> list = new ArrayList<Path>(parts.length); if (parts.length >= 1 && !parts[0].isEmpty()) { for (String p : parts) { list.add(new GlusterPath(fileSystem, p)); } } return Collections.unmodifiableList(list).iterator(); } GlusterPath(Glust...
@Test(expected = ClassCastException.class) public void testCompareTo_differentProvider() { Path path = new GlusterPath(mockFileSystem, ""); Path zipfile = Paths.get("/codeSamples/zipfs/zipfstest.zip"); path.compareTo(zipfile); }
@Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath other = (GlusterPath) path; Stri...
GlusterPath implements Path { @Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath ot...
GlusterPath implements Path { @Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath ot...
GlusterPath implements Path { @Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath ot...
GlusterPath implements Path { @Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath ot...
@Test public void testCompareTo() { Path p = new GlusterPath(mockFileSystem, "/foo"); Path other = new GlusterPath(mockFileSystem, "/bar"); assertTrue(p.compareTo(other) > 0); p = new GlusterPath(mockFileSystem, "/bar"); other = new GlusterPath(mockFileSystem, "/foo"); assertTrue(p.compareTo(other) < 0); p = new Gluste...
@Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath other = (GlusterPath) path; Stri...
GlusterPath implements Path { @Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath ot...
GlusterPath implements Path { @Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath ot...
GlusterPath implements Path { @Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath ot...
GlusterPath implements Path { @Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } GlusterPath ot...
@Test public void testToString_whenPathString() { String pathString = "/bar/baz"; Path p = new GlusterPath(mockFileSystem, pathString); String filesystemString = "gluster: doReturn(filesystemString).when(mockFileSystem).toString(); assertEquals(pathString, p.toString()); }
public String toString() { return getString(); }
GlusterPath implements Path { public String toString() { return getString(); } }
GlusterPath implements Path { public String toString() { return getString(); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); }
GlusterPath implements Path { public String toString() { return getString(); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override Path getFileName(); @Override Path get...
GlusterPath implements Path { public String toString() { return getString(); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override Path getFileName(); @Override Path get...
@Test public void testToString_whenNoPathString() { Path p = new GlusterPath(mockFileSystem, new String[]{"a", "b"}, true); assertEquals("/a/b", p.toString()); }
public String toString() { return getString(); }
GlusterPath implements Path { public String toString() { return getString(); } }
GlusterPath implements Path { public String toString() { return getString(); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); }
GlusterPath implements Path { public String toString() { return getString(); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override Path getFileName(); @Override Path get...
GlusterPath implements Path { public String toString() { return getString(); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override Path getFileName(); @Override Path get...
@Test(expected = IllegalStateException.class) public void testOpenDirectory_whenAlreadyOpen() { stream.setDirHandle(1); stream.open(mockPath); }
public void open(GlusterPath path) { dir = path; if (dirHandle == 0) { dirHandle = GLFS.glfs_opendir(path.getFileSystem().getVolptr(), path.getString()); } else { throw new IllegalStateException("Already open!"); } }
GlusterDirectoryStream implements DirectoryStream<Path> { public void open(GlusterPath path) { dir = path; if (dirHandle == 0) { dirHandle = GLFS.glfs_opendir(path.getFileSystem().getVolptr(), path.getString()); } else { throw new IllegalStateException("Already open!"); } } }
GlusterDirectoryStream implements DirectoryStream<Path> { public void open(GlusterPath path) { dir = path; if (dirHandle == 0) { dirHandle = GLFS.glfs_opendir(path.getFileSystem().getVolptr(), path.getString()); } else { throw new IllegalStateException("Already open!"); } } }
GlusterDirectoryStream implements DirectoryStream<Path> { public void open(GlusterPath path) { dir = path; if (dirHandle == 0) { dirHandle = GLFS.glfs_opendir(path.getFileSystem().getVolptr(), path.getString()); } else { throw new IllegalStateException("Already open!"); } } @Override Iterator<Path> iterator(); @Overri...
GlusterDirectoryStream implements DirectoryStream<Path> { public void open(GlusterPath path) { dir = path; if (dirHandle == 0) { dirHandle = GLFS.glfs_opendir(path.getFileSystem().getVolptr(), path.getString()); } else { throw new IllegalStateException("Already open!"); } } @Override Iterator<Path> iterator(); @Overri...
@Test public void testGetString_whenPathString() { String string = "/foo/bar"; GlusterPath path = new GlusterPath(mockFileSystem, string); path.setParts(new String[]{"a", "b"}); assertEquals(string, path.getString()); }
public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toString(); } }
GlusterPath implements Path { public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toStri...
GlusterPath implements Path { public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toStri...
GlusterPath implements Path { public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toStri...
GlusterPath implements Path { public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toStri...
@Test public void testGetString_whenNoPathString() { GlusterPath path = new GlusterPath(mockFileSystem, new String[]{"a", "b"}, false); assertEquals("a/b", path.getString()); }
public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toString(); } }
GlusterPath implements Path { public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toStri...
GlusterPath implements Path { public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toStri...
GlusterPath implements Path { public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toStri...
GlusterPath implements Path { public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); return sb.toStri...
@Test(expected = UnsupportedOperationException.class) public void testGuardRegisterWatchService() { GlusterPath path = spy(new GlusterPath(mockFileSystem, new String[]{}, false)); WatchService mockWatchService = mock(WatchService.class); path.guardRegisterWatchService(mockWatchService); }
void guardRegisterWatchService(WatchService watchService) { Class<? extends WatchService> watchServiceClass = watchService.getClass(); if (!GlusterWatchService.class.equals(watchServiceClass)) { throw new UnsupportedOperationException("GlusterPaths can only be watched by GlusterWatchServices. WatchService given: " + wa...
GlusterPath implements Path { void guardRegisterWatchService(WatchService watchService) { Class<? extends WatchService> watchServiceClass = watchService.getClass(); if (!GlusterWatchService.class.equals(watchServiceClass)) { throw new UnsupportedOperationException("GlusterPaths can only be watched by GlusterWatchServic...
GlusterPath implements Path { void guardRegisterWatchService(WatchService watchService) { Class<? extends WatchService> watchServiceClass = watchService.getClass(); if (!GlusterWatchService.class.equals(watchServiceClass)) { throw new UnsupportedOperationException("GlusterPaths can only be watched by GlusterWatchServic...
GlusterPath implements Path { void guardRegisterWatchService(WatchService watchService) { Class<? extends WatchService> watchServiceClass = watchService.getClass(); if (!GlusterWatchService.class.equals(watchServiceClass)) { throw new UnsupportedOperationException("GlusterPaths can only be watched by GlusterWatchServic...
GlusterPath implements Path { void guardRegisterWatchService(WatchService watchService) { Class<? extends WatchService> watchServiceClass = watchService.getClass(); if (!GlusterWatchService.class.equals(watchServiceClass)) { throw new UnsupportedOperationException("GlusterPaths can only be watched by GlusterWatchServic...
@Test public void testName() { String volname = "testvol"; doReturn(volname).when(mockFileSystem).getVolname(); assertEquals(volname, fileStore.name()); }
@Override public String name() { return fileSystem.getVolname(); }
GlusterFileStore extends FileStore { @Override public String name() { return fileSystem.getVolname(); } }
GlusterFileStore extends FileStore { @Override public String name() { return fileSystem.getVolname(); } }
GlusterFileStore extends FileStore { @Override public String name() { return fileSystem.getVolname(); } @Override String name(); @Override String type(); @Override boolean isReadOnly(); @Override long getTotalSpace(); @Override long getUsableSpace(); @Override long getUnallocatedSpace(); @Override boolean supportsFile...
GlusterFileStore extends FileStore { @Override public String name() { return fileSystem.getVolname(); } @Override String name(); @Override String type(); @Override boolean isReadOnly(); @Override long getTotalSpace(); @Override long getUsableSpace(); @Override long getUnallocatedSpace(); @Override boolean supportsFile...
@Test public void testType() { assertEquals("glusterfs", fileStore.type()); }
@Override public String type() { return GLUSTERFS; }
GlusterFileStore extends FileStore { @Override public String type() { return GLUSTERFS; } }
GlusterFileStore extends FileStore { @Override public String type() { return GLUSTERFS; } }
GlusterFileStore extends FileStore { @Override public String type() { return GLUSTERFS; } @Override String name(); @Override String type(); @Override boolean isReadOnly(); @Override long getTotalSpace(); @Override long getUsableSpace(); @Override long getUnallocatedSpace(); @Override boolean supportsFileAttributeView(...
GlusterFileStore extends FileStore { @Override public String type() { return GLUSTERFS; } @Override String name(); @Override String type(); @Override boolean isReadOnly(); @Override long getTotalSpace(); @Override long getUsableSpace(); @Override long getUnallocatedSpace(); @Override boolean supportsFileAttributeView(...
@Test public void testIsReadOnly() { assertFalse(fileStore.isReadOnly()); }
@Override public boolean isReadOnly() { return false; }
GlusterFileStore extends FileStore { @Override public boolean isReadOnly() { return false; } }
GlusterFileStore extends FileStore { @Override public boolean isReadOnly() { return false; } }
GlusterFileStore extends FileStore { @Override public boolean isReadOnly() { return false; } @Override String name(); @Override String type(); @Override boolean isReadOnly(); @Override long getTotalSpace(); @Override long getUsableSpace(); @Override long getUnallocatedSpace(); @Override boolean supportsFileAttributeVi...
GlusterFileStore extends FileStore { @Override public boolean isReadOnly() { return false; } @Override String name(); @Override String type(); @Override boolean isReadOnly(); @Override long getTotalSpace(); @Override long getUsableSpace(); @Override long getUnallocatedSpace(); @Override boolean supportsFileAttributeVi...
@Test public void testGetTotalSpace() throws IOException { long volptr = 4321l; long space = 1234l; doReturn(volptr).when(mockFileSystem).getVolptr(); doReturn(space).when(mockProvider).getTotalSpace(volptr); long totalSpace = fileStore.getTotalSpace(); verify(mockProvider).getTotalSpace(volptr); verify(mockFileSystem)...
@Override public long getTotalSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getTotalSpace(fileSystem.getVolptr()); }
GlusterFileStore extends FileStore { @Override public long getTotalSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getTotalSpace(fileSystem.getVolptr()); } }
GlusterFileStore extends FileStore { @Override public long getTotalSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getTotalSpace(fileSystem.getVolptr()); } }
GlusterFileStore extends FileStore { @Override public long getTotalSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getTotalSpace(fileSystem.getVolptr()); } @Override String name(); @Override String type(); @Override boolean isReadOnly...
GlusterFileStore extends FileStore { @Override public long getTotalSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getTotalSpace(fileSystem.getVolptr()); } @Override String name(); @Override String type(); @Override boolean isReadOnly...
@Test public void testGetUsableSpace() throws IOException { long volptr = 4321l; long space = 1234l; doReturn(volptr).when(mockFileSystem).getVolptr(); doReturn(space).when(mockProvider).getUsableSpace(volptr); long usableSpace = fileStore.getUsableSpace(); verify(mockProvider).getUsableSpace(volptr); verify(mockFileSy...
@Override public long getUsableSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUsableSpace(fileSystem.getVolptr()); }
GlusterFileStore extends FileStore { @Override public long getUsableSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUsableSpace(fileSystem.getVolptr()); } }
GlusterFileStore extends FileStore { @Override public long getUsableSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUsableSpace(fileSystem.getVolptr()); } }
GlusterFileStore extends FileStore { @Override public long getUsableSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUsableSpace(fileSystem.getVolptr()); } @Override String name(); @Override String type(); @Override boolean isReadOn...
GlusterFileStore extends FileStore { @Override public long getUsableSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUsableSpace(fileSystem.getVolptr()); } @Override String name(); @Override String type(); @Override boolean isReadOn...
@Test public void testGetUnallocatedSpace() throws IOException { long volptr = 4321l; long space = 1234l; doReturn(volptr).when(mockFileSystem).getVolptr(); doReturn(space).when(mockProvider).getUnallocatedSpace(volptr); long unallocatedSpace = fileStore.getUnallocatedSpace(); verify(mockProvider).getUnallocatedSpace(v...
@Override public long getUnallocatedSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUnallocatedSpace(fileSystem.getVolptr()); }
GlusterFileStore extends FileStore { @Override public long getUnallocatedSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUnallocatedSpace(fileSystem.getVolptr()); } }
GlusterFileStore extends FileStore { @Override public long getUnallocatedSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUnallocatedSpace(fileSystem.getVolptr()); } }
GlusterFileStore extends FileStore { @Override public long getUnallocatedSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUnallocatedSpace(fileSystem.getVolptr()); } @Override String name(); @Override String type(); @Override boolea...
GlusterFileStore extends FileStore { @Override public long getUnallocatedSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUnallocatedSpace(fileSystem.getVolptr()); } @Override String name(); @Override String type(); @Override boolea...