incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r831928 [2/2] - /incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/
Date Mon, 02 Nov 2009 15:45:40 GMT
Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaMonitor_ObjectMonitors.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaMonitor_ObjectMonitors.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaMonitor_ObjectMonitors.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaMonitor_ObjectMonitors.java Mon Nov  2 15:45:39 2009
@@ -28,6 +28,8 @@
 import javax.tools.diagnostics.runtime.java.JavaThread;
 
 import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+import org.apache.kato.tck.setup.javaruntime.TODOJavaMonitor_ObjectMonitors;
+import org.apache.kato.tck.setup.javaruntime.TODOJavaMonitor_ObjectMonitors.MonitorThreadConfig;
 
 
 /**
@@ -40,94 +42,11 @@
  * 
  */
 public class TestJavaMonitor_ObjectMonitors extends TCKJavaRuntimeTestcase {
-	static final String monitorNotifyThreadName = "NotifyThread";
-
-	static final String monitorOwnerThreadName = "OwnerThread";
-
-	static final String monitorEnterThreadName = "EnterThread";
-	static final String namePrefix = "TestMonitors-";
-
-	/**
-	 * A unique class to allow DTFJ to find the correct object.
-	 * 
-	 */
-	public class MonitorClass {
-		private String id;
-
-		public MonitorClass(String id) {
-			this.id = id;
-		}
-	}
-
-	static final String monitorClassName = MonitorClass.class.getName()
-			.replace('.', '/');
-
-	public static class MonitorThreadConfig {
-		public MonitorThreadConfig(int waiters, int enters, int owners) {
-			this.waiters = waiters;
-			this.enters = enters;
-			this.owners = owners;
-			this.id = generatePrefix(waiters, enters, owners);
-		}
-
-		void setMonitor(JavaMonitor monitor) {
-			this.monitor = monitor;
-		}
-		JavaMonitor getMonitor() {
-			return monitor;
-		}
-
-		String id;
-		int waiters, enters, owners;
-		private JavaMonitor monitor;
-
-	}
-
-	private static int NUM_MONITORS = 9;
-
-	static MonitorThreadConfig[] monitorConfigs;
-	{
-		int i=0;
-		monitorConfigs = new MonitorThreadConfig[NUM_MONITORS];
-		
-		monitorConfigs[i++] = new MonitorThreadConfig(2, 2, 1);
-		monitorConfigs[i++] = new MonitorThreadConfig(0, 2, 1);
-		monitorConfigs[i++] = new MonitorThreadConfig(2, 0, 1);
-		monitorConfigs[i++] = new MonitorThreadConfig(2, 0, 0);
-		monitorConfigs[i++] = new MonitorThreadConfig(1, 1, 1);
-		monitorConfigs[i++] = new MonitorThreadConfig(1, 0, 1);
-		monitorConfigs[i++] = new MonitorThreadConfig(1, 0, 0);
-		monitorConfigs[i++] = new MonitorThreadConfig(0, 0, 1);
-		monitorConfigs[i++] = new MonitorThreadConfig(0, 1, 1);
-			
-	}
-
-	private MonitorThreadConfig findMonitorThreadConfig(int waiters,
-			int enters, int owners) {
-		for (int i = 0; i < monitorConfigs.length; i++) {
-			MonitorThreadConfig current = monitorConfigs[i];
-
-			if ((current.waiters == waiters) && (current.enters == enters)
-					&& (current.owners == owners)) {
-				return current;
-			}
-		}
-
-		return null;
-	}
-
-	private MonitorThreadConfig findMonitorThreadConfig(String id) {
-		for (int i = 0; i < monitorConfigs.length; i++) {
-			MonitorThreadConfig current = monitorConfigs[i];
-
-			if (current.id.equals(id)) {
-				return current;
-			}
-		}
+	
 
-		return null;
-	}
+	public TODOJavaMonitor_ObjectMonitors setup=new TODOJavaMonitor_ObjectMonitors();
 
+	
 	/**
 	 * Not executed anywhere - for debugging
 	 */
@@ -225,59 +144,13 @@
 		}
 	}
 	
-	public void configureMonitors() {
-		for (int i = 0; i < monitorConfigs.length; i++) {
-			createMonitor(monitorConfigs[i].waiters, monitorConfigs[i].enters,
-					monitorConfigs[i].owners);
-		}
-	}
+	
 
 	private static String generatePrefix(int waiters, int enters, int owners) {
-		return namePrefix + waiters + "-" + owners + "-" + enters;
+		return TODOJavaMonitor_ObjectMonitors.namePrefix + waiters + "-" + owners + "-" + enters;
 	}
 
-	public void createMonitor(int waiters, int enters, int owners) {
-		String prefix = generatePrefix(waiters, enters, owners);
-
-		Object monitor = new MonitorClass(prefix);
-
-		// These rules are very important.
-		if (waiters == 0 && enters == 0 && owners == 0) {
-			throw new IllegalArgumentException(
-					"Can't create monitor with no threads");
-		}
-
-		if (waiters < 0 || enters < 0 || owners < 0) {
-			throw new IllegalArgumentException(
-					"Numbers of threads must be 0 or above.");
-		}
-
-		if (enters > 0 && owners == 0) {
-			throw new IllegalArgumentException(
-					"Can't create enters threads with no owner");
-		}
-
-		if (owners > 1) {
-			throw new IllegalArgumentException(
-					"Can't create monitor with more than one owner");
-		}
-
-		// The ordering is significant.
-		for (int i = 0; i < waiters; i++) {
-			new MonitorNotifyThread(prefix + "-" + monitorNotifyThreadName
-					+ "-" + i, monitor).start();
-		}
-
-		for (int i = 0; i < owners; i++) {
-			new MonitorOwnerThread(prefix + "-" + monitorOwnerThreadName + "-"
-					+ i, monitor).start();
-		}
-
-		for (int i = 0; i < enters; i++) {
-			new MonitorEnterThread(prefix + "-" + monitorEnterThreadName + "-"
-					+ i, monitor).start();
-		}
-	}
+	
 
 	public class MonitorNotifyThread extends Thread {
 		private Object monitor;
@@ -453,7 +326,7 @@
 
 			if (monitorObjectCandidate != null) {
 				JavaClass monitorClass = monitorObjectCandidate.getJavaClass();
-				if (!monitorClassName.equals(monitorClass.getName())) {
+				if (!TODOJavaMonitor_ObjectMonitors.monitorClassName.equals(monitorClass.getName())) {
 					continue;
 				}
 
@@ -475,7 +348,7 @@
 
 					if (id != null) {
 
-						MonitorThreadConfig config = findMonitorThreadConfig(id);
+						MonitorThreadConfig config = setup.findMonitorThreadConfig(id);
 
 						if (config != null) {
 							config.setMonitor(monitorCandidate);
@@ -487,25 +360,25 @@
 	}
 
 	public void testFindMonitor_0_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 1, 1).getMonitor();
 
 		assertNotNull("Couldn't find 0-1-1", monitor);
 	}
 
 	public void testGetID_0_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 1, 1).getMonitor();
 
 		assertNotNull("JavaMonitor.getID() for 0-1-1 is null.", monitor.getID());
 	}
 
 	public void testGetName_0_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 1, 1).getMonitor();
 		assertNotNull("JavaMonitor.getName() for 0-1-1 is null.", monitor
 				.getName());
 	}
 
 	public void testCountWaiters_0_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 1, 1).getMonitor();
 		int count = 0;
 		Iterator waiters = monitor.getNotifyWaiters().iterator();
 
@@ -518,7 +391,7 @@
 	}
 
 	public void testCountEnters_0_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 1, 1).getMonitor();
 		int count = 0;
 		Iterator enters = monitor.getEnterWaiters().iterator();
 
@@ -531,21 +404,21 @@
 	}
 
 	public void testCountOwners_0_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 1, 1).getMonitor();
 		JavaThread owner = monitor.getOwner();
 
 		assertNotNull("Owner count incorrect", owner);
 	}
 
 	public void testNameWaiters_0_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 1, 1).getMonitor();
 		int count = 0;
 		Iterator waiters = monitor.getNotifyWaiters().iterator();
 
 		while (waiters.hasNext()) {
 			JavaThread next = (JavaThread) waiters.next();
 			assertEquals("Waiters name incorrect", generatePrefix(0, 1, 1)
-					+ "-" + monitorNotifyThreadName + "-" + count, next
+					+ "-" + TODOJavaMonitor_ObjectMonitors.monitorNotifyThreadName + "-" + count, next
 					.getName());
 			count++;
 		}
@@ -554,48 +427,48 @@
 	}
 
 	public void testNameEnters_0_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 1, 1).getMonitor();
 		int count = 0;
 		Iterator enters = monitor.getEnterWaiters().iterator();
 
 		while (enters.hasNext()) {
 			JavaThread next = (JavaThread) enters.next();
 			assertEquals("Enters name incorrect", generatePrefix(0, 1, 1) + "-"
-					+ monitorEnterThreadName + "-" + count, next.getName());
+					+ TODOJavaMonitor_ObjectMonitors.monitorEnterThreadName + "-" + count, next.getName());
 			count++;
 		}
 	}
 
 	public void testNameOwners_0_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 1, 1).getMonitor();
 		JavaThread owner = monitor.getOwner();
 
 		assertEquals("Owner name incorrect", generatePrefix(0, 1, 1) + "-"
-				+ monitorOwnerThreadName + "-0", owner.getName());
+				+ TODOJavaMonitor_ObjectMonitors.monitorOwnerThreadName + "-0", owner.getName());
 	}
 	
 	///////////////////////////////////////////
 
 	public void testFindMonitor_0_0_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 0, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 0, 1).getMonitor();
 
 		assertNotNull("Couldn't find 0-1-1", monitor);
 	}
 
 	public void testGetID_0_0_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 0, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 0, 1).getMonitor();
 
 		assertNotNull("JavaMonitor.getID() for 0-1-1 is null.", monitor.getID());
 	}
 
 	public void testGetName_0_0_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 0, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 0, 1).getMonitor();
 		assertNotNull("JavaMonitor.getName() for 0-1-1 is null.", monitor
 				.getName());
 	}
 
 	public void testCountWaiters_0_0_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 0, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 0, 1).getMonitor();
 		int count = 0;
 		Iterator waiters = monitor.getNotifyWaiters().iterator();
 
@@ -608,7 +481,7 @@
 	}
 
 	public void testCountEnters_0_0_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 0, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 0, 1).getMonitor();
 		int count = 0;
 		Iterator enters = monitor.getEnterWaiters().iterator();
 
@@ -621,21 +494,21 @@
 	}
 
 	public void testCountOwners_0_0_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 0, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 0, 1).getMonitor();
 		JavaThread owner = monitor.getOwner();
 
 		assertNotNull("Owner count incorrect", owner);
 	}
 
 	public void testNameWaiters_0_0_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 0, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 0, 1).getMonitor();
 		int count = 0;
 		Iterator waiters = monitor.getNotifyWaiters().iterator();
 
 		while (waiters.hasNext()) {
 			JavaThread next = (JavaThread) waiters.next();
 			assertEquals("Waiters name incorrect", generatePrefix(0, 0, 1)
-					+ "-" + monitorNotifyThreadName + "-" + count, next
+					+ "-" + TODOJavaMonitor_ObjectMonitors.monitorNotifyThreadName + "-" + count, next
 					.getName());
 			count++;
 		}
@@ -643,48 +516,48 @@
 	}
 
 	public void testNameEnters_0_0_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 0, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 0, 1).getMonitor();
 		int count = 0;
 		Iterator enters = monitor.getEnterWaiters().iterator();
 
 		while (enters.hasNext()) {
 			JavaThread next = (JavaThread) enters.next();
 			assertEquals("Enters name incorrect", generatePrefix(0, 0, 1) + "-"
-					+ monitorEnterThreadName + "-" + count, next.getName());
+					+ TODOJavaMonitor_ObjectMonitors.monitorEnterThreadName + "-" + count, next.getName());
 			count++;
 		}
 	}
 
 	public void testNameOwners_0_0_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(0, 0, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(0, 0, 1).getMonitor();
 		JavaThread owner = monitor.getOwner();
 
 		assertEquals("Owner name incorrect", generatePrefix(0, 0, 1) + "-"
-				+ monitorOwnerThreadName + "-0", owner.getName());
+				+ TODOJavaMonitor_ObjectMonitors.monitorOwnerThreadName + "-0", owner.getName());
 	}
 
 	///////////////////////////////////////////
 
 	public void testFindMonitor_1_0_0() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 0, 0).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 0, 0).getMonitor();
 
 		assertNotNull("Couldn't find monitor 1-0-0", monitor);
 	}
 
 	public void testGetID_1_0_0() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 0, 0).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 0, 0).getMonitor();
 
 		assertNotNull("JavaMonitor.getID() for 1-0-0 is null.", monitor.getID());
 	}
 
 	public void testGetName_1_0_0() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 0, 0).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 0, 0).getMonitor();
 		assertNotNull("JavaMonitor.getName() for 1-0-0 is null.", monitor
 				.getName());
 	}
 
 	public void testCountWaiters_1_0_0() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 0, 0).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 0, 0).getMonitor();
 		int count = 0;
 		Iterator waiters = monitor.getNotifyWaiters().iterator();
 
@@ -697,7 +570,7 @@
 	}
 
 	public void testCountEnters_1_0_0() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 0, 0).getMonitor();
+		JavaMonitor monitor =setup.findMonitorThreadConfig(1, 0, 0).getMonitor();
 		int count = 0;
 		Iterator enters = monitor.getEnterWaiters().iterator();
 
@@ -710,35 +583,35 @@
 	}
 
 	public void testCountOwners_1_0_0() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 0, 0).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 0, 0).getMonitor();
 		JavaThread owner = monitor.getOwner();
 
 		assertNull("Owner count incorrect", owner);
 	}
 
 	public void testNameWaiters_1_0_0() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 0, 0).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 0, 0).getMonitor();
 		int count = 0;
 		Iterator waiters = monitor.getNotifyWaiters().iterator();
 
 		while (waiters.hasNext()) {
 			JavaThread next = (JavaThread) waiters.next();
 			assertEquals("Waiters name incorrect", generatePrefix(1, 0, 0)
-					+ "-" + monitorNotifyThreadName + "-" + count, next
+					+ "-" + TODOJavaMonitor_ObjectMonitors.monitorNotifyThreadName + "-" + count, next
 					.getName());
 			count++;
 		}
 	}
 
 	public void testNameEnters_1_0_0() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 0, 0).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 0, 0).getMonitor();
 		int count = 0;
 		Iterator enters = monitor.getEnterWaiters().iterator();
 
 		while (enters.hasNext()) {
 			JavaThread next = (JavaThread) enters.next();
 			assertEquals("Enters name incorrect", generatePrefix(1, 0, 0) + "-"
-					+ monitorEnterThreadName + "-" + count, next.getName());
+					+ TODOJavaMonitor_ObjectMonitors.monitorEnterThreadName + "-" + count, next.getName());
 			count++;
 		}
 	}
@@ -746,25 +619,25 @@
 	///////////////////////////////////////////
 
 	public void testFindMonitor_1_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 1, 1).getMonitor();
 
 		assertNotNull("Couldn't find monitor 1-1-1", monitor);
 	}
 
 	public void testGetID_1_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 1, 1).getMonitor();
 
 		assertNotNull("JavaMonitor.getID() for 1-1-1 is null.", monitor.getID());
 	}
 
 	public void testGetName_1_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 1, 1).getMonitor();
 		assertNotNull("JavaMonitor.getName() for 1-1-1 is null.", monitor
 				.getName());
 	}
 
 	public void testCountWaiters_1_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 1, 1).getMonitor();
 		int count = 0;
 		Iterator waiters = monitor.getNotifyWaiters().iterator();
 
@@ -777,7 +650,7 @@
 	}
 
 	public void testCountEnters_1_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 1, 1).getMonitor();
 		int count = 0;
 		Iterator enters = monitor.getEnterWaiters().iterator();
 		enters = monitor.getEnterWaiters().iterator();
@@ -791,14 +664,14 @@
 	}
 
 	public void testCountOwners_1_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 1, 1).getMonitor();
 		JavaThread owner = monitor.getOwner();
 
 		assertNotNull("Owner count incorrect", owner);
 	}
 
 	public void testNameWaiters_1_1_1() throws Exception {
-		JavaMonitor monitor = findMonitorThreadConfig(1, 1, 1).getMonitor();
+		JavaMonitor monitor = setup.findMonitorThreadConfig(1, 1, 1).getMonitor();
 		int count = 0;
 		Iterator waiters = monitor.getNotifyWaiters().iterator();
 
@@ -809,7 +682,7 @@
 		while (waiters.hasNext()) {
 			JavaThread next = (JavaThread) waiters.next();
 			assertEquals("Waiters name incorrect", generatePrefix(1, 1, 1)
-					+ "-" + monitorNotifyThreadName + "-" + count, next
+					+ "-" + TODOJavaMonitor_ObjectMonitors.monitorNotifyThreadName + "-" + count, next
 					.getName());
 			count++;
 		}
@@ -823,7 +696,7 @@
 		while (enters.hasNext()) {
 			JavaThread next = (JavaThread) enters.next();		
 			assertEquals("Enters name incorrect", generatePrefix(1, 1, 1) + "-"
-					+ monitorEnterThreadName + "-" + count, next.getName());
+					+ TODOJavaMonitor_ObjectMonitors.monitorEnterThreadName + "-" + count, next.getName());
 			count++;
 		}
 	}
@@ -833,7 +706,7 @@
 		JavaThread owner = monitor.getOwner();
 
 		assertEquals("Owner name incorrect", generatePrefix(1, 1, 1) + "-"
-				+ monitorOwnerThreadName + "-0", owner.getName());
+				+ TODOJavaMonitor_ObjectMonitors.monitorOwnerThreadName + "-0", owner.getName());
 	}
 	
 	//////////////////////////////////////////////
@@ -897,7 +770,7 @@
 		while (waiters.hasNext()) {
 			JavaThread next = (JavaThread) waiters.next();
 			assertEquals("Waiters name incorrect", generatePrefix(2, 0, 0)
-					+ "-" + monitorNotifyThreadName + "-" + count, next
+					+ "-" + TODOJavaMonitor_ObjectMonitors.monitorNotifyThreadName + "-" + count, next
 					.getName());
 			count++;
 		}
@@ -911,7 +784,7 @@
 		while (enters.hasNext()) {
 			JavaThread next = (JavaThread) enters.next();
 			assertEquals("Enters name incorrect", generatePrefix(2, 0, 0) + "-"
-					+ monitorEnterThreadName + "-" + count, next.getName());
+					+ TODOJavaMonitor_ObjectMonitors.monitorEnterThreadName + "-" + count, next.getName());
 			count++;
 		}
 	}
@@ -976,7 +849,7 @@
 		while (waiters.hasNext()) {
 			JavaThread next = (JavaThread) waiters.next();
 			assertEquals("Waiters name incorrect", generatePrefix(1, 0, 1)
-					+ "-" + monitorNotifyThreadName + "-" + count, next
+					+ "-" + TODOJavaMonitor_ObjectMonitors.monitorNotifyThreadName + "-" + count, next
 					.getName());
 			count++;
 		}
@@ -990,7 +863,7 @@
 		while (enters.hasNext()) {
 			JavaThread next = (JavaThread) enters.next();
 			assertEquals("Enters name incorrect", generatePrefix(1, 0, 1) + "-"
-					+ monitorEnterThreadName + "-" + count, next.getName());
+					+ TODOJavaMonitor_ObjectMonitors.monitorEnterThreadName + "-" + count, next.getName());
 			count++;
 		}
 	}
@@ -1000,7 +873,7 @@
 		JavaThread owner = monitor.getOwner();
 
 		assertEquals("Owner name incorrect", generatePrefix(1, 0, 1) + "-"
-				+ monitorOwnerThreadName + "-0", owner.getName());
+				+ TODOJavaMonitor_ObjectMonitors.monitorOwnerThreadName + "-0", owner.getName());
 	}
 	///////////////////////////////////////////
 
@@ -1063,7 +936,7 @@
 		while (waiters.hasNext()) {
 			JavaThread next = (JavaThread) waiters.next();
 			assertEquals("Waiters name incorrect", generatePrefix(0, 2, 1)
-					+ "-" + monitorNotifyThreadName + "-" + count, next
+					+ "-" + TODOJavaMonitor_ObjectMonitors.monitorNotifyThreadName + "-" + count, next
 					.getName());
 			count++;
 		}
@@ -1074,7 +947,7 @@
 		Iterator enters = monitor.getEnterWaiters().iterator();
 
 		String error = checkNames(enters, generatePrefix(0, 2, 1) + "-"
-				+ monitorEnterThreadName, 2);
+				+ TODOJavaMonitor_ObjectMonitors.monitorEnterThreadName, 2);
 		
 		assertNull(error, error);
 	}
@@ -1084,7 +957,7 @@
 		JavaThread owner = monitor.getOwner();
 
 		assertEquals("Owner name incorrect", generatePrefix(0, 2, 1) + "-"
-				+ monitorOwnerThreadName + "-0", owner.getName());
+				+ TODOJavaMonitor_ObjectMonitors.monitorOwnerThreadName + "-0", owner.getName());
 	}
 		
 	///////////////////////////////////////////
@@ -1145,7 +1018,7 @@
 		Iterator waiters = monitor.getNotifyWaiters().iterator();
 
 		String error = checkNames(waiters, generatePrefix(2, 2, 1)
-				+ "-" + monitorNotifyThreadName , 2);
+				+ "-" + TODOJavaMonitor_ObjectMonitors.monitorNotifyThreadName , 2);
 		assertNull(error, error);
 	}
 
@@ -1154,7 +1027,7 @@
 		Iterator enters = monitor.getEnterWaiters().iterator();
 
 		String error = checkNames(enters, generatePrefix(2, 2, 1) + "-"
-				+ monitorEnterThreadName, 2);
+				+ TODOJavaMonitor_ObjectMonitors.monitorEnterThreadName, 2);
 		
 		assertNull(error, error);
 	}
@@ -1164,7 +1037,7 @@
 		JavaThread owner = monitor.getOwner();
 
 		assertEquals("Owner name incorrect", generatePrefix(2, 2, 1) + "-"
-				+ monitorOwnerThreadName + "-0", owner.getName());
+				+ TODOJavaMonitor_ObjectMonitors.monitorOwnerThreadName + "-0", owner.getName());
 	}
 
 	////////////////////////////////////

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_arraycopy.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_arraycopy.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_arraycopy.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_arraycopy.java Mon Nov  2 15:45:39 2009
@@ -25,6 +25,8 @@
 import javax.tools.diagnostics.runtime.java.JavaRuntime;
 
 import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+import org.apache.kato.tck.setup.javaruntime.SetupJavaObject_arraycopy;
+import org.apache.kato.tck.setup.javaruntime.SetupJavaObject_arraycopy.TestArrays;
 
 
 /**
@@ -37,61 +39,7 @@
  */
 public class TestJavaObject_arraycopy extends TCKJavaRuntimeTestcase {
 
-	/**
-	 * A container and initializer for each array's contents 
-	 * 
-	 */
-	static class TestArrays {
-		public boolean[] booleanArray;
-		public byte[] byteArray;
-		public short[] shortArray;
-		public char[] charArray;
-		public int[] intArray;
-		public long[] longArray;
-		public float[] floatArray;
-		public double[] doubleArray;
-		public Integer[] integerArray;
-		public Object nonArray = new Object();
-		public short[][] arrayArray; 
-		
-		public TestArrays(int count) {
-			booleanArray = new boolean[count];
-			byteArray = new byte[count];
-			shortArray = new short[count];
-			charArray = new char[count];
-			intArray = new int[count];
-			longArray = new long[count];
-			floatArray = new float[count];
-			doubleArray = new double[count];
-			integerArray = new Integer[count];
-			arrayArray = new short[count][count];
-			
-			for (int i=0; i < count; i++) {
-				booleanArray[i] = (i % 2) == 1;
-				byteArray[i] = (byte) i;
-				shortArray[i] = (short) i;
-				charArray[i] = (char) i;
-				intArray[i] = i;
-				longArray[i] = i;
-				floatArray[i] = i;
-				doubleArray[i] = i;
-				integerArray[i] = new Integer(i);
-				
-				for(int j = 0; j < count; j++) {
-					arrayArray[i][j] = (short) (i + j);
-				}
-			}
-
-		}
-	}
-
-	// The array sizes.
-	private static final int testArraysElementCount = 10;
-
-	// As this is static, this will exist in both the DTFJ dump and the JUnit testcase. No configure needed.
-	static TestArrays theTestObject = new TestArrays(testArraysElementCount);
-
-	static final String TestArraysClassName = TestArrays.class.getName().replace('.', '/');
+	
 
 	static JavaObject booleanDumpArray, byteDumpArray, shortDumpArray,
 				charDumpArray, intDumpArray, longDumpArray,
@@ -101,6 +49,9 @@
 	static JavaField valueField = null;
 	static JavaRuntime staticRuntime = null;
 	
+	static int testArraysElementCount=SetupJavaObject_arraycopy.testArraysElementCount;
+	static TestArrays theTestObject=SetupJavaObject_arraycopy.theTestObject;
+	
 	/**
 	 * Setups if the test classe's statics.
 	 * this is called before every test method. This method is extremely
@@ -142,7 +93,7 @@
 				JavaObject aJavaObject = (JavaObject) nextObject;
 				theJavaClass = aJavaObject.getJavaClass();
 				String theClassName = (theJavaClass).getName();
-				if (theClassName.equals(TestArraysClassName)){
+				if (theClassName.equals(SetupJavaObject_arraycopy.TestArraysClassName)){
 					theJavaObject = aJavaObject;
 					break;
 				}

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_getDeclaredFields_getName.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_getDeclaredFields_getName.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_getDeclaredFields_getName.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_getDeclaredFields_getName.java Mon Nov  2 15:45:39 2009
@@ -24,24 +24,13 @@
 import javax.tools.diagnostics.runtime.java.JavaRuntime;
 
 import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+import org.apache.kato.tck.setup.javaruntime.SetupJavaObject_getDeclaredFields_getName;
 
 
 
 public class TestJavaObject_getDeclaredFields_getName extends TCKJavaRuntimeTestcase {
 
-	static TestObject theTestObject;
-
-	class TestObject {
-		private String JavaObject_getDeclaredFields_getName = "JavaObject_getDeclaredFields_getName";
-	}
-
-	static final String TestObjectClassName = TestObject.class.getName().replace('.', '/');
-
-	public void configureJavaObject_get()
-	{
-		theTestObject=new TestObject();
-	}
-
+	
 
 	/**
 	 * 
@@ -75,7 +64,7 @@
 				try {
 					JavaClass theJavaClass = aJavaObject.getJavaClass();
 					String theClassName = (theJavaClass).getName();
-					if (theClassName.equals(TestObjectClassName)){
+					if (theClassName.equals(SetupJavaObject_getDeclaredFields_getName.TestObjectClassName)){
 
 						Iterator fields = theJavaClass.getDeclaredFields().iterator();
 

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_getReferences.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_getReferences.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_getReferences.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaObject_getReferences.java Mon Nov  2 15:45:39 2009
@@ -27,12 +27,6 @@
 
 public class TestJavaObject_getReferences extends TCKJavaRuntimeTestcase {
 
-	int[][] multiDimArray = new int[3][5];
-	
-	public void configureMultiDimensionalArray() {
-		multiDimArray = new int[][]{{1,2},{11,12},{21,22}};
-	}
-	
 	public void testMultiDimensionalArrayReferences() {
 		try {
 			JavaObject thisObject = getThis();

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaReferences.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaReferences.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaReferences.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaReferences.java Mon Nov  2 15:45:39 2009
@@ -14,10 +14,6 @@
 package org.apache.kato.tck.tests.javaruntime;
 
 
-import java.lang.ref.PhantomReference;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
-import java.lang.ref.WeakReference;
 import java.util.Iterator;
 
 import javax.tools.diagnostics.runtime.java.JavaClass;
@@ -29,47 +25,6 @@
 
 public class TestJavaReferences extends TCKJavaRuntimeTestcase {
 	
-	class StrongReferent {
-		public static final String TYPE = "Strong"; 
-	};
-
-	class WeakReferent {
-		public static final String TYPE = "Weak"; 
-	};
-	class SoftReferent {
-		public static final String TYPE = "Soft"; 
-
-	};
-	class PhantomReferent {
-		public static final String TYPE = "Phantom"; 
-	};
-	
-	class ArrayElement {
-		public static final String TYPE = "ArrayElement"; 
-		
-	}
-	
-	private WeakReference weakReference = null;
-	private SoftReference softReference = null;
-	private PhantomReference phantomReference = null;
-	
-	private StrongReferent strongReferent = new StrongReferent();
-	private WeakReferent weakReferent = new WeakReferent();
-	private SoftReferent softReferent = new SoftReferent();
-	private PhantomReferent phantomReferent = new PhantomReferent();
-	
-	private ClassLoader classLoader = null;
-	
-	private ArrayElement[] array = new ArrayElement[1];	
-	public void configureReferences() {
-		weakReference = new WeakReference(weakReferent);
-		softReference = new SoftReference(softReferent);
-		phantomReference = new PhantomReference(phantomReferent, new ReferenceQueue());
-		
-		array[0] = new ArrayElement();
-		
-		classLoader = this.getClass().getClassLoader();
-	}
 	
 	public void testReferences_getDescription() {
 		JavaObject thisObj = getThis();

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime.java Mon Nov  2 15:45:39 2009
@@ -22,6 +22,7 @@
 import javax.tools.diagnostics.runtime.java.JavaVMOption;
 
 import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+import org.apache.kato.tck.setup.javaruntime.SetupJavaRuntime;
 
 
 /**
@@ -31,13 +32,6 @@
 public class TestJavaRuntime extends TCKJavaRuntimeTestcase {
 
 	
-	private static final String DTCK_TEST_RUNTIME_VERSION = "-Dtck.test_runtime_version=";
-
-	public String[] jvmJavaJavaRuntime_getVersion()
-	{
-			return new String[]{DTCK_TEST_RUNTIME_VERSION+System.getProperty("java.version")};
-	}
-
 	public void testJavaJavaRuntime_getVersion() throws CorruptDataException, DataUnavailable
 	{
 		
@@ -59,15 +53,15 @@
 		while(i.hasNext()) {
 			JavaVMOption option=(JavaVMOption) i.next();
 			String data=option.getOptionString();
-			if(data.startsWith(DTCK_TEST_RUNTIME_VERSION)) {
-				String received=data.substring(DTCK_TEST_RUNTIME_VERSION.length());
+			if(data.startsWith(SetupJavaRuntime.DTCK_TEST_RUNTIME_VERSION)) {
+				String received=data.substring(SetupJavaRuntime.DTCK_TEST_RUNTIME_VERSION.length());
 				assertTrue(version.indexOf(received) != -1);
 				return; // test passed
 			}
 			
 		}
 		
-		fail("expected to see vm option for system property starting "+DTCK_TEST_RUNTIME_VERSION);
+		fail("expected to see vm option for system property starting "+SetupJavaRuntime.DTCK_TEST_RUNTIME_VERSION);
 	}
 	
 	public void testJavaRuntime_getFullVersion()

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntimeThreads.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntimeThreads.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntimeThreads.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntimeThreads.java Mon Nov  2 15:45:39 2009
@@ -25,6 +25,7 @@
 import javax.tools.diagnostics.runtime.java.JavaThread;
 
 import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+import org.apache.kato.tck.setup.javaruntime.SetupJavaRuntimeThreads;
 
 
 /**
@@ -33,28 +34,6 @@
  */
 public class TestJavaRuntimeThreads extends TCKJavaRuntimeTestcase {
 
-	private static final String DTFJ_TCK_T3 = "dtfj_tck_t3";
-	private static final String DTFJ_TCK_T2 = "dtfj_tck_t2";
-	private static final String DTFJ_TCK_T1 = "dtfj_tck_t1";
-
-	public void configureSetThreads() 
-	{
-		
-		
-		ThreadGroup group=new ThreadGroup("dtfj_tck");
-		
-		
-		Thread t1=new Thread(group,new PausingRunnable(),DTFJ_TCK_T1);
-		t1.start();
-		
-		Thread t2=new Thread(group,new PausingRunnable(),DTFJ_TCK_T2);
-		t2.start();
-		
-		Thread t3=new Thread(group,new PausingRunnable(),DTFJ_TCK_T3);
-		t3.start();
-		
-	}
-
 	/**
 	 * Test has at least one thread
 	 * 
@@ -81,9 +60,9 @@
 		
 		List allThreads = getJavaRuntime().getThreads();
 		
-		assertNotNull(getThread(allThreads,DTFJ_TCK_T1));
-		assertNotNull(getThread(allThreads,DTFJ_TCK_T2));
-		assertNotNull(getThread(allThreads,DTFJ_TCK_T3));
+		assertNotNull(getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1));
+		assertNotNull(getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T2));
+		assertNotNull(getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T3));
 		
 	}
 
@@ -91,7 +70,7 @@
 		
 		List allThreads = getJavaRuntime().getThreads();
 		
-		JavaThread t1=getThread(allThreads,DTFJ_TCK_T1);
+		JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
 		int state=t1.getState();
 		assertEquals(JavaThread.STATE_ALIVE | JavaThread.STATE_WAITING | JavaThread.STATE_SLEEPING,state);
 		
@@ -101,7 +80,7 @@
 		
 		List allThreads = getJavaRuntime().getThreads();
 		
-		JavaThread t1=getThread(allThreads,DTFJ_TCK_T1);
+		JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
 		Iterator i=t1.getStackFrames().iterator();
 		assertTrue(i.hasNext());
 		
@@ -111,7 +90,7 @@
 		
 		List allThreads = getJavaRuntime().getThreads();
 		
-		JavaThread t1=getThread(allThreads,DTFJ_TCK_T1);
+		JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
 		Iterator i=t1.getStackFrames().iterator();
 		JavaStackFrame frame=(JavaStackFrame) i.next();
 		JavaLocation location=frame.getLocation();
@@ -123,7 +102,7 @@
 		
 		List allThreads = getJavaRuntime().getThreads();
 		
-		JavaThread t1=getThread(allThreads,DTFJ_TCK_T1);
+		JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
 		Iterator i=t1.getStackFrames().iterator();
 		JavaStackFrame frame=(JavaStackFrame) i.next();
 		JavaLocation location=frame.getLocation();
@@ -136,7 +115,7 @@
 		
 		List allThreads = getJavaRuntime().getThreads();
 		
-		JavaThread t1=getThread(allThreads,DTFJ_TCK_T1);
+		JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
 		Iterator i=t1.getStackFrames().iterator();
 		JavaStackFrame frame=(JavaStackFrame) i.next();
 		JavaLocation location=frame.getLocation();
@@ -165,7 +144,7 @@
 	public void testThreadGroupMembership() throws CorruptDataException {
 		
 		List allThreads = getJavaRuntime().getThreads();
-		JavaThread t1=getThread(allThreads, DTFJ_TCK_T1);
+		JavaThread t1=getThread(allThreads, SetupJavaRuntimeThreads.DTFJ_TCK_T1);
 		
 		
 	}
@@ -180,16 +159,6 @@
 		return null;
 	}
 
-	class PausingRunnable implements Runnable {
-		public void run() {
-			try {
-				Thread.sleep(1000000);
-			} catch (InterruptedException e) {
-				
-				e.printStackTrace();
-			}
-			
-		}
-	}
+	
 }
 

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime_getCompiledMethods.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime_getCompiledMethods.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime_getCompiledMethods.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime_getCompiledMethods.java Mon Nov  2 15:45:39 2009
@@ -23,23 +23,6 @@
 
 
 public class TestJavaRuntime_getCompiledMethods extends TCKJavaRuntimeTestcase {
-	public int jitMe(int value, int cnt) {
-		if (cnt ==0 ) {
-			return 0;
-		}
-		if (Math.IEEEremainder(value, 2)== 0)
-			return jitMe(value+1, cnt-1);
-		else
-			return jitMe(value-1,cnt-1);
-		
-	}
-	
-	public void configureCompiledMethod() {
-		int value = 0;
-		value = jitMe(0,3000);
-		System.out.println("Value is "+ value);
-	}
-	
 	public void testHasCompiledMethods() {
 		JavaRuntime runtime=getJavaRuntime();
 		Iterator compiledMethods=runtime.getCompiledMethods().iterator();

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime_getHeapRoots.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime_getHeapRoots.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime_getHeapRoots.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaRuntime_getHeapRoots.java Mon Nov  2 15:45:39 2009
@@ -32,187 +32,22 @@
 import javax.tools.diagnostics.runtime.java.JavaRuntime;
 import javax.tools.diagnostics.runtime.java.JavaThread;
 
-import org.apache.kato.tck.api.ICheckpoint;
 import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+import org.apache.kato.tck.setup.javaruntime.SetupJavaRuntime_getHeapRoots;
+import org.apache.kato.tck.setup.javaruntime.SetupJavaRuntime_getHeapRoots.HeapRoot;
+import org.apache.kato.tck.tests.javaruntime.TestJavaStackFrame_getHeapRoots.HeapRootsTestLocalVariable;
+import org.apache.kato.tck.tests.javaruntime.TestJavaStackFrame_getHeapRoots.HeapRootsTestParam;
 
 
 public class TestJavaRuntime_getHeapRoots extends TCKJavaRuntimeTestcase {
 	
-	private static final String DTFJ_STRING_TABLE_ROOT_TEST = "DTFJ StringTable root test";
-
-	private static Map rootsCheckList = null;
+	private SetupJavaRuntime_getHeapRoots setup=new SetupJavaRuntime_getHeapRoots();
 	
 	private static JavaClass javaLangString = null;
 	
-	private static java.lang.ClassLoader cl = null;
-	
-	private HeapRootsTestUnfinalized unfinalizedObj = null;
-	
-	static class HeapRoot {
-		private Object root = null;
-		private int type = 0;
-		
-		HeapRoot(Object r, int t) {
-			root = r;
-			type = t;
-		}
-		
-		public boolean equals(Object o) {
-			if (! (o instanceof HeapRoot)) {
-				return false;
-			} else {
-				HeapRoot ro = (HeapRoot) o;
-				return root.equals(ro.getRoot()) && type==0?true:type==ro.getType(); 
-			}
-		}
-		
-		public int hashCode() {
-			return root.hashCode();
-		}
-		
-		public Object getRoot() {
-			return root;
-		}
-
-		public int getType() {
-			return type;
-		}
-		
-		public String toString() {
-			if (root instanceof JavaObject) {
-				JavaObject objectRoot = (JavaObject)root;
-				String objectId = null;
-				try {
-					objectId = objectRoot.getJavaClass().getName() + "@" + objectRoot.getID();
-				} catch (CorruptDataException e) {
-					assertNotNull(e.getCorruptData());
-					objectId = objectRoot.toString();
-				}
-				return "Root " + objectId + " of type \"" + getRootTypeDescription(type) + "\"";
-			} else {
-				return "Root " + root + " of type \"" + getRootTypeDescription(type) + "\"";
-			}
-		}
-		
-		public static String getRootTypeDescription(int type) {
-			switch (type) {
-			case JavaReference.HEAP_ROOT_CLASSLOADER:
-				return "Classloader";
-			case JavaReference.HEAP_ROOT_FINALIZABLE_OBJ:
-				return "Finalizable object";
-			case JavaReference.HEAP_ROOT_JNI_GLOBAL:
-				return "JNI Global";
-			case JavaReference.HEAP_ROOT_JNI_LOCAL:
-				return "JNI Local";
-			case JavaReference.HEAP_ROOT_MONITOR:
-				return "Monitor";
-			case JavaReference.HEAP_ROOT_OTHER:
-				return "Other root";
-			case JavaReference.HEAP_ROOT_STACK_LOCAL:
-				return "Stack local";
-			case JavaReference.HEAP_ROOT_STRINGTABLE:
-				return "String table";
-			case JavaReference.HEAP_ROOT_SYSTEM_CLASS:
-				return "System class";
-			case JavaReference.HEAP_ROOT_THREAD:
-				return "Thread";
-			case JavaReference.HEAP_ROOT_UNFINALIZED_OBJ:
-				return "Unfinalized object";
-			case JavaReference.HEAP_ROOT_UNKNOWN:
-				return "Unknown";
-			default:
-				return "<Unrecognized root type>";
-			}
-		}
-	}
-	
-	class HeapRootsTestClassLoader extends ClassLoader {
-		
-		public Class findClass(String name) {
-			byte[] b = loadClassData(name);
-			return defineClass(name, b, 0, b.length);
-		}
-		private byte[] loadClassData(String name) {
-			return null;
-		}
-	}
-
-	class HeapRootsTestThread extends java.lang.Thread {
-		public void run() {
-			while (true) {
-				try {
-					sleep(10000);
-				} catch (InterruptedException e) {}
-			}
-		}
-	}
-
-	
-	class HeapRootsTestFinalizable {
-		protected void finalize() {
-//			System.out.println("Finalizer for object " + this + " started in thread " + Thread.currentThread());
-			while (true) {
-				try {
-					Thread.sleep(1000);
-				} catch (InterruptedException e) {
-					e.printStackTrace();
-				}
-			}
-		}
-	}
-
-	class HeapRootsTestUnfinalized {
-		protected void finalize() {
-			System.out.println("Finalizer for object " + this + " started...");
-		}
-	}
-
+	public static Map rootsCheckList = null;
 	
-	public void configureClassloaderRoot() {
-
-		cl = new HeapRootsTestClassLoader();
-	}
-	
-	public void configureUnfinalizedRoot(ICheckpoint cp) {
-		unfinalizedObj = new HeapRootsTestUnfinalized();
-		cp.checkpoint();
-		System.out.println(unfinalizedObj);
-	}
-
-	public void configureFinalizableRoot() {
-		HeapRootsTestFinalizable finalizableObj = new HeapRootsTestFinalizable();
-		HeapRootsTestFinalizable finalizableObj2 = new HeapRootsTestFinalizable();
-		finalizableObj = null;
-		finalizableObj2 = null;
-		System.gc();
-	}
-
-	public void configureStringTableRoot() {
-		String string = DTFJ_STRING_TABLE_ROOT_TEST;
-		string.intern();
-	}
-	
-	public void configureThreadRoot(ICheckpoint cp) {
-		HeapRootsTestThread thread = new HeapRootsTestThread();
-		thread.start();
-		cp.checkpoint();
-	}
 	
-	class HeapRootsTestParam {}
-	class HeapRootsTestLocalVariable {}
-
-	public final String javaLocalRootsthreadName = this.getClass().getName()+"#configureJavaLocalsRoots";
-	public void configureJavaLocalsRoots(ICheckpoint cp) {
-		HeapRootsTestParam param = new HeapRootsTestParam();
-		methodA(cp, param);
-	}
-	
-	private void methodA(ICheckpoint cp, HeapRootsTestParam param) {
-		HeapRootsTestLocalVariable localVariable = new HeapRootsTestLocalVariable();
-		cp.checkpoint();
-		System.out.println(param);
-		System.out.println(localVariable);
-	}
 	
 	public void testSystemClassRoots() {
 		if (rootsCheckList == null) {
@@ -301,7 +136,7 @@
 					
 				}
 				String currentString = new String(contents);
-				if (DTFJ_STRING_TABLE_ROOT_TEST.equals(currentString)) {
+				if (SetupJavaRuntime_getHeapRoots.DTFJ_STRING_TABLE_ROOT_TEST.equals(currentString)) {
 					found = true;
 					break;
 				}
@@ -464,13 +299,13 @@
 		Iterator threads = getJavaRuntime().getThreads().iterator();
 		while(threads.hasNext()) {
 			JavaThread candidateThread = (JavaThread) threads.next();
-			if (javaLocalRootsthreadName.equals(candidateThread.getName())) {
+			if (setup.javaLocalRootsthreadName.equals(candidateThread.getName())) {
 				thread = candidateThread;
 				break;
 			}
 		}
 		
-		assertNotNull("Couldn't find thread "+javaLocalRootsthreadName, thread);			
+		assertNotNull("Couldn't find thread "+setup.javaLocalRootsthreadName, thread);			
 		
 		// Set up a set of JavaObject class names to look for.
 		Set roots = new HashSet();

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThreadInspection.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThreadInspection.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThreadInspection.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThreadInspection.java Mon Nov  2 15:45:39 2009
@@ -32,32 +32,9 @@
 public class TestJavaThreadInspection extends TCKJavaRuntimeTestcase{
 
 
-public Thread[] configThreadInstances=null;
 private JavaObject[] threadDumpInstances=null;
 
 	
-	public void configureValidJavaThreads(ICheckpoint cp) {
-		Thread t1=new Thread() {
-			public void run() {
-				while (true) {
-					try {
-						sleep (10000);
-					} catch (InterruptedException e) {
-					}
-				}
-			}
-		}; 
-		Thread t2=new Thread(t1);
-		Thread t3=new Thread("");
-
-		configThreadInstances=new Thread[]{t1,t2,t3};
-		
-		cp.checkpoint();
-		
-	}
-
-	
-	
 	/**
 	 * Locate special holder
 	 * @throws CorruptDataException 

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThread_getName.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThread_getName.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThread_getName.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThread_getName.java Mon Nov  2 15:45:39 2009
@@ -13,7 +13,6 @@
  ******************************************************************************/
 package org.apache.kato.tck.tests.javaruntime;
 
-import java.util.Hashtable;
 import java.util.Iterator;
 
 import javax.tools.diagnostics.image.CorruptData;
@@ -22,41 +21,12 @@
 import javax.tools.diagnostics.runtime.java.JavaThread;
 
 import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+import org.apache.kato.tck.setup.javaruntime.SetupJavaThread_getName;
 
 
 public class TestJavaThread_getName extends TCKJavaRuntimeTestcase {
 	
-	public class MyThread extends Thread {
-		public Hashtable name = null;
-		
-		public MyThread(Runnable r, String n) {
-			super(r,n);
-		}
-		
-	}
-
-	private String threadName = "a_special_thread";
-	
 	
-	public void configureJavaThread()
-	{
-		Runnable r=new Runnable() {
-
-			public void run() {
-				try {
-					Thread.sleep(1000000);
-				} catch (InterruptedException e) {
-					e.printStackTrace();
-				}
-
-			}};
-
-			MyThread t=new MyThread(r,threadName);
-			t.start();
-	}
-
-	
-
 	public void testJavaThread()
 	{
 		boolean foundThread = false;
@@ -76,7 +46,7 @@
 			JavaThread thread = (JavaThread) next;
 
 			try {
-				if (0==threadName.compareTo(thread.getName())){
+				if (0==SetupJavaThread_getName.threadName.compareTo(thread.getName())){
 					foundThread=true;
 				}
 			} catch (CorruptDataException e) {

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThread_getStackFrames.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThread_getStackFrames.java?rev=831928&r1=831927&r2=831928&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThread_getStackFrames.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tck/tests/javaruntime/TestJavaThread_getStackFrames.java Mon Nov  2 15:45:39 2009
@@ -22,6 +22,7 @@
 import javax.tools.diagnostics.runtime.java.JavaThread;
 
 import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+import org.apache.kato.tck.setup.javaruntime.SetupJavaThread_getStackFrames;
 
 
 /**
@@ -34,64 +35,6 @@
  * 
  */
 public class TestJavaThread_getStackFrames extends TCKJavaRuntimeTestcase {
-	public static final String threadName = "TestJavaThread_getStackFrames Thread";
-
-	private String[] methodNames = { "wait", "methodC", "methodB", "methodA",
-			"run" };
-
-	public static class ContrivedThread extends Thread {
-		volatile private boolean running = false;
-
-		public boolean isRunning() {
-			return running;
-		}
-
-		public ContrivedThread(String name) {
-			super(name);
-		}
-
-		public void run() {
-			methodA(1);
-		}
-
-		public int methodA(int arg) {
-			return methodB(arg) + 1;
-		}
-
-		public int methodB(int arg) {
-			return methodC(arg, arg);
-		}
-
-		public synchronized int methodC(int arg1, int arg2) {
-			int total = arg1 + arg2;
-
-			this.running = true;
-
-			this.notify();
-			try {
-				wait();
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-			return total;
-		}
-	}
-
-	public void configureThreadStack() {
-		ContrivedThread thread = new ContrivedThread(threadName);
-		synchronized (thread) {
-			thread.start();
-			while (!thread.isRunning()) {
-				try {
-					thread.wait();
-				} catch (InterruptedException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-		}
-	}
-
 	public void setUp () {
 		JavaRuntime runtime = getJavaRuntime();
 		Iterator threads = runtime.getThreads().iterator();
@@ -103,7 +46,7 @@
 				JavaThread thread = (JavaThread) next;
 				
 				try {
-					if (threadName.equals( thread.getName())) {
+					if (SetupJavaThread_getStackFrames.threadName.equals( thread.getName())) {
 						contrivedThread = thread;
 						break;
 					}
@@ -116,7 +59,7 @@
 		}
 		
 		if (contrivedThread == null) {
-			fail("Couldn't find thread "+threadName);
+			fail("Couldn't find thread "+SetupJavaThread_getStackFrames.threadName);
 		}
 	}
 
@@ -134,8 +77,8 @@
 
 				JavaLocation location = frame.getLocation();
 				
-				if ((methodIndex < methodNames.length)
-						&& methodNames[methodIndex].equals(location.getMethod().getName())) {
+				if ((methodIndex < SetupJavaThread_getStackFrames.methodNames.length)
+						&& SetupJavaThread_getStackFrames.methodNames[methodIndex].equals(location.getMethod().getName())) {
 					methodIndex++;
 				}
 
@@ -143,6 +86,6 @@
 		}
 
 		assertEquals("Didn't find all expected methods name. Couldn't find "
-				+ ((methodIndex < methodNames.length) ? methodNames[methodIndex] : ""), methodNames.length, methodIndex);
+				+ ((methodIndex < SetupJavaThread_getStackFrames.methodNames.length) ? SetupJavaThread_getStackFrames.methodNames[methodIndex] : ""), SetupJavaThread_getStackFrames.methodNames.length, methodIndex);
 	}
 }



Mime
View raw message