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 convertToByte() throws Exception { Long l = 0L; Byte value = (byte) 0; assertEquals(value, converter.toByte(l)); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) { return value.byteValue(); } throw new Atl... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... |
@Test(expected = AtlasConversionException.class) public void convertToByteOutOfRange() throws Exception { converter.toByte(Long.MAX_VALUE); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) { return value.byteValue(); } throw new Atl... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... |
@Test public void convertToByteNull() throws Exception { assertNull(converter.toByte(null)); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) { return value.byteValue(); } throw new Atl... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.BYTE, concerns = AtlasConversionConcern.RANGE) public Byte toByte(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VA... |
@Test public void convertToCharacter() throws Exception { Long l = 0L; Character c = converter.toCharacter(l); assertNotNull(c); assertEquals(0, c.charValue()); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value < Character.MIN_VALUE || value > Charact... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... |
@Test public void convertToCharacterNull() throws Exception { Long l = null; Character c = converter.toCharacter(l); assertNull(c); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value < Character.MIN_VALUE || value > Charact... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... |
@Test(expected = AtlasConversionException.class) public void convertToCharacterMAX() throws Exception { Long l = Long.MAX_VALUE; converter.toCharacter(l); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value < Character.MIN_VALUE || value > Charact... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... |
@Test(expected = AtlasConversionException.class) public void convertToCharacterMIN() throws Exception { Long l = -1L; converter.toCharacter(l); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value < Character.MIN_VALUE || value > Charact... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.CHAR, concerns = { AtlasConversionConcern.RANGE, AtlasConversionConcern.CONVENTION }) public Character toCharacter(Long value) throws AtlasConversionException { if (value == null) { return null; } if... |
@Test public void toDate() throws Exception { Date date = converter.toDate(Long.MAX_VALUE); assertNotNull(date); date = converter.toDate(Long.MIN_VALUE); assertNotNull(date); date = converter.toDate(Long.parseLong("0")); assertTrue(date.toInstant().toString().equals("1970-01-01T00:00:00Z")); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DATE_TIME_TZ) public Date toDate(Long date) { if (date >= Instant.MIN.getEpochSecond()) { return Date.from(Instant.ofEpochMilli(date)); } return new Date(date); } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DATE_TIME_TZ) public Date toDate(Long date) { if (date >= Instant.MIN.getEpochSecond()) { return Date.from(Instant.ofEpochMilli(date)); } return new Date(date); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DATE_TIME_TZ) public Date toDate(Long date) { if (date >= Instant.MIN.getEpochSecond()) { return Date.from(Instant.ofEpochMilli(date)); } return new Date(date); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DATE_TIME_TZ) public Date toDate(Long date) { if (date >= Instant.MIN.getEpochSecond()) { return Date.from(Instant.ofEpochMilli(date)); } return new Date(date); } @AtlasConversionInfo(sourceType = F... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DATE_TIME_TZ) public Date toDate(Long date) { if (date >= Instant.MIN.getEpochSecond()) { return Date.from(Instant.ofEpochMilli(date)); } return new Date(date); } @AtlasConversionInfo(sourceType = F... |
@Test public void convertToDouble() { Long l = 0L; Double d = converter.toDouble(l); assertNotNull(d); assertEquals(0.0, d, 0.0); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDe... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDe... |
@Test public void testDateTimeViaSetter() { JavaClass javaClass = classInspectionService.inspectClass(DateTimeSetter.class, CollectionType.NONE, null); assertEquals(14, javaClass.getJavaFields().getJavaField().size()); for (JavaField field : javaClass.getJavaFields().getJavaField()) { if ("year".equals(field.getName())... | public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } } | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } } | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } List<String> getMapClasses(); List<String> get... | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } List<String> getMapClasses(); List<String> get... |
@Test public void convertToDoubleNull() { Long l = null; Double d = converter.toDouble(l); assertNull(d); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDe... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDe... |
@Test public void convertToDoubleMAX() { Long l = Long.MAX_VALUE; Double d = converter.toDouble(l); assertNotNull(d); assertEquals(Long.MAX_VALUE, l, 0.0); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDe... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DOUBLE) public Double toDouble(Long value) { if (value == null) { return null; } return value.doubleValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDe... |
@Test public void convertToFloat() { Long l = 0L; Float f = converter.toFloat(l); assertNotNull(f); assertEquals(0.0, f, 0.0); l = 1L; f = converter.toFloat(l); assertNotNull(f); assertEquals(1.0f, f, 0.0); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecima... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecima... |
@Test public void convertToFloatNull() { assertNull(converter.toFloat(null)); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecima... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecima... |
@Test public void convertToFloatMAX() { Long l = Long.MAX_VALUE; Float f = converter.toFloat(l); assertNotNull(f); assertEquals(Long.MAX_VALUE, l, 0.0); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecima... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.FLOAT) public Float toFloat(Long value) { if (value == null) { return null; } return value.floatValue(); } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecima... |
@Test public void convertToInteger() throws Exception { Long l = 0L; Integer i = converter.toInteger(l); assertNotNull(i); assertEquals(0, i, 0.0); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) { throw new AtlasConversionExc... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... |
@Test(expected = AtlasConversionException.class) public void convertToIntegerMAX() throws Exception { converter.toInteger(Long.MAX_VALUE); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) { throw new AtlasConversionExc... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... |
@Test(expected = AtlasConversionException.class) public void convertToIntegerMIN() throws Exception { converter.toInteger(Long.MIN_VALUE); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) { throw new AtlasConversionExc... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... |
@Test public void convertToIntegerNull() throws Exception { Long l = null; Integer i = converter.toInteger(l); assertNull(i); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) { throw new AtlasConversionExc... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.INTEGER, concerns = AtlasConversionConcern.RANGE) public Integer toInteger(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Integer.MAX_VALUE || value < I... |
@Test public void convertToLong() { Long l = 1L; Long d = converter.toLong(l); assertNotNull(d); assertNotSame(l, d); assertEquals(1L, d, 0.0); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecimal toBigDecimal(Long... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecimal toBigDecimal(Long... |
@Test public void testEnum() { JavaClass javaClass = classInspectionService.inspectClass(TestEnum.class, CollectionType.NONE, null); assertNotNull(javaClass.getJavaFields()); assertEquals(2, javaClass.getJavaFields().getJavaField().size()); for (JavaField field : javaClass.getJavaFields().getJavaField()) { if ("extende... | public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } } | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } } | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } List<String> getMapClasses(); List<String> get... | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } List<String> getMapClasses(); List<String> get... |
@Test public void convertToLongNull() { Long l = null; Long d = converter.toLong(l); assertNull(d); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecimal toBigDecimal(Long... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.LONG) public Long toLong(Long value) { return value != null ? new Long(value) : null; } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecimal toBigDecimal(Long... |
@Test public void convertToShort() throws Exception { Long l = 0L; Short s = converter.toShort(l); assertNotNull(s); assertEquals(0, s, 0.0); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { throw new AtlasConversionException( St... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... |
@Test public void convertToShortNull() throws Exception { Long l = null; Short s = converter.toShort(l); assertNull(s); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { throw new AtlasConversionException( St... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... |
@Test(expected = AtlasConversionException.class) public void convertToShortExceptionMAX() throws Exception { Long l = Long.MAX_VALUE; converter.toShort(l); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN_VALUE) { throw new AtlasConversionException( St... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.SHORT, concerns = AtlasConversionConcern.RANGE) public Short toShort(Long value) throws AtlasConversionException { if (value == null) { return null; } if (value > Short.MAX_VALUE || value < Short.MIN... |
@Test public void convertToString() { Long l = 0L; String s = converter.toString(l); assertNotNull(s); assertTrue("0".equals(s)); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecimal toBig... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecimal toBig... |
@Test public void convertToStringNull() { Long l = null; String s = converter.toString(l); assertNull(s); } | @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } } | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecimal toBig... | LongConverter implements AtlasConverter<Long> { @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.STRING) public String toString(Long value) { return value != null ? String.valueOf(value) : null; } @AtlasConversionInfo(sourceType = FieldType.LONG, targetType = FieldType.DECIMAL) BigDecimal toBig... |
@Test public void convertToBoolean() { Character c = Character.forDigit(1, 10); Boolean t = converter.toBoolean(c, null, null); assertNotNull(t); assertTrue(t); c = "T".charAt(0); Boolean t2 = converter.toBoolean(c, null, null); assertNotNull(t2); assertTrue(t2); c = "t".charAt(0); Boolean t3 = converter.toBoolean(c, n... | @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String regex = sourceFormat != null && !"".equals(sourceFormat) ? ... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String r... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String r... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String r... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String r... |
@Test public void convertToBooleanInvalid() { Character c = null; converter.toBoolean(c, null, null); assertNull(c); } | @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String regex = sourceFormat != null && !"".equals(sourceFormat) ? ... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String r... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String r... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String r... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BOOLEAN, concerns = { AtlasConversionConcern.CONVENTION }) public Boolean toBoolean(Character value, String sourceFormat, String targetFormat) { if (value == null) { return null; } String r... |
@Test public void convertToByte() throws Exception { byte value = 99; assertEquals(value, converter.toByte('c').byteValue()); } | @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX_VALUE) { throw new AtlasConversionException( String.forma... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX... |
@Test(expected = AtlasConversionException.class) public void convertToByteOutOfRange() throws Exception { byte value = 99; assertEquals(value, converter.toByte('\uD840').byteValue()); } | @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX_VALUE) { throw new AtlasConversionException( String.forma... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX... | CharacterConverter implements AtlasConverter<Character> { @AtlasConversionInfo(sourceType = FieldType.CHAR, targetType = FieldType.BYTE, concerns = { AtlasConversionConcern.RANGE }) public Byte toByte(Character value) throws AtlasConversionException { if (value == null) { return null; } if (value.charValue() > Byte.MAX... |
@Test public void testTopmostListString() { JavaClass javaClass = classInspectionService.inspectClass(String.class, CollectionType.LIST, null); assertEquals("java.lang.String", javaClass.getClassName()); assertEquals(CollectionType.LIST, javaClass.getCollectionType()); assertNull(javaClass.getCollectionClassName()); as... | public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } } | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } } | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } List<String> getMapClasses(); List<String> get... | ClassInspectionService { public JavaClass inspectClass(String className, CollectionType collectionType, String collectionClassName) { ClassLoader classLoader = getClass().getClassLoader(); return inspectClass(classLoader, className, collectionType, collectionClassName); } List<String> getMapClasses(); List<String> get... |
@Test public void testDeserialize() throws Exception { byte[] encryptedContent = HexUtils.toBytes("01074b1955bf07aaa979ae8af6eebfea5da8e83cad505edbaade9ba4ed528a8d" + "e36c95ece996189dedf4756fba2599f94b4f370d701366e2f0ba4e59111c0787" + "708cf4b0b82de558b4d8bf5d90b3512f09814d605d4c14f2f85b596211f83918" + "c31c4bef19ea47... | public static BackupPayload deserialize(byte[] data){ ByteReader reader = new ByteReader(data); try { byte version = reader.get(); int timestamp = reader.getIntLE(); byte[] iv = reader.getBytes(16); int cipherTextLen = (int)reader.getCompactInt(); byte[] cipherText = reader.getBytes(cipherTextLen); int sigLen = (int)re... | BackupPayload { public static BackupPayload deserialize(byte[] data){ ByteReader reader = new ByteReader(data); try { byte version = reader.get(); int timestamp = reader.getIntLE(); byte[] iv = reader.getBytes(16); int cipherTextLen = (int)reader.getCompactInt(); byte[] cipherText = reader.getBytes(cipherTextLen); int ... | BackupPayload { public static BackupPayload deserialize(byte[] data){ ByteReader reader = new ByteReader(data); try { byte version = reader.get(); int timestamp = reader.getIntLE(); byte[] iv = reader.getBytes(16); int cipherTextLen = (int)reader.getCompactInt(); byte[] cipherText = reader.getBytes(cipherTextLen); int ... | BackupPayload { public static BackupPayload deserialize(byte[] data){ ByteReader reader = new ByteReader(data); try { byte version = reader.get(); int timestamp = reader.getIntLE(); byte[] iv = reader.getBytes(16); int cipherTextLen = (int)reader.getCompactInt(); byte[] cipherText = reader.getBytes(cipherTextLen); int ... | BackupPayload { public static BackupPayload deserialize(byte[] data){ ByteReader reader = new ByteReader(data); try { byte version = reader.get(); int timestamp = reader.getIntLE(); byte[] iv = reader.getBytes(16); int cipherTextLen = (int)reader.getCompactInt(); byte[] cipherText = reader.getBytes(cipherTextLen); int ... |
@Test public void getMinPosition() throws Exception { assertEquals(MIN_POSITION, algorithm.getMinPosition()); } | @Override public int getMinPosition() { return minPosition; } | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public int getMinPosition() { return minPosition; } } | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public int getMinPosition() { return minPosition; } ExponentialFeeItemsAlgorithm(long minValue, int minPosition, long maxValue, int maxPosition); } | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public int getMinPosition() { return minPosition; } ExponentialFeeItemsAlgorithm(long minValue, int minPosition, long maxValue, int maxPosition); @Override long computeValue(int position); @Override int getMinPosition(); @Override int getMaxPosition(... | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public int getMinPosition() { return minPosition; } ExponentialFeeItemsAlgorithm(long minValue, int minPosition, long maxValue, int maxPosition); @Override long computeValue(int position); @Override int getMinPosition(); @Override int getMaxPosition(... |
@Test public void getMaxPosition() throws Exception { assertEquals(MAX_POSITION, algorithm.getMaxPosition()); } | @Override public int getMaxPosition() { return maxPosition; } | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public int getMaxPosition() { return maxPosition; } } | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public int getMaxPosition() { return maxPosition; } ExponentialFeeItemsAlgorithm(long minValue, int minPosition, long maxValue, int maxPosition); } | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public int getMaxPosition() { return maxPosition; } ExponentialFeeItemsAlgorithm(long minValue, int minPosition, long maxValue, int maxPosition); @Override long computeValue(int position); @Override int getMinPosition(); @Override int getMaxPosition(... | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public int getMaxPosition() { return maxPosition; } ExponentialFeeItemsAlgorithm(long minValue, int minPosition, long maxValue, int maxPosition); @Override long computeValue(int position); @Override int getMinPosition(); @Override int getMaxPosition(... |
@Test public void testTruncateAndConvertDecimalString() { assertEquals(Utils.truncateAndConvertDecimalString("10.12345678", 8), "10.12345678"); assertEquals(Utils.truncateAndConvertDecimalString("5", 8), "5"); assertEquals(Utils.truncateAndConvertDecimalString("5", 0), "5"); assertEquals(Utils.truncateAndConvertDecimal... | public static String truncateAndConvertDecimalString(String number, int maxDecimalPlaces) { if (number == null) { return null; } number = number.trim(); if (!isValidDecimalNumber(number)) { return null; } number = number.replace(',', '.'); boolean foundDot = false; int decimals = 0; char[] chars = number.toCharArray();... | Utils { public static String truncateAndConvertDecimalString(String number, int maxDecimalPlaces) { if (number == null) { return null; } number = number.trim(); if (!isValidDecimalNumber(number)) { return null; } number = number.replace(',', '.'); boolean foundDot = false; int decimals = 0; char[] chars = number.toChar... | Utils { public static String truncateAndConvertDecimalString(String number, int maxDecimalPlaces) { if (number == null) { return null; } number = number.trim(); if (!isValidDecimalNumber(number)) { return null; } number = number.replace(',', '.'); boolean foundDot = false; int decimals = 0; char[] chars = number.toChar... | Utils { public static String truncateAndConvertDecimalString(String number, int maxDecimalPlaces) { if (number == null) { return null; } number = number.trim(); if (!isValidDecimalNumber(number)) { return null; } number = number.replace(',', '.'); boolean foundDot = false; int decimals = 0; char[] chars = number.toChar... | Utils { public static String truncateAndConvertDecimalString(String number, int maxDecimalPlaces) { if (number == null) { return null; } number = number.trim(); if (!isValidDecimalNumber(number)) { return null; } number = number.replace(',', '.'); boolean foundDot = false; int decimals = 0; char[] chars = number.toChar... |
@Test public void tvTest1() throws BipSss.NotEnoughSharesException, BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { Collection<Share> shares = addShareWithId("SSS-4EtJVAbu6g9", "5df6", new ArrayList<Share>()); addShareWithId("SSS-4EtJVHFLUQ7", "5df6", shares); String result = BipSss.combine(sha... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void tvTest2() throws BipSss.NotEnoughSharesException, BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { Collection<Share> shares = addShareWithId("SSS-FmEQ1wApUkUA", "ff12", new ArrayList<Share>()); addShareWithId("SSS-FmEQ2TkajyyQ", "ff12", shares); addShareWithId("SSS-FmEQ2yQJjYme... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void tvTest3() throws BipSss.NotEnoughSharesException, BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { String result = BipSss.combine(addShareWithId("SSS-2b8cxNvVnwSHzDKPr3", "1234", new ArrayList<Share>())); assertResult(result, HexUtils.toBytes("0102030405")); } | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void tvTest4() throws BipSss.NotEnoughSharesException, BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { Collection<Share> shares = addShareWithId("SSS-2cTMvHxbT71LzEzbfi", "5851", new ArrayList<Share>()); addShareWithId("SSS-2cTMvNxxgQ3Hcg1Bab", "5851", shares); addShareWithId("SSS-... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void tvTest5() throws BipSss.NotEnoughSharesException, BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { Collection<Share> shares = addShareWithId("SSS-5CJkUwdiUPZi2R8RJJzkUFvs1TWC22JAQD2T3QMyhuAvDgzrXKuhT5at", "20ba", new ArrayList<Share>()); addShareWithId("SSS-5CJkUyu8LAq7Newbgpc5... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void tvTest6() throws BipSss.NotEnoughSharesException, BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { Collection<Share> shares = addShareWithId("SSS-L7d2zGTyrAkwk2BESS1ksfA3ejFHhyBrPUp8M3gTgzj6XH7r7rTvEZkks", "bf09", new ArrayList<Share>()); addShareWithId("SSS-L7d2zWZue1HrHVYfbVx... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void tvTest7() throws BipSss.NotEnoughSharesException, BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { Collection<Share> shares = addShareWithId("SSS-2mghkBRhDnYVjuy9JkUN9SMWEQfFeizsE", "6b91", new ArrayList<Share>()); addShareWithId("SSS-2mghkFR2Fm7psBGPYC5EAUSG12QjgytWq", "6b91",... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void testFromData() throws Exception { byte[] cipherText = HexUtils.toBytes("5edbaade9ba4ed528a8de36c95ece996189dedf4756fba2599f94b4f370d7013" + "66e2f0ba4e59111c0787708cf4b0b82de558b4d8bf5d90b3512f09814d605d4c" + "14f2f85b596211f83918c31c4bef19ea"); MerkleTree merkleTree = MerkleTree.fromData(cipherText);... | public static MerkleTree fromData(byte[] data){ return fromData(data, DEFAULT_CHUNK_SIZE); } | MerkleTree { public static MerkleTree fromData(byte[] data){ return fromData(data, DEFAULT_CHUNK_SIZE); } } | MerkleTree { public static MerkleTree fromData(byte[] data){ return fromData(data, DEFAULT_CHUNK_SIZE); } MerkleTree(Sha256Hash root, ArrayList<byte[]> chunks); } | MerkleTree { public static MerkleTree fromData(byte[] data){ return fromData(data, DEFAULT_CHUNK_SIZE); } MerkleTree(Sha256Hash root, ArrayList<byte[]> chunks); static MerkleTree fromData(byte[] data); static MerkleTree fromData(byte[] data, int chunkSize); Sha256Hash getRoot(); ArrayList<byte[]> getChunks(); @Override... | MerkleTree { public static MerkleTree fromData(byte[] data){ return fromData(data, DEFAULT_CHUNK_SIZE); } MerkleTree(Sha256Hash root, ArrayList<byte[]> chunks); static MerkleTree fromData(byte[] data); static MerkleTree fromData(byte[] data, int chunkSize); Sha256Hash getRoot(); ArrayList<byte[]> getChunks(); @Override... |
@Test public void tvTest8() throws BipSss.NotEnoughSharesException, BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { Collection<Share> shares = addShareWithId("SSS-ycigiEv2xRyozNqze5bxgRJZ57wCDEZrU6LJ3v4d2BWQWysFQNZ53D", "a53f", new ArrayList<Share>()); addShareWithId("SSS-ycigjnVFuh8u794S3f3f7E... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void tvTest9() throws BipSss.NotEnoughSharesException, BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { Collection<Share> shares = addShareWithId("SSS-J3N84hNNoV5ZYcjnWXeRLZ4sJEmGQ7tdUfXxhasAEb2synv2Ygb1p9sW31svpMDrXM7hxYCDTSftZJdb2EtR1gQviu1NJQNV1N", "e7bc", new ArrayList<Share>())... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void notEnoughShares() throws BipSss.InvalidContentTypeException, BipSss.IncompatibleSharesException { Collection<Share> shares = addShareWithId("SSS-5CJkUwdiUPZi2R8RJJzkUFvs1TWC22JAQD2T3QMyhuAvDgzrXKuhT5at", "20ba", new ArrayList<Share>()); try { BipSss.combine(shares); Assert.fail(); } catch (BipSss.NotE... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void IncompatibleShares() throws BipSss.InvalidContentTypeException, BipSss.NotEnoughSharesException { Collection<Share> shares = addShareWithId("SSS-5CJkUwdiUPZi2R8RJJzkUFvs1TWC22JAQD2T3QMyhuAvDgzrXKuhT5at", "20ba", new ArrayList<Share>()); addShareWithId("SSS-J3N86LXy38QWEoneDmowUeX4XRycx2uQqT8jT3H4cZLMQ... | public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Share share =... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... | BipSss { public static String combine(Collection<Share> shares) throws IncompatibleSharesException, NotEnoughSharesException, InvalidContentTypeException { if (shares.size() == 0) { throw new NotEnoughSharesException(1); } Iterator<Share> it = shares.iterator(); Share firstShare = it.next(); while (it.hasNext()) { Shar... |
@Test public void toHex() throws Exception { for(byte[] bytes : bytess) { String hex = new String(Hex.encode(bytes)); assertEquals(hex, HexUtils.toHex(bytes)); } } | public static String toHex(byte[] bytes) { return toHex(bytes, null); } | HexUtils { public static String toHex(byte[] bytes) { return toHex(bytes, null); } } | HexUtils { public static String toHex(byte[] bytes) { return toHex(bytes, null); } } | HexUtils { public static String toHex(byte[] bytes) { return toHex(bytes, null); } static String toHex(byte[] bytes); static String toHex(byte[] bytes, String separator); static String toHex(byte[] bytes, int offset, int length); static String toHex(byte b); static String toHex(byte[] bytes, int offset, int length, St... | HexUtils { public static String toHex(byte[] bytes) { return toHex(bytes, null); } static String toHex(byte[] bytes); static String toHex(byte[] bytes, String separator); static String toHex(byte[] bytes, int offset, int length); static String toHex(byte b); static String toHex(byte[] bytes, int offset, int length, St... |
@Test public void toBytes() throws Exception { for(String string : strings) { byte [] bytes = Hex.decode(string); assertArrayEquals(bytes, HexUtils.toBytes(string)); } } | public static byte[] toBytes(String hexString) { if(hexString != null) { hexString = hexString.replace(" ", ""); } if (hexString == null || hexString.length() % 2 != 0) { throw new RuntimeException("Input string must contain an even number of characters"); } char[] hex = hexString.toCharArray(); int length = hex.length... | HexUtils { public static byte[] toBytes(String hexString) { if(hexString != null) { hexString = hexString.replace(" ", ""); } if (hexString == null || hexString.length() % 2 != 0) { throw new RuntimeException("Input string must contain an even number of characters"); } char[] hex = hexString.toCharArray(); int length =... | HexUtils { public static byte[] toBytes(String hexString) { if(hexString != null) { hexString = hexString.replace(" ", ""); } if (hexString == null || hexString.length() % 2 != 0) { throw new RuntimeException("Input string must contain an even number of characters"); } char[] hex = hexString.toCharArray(); int length =... | HexUtils { public static byte[] toBytes(String hexString) { if(hexString != null) { hexString = hexString.replace(" ", ""); } if (hexString == null || hexString.length() % 2 != 0) { throw new RuntimeException("Input string must contain an even number of characters"); } char[] hex = hexString.toCharArray(); int length =... | HexUtils { public static byte[] toBytes(String hexString) { if(hexString != null) { hexString = hexString.replace(" ", ""); } if (hexString == null || hexString.length() % 2 != 0) { throw new RuntimeException("Input string must contain an even number of characters"); } char[] hex = hexString.toCharArray(); int length =... |
@Test public void chunkTest() throws Script.ScriptParsingException { final String TEST_SCRIPT="5321033e20dea007b39688c6e97427a65aeedd0b47fde14e96631bb0330a403663150c2103b5058635d91ae26306140b90673b89616062c59a80301622f4ed6f8050c65a7f2103c04f34973eee8485e21a014268908d36510ed6f149c0ec3331aa521c6cc3929c2103d87a6d71ab19fda... | protected static byte[][] chunksFromScriptBytes(byte[] script) throws ScriptParsingException { try { ByteReader reader = new ByteReader(script); int numChunks = countChunks(reader); if (numChunks == -1) { throw new ScriptParsingException(script); } byte[][] chunks = new byte[numChunks][]; int index = 0; reader.reset();... | Script implements Serializable { protected static byte[][] chunksFromScriptBytes(byte[] script) throws ScriptParsingException { try { ByteReader reader = new ByteReader(script); int numChunks = countChunks(reader); if (numChunks == -1) { throw new ScriptParsingException(script); } byte[][] chunks = new byte[numChunks][... | Script implements Serializable { protected static byte[][] chunksFromScriptBytes(byte[] script) throws ScriptParsingException { try { ByteReader reader = new ByteReader(script); int numChunks = countChunks(reader); if (numChunks == -1) { throw new ScriptParsingException(script); } byte[][] chunks = new byte[numChunks][... | Script implements Serializable { protected static byte[][] chunksFromScriptBytes(byte[] script) throws ScriptParsingException { try { ByteReader reader = new ByteReader(script); int numChunks = countChunks(reader); if (numChunks == -1) { throw new ScriptParsingException(script); } byte[][] chunks = new byte[numChunks][... | Script implements Serializable { protected static byte[][] chunksFromScriptBytes(byte[] script) throws ScriptParsingException { try { ByteReader reader = new ByteReader(script); int numChunks = countChunks(reader); if (numChunks == -1) { throw new ScriptParsingException(script); } byte[][] chunks = new byte[numChunks][... |
@Test public void isScriptOutputOpReturnTest() throws Exception { byte[][] chunks = new byte[2][]; chunks[0]=new byte[]{OP_RETURN}; assertFalse(isScriptOutputOpReturn(chunks)); assertTrue(isScriptOutputOpReturn(new byte[][]{{OP_RETURN}, "Hallotest".getBytes()})); assertFalse(isScriptOutputOpReturn(new byte[][]{{OP_RETU... | protected static boolean isScriptOutputOpReturn(byte[][] chunks) { return chunks.length == 2 && Script.isOP(chunks[0], OP_RETURN) && chunks[1] != null && chunks[1].length > 0; } | ScriptOutputOpReturn extends ScriptOutput implements Serializable { protected static boolean isScriptOutputOpReturn(byte[][] chunks) { return chunks.length == 2 && Script.isOP(chunks[0], OP_RETURN) && chunks[1] != null && chunks[1].length > 0; } } | ScriptOutputOpReturn extends ScriptOutput implements Serializable { protected static boolean isScriptOutputOpReturn(byte[][] chunks) { return chunks.length == 2 && Script.isOP(chunks[0], OP_RETURN) && chunks[1] != null && chunks[1].length > 0; } protected ScriptOutputOpReturn(byte[][] chunks, byte[] scriptBytes); } | ScriptOutputOpReturn extends ScriptOutput implements Serializable { protected static boolean isScriptOutputOpReturn(byte[][] chunks) { return chunks.length == 2 && Script.isOP(chunks[0], OP_RETURN) && chunks[1] != null && chunks[1].length > 0; } protected ScriptOutputOpReturn(byte[][] chunks, byte[] scriptBytes); byte... | ScriptOutputOpReturn extends ScriptOutput implements Serializable { protected static boolean isScriptOutputOpReturn(byte[][] chunks) { return chunks.length == 2 && Script.isOP(chunks[0], OP_RETURN) && chunks[1] != null && chunks[1].length > 0; } protected ScriptOutputOpReturn(byte[][] chunks, byte[] scriptBytes); byte... |
@Test(timeout=500) @Ignore("This is not really a requirement but was meant to show the supperior performance of bitcoinJ") public void generateSignaturesBitlib() throws Exception { List<SigningRequest> requests = new ArrayList<>(); for(int i = 0; i<30; i++) { requests.add(new SigningRequest(PUBLIC_KEYS[i % COUNT], Hash... | public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { throw new RuntimeException("Priv... | StandardTransactionBuilder { public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { thr... | StandardTransactionBuilder { public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { thr... | StandardTransactionBuilder { public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { thr... | StandardTransactionBuilder { public static List<byte[]> generateSignatures(SigningRequest[] requests, IPrivateKeyRing keyRing) { List<byte[]> signatures = new LinkedList<>(); for (SigningRequest request : requests) { BitcoinSigner signer = keyRing.findSignerByPublicKey(request.getPublicKey()); if (signer == null) { thr... |
@Test public void shouldBeZero() throws Exception { assertTrue(counter.isZero()); } | public boolean isZero() { for (byte b : state) { if (b != 0) { return false; } } return true; } | Counter { public boolean isZero() { for (byte b : state) { if (b != 0) { return false; } } return true; } } | Counter { public boolean isZero() { for (byte b : state) { if (b != 0) { return false; } } return true; } Counter(int bits); } | Counter { public boolean isZero() { for (byte b : state) { if (b != 0) { return false; } } return true; } Counter(int bits); void increment(); byte[] getState(); boolean isZero(); } | Counter { public boolean isZero() { for (byte b : state) { if (b != 0) { return false; } } return true; } Counter(int bits); void increment(); byte[] getState(); boolean isZero(); } |
@Test public void testCreateMaxBitcoin() { PopRequest uri = new PopRequest("btcpop:?p=a&n=1&amount=21000000.00000000"); assertEquals(2100000000000000L, uri.getAmountSatoshis().longValue()); } | public Long getAmountSatoshis() { return amountSatoshis; } | PopRequest implements Serializable { public Long getAmountSatoshis() { return amountSatoshis; } } | PopRequest implements Serializable { public Long getAmountSatoshis() { return amountSatoshis; } PopRequest(String input); } | PopRequest implements Serializable { public Long getAmountSatoshis() { return amountSatoshis; } PopRequest(String input); byte[] getN(); Long getAmountSatoshis(); String getLabel(); Sha256Hash getTxid(); String getP(); String getMessage(); String toString(); } | PopRequest implements Serializable { public Long getAmountSatoshis() { return amountSatoshis; } PopRequest(String input); byte[] getN(); Long getAmountSatoshis(); String getLabel(); Sha256Hash getTxid(); String getP(); String getMessage(); String toString(); } |
@Test public void shouldCreateInstanceAndWaitForInitialization() throws Exception { Fortuna fortuna = Fortuna.createInstance(); try { fortuna.nextInt(42); } catch (IllegalStateException ignored) { fail("Did not wait for initialization"); } } | public static Fortuna createInstance() { return createInstance(defaultSources()); } | Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } } | Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } private Fortuna(Generator generator, Pool[] pools); } | Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } private Fortuna(Generator generator, Pool[] pools); static Fortuna createInstance(); static Fortuna createInstance(Iterable<EntropySource> sources); @Override synchronized void setSeed(long seed); } | Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } private Fortuna(Generator generator, Pool[] pools); static Fortuna createInstance(); static Fortuna createInstance(Iterable<EntropySource> sources); @Override synchronized void setSeed(long seed); } |
@Ignore @Test public void shouldProduceEvenDistribution() throws Exception { int[] numbers = new int[10]; Fortuna fortuna = Fortuna.createInstance(); for (int i = 0; i < 1000000; i++) { numbers[fortuna.nextInt(10)]++; } int lowest = Integer.MAX_VALUE; int highest = Integer.MIN_VALUE; for (int number : numbers) { if (nu... | public static Fortuna createInstance() { return createInstance(defaultSources()); } | Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } } | Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } private Fortuna(Generator generator, Pool[] pools); } | Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } private Fortuna(Generator generator, Pool[] pools); static Fortuna createInstance(); static Fortuna createInstance(Iterable<EntropySource> sources); @Override synchronized void setSeed(long seed); } | Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } private Fortuna(Generator generator, Pool[] pools); static Fortuna createInstance(); static Fortuna createInstance(Iterable<EntropySource> sources); @Override synchronized void setSeed(long seed); } |
@Test public void shouldAddBytes() throws Exception { target.event( new EventScheduler() { @Override public void schedule(long delay, TimeUnit timeUnit) { assertEquals(100, timeUnit.toMillis(delay)); schedules++; } }, new EventAdder() { @Override public void add(byte[] event) { assertEquals(2, event.length); adds++; } ... | @Override public void event(EventScheduler scheduler, EventAdder adder) { long threadTime = threadMXBean.getCurrentThreadCpuTime() + threadMXBean.getCurrentThreadUserTime(); adder.add(Util.twoLeastSignificantBytes(threadTime)); scheduler.schedule(100, TimeUnit.MILLISECONDS); } | ThreadTimeEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long threadTime = threadMXBean.getCurrentThreadCpuTime() + threadMXBean.getCurrentThreadUserTime(); adder.add(Util.twoLeastSignificantBytes(threadTime)); scheduler.schedule(100, TimeUnit.MILLISEC... | ThreadTimeEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long threadTime = threadMXBean.getCurrentThreadCpuTime() + threadMXBean.getCurrentThreadUserTime(); adder.add(Util.twoLeastSignificantBytes(threadTime)); scheduler.schedule(100, TimeUnit.MILLISEC... | ThreadTimeEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long threadTime = threadMXBean.getCurrentThreadCpuTime() + threadMXBean.getCurrentThreadUserTime(); adder.add(Util.twoLeastSignificantBytes(threadTime)); scheduler.schedule(100, TimeUnit.MILLISEC... | ThreadTimeEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long threadTime = threadMXBean.getCurrentThreadCpuTime() + threadMXBean.getCurrentThreadUserTime(); adder.add(Util.twoLeastSignificantBytes(threadTime)); scheduler.schedule(100, TimeUnit.MILLISEC... |
@Test public void shouldAddUptime() throws Exception { target.event( new EventScheduler() { @Override public void schedule(long delay, TimeUnit timeUnit) { assertEquals(100, timeUnit.toMillis(delay)); schedules++; } }, new EventAdder() { @Override public void add(byte[] event) { assertEquals(32, event.length); adds++; ... | @Override public void event(EventScheduler scheduler, EventAdder adder) { try { InputStream inputStream = device2Stream(); try { int size = inputStream.read(bytes); Preconditions.checkState(size == bytes.length); adder.add(bytes); scheduler.schedule(100, TimeUnit.MILLISECONDS); } finally { inputStream.close(); } } catc... | PlatformEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { try { InputStream inputStream = device2Stream(); try { int size = inputStream.read(bytes); Preconditions.checkState(size == bytes.length); adder.add(bytes); scheduler.schedule(100, TimeUnit.MILLISE... | PlatformEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { try { InputStream inputStream = device2Stream(); try { int size = inputStream.read(bytes); Preconditions.checkState(size == bytes.length); adder.add(bytes); scheduler.schedule(100, TimeUnit.MILLISE... | PlatformEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { try { InputStream inputStream = device2Stream(); try { int size = inputStream.read(bytes); Preconditions.checkState(size == bytes.length); adder.add(bytes); scheduler.schedule(100, TimeUnit.MILLISE... | PlatformEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { try { InputStream inputStream = device2Stream(); try { int size = inputStream.read(bytes); Preconditions.checkState(size == bytes.length); adder.add(bytes); scheduler.schedule(100, TimeUnit.MILLISE... |
@Test public void shouldUseTimeBetweenCallsToCreateEvents() throws Exception { target.event( new EventScheduler() { @Override public void schedule(long delay, TimeUnit timeUnit) { assertEquals(10, timeUnit.toMillis(delay)); schedules++; } }, new EventAdder() { @Override public void add(byte[] event) { assertEquals(2, e... | @Override public void event(EventScheduler scheduler, EventAdder adder) { long now = System.nanoTime(); long elapsed = now - lastTime; lastTime = now; adder.add(Util.twoLeastSignificantBytes(elapsed)); scheduler.schedule(10, TimeUnit.MILLISECONDS); } | SchedulingEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long now = System.nanoTime(); long elapsed = now - lastTime; lastTime = now; adder.add(Util.twoLeastSignificantBytes(elapsed)); scheduler.schedule(10, TimeUnit.MILLISECONDS); } } | SchedulingEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long now = System.nanoTime(); long elapsed = now - lastTime; lastTime = now; adder.add(Util.twoLeastSignificantBytes(elapsed)); scheduler.schedule(10, TimeUnit.MILLISECONDS); } } | SchedulingEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long now = System.nanoTime(); long elapsed = now - lastTime; lastTime = now; adder.add(Util.twoLeastSignificantBytes(elapsed)); scheduler.schedule(10, TimeUnit.MILLISECONDS); } @Override void ev... | SchedulingEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long now = System.nanoTime(); long elapsed = now - lastTime; lastTime = now; adder.add(Util.twoLeastSignificantBytes(elapsed)); scheduler.schedule(10, TimeUnit.MILLISECONDS); } @Override void ev... |
@Test public void shouldAddUptime() throws Exception { target.event( new EventScheduler() { @Override public void schedule(long delay, TimeUnit timeUnit) { assertEquals(1000, timeUnit.toMillis(delay)); schedules++; } }, new EventAdder() { @Override public void add(byte[] event) { assertEquals(2, event.length); adds++; ... | @Override public void event(EventScheduler scheduler, EventAdder adder) { long uptime = runtimeMXBean.getUptime(); adder.add(Util.twoLeastSignificantBytes(uptime)); scheduler.schedule(1, TimeUnit.SECONDS); } | UptimeEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long uptime = runtimeMXBean.getUptime(); adder.add(Util.twoLeastSignificantBytes(uptime)); scheduler.schedule(1, TimeUnit.SECONDS); } } | UptimeEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long uptime = runtimeMXBean.getUptime(); adder.add(Util.twoLeastSignificantBytes(uptime)); scheduler.schedule(1, TimeUnit.SECONDS); } } | UptimeEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long uptime = runtimeMXBean.getUptime(); adder.add(Util.twoLeastSignificantBytes(uptime)); scheduler.schedule(1, TimeUnit.SECONDS); } @Override void event(EventScheduler scheduler, EventAdder adder)... | UptimeEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long uptime = runtimeMXBean.getUptime(); adder.add(Util.twoLeastSignificantBytes(uptime)); scheduler.schedule(1, TimeUnit.SECONDS); } @Override void event(EventScheduler scheduler, EventAdder adder)... |
@Test public void shouldAddTwoBytesAndSchedule() throws Exception { target.event( new EventScheduler() { @Override public void schedule(long delay, TimeUnit timeUnit) { assertEquals(1000, timeUnit.toMillis(delay)); schedules++; } }, new EventAdder() { @Override public void add(byte[] event) { assertEquals(2, event.leng... | @Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longValue(); adder.add(Util.twoLeastSignificantBytes(conv... | LoadAverageEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longV... | LoadAverageEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longV... | LoadAverageEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longV... | LoadAverageEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longV... |
@Test public void shouldGetGarbageCollectionData() throws Exception { target.event( new EventScheduler() { @Override public void schedule(long delay, TimeUnit timeUnit) { assertEquals(TimeUnit.SECONDS.toMillis(10), timeUnit.toMillis(delay)); schedules++; } }, new EventAdder() { @Override public void add(byte[] event) {... | @Override public void event(EventScheduler scheduler, EventAdder adder) { long sum = 0; for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMXBeans) { sum += garbageCollectorMXBean.getCollectionCount() + garbageCollectorMXBean.getCollectionTime(); } adder.add(Util.twoLeastSignificantBytes(sum)); schedu... | GarbageCollectorEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long sum = 0; for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMXBeans) { sum += garbageCollectorMXBean.getCollectionCount() + garbageCollectorMXBean.getCollectionTime()... | GarbageCollectorEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long sum = 0; for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMXBeans) { sum += garbageCollectorMXBean.getCollectionCount() + garbageCollectorMXBean.getCollectionTime()... | GarbageCollectorEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long sum = 0; for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMXBeans) { sum += garbageCollectorMXBean.getCollectionCount() + garbageCollectorMXBean.getCollectionTime()... | GarbageCollectorEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long sum = 0; for (GarbageCollectorMXBean garbageCollectorMXBean : garbageCollectorMXBeans) { sum += garbageCollectorMXBean.getCollectionCount() + garbageCollectorMXBean.getCollectionTime()... |
@Test public void shouldReadFreeMemory() throws Exception { target.event( new EventScheduler() { @Override public void schedule(long delay, TimeUnit timeUnit) { assertEquals(100, timeUnit.toMillis(delay)); schedules++; } }, new EventAdder() { @Override public void add(byte[] event) { assertEquals(2, event.length); adds... | @Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); } | FreeMemoryEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); } } | FreeMemoryEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); } } | FreeMemoryEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); } @Override void event(EventScheduler s... | FreeMemoryEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); } @Override void event(EventScheduler s... |
@Test(expected = IllegalArgumentException.class) public void shouldFailIfSourceIsLessThanZero() throws Exception { pool.add(-1, "Hello".getBytes()); } | public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need to be in... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... |
@Test public void testCreateUrlDecode() throws UnsupportedEncodingException { String encoded = URLEncoder.encode("http: PopRequest uri = new PopRequest("btcpop:?label=a text&n=111&p=" + encoded); assertEquals("a text", uri.getLabel()); assertEquals("http: } | public String getLabel() { return label; } | PopRequest implements Serializable { public String getLabel() { return label; } } | PopRequest implements Serializable { public String getLabel() { return label; } PopRequest(String input); } | PopRequest implements Serializable { public String getLabel() { return label; } PopRequest(String input); byte[] getN(); Long getAmountSatoshis(); String getLabel(); Sha256Hash getTxid(); String getP(); String getMessage(); String toString(); } | PopRequest implements Serializable { public String getLabel() { return label; } PopRequest(String input); byte[] getN(); Long getAmountSatoshis(); String getLabel(); Sha256Hash getTxid(); String getP(); String getMessage(); String toString(); } |
@Test(expected = IllegalArgumentException.class) public void shouldFailIfSourceIsGreaterThan255() throws Exception { pool.add(256, "Hello".getBytes()); } | public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need to be in... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... |
@Test(expected = IllegalArgumentException.class) public void shouldFailIfEventIsEmpty() throws Exception { pool.add(0, new byte[0]); } | public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need to be in... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... |
@Test(expected = IllegalArgumentException.class) public void shouldFailIfEventLengthIsGreaterThan32() throws Exception { pool.add(0, new byte[33]); } | public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need to be in... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... | Pool { public void add(int source, byte[] event) { writeLock.lock(); try { if (source < 0 || source > 255) { throw new IllegalArgumentException("Source needs to be in the range 0 to 255, it was " + source); } if (event.length < 1 || event.length > 32) { throw new IllegalArgumentException("The length of the event need t... |
@Test public void shouldGet32BytesOfSeedData() throws Exception { byte[] bytes = pool.getAndClear(); assertEquals(32, bytes.length); } | public byte[] getAndClear() { writeLock.lock(); try { size = 0; return poolDigest.digest(); } finally { writeLock.unlock(); } } | Pool { public byte[] getAndClear() { writeLock.lock(); try { size = 0; return poolDigest.digest(); } finally { writeLock.unlock(); } } } | Pool { public byte[] getAndClear() { writeLock.lock(); try { size = 0; return poolDigest.digest(); } finally { writeLock.unlock(); } } } | Pool { public byte[] getAndClear() { writeLock.lock(); try { size = 0; return poolDigest.digest(); } finally { writeLock.unlock(); } } long size(); void add(int source, byte[] event); byte[] getAndClear(); } | Pool { public byte[] getAndClear() { writeLock.lock(); try { size = 0; return poolDigest.digest(); } finally { writeLock.unlock(); } } long size(); void add(int source, byte[] event); byte[] getAndClear(); } |
@Test public void testParse(){ BackupUtil util = new BackupUtil(ENCRYPTED_KEY, CORRECT_PASSWORD); String decoded = util.getKey(); assertEquals(EXPECTED_RESPONSE, decoded); decoded= new BackupUtil(ENCRYPTED_KEY, "QDTDXOYFBXBKKMK").getKey(); assertEquals(EXPECTED_RESPONSE, decoded); } | public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else { if (passwo... | BackupUtil { public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else... | BackupUtil { public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else... | BackupUtil { public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else... | BackupUtil { public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else... |
@Test public void testErrorHandling(){ BackupUtil util = new BackupUtil(ENCRYPTED_KEY, "QDTDXOYFBXBKKAA"); String decoded = util.getKey(); assertTrue(decoded.startsWith("Error: ")); util = new BackupUtil(ENCRYPTED_KEY, "QDTDXOYFBXBKKAAA"); decoded = util.getKey(); assertTrue(decoded.startsWith("Error: ")); util = new B... | public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else { if (passwo... | BackupUtil { public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else... | BackupUtil { public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else... | BackupUtil { public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else... | BackupUtil { public String getKey() { final String realpassword; if (password.length() == 16) { boolean checksumValid = MrdExport.isChecksumValid(password); if (!checksumValid) { return "Error: the last character of the password was not matching the checksum"; } else { realpassword = password.substring(0, 15); } } else... |
@Test public void P2PKHAddressTest() throws Exception { Assert.assertEquals(Address.fromStandardBytes(BCHBechAddress.bchBechDecode("bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a").getHash(), NetworkParameters.productionNetwork).toString(), "1BpEi6DfDAUFd7GtittLSdBeYJvcoaVggu"); } | public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(Locale.ROOT))) { ... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... |
@Test public void P2SHAddressTest() throws Exception { Assert.assertEquals(Address.fromP2SHBytes(BCHBechAddress.bchBechDecode("bitcoincash:pqq3728yw0y47sqn6l2na30mcw6zm78dzq5ucqzc37").getHash(), NetworkParameters.productionNetwork).toString(), "31nwvkZwyPdgzjBJZXfDmSWsC4ZLKpYyUw"); } | public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(Locale.ROOT))) { ... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... |
@Test public void legacyAddressConstructorTest() throws Exception { Assert.assertEquals(BCHBechAddress.bchBechDecode("bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a") .constructLegacyAddress(NetworkParameters.productionNetwork).toString(), "1BpEi6DfDAUFd7GtittLSdBeYJvcoaVggu"); Assert.assertEquals(BCHBechAddres... | public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(Locale.ROOT))) { ... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... | BCHBechAddress { public static BechAddressParams bchBechDecode(String bech) throws Exception { byte[] buffer = bech.getBytes(); for (byte b : buffer) { if (b < 0x21 || b > 0x7e) { throw new Exception("bech32 characters out of range"); } } if (!bech.equals(bech.toLowerCase(Locale.ROOT)) && !bech.equals(bech.toUpperCase(... |
@Test public void computeValue() throws Exception { assertEquals(MIN_VALUE, algorithm.computeValue(MIN_POSITION)); assertEquals(MAX_VALUE, algorithm.computeValue(MAX_POSITION)); assertTrue(algorithm.computeValue(MIN_POSITION + 1) > MIN_VALUE); assertTrue(algorithm.computeValue(MAX_POSITION - 1) < MAX_VALUE); } | @Override public long computeValue(int position) { int step = position - minPosition; return round((double)minValue * pow(scale, step)); } | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public long computeValue(int position) { int step = position - minPosition; return round((double)minValue * pow(scale, step)); } } | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public long computeValue(int position) { int step = position - minPosition; return round((double)minValue * pow(scale, step)); } ExponentialFeeItemsAlgorithm(long minValue, int minPosition, long maxValue, int maxPosition); } | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public long computeValue(int position) { int step = position - minPosition; return round((double)minValue * pow(scale, step)); } ExponentialFeeItemsAlgorithm(long minValue, int minPosition, long maxValue, int maxPosition); @Override long computeValue... | ExponentialFeeItemsAlgorithm implements FeeItemsAlgorithm { @Override public long computeValue(int position) { int step = position - minPosition; return round((double)minValue * pow(scale, step)); } ExponentialFeeItemsAlgorithm(long minValue, int minPosition, long maxValue, int maxPosition); @Override long computeValue... |
@Test void onlySimpleTypes() { JazonList jazonList = new JazonList("orange", 55, false, 173.50, null); List<JsonExpectationInput> list = jazonList.list(); assertEquals(5, list.size()); assertEquals(new ObjectExpectationInput("orange"), list.get(0)); assertEquals(new ObjectExpectationInput(55), list.get(1)); assertEqual... | public List<JsonExpectationInput> list() { return list; } | JazonList { public List<JsonExpectationInput> list() { return list; } } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); JazonList with(Object object); JazonList with(Predicate<T> predicate); List<JsonExpectationInput> list(); } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); JazonList with(Object object); JazonList with(Predicate<T> predicate); List<JsonExpectationInput> list(); } |
@Test void nullIsTranslatedToNullPredicate_usingConstructor() { JazonList jazonList = new JazonList(null, null); List<JsonExpectationInput> list = jazonList.list(); assertEquals(2, list.size()); assertEquals(new PredicateExpectationInput<>(null), list.get(0)); } | public List<JsonExpectationInput> list() { return list; } | JazonList { public List<JsonExpectationInput> list() { return list; } } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); JazonList with(Object object); JazonList with(Predicate<T> predicate); List<JsonExpectationInput> list(); } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); JazonList with(Object object); JazonList with(Predicate<T> predicate); List<JsonExpectationInput> list(); } |
@Test void onlyPredicates() { JazonList jazonList = new JazonList((Integer it) -> it > 0, (String s) -> s.matches("re.*")); List<JsonExpectationInput> list = jazonList.list(); assertEquals(2, list.size()); PredicateExpectationInput firstPredicateInput = (PredicateExpectationInput) list.get(0); Predicate<Integer> firstP... | public List<JsonExpectationInput> list() { return list; } | JazonList { public List<JsonExpectationInput> list() { return list; } } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); JazonList with(Object object); JazonList with(Predicate<T> predicate); List<JsonExpectationInput> list(); } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); JazonList with(Object object); JazonList with(Predicate<T> predicate); List<JsonExpectationInput> list(); } |
@Test void nestedList() { JazonList drinks = new JazonList("pepsi", "coca cola", "sprite"); JazonList birds = new JazonList("pigeon", "sparrow"); JazonList jazonList = new JazonList(drinks, birds); List<JsonExpectationInput> list = jazonList.list(); assertEquals(2, list.size()); assertEquals(new ObjectExpectationInput(... | public List<JsonExpectationInput> list() { return list; } | JazonList { public List<JsonExpectationInput> list() { return list; } } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); JazonList with(Object object); JazonList with(Predicate<T> predicate); List<JsonExpectationInput> list(); } | JazonList { public List<JsonExpectationInput> list() { return list; } JazonList(Predicate<?>... predicates); JazonList(Object... objects); JazonList with(Object object); JazonList with(Predicate<T> predicate); List<JsonExpectationInput> list(); } |
@Test public void testListProperties() throws Exception { example.listProperties(); } | public void listProperties () throws IOException { for(Property property : dataset.getProperties()) { System.out.format("%s (%s) - %s%n", property.getName(), property.valueType.name(), property.getDescription()); StringBuilder propertyOutput = new StringBuilder(); for (Value value : property.getValues().getAll()) { pro... | MetadataExample implements Closeable { public void listProperties () throws IOException { for(Property property : dataset.getProperties()) { System.out.format("%s (%s) - %s%n", property.getName(), property.valueType.name(), property.getDescription()); StringBuilder propertyOutput = new StringBuilder(); for (Value value... | MetadataExample implements Closeable { public void listProperties () throws IOException { for(Property property : dataset.getProperties()) { System.out.format("%s (%s) - %s%n", property.getName(), property.valueType.name(), property.getDescription()); StringBuilder propertyOutput = new StringBuilder(); for (Value value... | MetadataExample implements Closeable { public void listProperties () throws IOException { for(Property property : dataset.getProperties()) { System.out.format("%s (%s) - %s%n", property.getName(), property.valueType.name(), property.getDescription()); StringBuilder propertyOutput = new StringBuilder(); for (Value value... | MetadataExample implements Closeable { public void listProperties () throws IOException { for(Property property : dataset.getProperties()) { System.out.format("%s (%s) - %s%n", property.getName(), property.valueType.name(), property.getDescription()); StringBuilder propertyOutput = new StringBuilder(); for (Value value... |
@Test public void testLiteGettingStartedMediahubUA() throws IOException { assertFalse(gs.isMobile(gs.mediaHubUserAgent)); } | public boolean isMobile(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toBool(); } | StronglyTypedValues implements Closeable { public boolean isMobile(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toBool(); } } | StronglyTypedValues implements Closeable { public boolean isMobile(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toBool(); } StronglyTypedValues(); } | StronglyTypedValues implements Closeable { public boolean isMobile(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toBool(); } StronglyTypedValues(); boolean isMobile(String userAgent); static void main(String[] args); @Override void close(); } | StronglyTypedValues implements Closeable { public boolean isMobile(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toBool(); } StronglyTypedValues(); boolean isMobile(String userAgent); static void main(String[] args); @Override void close(); } |
@Test public void testStreamMemory() throws Exception { logger.info("Stream Array / Memory"); testDataSet(StreamFactory.create(Benchmark.fileAsBytes(Shared.getLitePatternV32()))); } | protected static byte[] fileAsBytes(String deviceDataFile) throws IOException { File file = new File(deviceDataFile); byte fileContent[] = new byte[(int) file.length()]; FileInputStream fin = new FileInputStream(file); try { int bytesRead = fin.read(fileContent); if (bytesRead != file.length()) { throw new IllegalState... | Benchmark { protected static byte[] fileAsBytes(String deviceDataFile) throws IOException { File file = new File(deviceDataFile); byte fileContent[] = new byte[(int) file.length()]; FileInputStream fin = new FileInputStream(file); try { int bytesRead = fin.read(fileContent); if (bytesRead != file.length()) { throw new ... | Benchmark { protected static byte[] fileAsBytes(String deviceDataFile) throws IOException { File file = new File(deviceDataFile); byte fileContent[] = new byte[(int) file.length()]; FileInputStream fin = new FileInputStream(file); try { int bytesRead = fin.read(fileContent); if (bytesRead != file.length()) { throw new ... | Benchmark { protected static byte[] fileAsBytes(String deviceDataFile) throws IOException { File file = new File(deviceDataFile); byte fileContent[] = new byte[(int) file.length()]; FileInputStream fin = new FileInputStream(file); try { int bytesRead = fin.read(fileContent); if (bytesRead != file.length()) { throw new ... | Benchmark { protected static byte[] fileAsBytes(String deviceDataFile) throws IOException { File file = new File(deviceDataFile); byte fileContent[] = new byte[(int) file.length()]; FileInputStream fin = new FileInputStream(file); try { int bytesRead = fin.read(fileContent); if (bytesRead != file.length()) { throw new ... |
@Test public void testCreate() throws IOException, InterruptedException { long start; Provider provider = new Provider(MemoryFactory.create(new FileInputStream(Filename.LITE_PATTERN_V32))); List<Match> matches= new ArrayList<Match>(NUMBER_OF_TESTS); for (int i = 0; i< NUMBER_OF_TESTS; i++) { matches.add(provider.create... | void reset() { this.state.reset(); this.overriddenProfiles = null; this.cookie = null; this.propertyValueOverridesCookies = null; } | Match { void reset() { this.state.reset(); this.overriddenProfiles = null; this.cookie = null; this.propertyValueOverridesCookies = null; } } | Match { void reset() { this.state.reset(); this.overriddenProfiles = null; this.cookie = null; this.propertyValueOverridesCookies = null; } Match(Provider provider); Match(Provider provider, String targetUserAgent); } | Match { void reset() { this.state.reset(); this.overriddenProfiles = null; this.cookie = null; this.propertyValueOverridesCookies = null; } Match(Provider provider); Match(Provider provider, String targetUserAgent); Dataset getDataSet(); String getTargetUserAgent(); long getElapsed(); Signature getSignature(); MatchM... | Match { void reset() { this.state.reset(); this.overriddenProfiles = null; this.cookie = null; this.propertyValueOverridesCookies = null; } Match(Provider provider); Match(Provider provider, String targetUserAgent); Dataset getDataSet(); String getTargetUserAgent(); long getElapsed(); Signature getSignature(); MatchM... |
@Test public void testDefaultIsNoCaches () throws IOException { IndirectDataset dataset = DatasetBuilder.file() .build(Filename.LITE_PATTERN_V32); assertEquals(null, dataset.getCache(StringsCache)); assertEquals(null, dataset.getCache(SignaturesCache)); assertEquals(null, dataset.getCache(NodesCache)); assertEquals(nul... | public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); static final int STRINGS_CACHE_SIZE; static final int NODES_CACHE_SIZE; static final int VALUES_CACHE_SIZE; static final int P... |
@Test public void testAddDefaultCaches () throws IOException { IndirectDataset dataset = DatasetBuilder.file() .configureDefaultCaches() .build(Filename.LITE_PATTERN_V32); assertEquals(LruCache.class, dataset.getCache(StringsCache).getClass()); assertEquals(LruCache.class, dataset.getCache(SignaturesCache).getClass());... | public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); static final int STRINGS_CACHE_SIZE; static final int NODES_CACHE_SIZE; static final int VALUES_CACHE_SIZE; static final int P... |
@Test public void testCreate32FromBuilder () throws Exception { File temp = File.createTempFile("Test",".dat"); File source = new File(Filename.LITE_PATTERN_V32); Files.copy(source, temp); Dataset dataset = DatasetBuilder.file() .lastModified(new Date()) .build(temp.getPath()); ViableProvider.ensureViableProvider(new P... | public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); static final int STRINGS_CACHE_SIZE; static final int NODES_CACHE_SIZE; static final int VALUES_CACHE_SIZE; static final int P... |
@Test(expected = NoSuchElementException.class) public void testIterator () throws Exception { IndirectDataset indirectDataset = DatasetBuilder.file() .lastModified(new Date()) .build(Filename.LITE_PATTERN_V32); Iterator it = indirectDataset.profiles.iterator(); while (it.hasNext()) { it.next(); } it.next(); } | public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); static final int STRINGS_CACHE_SIZE; static final int NODES_CACHE_SIZE; static final int VALUES_CACHE_SIZE; static final int P... |
@Test public void testMemoryStreamDatasetConsistentNoCache () throws IOException { IndirectDataset indirectDataset = DatasetBuilder.file() .lastModified(new Date()) .build(Filename.LITE_PATTERN_V32); Dataset memoryDataset = MemoryFactory.create(Filename.LITE_PATTERN_V32); compareDatasets(indirectDataset, memoryDataset)... | public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); static final int STRINGS_CACHE_SIZE; static final int NODES_CACHE_SIZE; static final int VALUES_CACHE_SIZE; static final int P... |
@Test public void testMemoryStreamDatasetConsistentPartialLruCache () throws IOException { IndirectDataset indirectDataset = DatasetBuilder.file() .configureCache(NodesCache, new CacheOptions(20, LruCache.builder())) .configureCache(ValuesCache, new CacheOptions(100, LruCache.builder())) .configureCache(StringsCache, n... | public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); } | DatasetBuilder { public static BuildFromFile file() { return new DatasetBuilder().new BuildFromFile(); } private DatasetBuilder(); static BuildFromFile file(); static BuildFromBuffer buffer(); static final int STRINGS_CACHE_SIZE; static final int NODES_CACHE_SIZE; static final int VALUES_CACHE_SIZE; static final int P... |
@Test public void testCreate32FromFilename () throws Exception { File temp = File.createTempFile("Test",".dat"); File source = new File(Filename.LITE_PATTERN_V32); Files.copy(source, temp); Dataset dataset = StreamFactory.create(temp.getPath()); ViableProvider.ensureViableProvider(new Provider(dataset)); dataset.close(... | public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } static IndirectDataset create(byte[] data); static IndirectDataset create(String filePath); static IndirectDataset create(String filePath, boolean isTempFile);... | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } static IndirectDataset create(byte[] data); static IndirectDataset create(String filePath); static IndirectDataset create(String filePath, boolean isTempFile);... |
@Test public void FindProfilesExample() throws IOException { fp = new FindProfiles(); List<Profile> profiles = fp.provider.dataSet.findProfiles("IsMobile", "True", null); for (Profile profile : profiles) { assertEquals(profile.getValues("IsMobile").toString(), "True"); } profiles = fp.provider.dataSet.findProfiles("IsM... | public FindProfiles() throws IOException { provider = new Provider(StreamFactory.create(Shared.getLitePatternV32(), false)); } | FindProfiles implements Closeable { public FindProfiles() throws IOException { provider = new Provider(StreamFactory.create(Shared.getLitePatternV32(), false)); } } | FindProfiles implements Closeable { public FindProfiles() throws IOException { provider = new Provider(StreamFactory.create(Shared.getLitePatternV32(), false)); } FindProfiles(); } | FindProfiles implements Closeable { public FindProfiles() throws IOException { provider = new Provider(StreamFactory.create(Shared.getLitePatternV32(), false)); } FindProfiles(); static void main(String[] args); @Override void close(); } | FindProfiles implements Closeable { public FindProfiles() throws IOException { provider = new Provider(StreamFactory.create(Shared.getLitePatternV32(), false)); } FindProfiles(); static void main(String[] args); @Override void close(); } |
@Test public void testCreate31FromFilename () throws Exception { Dataset dataset = StreamFactory.create(Filename.LITE_PATTERN_V31); ViableProvider.ensureViableProvider(new Provider(dataset)); } | public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } static IndirectDataset create(byte[] data); static IndirectDataset create(String filePath); static IndirectDataset create(String filePath, boolean isTempFile);... | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } static IndirectDataset create(byte[] data); static IndirectDataset create(String filePath); static IndirectDataset create(String filePath, boolean isTempFile);... |
@Test public void testMemoryStreamDatasetConsistentDefault () throws IOException { IndirectDataset indirectDataset = StreamFactory.create(Filename.LITE_PATTERN_V32); Dataset memoryDataset = MemoryFactory.create(Filename.LITE_PATTERN_V32); compareDatasets(indirectDataset, memoryDataset); } | public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } static IndirectDataset create(byte[] data); static IndirectDataset create(String filePath); static IndirectDataset create(String filePath, boolean isTempFile);... | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } static IndirectDataset create(byte[] data); static IndirectDataset create(String filePath); static IndirectDataset create(String filePath, boolean isTempFile);... |
@Test public void testDefaultCache () throws Exception { Dataset dataset = StreamFactory.create(Filename.LITE_PATTERN_V32); Provider provider = new Provider(dataset, 20); cacheTests(provider); } | public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } } | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } static IndirectDataset create(byte[] data); static IndirectDataset create(String filePath); static IndirectDataset create(String filePath, boolean isTempFile);... | StreamFactory { public static IndirectDataset create(byte[] data) throws IOException { return DatasetBuilder.buffer() .configureDefaultCaches() .build(data); } static IndirectDataset create(byte[] data); static IndirectDataset create(String filePath); static IndirectDataset create(String filePath, boolean isTempFile);... |
@Test public void testMemoryAndStreamSame () throws IOException { IndirectDataset cachedDataset = DatasetBuilder.file() .configureDefaultCaches() .build(Filename.LITE_PATTERN_V32); Provider cachedProvider = new Provider(cachedDataset, new LruCache(5000)); IndirectDataset unCachedDataset = DatasetBuilder.file() .build(F... | public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } | Provider { public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } } | Provider { public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } Provider(Dataset dataSet); Provider(Dataset dataSet, int cacheSize); Provider(Dataset dataSet, ILoadingCache cache); Provider(Dataset dataSet, boolean recordDetectionTime, ILoadingCache cach... | Provider { public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } Provider(Dataset dataSet); Provider(Dataset dataSet, int cacheSize); Provider(Dataset dataSet, ILoadingCache cache); Provider(Dataset dataSet, boolean recordDetectionTime, ILoadingCache cach... | Provider { public Match match(final Map<String, String> headers) throws IOException { return match(headers, createMatch()); } Provider(Dataset dataSet); Provider(Dataset dataSet, int cacheSize); Provider(Dataset dataSet, ILoadingCache cache); Provider(Dataset dataSet, boolean recordDetectionTime, ILoadingCache cach... |
@Test public void dynamicFilter() throws IOException { ArrayList<Signature> signatures; int signaturesOriginal = df.signatures.size(); signatures = df.filterBy("IsMobile", "True", null); int signaturesIsMobile = signatures.size(); signatures = df.filterBy("PlatformName", "Android", signatures); int signaturesPlatformna... | public ArrayList<Signature> filterBy(String propertyName, String propertyValue, ArrayList<Signature> listToFilter) throws IOException { if (propertyName.isEmpty() || propertyValue.isEmpty()) { throw new IllegalArgumentException("Property and Value can not be " + "empty or null."); } if (listToFilter == null) { listToFi... | DynamicFilters { public ArrayList<Signature> filterBy(String propertyName, String propertyValue, ArrayList<Signature> listToFilter) throws IOException { if (propertyName.isEmpty() || propertyValue.isEmpty()) { throw new IllegalArgumentException("Property and Value can not be " + "empty or null."); } if (listToFilter ==... | DynamicFilters { public ArrayList<Signature> filterBy(String propertyName, String propertyValue, ArrayList<Signature> listToFilter) throws IOException { if (propertyName.isEmpty() || propertyValue.isEmpty()) { throw new IllegalArgumentException("Property and Value can not be " + "empty or null."); } if (listToFilter ==... | DynamicFilters { public ArrayList<Signature> filterBy(String propertyName, String propertyValue, ArrayList<Signature> listToFilter) throws IOException { if (propertyName.isEmpty() || propertyValue.isEmpty()) { throw new IllegalArgumentException("Property and Value can not be " + "empty or null."); } if (listToFilter ==... | DynamicFilters { public ArrayList<Signature> filterBy(String propertyName, String propertyValue, ArrayList<Signature> listToFilter) throws IOException { if (propertyName.isEmpty() || propertyValue.isEmpty()) { throw new IllegalArgumentException("Property and Value can not be " + "empty or null."); } if (listToFilter ==... |
@Test public void testAllProfiles() throws Exception { assertEquals(outputFile.length(), 0); example.run(outputFile.getAbsolutePath()); assertNotEquals(outputFile.length(), 0); } | public AllProfiles() throws IOException { provider = new Provider(StreamFactory.create( Shared.getLitePatternV32(), false)); hardwareComponent = provider.dataSet.getComponent("HardwarePlatform"); hardwareProperties = hardwareComponent.getProperties(); hardwareProfiles = hardwareComponent.getProfiles(); } | AllProfiles implements Closeable { public AllProfiles() throws IOException { provider = new Provider(StreamFactory.create( Shared.getLitePatternV32(), false)); hardwareComponent = provider.dataSet.getComponent("HardwarePlatform"); hardwareProperties = hardwareComponent.getProperties(); hardwareProfiles = hardwareCompon... | AllProfiles implements Closeable { public AllProfiles() throws IOException { provider = new Provider(StreamFactory.create( Shared.getLitePatternV32(), false)); hardwareComponent = provider.dataSet.getComponent("HardwarePlatform"); hardwareProperties = hardwareComponent.getProperties(); hardwareProfiles = hardwareCompon... | AllProfiles implements Closeable { public AllProfiles() throws IOException { provider = new Provider(StreamFactory.create( Shared.getLitePatternV32(), false)); hardwareComponent = provider.dataSet.getComponent("HardwarePlatform"); hardwareProperties = hardwareComponent.getProperties(); hardwareProfiles = hardwareCompon... | AllProfiles implements Closeable { public AllProfiles() throws IOException { provider = new Provider(StreamFactory.create( Shared.getLitePatternV32(), false)); hardwareComponent = provider.dataSet.getComponent("HardwarePlatform"); hardwareProperties = hardwareComponent.getProperties(); hardwareProfiles = hardwareCompon... |
@Test public void testLiteGettingStartedMobileUA() throws IOException { String result = gs.detect(gs.mobileUserAgent); System.out.println("Mobile User-Agent: " + gs.mobileUserAgent); System.out.println("IsMobile: " + result); assertTrue(result.equals("True")); } | public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } | GettingStarted implements Closeable { public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } } | GettingStarted implements Closeable { public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } GettingStarted(); } | GettingStarted implements Closeable { public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } GettingStarted(); String detect(String userAgent); static void main(String[] args); @Override void close(); } | GettingStarted implements Closeable { public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } GettingStarted(); String detect(String userAgent); static void main(String[] args); @Override void close(); } |
@Test public void testLiteGettingStartedDesktopUA() throws IOException { String result = gs.detect(gs.desktopUserAgent); System.out.println("Desktop User-Agent: " + gs.desktopUserAgent); System.out.println("IsMobile: " + result); assertTrue(result.equals("False")); } | public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } | GettingStarted implements Closeable { public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } } | GettingStarted implements Closeable { public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } GettingStarted(); } | GettingStarted implements Closeable { public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } GettingStarted(); String detect(String userAgent); static void main(String[] args); @Override void close(); } | GettingStarted implements Closeable { public String detect(String userAgent) throws IOException { Match match = provider.match(userAgent); return match.getValues("IsMobile").toString(); } GettingStarted(); String detect(String userAgent); static void main(String[] args); @Override void close(); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.