forked from I2P_Developers/i2p.i2p
merge of '36411afd84e961f271fd1d09a2d7f227f633af4c'
and 'a441ad8880324b5e5e9deb63487986976daf06a8'
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
<cobertura-instrument todir="./build/obj_test">
|
||||
<fileset dir="./build/obj">
|
||||
<include name="**/*.class"/>
|
||||
<exclude name="**/*Test.class" />
|
||||
</fileset>
|
||||
</cobertura-instrument>
|
||||
</target>
|
||||
|
||||
@@ -179,6 +179,7 @@ public class DataHelper {
|
||||
* @param props source
|
||||
* @return new offset
|
||||
*/
|
||||
@Deprecated
|
||||
public static int toProperties(byte target[], int offset, Properties props) throws DataFormatException, IOException {
|
||||
if (props != null) {
|
||||
OrderedProperties p = new OrderedProperties();
|
||||
@@ -219,6 +220,7 @@ public class DataHelper {
|
||||
* @param target returned Properties
|
||||
* @return new offset
|
||||
*/
|
||||
@Deprecated
|
||||
public static int fromProperties(byte source[], int offset, Properties target) throws DataFormatException, IOException {
|
||||
int size = (int)fromLong(source, offset, 2);
|
||||
offset += 2;
|
||||
@@ -254,6 +256,7 @@ public class DataHelper {
|
||||
*
|
||||
* @throws RuntimeException if either is too long.
|
||||
*/
|
||||
@Deprecated
|
||||
public static byte[] toProperties(Properties opts) {
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(2);
|
||||
@@ -544,6 +547,7 @@ public class DataHelper {
|
||||
}
|
||||
|
||||
/** @deprecated unused */
|
||||
@Deprecated
|
||||
public static byte[] toDate(Date date) throws IllegalArgumentException {
|
||||
if (date == null)
|
||||
return toLong(DATE_LENGTH, 0L);
|
||||
@@ -678,6 +682,7 @@ public class DataHelper {
|
||||
* @throws IOException if there is an IO error writing the boolean
|
||||
* @deprecated unused
|
||||
*/
|
||||
@Deprecated
|
||||
public static void writeBoolean(OutputStream out, Boolean bool)
|
||||
throws DataFormatException, IOException {
|
||||
if (bool == null)
|
||||
@@ -689,6 +694,7 @@ public class DataHelper {
|
||||
}
|
||||
|
||||
/** @deprecated unused */
|
||||
@Deprecated
|
||||
public static Boolean fromBoolean(byte data[], int offset) {
|
||||
if (data[offset] == BOOLEAN_TRUE)
|
||||
return Boolean.TRUE;
|
||||
@@ -699,11 +705,13 @@ public class DataHelper {
|
||||
}
|
||||
|
||||
/** @deprecated unused */
|
||||
@Deprecated
|
||||
public static void toBoolean(byte data[], int offset, boolean value) {
|
||||
data[offset] = (value ? BOOLEAN_TRUE : BOOLEAN_FALSE);
|
||||
}
|
||||
|
||||
/** @deprecated unused */
|
||||
@Deprecated
|
||||
public static void toBoolean(byte data[], int offset, Boolean value) {
|
||||
if (value == null)
|
||||
data[offset] = BOOLEAN_UNKNOWN;
|
||||
@@ -712,12 +720,16 @@ public class DataHelper {
|
||||
}
|
||||
|
||||
/** deprecated - used only in DatabaseLookupMessage */
|
||||
@Deprecated
|
||||
public static final byte BOOLEAN_TRUE = 0x1;
|
||||
/** deprecated - used only in DatabaseLookupMessage */
|
||||
@Deprecated
|
||||
public static final byte BOOLEAN_FALSE = 0x0;
|
||||
/** @deprecated unused */
|
||||
@Deprecated
|
||||
public static final byte BOOLEAN_UNKNOWN = 0x2;
|
||||
/** @deprecated unused */
|
||||
@Deprecated
|
||||
public static final int BOOLEAN_LENGTH = 1;
|
||||
|
||||
//
|
||||
@@ -780,6 +792,7 @@ public class DataHelper {
|
||||
* Compare two integers, really just for consistency.
|
||||
* @deprecated inefficient
|
||||
*/
|
||||
@Deprecated
|
||||
public final static boolean eq(int lhs, int rhs) {
|
||||
return lhs == rhs;
|
||||
}
|
||||
@@ -788,6 +801,7 @@ public class DataHelper {
|
||||
* Compare two longs, really just for consistency.
|
||||
* @deprecated inefficient
|
||||
*/
|
||||
@Deprecated
|
||||
public final static boolean eq(long lhs, long rhs) {
|
||||
return lhs == rhs;
|
||||
}
|
||||
@@ -796,6 +810,7 @@ public class DataHelper {
|
||||
* Compare two bytes, really just for consistency.
|
||||
* @deprecated inefficient
|
||||
*/
|
||||
@Deprecated
|
||||
public final static boolean eq(byte lhs, byte rhs) {
|
||||
return lhs == rhs;
|
||||
}
|
||||
@@ -974,6 +989,7 @@ public class DataHelper {
|
||||
* @return true if the line was read, false if eof was reached before a
|
||||
* newline was found
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean readLine(InputStream in, StringBuffer buf) throws IOException {
|
||||
return readLine(in, buf, null);
|
||||
}
|
||||
@@ -987,6 +1003,7 @@ public class DataHelper {
|
||||
* Warning - 8KB line length limit as of 0.7.13, @throws IOException if exceeded
|
||||
* @deprecated use StringBuilder version
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean readLine(InputStream in, StringBuffer buf, Sha256Standalone hash) throws IOException {
|
||||
int c = -1;
|
||||
int i = 0;
|
||||
|
||||
@@ -25,4 +25,50 @@ public class LeaseSetTest extends StructureTest {
|
||||
return leaseSet;
|
||||
}
|
||||
public DataStructure createStructureToRead() { return new LeaseSet(); }
|
||||
|
||||
public void testGetLeaseInvalid() {
|
||||
// create test subject
|
||||
LeaseSet subj = new LeaseSet();
|
||||
|
||||
// should contain no leases now..
|
||||
try {
|
||||
assertNull(subj.getLease(0));
|
||||
} catch(RuntimeException exc) {
|
||||
// all good
|
||||
}
|
||||
|
||||
// this shouldn't work either
|
||||
try {
|
||||
assertNull(subj.getLease(-1));
|
||||
} catch(RuntimeException exc) {
|
||||
// all good
|
||||
}
|
||||
}
|
||||
|
||||
public void testAddLeaseNull() {
|
||||
// create test subject
|
||||
LeaseSet subj = new LeaseSet();
|
||||
|
||||
// now add an null lease
|
||||
try {
|
||||
subj.addLease(null);
|
||||
fail("Failed at failing.");
|
||||
} catch(IllegalArgumentException exc) {
|
||||
// all good
|
||||
}
|
||||
}
|
||||
|
||||
public void testAddLeaseInvalid() {
|
||||
// create test subject
|
||||
LeaseSet subj = new LeaseSet();
|
||||
|
||||
// try to add completely invalid lease(ie. no data)
|
||||
try {
|
||||
subj.addLease(new Lease());
|
||||
fail("Failed at failing.");
|
||||
} catch(IllegalArgumentException exc) {
|
||||
// all good
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public class RouterAddressTest extends StructureTest {
|
||||
addr.setOptions(options);
|
||||
addr.setTransportStyle("Blah");
|
||||
assertFalse(addr.equals(null));
|
||||
assertFalse(addr.equals(""));
|
||||
}
|
||||
|
||||
public void testToString(){
|
||||
@@ -73,5 +74,7 @@ public class RouterAddressTest extends StructureTest {
|
||||
addr.setOptions(options);
|
||||
addr.setTransportStyle("Blah");
|
||||
addr.toString();
|
||||
addr.setOptions(null);
|
||||
addr.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user