You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2013/05/17 12:25:16 UTC
svn commit: r1483727 [3/3] - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting:
functionTests/harness/ functionTests/suites/
functionTests/tests/junitTests/compatibility/
functionTests/tests/junitTests/derbyNet/ functionTests/tests/lang/ fun...
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java Fri May 17 10:25:14 2013
@@ -171,9 +171,9 @@ public class TestUtil {
{
if (framework != UNKNOWN_FRAMEWORK)
return framework;
- String frameworkString = (String) AccessController.doPrivileged
- (new PrivilegedAction() {
- public Object run() {
+ String frameworkString = AccessController.doPrivileged
+ (new PrivilegedAction<String>() {
+ public String run() {
return System.getProperty("framework");
}
}
@@ -219,9 +219,9 @@ public class TestUtil {
*/
public static String getHostName()
{
- String hostName = (String) AccessController.doPrivileged
- (new PrivilegedAction() {
- public Object run() {
+ String hostName = AccessController.doPrivileged
+ (new PrivilegedAction<String>() {
+ public String run() {
return System.getProperty("hostName");
}
}
@@ -291,9 +291,10 @@ public class TestUtil {
try {
AccessController.doPrivileged
- (new PrivilegedExceptionAction() {
- public Object run() throws Exception {
- return Class.forName(driverName).newInstance();
+ (new PrivilegedExceptionAction<Void>() {
+ public Void run() throws Exception {
+ Class.forName(driverName).newInstance();
+ return null;
}
}
);
@@ -412,7 +413,7 @@ public class TestUtil {
static private Class[] INT_ARG_TYPE = {Integer.TYPE};
static private Class[] BOOLEAN_ARG_TYPE = { Boolean.TYPE };
// A hashtable of special non-string attributes.
- private static Hashtable specialAttributes = null;
+ private static Hashtable<String, Class[]> specialAttributes = null;
private static Object getDataSourceWithReflection(String classname, Properties attrs)
@@ -424,7 +425,7 @@ public class TestUtil {
if (specialAttributes == null)
{
- specialAttributes = new Hashtable();
+ specialAttributes = new Hashtable<String, Class[]>();
specialAttributes.put("portNumber",INT_ARG_TYPE);
specialAttributes.put("driverType",INT_ARG_TYPE);
specialAttributes.put("retrieveMessagesFromServerOnGetMessage",
@@ -923,9 +924,9 @@ public class TestUtil {
public static void dumpAllStackTracesIfSupported(PrintWriter log)
{
try {
- String version = (String) AccessController.doPrivileged
- (new java.security.PrivilegedAction(){
- public Object run(){
+ String version = AccessController.doPrivileged
+ (new PrivilegedAction<String>(){
+ public String run(){
return System.getProperty("java.version");
}
}
@@ -934,18 +935,18 @@ public class TestUtil {
JavaVersionHolder j= new JavaVersionHolder(version);
if (j.atLeast(1,5)){
- Class c = Class.forName("org.apache.derbyTesting.functionTests.util.ThreadDump");
+ Class<?> c = Class.forName("org.apache.derbyTesting.functionTests.util.ThreadDump");
final Method m = c.getMethod("getStackDumpString",new Class[] {});
String dump;
try {
- dump = (String) AccessController.doPrivileged
- (new PrivilegedExceptionAction(){
- public Object run() throws
+ dump = AccessController.doPrivileged
+ (new PrivilegedExceptionAction<String>(){
+ public String run() throws
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException{
- return m.invoke(null, null);
+ return (String) m.invoke(null);
}
}
);
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/build.xml?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/build.xml Fri May 17 10:25:14 2013
@@ -64,6 +64,7 @@
<include name="${this.dir}/StaticInitializers/*.java"/>
<include name="${this.dir}/streams/*.java"/>
<include name="${this.dir}/corruptio/*.java"/>
+ <compilerarg value="-Xlint"/>
</javac>
</target>
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/build.xml?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/build.xml Fri May 17 10:25:14 2013
@@ -73,6 +73,7 @@
<pathelement path="${junit}"/>
</classpath>
<include name="${derby.testing.unittest.dir}/**/*.java"/>
+ <compilerarg value="-Xlint"/>
</javac>
<copy todir="${out.dir}/${derby.testing.unittest.dir}">
<fileset dir="${derby.testing.src.dir}/${derby.testing.unittest.dir}"
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/crypto/T_Cipher.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/crypto/T_Cipher.java?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/crypto/T_Cipher.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/crypto/T_Cipher.java Fri May 17 10:25:14 2013
@@ -28,21 +28,13 @@ import org.apache.derby.iapi.services.cr
import org.apache.derby.iapi.services.monitor.Monitor;
-import org.apache.derby.iapi.db.PropertyInfo;
-
import org.apache.derby.iapi.error.StandardException;
import java.security.AccessController;
import java.security.Key;
import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.RandomAccessFile;
import java.io.IOException;
@@ -104,8 +96,8 @@ public class T_Cipher extends T_Generic
// allow for alternate providers
String testProvider =
- (String) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
return System.getProperty("testEncryptionProvider");
}
});
@@ -618,8 +610,8 @@ public class T_Cipher extends T_Generic
*/
private void deleteFile(final File f)
{
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
if (f.exists())
f.delete();
return null;
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/BasicUnitTestManager.java Fri May 17 10:25:14 2013
@@ -28,10 +28,6 @@ import org.apache.derby.iapi.error.Stand
import org.apache.derby.iapi.services.monitor.Monitor;
import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.services.stream.HeaderPrintWriter;
-import org.apache.derbyTesting.unitTests.harness.UnitTest;
-import org.apache.derbyTesting.unitTests.harness.UnitTestConstants;
-import org.apache.derbyTesting.unitTests.harness.UnitTestManager;
-import org.apache.derbyTesting.unitTests.harness.T_Bomb;
import java.util.Date;
import java.util.Enumeration;
import java.util.Properties;
@@ -40,8 +36,8 @@ import java.util.Hashtable;
public class BasicUnitTestManager implements UnitTestManager, ModuleControl
{
- private Vector vectorOfTests;
- private Hashtable namesOfTests;
+ private Vector<UnitTest> vectorOfTests;
+ private Hashtable<String, String> namesOfTests;
private static boolean alreadyRun = false;
private HeaderPrintWriter output;
@@ -78,8 +74,8 @@ public class BasicUnitTestManager implem
this.currentOutput = output;
- vectorOfTests = new Vector();
- namesOfTests = new Hashtable();
+ vectorOfTests = new Vector<UnitTest>();
+ namesOfTests = new Hashtable<String, String>();
findTests(startParams, startParams);
try {
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/T_Bomb.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/T_Bomb.java?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/T_Bomb.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/harness/T_Bomb.java Fri May 17 10:25:14 2013
@@ -23,11 +23,9 @@ package org.apache.derbyTesting.unitTest
import org.apache.derby.iapi.services.property.PropertyUtil;
import org.apache.derby.iapi.services.context.ContextService;
-import org.apache.derby.iapi.services.monitor.Monitor;
import org.apache.derby.iapi.services.context.Context;
-import java.util.Enumeration;
import java.util.Vector;
public class T_Bomb implements Runnable {
@@ -37,7 +35,7 @@ public class T_Bomb implements Runnable
private static T_Bomb me;
private Thread t;
- private Vector v;
+ private Vector<T_Bombable> v;
private long delay;
private boolean armed = false;
@@ -47,7 +45,7 @@ public class T_Bomb implements Runnable
PropertyUtil.getSystemInt(BOMB_DELAY_PN,0,
Integer.MAX_VALUE,
DEFAULT_BOMB_DELAY);
- v = new Vector();
+ v = new Vector<T_Bombable>();
t = new Thread(this);
t.setDaemon(true);
t.start();
@@ -135,9 +133,8 @@ public class T_Bomb implements Runnable
private void performLastGasp()
{
- for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
+ for (T_Bombable b : v) {
try{
- T_Bombable b = (T_Bombable)e.nextElement();
b.lastChance();
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.java?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/SystemPrivilegesPermissionTest.java Fri May 17 10:25:14 2013
@@ -554,14 +554,14 @@ public class SystemPrivilegesPermissionT
/**
* Runs a privileged user action for a given principal.
*/
- private void execute(SystemPrincipal principal,
- PrivilegedAction action,
+ private <T> void execute(SystemPrincipal principal,
+ PrivilegedAction<T> action,
boolean isGrantExpected) {
//println();
//println(" testing action " + action);
- final RunAsPrivilegedUserAction runAsPrivilegedUserAction
- = new RunAsPrivilegedUserAction(principal, action);
+ final RunAsPrivilegedUserAction<T> runAsPrivilegedUserAction
+ = new RunAsPrivilegedUserAction<T>(principal, action);
try {
AccessController.doPrivileged(runAsPrivilegedUserAction);
//println(" Congrats! access granted " + action);
@@ -679,14 +679,14 @@ public class SystemPrivilegesPermissionT
* Represents a Shutdown server and engine action.
*/
public class ShutdownAction
- implements PrivilegedAction {
+ implements PrivilegedAction<Void> {
protected final Permission permission;
public ShutdownAction(Permission permission) {
this.permission = permission;
}
- public Object run() {
+ public Void run() {
//println(" checking access " + permission + "...");
AccessController.checkPermission(permission);
//println(" granted access " + this);
@@ -702,14 +702,14 @@ public class SystemPrivilegesPermissionT
* Represents a Create Database action.
*/
public class CreateDatabaseAction
- implements PrivilegedAction {
+ implements PrivilegedAction<Void> {
protected final Permission permission;
public CreateDatabaseAction(Permission permission) {
this.permission = permission;
}
- public Object run() {
+ public Void run() {
//println(" checking access " + permission + "...");
AccessController.checkPermission(permission);
//println(" granted access " + this);
@@ -745,20 +745,21 @@ public class SystemPrivilegesPermissionT
/**
* Represents a Privileged User action.
*/
- static public class RunAsPrivilegedUserAction
- implements PrivilegedAction {
+ static public class RunAsPrivilegedUserAction<T>
+ implements PrivilegedAction<T> {
final private SystemPrincipal principal;
- final private PrivilegedAction action;
+ final private PrivilegedAction<? extends T> action;
public RunAsPrivilegedUserAction(SystemPrincipal principal,
- PrivilegedAction action) {
+ PrivilegedAction<? extends T> action) {
this.principal = principal;
this.action = action;
}
- public Object run() {
+ public T run() {
final boolean readOnly = true;
- final Set principals = new HashSet();
+ final Set<SystemPrincipal> principals =
+ new HashSet<SystemPrincipal>();
final Set publicCredentials = new HashSet();
final Set privateCredentials = new HashSet();
// add the given principal
@@ -785,9 +786,8 @@ public class SystemPrivilegesPermissionT
// permission. In contrast, doAsPrivileged() with a null ACC
// seems to effectively ignore the caller's protection domain, so
// the check now only depends on the principal's permissions.
- Subject.doAsPrivileged(subject, action, null);
+ return Subject.doAsPrivileged(subject, action, null);
//Subject.doAs(subject, action);
- return null;
}
}
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_DaemonService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_DaemonService.java?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_DaemonService.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_DaemonService.java Fri May 17 10:25:14 2013
@@ -41,12 +41,12 @@ public class T_DaemonService extends T_M
/*
* fields for testing serviceable, one per test object
*/
- private Vector serviceRecord; // a vectory of T_Serviceable
+ private Vector<T_Serviceable> serviceRecord;
public T_DaemonService()
{
super();
- serviceRecord = new Vector(9, 1);
+ serviceRecord = new Vector<T_Serviceable>(9, 1);
random = new Random();
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_AccessFactory.java Fri May 17 10:25:14 2013
@@ -32,11 +32,8 @@ import org.apache.derby.iapi.types.Strin
import org.apache.derby.iapi.services.context.ContextManager;
import org.apache.derby.iapi.services.context.ContextService;
-import org.apache.derby.iapi.services.io.Storable;
-
import org.apache.derby.iapi.services.monitor.Monitor;
import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.services.io.FormatIdUtil;
import org.apache.derby.iapi.error.StandardException;
@@ -45,12 +42,10 @@ import org.apache.derby.iapi.types.DataV
import org.apache.derby.iapi.types.RowLocation;
import org.apache.derby.iapi.store.raw.RawStoreFactory;
-import org.apache.derby.iapi.store.raw.Transaction;
import org.apache.derby.iapi.reference.Property;
import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.services.io.FormatableBitSet;
import org.apache.derby.iapi.services.i18n.MessageService;
-import java.io.File;
import java.io.Serializable;
import java.util.Hashtable;
import java.util.Properties;
@@ -290,20 +285,21 @@ public class T_AccessFactory extends T_G
cc.insertAndFetchLocation(r1.getRowArray(), rowloc);
// quick test to make sure we can hash insert and find row location.
- Hashtable test_rowloc_hash = new Hashtable();
+ Hashtable<RowLocation, RowLocation> test_rowloc_hash =
+ new Hashtable<RowLocation, RowLocation>();
test_rowloc_hash.put(rowloc, rowloc);
- RowLocation hash_find = (RowLocation) test_rowloc_hash.get(rowloc);
+ RowLocation hash_find = test_rowloc_hash.get(rowloc);
if (!hash_find.equals(rowloc))
throw T_Fail.testFailMsg("(insertAndFetch) bad hash lookup 1");
- hash_find = (RowLocation) test_rowloc_hash.remove(rowloc);
+ hash_find = test_rowloc_hash.remove(rowloc);
if (!hash_find.equals(rowloc))
throw T_Fail.testFailMsg("(insertAndFetch) bad hash lookup 2");
- hash_find = (RowLocation) test_rowloc_hash.remove(rowloc);
+ hash_find = test_rowloc_hash.remove(rowloc);
if (hash_find != null)
throw T_Fail.testFailMsg("(insertAndFetch) bad hash lookup 3");
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_QualifierTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_QualifierTest.java?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_QualifierTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_QualifierTest.java Fri May 17 10:25:14 2013
@@ -84,12 +84,12 @@ public class T_QualifierTest
* Private/Protected methods of This class:
**************************************************************************
*/
- private static HashSet create_hash_set(
+ private static HashSet<Long> create_hash_set(
int expect_key,
int expect_numrows,
int order)
{
- HashSet set = new HashSet(10, 0.8f);
+ HashSet<Long> set = new HashSet<Long>(10, 0.8f);
int key_val = expect_key;
for (int i = 0; i < expect_numrows; i++)
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_SortController.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_SortController.java?rev=1483727&r1=1483726&r2=1483727&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_SortController.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/store/T_SortController.java Fri May 17 10:25:14 2013
@@ -70,8 +70,8 @@ public class T_SortController extends T_
}
private void setSortBufferSize(final String buf_length) {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
System.setProperty("derby.storage.sortBufferMax", buf_length);
return null;
}
@@ -728,7 +728,7 @@ public class T_SortController extends T_
{
int numMergeRuns = Integer.parseInt(sortprop.getProperty(
MessageService.getTextMessage(SQLState.STORE_RTS_NUM_MERGE_RUNS)));
- Vector mergeRuns = new Vector();
+ Vector<Integer> mergeRuns = new Vector<Integer>();
StringTokenizer st = new StringTokenizer(sortprop.getProperty(
MessageService.getTextMessage(SQLState.STORE_RTS_MERGE_RUNS_SIZE)),
"[],",false);
@@ -742,7 +742,7 @@ public class T_SortController extends T_
int totRunSize = 0;
for (int i = 0; i < mergeRuns.size(); i++)
- totRunSize += ((Integer) mergeRuns.elementAt(i)).intValue();
+ totRunSize += mergeRuns.elementAt(i);
if (totRunSize != numRowsInput)
FAIL("(testSort) the sum of the elements of the vector SortInfo.mergeRunsSize (value: " +
totRunSize + " ) is not equal to SortInfo.numRowsInput (value: " +
@@ -843,12 +843,12 @@ public class T_SortController extends T_
class T_DummySortObserver implements SortObserver
{
T_AccessRow template;
- Vector vector;
+ Vector<DataValueDescriptor[]> vector;
T_DummySortObserver(T_AccessRow template)
{
this.template = template;
- vector = new Vector();
+ vector = new Vector<DataValueDescriptor[]>();
}
/*
@@ -884,10 +884,7 @@ class T_DummySortObserver implements Sor
if (lastElement > 0)
{
- DataValueDescriptor[] retval =
- (DataValueDescriptor[]) vector.elementAt(lastElement - 1);
- vector.removeElementAt(lastElement - 1);
- return retval;
+ return vector.remove(lastElement - 1);
}
return template.getRowArrayClone();
}