@Test public void testStringToLongNull() { Long testLong = PrimaryIndexBucketLocatorImpl.convertStringToBuckectingLong(null); assertTrue("null values sent is not null", testLong == null); Long testLong1 = PrimaryIndexBucketLocatorImpl.convertStringToBuckectingLong(""); assertTrue("blank string sent is not null", testLong1 == null); }
protected static Long convertStringToBuckectingLong(String stringToBeConverted) { if (stringToBeConverted == null || stringToBeConverted.equals("")) { return null; } byte[] byteString = stringToBeConverted.getBytes(); if (byteString.length < 8) { byte[] newByteString = new byte[8]; for (int i = 0; i < newByteString.length; i++) { if (i < byteString.length) { newByteString[i] = byteString[i]; } else { newByteString[i] = 0; } } byteString = newByteString; } ByteBuffer bb = ByteBuffer.wrap(byteString); long byteMethod = bb.getLong(); byteMethod = Math.abs(byteMethod); return byteMethod; }
PrimaryIndexBucketLocatorImpl implements BucketLocator { protected static Long convertStringToBuckectingLong(String stringToBeConverted) { if (stringToBeConverted == null || stringToBeConverted.equals("")) { return null; } byte[] byteString = stringToBeConverted.getBytes(); if (byteString.length < 8) { byte[] newByteString = new byte[8]; for (int i = 0; i < newByteString.length; i++) { if (i < byteString.length) { newByteString[i] = byteString[i]; } else { newByteString[i] = 0; } } byteString = newByteString; } ByteBuffer bb = ByteBuffer.wrap(byteString); long byteMethod = bb.getLong(); byteMethod = Math.abs(byteMethod); return byteMethod; } }
PrimaryIndexBucketLocatorImpl implements BucketLocator { protected static Long convertStringToBuckectingLong(String stringToBeConverted) { if (stringToBeConverted == null || stringToBeConverted.equals("")) { return null; } byte[] byteString = stringToBeConverted.getBytes(); if (byteString.length < 8) { byte[] newByteString = new byte[8]; for (int i = 0; i < newByteString.length; i++) { if (i < byteString.length) { newByteString[i] = byteString[i]; } else { newByteString[i] = 0; } } byteString = newByteString; } ByteBuffer bb = ByteBuffer.wrap(byteString); long byteMethod = bb.getLong(); byteMethod = Math.abs(byteMethod); return byteMethod; } private  PrimaryIndexBucketLocatorImpl(); @Deprecated  PrimaryIndexBucketLocatorImpl(List<Long> textBuckets, List<Long> dateTimeBuckets,
            List<Long> doubleBuckets, List<Long> integerBuckets, List<Long> booleanBuckets,
            List<Long> uuidBuckets, List<Long> binaryBuckets, List<Long> longBuckets, List<Long> timepointBuckets); }
PrimaryIndexBucketLocatorImpl implements BucketLocator { protected static Long convertStringToBuckectingLong(String stringToBeConverted) { if (stringToBeConverted == null || stringToBeConverted.equals("")) { return null; } byte[] byteString = stringToBeConverted.getBytes(); if (byteString.length < 8) { byte[] newByteString = new byte[8]; for (int i = 0; i < newByteString.length; i++) { if (i < byteString.length) { newByteString[i] = byteString[i]; } else { newByteString[i] = 0; } } byteString = newByteString; } ByteBuffer bb = ByteBuffer.wrap(byteString); long byteMethod = bb.getLong(); byteMethod = Math.abs(byteMethod); return byteMethod; } private  PrimaryIndexBucketLocatorImpl(); @Deprecated  PrimaryIndexBucketLocatorImpl(List<Long> textBuckets, List<Long> dateTimeBuckets,
            List<Long> doubleBuckets, List<Long> integerBuckets, List<Long> booleanBuckets,
            List<Long> uuidBuckets, List<Long> binaryBuckets, List<Long> longBuckets, List<Long> timepointBuckets); static PrimaryIndexBucketLocatorImpl getInstance(); @Override Long getBucket(Object bucketingObject, FieldDataType dataType); static Long convertObjectToBucketingToken(Object toBeConverted, FieldDataType dataType); static List<Long>[] getBUCKETS(); }
PrimaryIndexBucketLocatorImpl implements BucketLocator { protected static Long convertStringToBuckectingLong(String stringToBeConverted) { if (stringToBeConverted == null || stringToBeConverted.equals("")) { return null; } byte[] byteString = stringToBeConverted.getBytes(); if (byteString.length < 8) { byte[] newByteString = new byte[8]; for (int i = 0; i < newByteString.length; i++) { if (i < byteString.length) { newByteString[i] = byteString[i]; } else { newByteString[i] = 0; } } byteString = newByteString; } ByteBuffer bb = ByteBuffer.wrap(byteString); long byteMethod = bb.getLong(); byteMethod = Math.abs(byteMethod); return byteMethod; } private  PrimaryIndexBucketLocatorImpl(); @Deprecated  PrimaryIndexBucketLocatorImpl(List<Long> textBuckets, List<Long> dateTimeBuckets,
            List<Long> doubleBuckets, List<Long> integerBuckets, List<Long> booleanBuckets,
            List<Long> uuidBuckets, List<Long> binaryBuckets, List<Long> longBuckets, List<Long> timepointBuckets); static PrimaryIndexBucketLocatorImpl getInstance(); @Override Long getBucket(Object bucketingObject, FieldDataType dataType); static Long convertObjectToBucketingToken(Object toBeConverted, FieldDataType dataType); static List<Long>[] getBUCKETS();  }