You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kato-commits@incubator.apache.org by mo...@apache.org on 2009/11/23 15:54:15 UTC

svn commit: r883384 [37/47] - in /incubator/kato/trunk/org.apache.kato: ./ kato.anttasks/src/main/java/org/apache/kato/anttasks/ kato.anttasks/src/main/java/org/apache/kato/anttasks/sitebuilder/ kato.anttasks/src/main/java/org/apache/kato/anttasks/tck/...

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaObjectTest.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaObjectTest.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaObjectTest.java Mon Nov 23 15:53:48 2009
@@ -1,803 +1,803 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tests.junit;
-
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.tools.diagnostics.image.CorruptData;
-import javax.tools.diagnostics.image.CorruptDataException;
-import javax.tools.diagnostics.image.DataUnavailable;
-import javax.tools.diagnostics.image.MemoryAccessException;
-import javax.tools.diagnostics.runtime.java.JavaClass;
-import javax.tools.diagnostics.runtime.java.JavaObject;
-import javax.tools.diagnostics.runtime.java.JavaReference;
-
-import org.apache.kato.tck.api.ICheckpoint;
-
-
-public class JavaObjectTest extends AbstractImageTestcase
-{
-	protected static final char SIG_BOOLEAN = 'Z';
-	protected static final char SIG_BYTE = 'B';
-	protected static final char SIG_CHAR = 'C';
-	protected static final char SIG_SHORT = 'S';
-	protected static final char SIG_INT = 'I';
-	protected static final char SIG_LONG = 'J';
-	protected static final char SIG_FLOAT = 'F';
-	protected static final char SIG_DOUBLE = 'D';
-	protected static final char SIG_OBJECT = 'L';
-	protected static final char SIG_ARRAY = '[';
-
-	private JavaObject _object = null;
-	private JavaObject _array = null;
-	
-	
-	/**
-	 * Add array object with values to dumo
-	 */
-	public void configureArrayObject(ICheckpoint point) {
-	
-		Object o[]=new Object[]{new Object(),"ZZZ",new Hashtable()};
-		point.checkpoint();
-		
-	}
-	
-	protected void setUp() throws Exception
-	{
-		try {
-			_object = defaultJavaObject(false);
-			_array = defaultJavaObject(true);
-			super.setUp();
-		} catch (TestNotImplementedException e) {
-			throw e;
-		} catch (Throwable t) {
-			//we weren't expecting any exceptions during startup so that is a test failure
-			t.printStackTrace();
-			fail();
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getJavaClass()'
-	 * 
-	 * Ensures that we get a class which has a name (that should imply that it is sane)
-	 */
-	public void testGetJavaClass()
-	{
-		JavaClass theClass = null;
-		try {
-			theClass = _object.getJavaClass();
-		} catch (CorruptDataException e) {
-		}
-		assertNotNull(theClass);
-		try {
-			assertNotNull(theClass.getName());
-		} catch (CorruptDataException e) {
-			//this would be wrong since we are supposed to get a sane object back
-			assertTrue(false);
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.isArray()'
-	 * 
-	 * Ensures that this call returns something
-	 */
-	public void testIsArray()
-	{
-		try {
-			_object.isArray();
-		} catch (CorruptDataException e) {
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getArraySize()'
-	 * 
-	 * Ensures that we only get specced behaviour for this call
-	 */
-	public void testGetArraySize()
-	{
-		try {
-			_array.getArraySize();
-		} catch (CorruptDataException e) {
-		} catch (IllegalArgumentException e) {
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures that we can copy one element from a an array
-	 */
-	public void testArraycopy()
-	{
-		try {
-			Object destination = destArray(1);
-			
-			_array.arraycopy(0, destination, 0, 1);
-		} catch (CorruptDataException e) {
-			//technically allowed
-		} catch (MemoryAccessException e) {
-			assertNotNull(e.getPointer());
-			//technically allowed
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures that we can copy all the elements from an array
-	 */
-	public void testArraycopy2()
-	{
-		try {
-			int size = _array.getArraySize();
-			Object destination = destArray(size);			
-			_array.arraycopy(0, destination, 0, size);
-		} catch (CorruptDataException e) {
-			//technically allowed
-		} catch (MemoryAccessException e) {
-			assertNotNull(e.getPointer());
-			//technically allowed
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures that we can copy most of the elements from an array
-	 */
-	public void testArraycopy2a()
-	{
-		try {
-			int size = _array.getArraySize();
-			Object destination = destArray(size);			
-			_array.arraycopy(0, destination, 0, size-1);
-		} catch (CorruptDataException e) {
-			//technically allowed
-		} catch (MemoryAccessException e) {
-			assertNotNull(e.getPointer());
-			//technically allowed
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures that we can copy most of the elements from an array
-	 */
-	public void testArraycopy2b()
-	{
-		try {
-			int size = _array.getArraySize();
-			Object destination = destArray(size);			
-			_array.arraycopy(1, destination, 0, size-1);
-		} catch (CorruptDataException e) {
-			//technically allowed
-		} catch (MemoryAccessException e) {
-			assertNotNull(e.getPointer());
-			//technically allowed
-		}
-	}
-	
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures that we can copy most of the elements from an array
-	 */
-	public void testArraycopy2c()
-	{
-		try {
-			int size = _array.getArraySize();
-			Object destination = destArray(size);			
-			_array.arraycopy(1, destination, 1, size-1);
-		} catch (CorruptDataException e) {
-			//technically allowed
-		} catch (MemoryAccessException e) {
-			assertNotNull(e.getPointer());
-			//technically allowed
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures that we can copy most of the elements from an array
-	 */
-	public void testArraycopy2d()
-	{
-		try {
-			int size = _array.getArraySize();
-			Object destination = destArray(size);			
-			_array.arraycopy(0, destination, 1, size-1);
-		} catch (CorruptDataException e) {
-			//technically allowed
-		} catch (MemoryAccessException e) {
-			assertNotNull(e.getPointer());
-			//technically allowed
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures source index out of range is detected
-	 */
-	public void testArraycopy3()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(-1, destination, 0, size);
-				fail("Expected source index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures source index out of range is detected (at the end)
-	 */
-	public void testArraycopy4()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size+1);
-			try {
-				_array.arraycopy(1, destination, 0, size);
-				fail("Expected source index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size+1, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures source index out of range is detected
-	 */
-	public void testArraycopy5()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size+1);
-			try {
-				_array.arraycopy(size, destination, 0, 1);
-				fail("Expected source index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size+1, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures destination index out of range is detected
-	 */
-	public void testArraycopy6()
-	{
-		
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(0, destination, -1, size);
-				fail("Expected source index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures destination index out of range is detected
-	 */
-	public void testArraycopy7()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(0, destination, 1, size);
-				fail("Expected destination index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures source index out of range is detected
-	 */
-	public void testArraycopy8()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(size+1, destination, 0, 0);
-				fail("Expected source index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures negative length is detected
-	 */
-	public void testArraycopy9()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(0, destination, 0, -1);
-				fail("Expected source index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures null destination is detected
-	 */
-	public void testArraycopy10()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(0, null, 0, size);
-				fail("Expected source index out of bounds");
-			} catch (NullPointerException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures bad destination is detected
-	 */
-	public void testArraycopy11()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(0, new JavaClass[size], 0, size);
-				fail("Expected source index out of bounds");
-			} catch (IllegalArgumentException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures out of range source index is detected
-	 */
-	public void failing_testArraycopy12()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(Integer.MAX_VALUE, destination, 0, 1);
-				fail("Expected source index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures out of range destination index is detected
-	 */
-	public void testArraycopy13()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(0, destination, Integer.MAX_VALUE, 1);
-				fail("Expected destination index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
-	 * 
-	 * Ensures out of range size is detected
-	 */
-	public void failing_testArraycopy14()
-	{
-		try {
-			int size = _array.getArraySize();		
-			Object destination = destArray(size);
-			try {
-				_array.arraycopy(1, destination, 1, Integer.MAX_VALUE);
-				fail("Expected destination index out of bounds");
-			} catch (IndexOutOfBoundsException e) {
-				// Expected array unchanged
-				testArray(size, destination);
-			} catch (MemoryAccessException e) {
-				assertNotNull(e.getPointer());
-				throw new Error(e);
-			} catch (CorruptDataException e) {
-				throw new Error(e);
-			}
-		} catch (CorruptDataException e) {		
-		}
-	}
-	
-	private Object destArray(int size) throws CorruptDataException {
-		return destArray(_array, 0, size, null);
-	}
-	
-	private void testArray(int size, Object comp) throws CorruptDataException {
-		destArray(_array, 0, size, comp);
-	}
-
-	
-	/**
-	 * @param size size of array
-	 * 
-	 * @throws CorruptDataException
-	 */
-	private Object destArray(JavaObject array, int start, int end, Object comp) throws CorruptDataException {
-		boolean fill = comp == null;
-		int size = end;
-		Object destination;
-		
-		String componentType = array.getJavaClass().getComponentType().getName();
-
-		if (componentType.equals("boolean")) {
-			boolean[] destination1 = fill ? new boolean[size] : (boolean[])comp;
-			for (int i = start; i < end; ++i) {
-				if (fill)
-				destination1[i] = (i & 1) != 0;
-				assertEquals("index "+i, 
-				destination1[i] , (i & 1) != 0);						
-			}
-			destination = destination1;
-		} else if (componentType.equals("byte")) {
-			byte[] destination1 = fill ? new byte[size] : (byte[])comp;
-			for (int i = start; i < end; ++i) {
-				if (fill)
-				destination1[i] = (byte)(i*3);
-				assertEquals("index "+i,
-				destination1[i] , (byte)(i*3));
-			}
-			destination = destination1;
-		} else if (componentType.equals("char")) {
-			char[] destination1 = fill ? new char[size] : (char[])comp;
-			for (int i = start; i < end; ++i) {
-				if (fill)
-				destination1[i] = (char)(i*3);
-				assertEquals("index "+i,
-				destination1[i] , (char)(i*3));
-			}
-			destination = destination1;
-		} else if (componentType.equals("double")) {
-			double[] destination1 = fill ? new double[size] : (double[])comp;
-			for (int i = start; i < end; ++i) {
-				if (fill)
-				destination1[i] = i*0.1;
-				assertEquals("index "+i,
-				destination1[i] , i*0.1, 0.0);						
-			}
-			destination = destination1;
-		} else if (componentType.equals("float")) {
-			float[] destination1 = fill ? new float[size] : (float[])comp;
-			for (int i = start; i < end; ++i) {
-				if (fill)
-				destination1[i] = i*0.1f;
-				assertEquals("index "+i,
-				destination1[i] , i*0.1f, 0.0f);						
-			}
-			destination = destination1;
-		} else if (componentType.equals("int")) {
-			int[] destination1 = fill ? new int[size] : (int[])comp;
-			for (int i = start; i < end; ++i) {
-				if (fill)
-				destination1[i] = (int)(i*3);
-				assertEquals("index "+i,
-				destination1[i] , (int)(i*3));						
-			}
-			destination = destination1;
-		} else if (componentType.equals("long")) {
-			long[] destination1 = fill ? new long[size] : (long[])comp;
-			for (int i = start; i < end; ++i) {
-				if (fill)
-				destination1[i] = (long)(i*3);
-				assertEquals("index "+i,
-				destination1[i] , (long)(i*3));
-			}
-			destination = destination1;
-		} else if (componentType.equals("short")) {
-			short[] destination1 = fill ? new short[size] : (short[])comp;
-			for (int i = start; i < end; ++i) {
-				if (fill)
-				destination1[i] = (short)(i*3);
-				assertEquals("index "+i,
-				destination1[i] , (short)(i*3));
-			}
-			destination = destination1;
-		} else {
-			// component type is array or object
-			Object destination1[] = fill ? new Object[size] : (Object[])comp;
-			for (int i = start; i < end; ++i) {
-				if (fill)
-				destination1[i] = new Integer(i*3);
-				assertEquals("index "+i,
-				destination1[i] , new Integer(i*3));						
-			}
-			destination = destination1;
-		}
-		return destination;
-	}
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getSize()'
-	 * 
-	 * Ensures that a positive integer is returned
-	 */
-	public void testGetSize()
-	{
-		try {
-			assertTrue(_object.getSize() > 0);
-		} catch (CorruptDataException e) {
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getHashcode()'
-	 * 
-	 * Ensures that the call succeeds
-	 */
-	public void testGetHashcode()
-	{
-		try {
-			_object.getHashcode();
-		} catch (DataUnavailable e) {
-		} catch (CorruptDataException e) {
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getPersistentHashcode()'
-	 * 
-	 * Ensures that the call succeeeds
-	 */
-	public void testGetPersistentHashcode()
-	{
-		try {
-			_object.getPersistentHashcode();
-		} catch (DataUnavailable e) {
-		} catch (CorruptDataException e) {
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getID()'
-	 * 
-	 * Ensures that a non-zero pointer is returned
-	 */
-	public void testGetID()
-	{
-		assertTrue(0 != _object.getID().getAddress());
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getHeap()'
-	 * 
-	 * Ensures that a non-null heap is returned
-	 */
-	public void testGetHeap()
-	{
-		try {
-			assertTrue(null != _object.getHeap());
-		} catch (CorruptDataException e) {
-		} catch (DataUnavailable e) {
-		}
-	}
-
-	
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getSections()'
-	 * 
-	 * Ensures that at least one section is in the returned iterator
-	 */
-	public void testGetSections()
-	{
-		List sections = _object.getSections();
-		
-		assertNotNull(sections);
-		assertFalse(sections.isEmpty());
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getReferences()'
-	 * 
-	 * Ensures that the test object and test array object return non-null iterators, that any elements
-	 * are either JavaReference or CorruptData, and that any JavaReference objects have a non-null 
-	 * description.
-	 */
-	public void testGetReferences()
-	{
-		try {
-			// test references from a non-array object
-			Iterator references = _object.getReferences().iterator();
-			assertNotNull(references);
-			while (references.hasNext()) {
-				Object instance = references.next();
-				assertTrue((instance instanceof JavaReference) || (instance instanceof CorruptData));
-				if (instance instanceof JavaReference) {
-					// sniff these objects by getting the description
-					JavaReference object = (JavaReference)instance;
-					String description = object.getDescription();
-					assertNotNull(description);
-				}
-			}
-			
-			// test references from an array object
-			references = _array.getReferences().iterator();
-			assertNotNull(references);
-			while (references.hasNext()) {
-				Object instance = references.next();
-				assertTrue((instance instanceof JavaReference) || (instance instanceof CorruptData));
-				if (instance instanceof JavaReference) {
-					// sniff these objects by getting the description
-					JavaReference object = (JavaReference)instance;
-					String description = object.getDescription();
-					assertNotNull(description);
-				}
-			}
-		} catch (Exception e) {
-			// if we caught anything else, this is a failure
-			e.printStackTrace();
-			fail();
-		}	
-	}
-	
-	/**
-	 * Verify that the equals call doesn't throw
-	 */
-	public void testEquals()
-	{
-		try{
-			assertTrue(_object.equals(_object));
-		} catch (Throwable t) {
-			assertTrue(false);
-		}
-	}
-	
-	/**
-	 * Verify that hashCode() doesn't throw and returns non-zero (technically zero is ok but it will be 
-	 * flagged here to ensure that we aren't doing anything bad to create the hashcode)
-	 */
-	public void testHashCode()
-	{
-		try {
-			assertTrue(0 != _object.hashCode());
-		} catch (Throwable t) {
-			assertTrue(false);
-		}
-	}
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tests.junit;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.tools.diagnostics.image.CorruptData;
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.MemoryAccessException;
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaReference;
+
+import org.apache.kato.tck.api.ICheckpoint;
+
+
+public class JavaObjectTest extends AbstractImageTestcase
+{
+	protected static final char SIG_BOOLEAN = 'Z';
+	protected static final char SIG_BYTE = 'B';
+	protected static final char SIG_CHAR = 'C';
+	protected static final char SIG_SHORT = 'S';
+	protected static final char SIG_INT = 'I';
+	protected static final char SIG_LONG = 'J';
+	protected static final char SIG_FLOAT = 'F';
+	protected static final char SIG_DOUBLE = 'D';
+	protected static final char SIG_OBJECT = 'L';
+	protected static final char SIG_ARRAY = '[';
+
+	private JavaObject _object = null;
+	private JavaObject _array = null;
+	
+	
+	/**
+	 * Add array object with values to dumo
+	 */
+	public void configureArrayObject(ICheckpoint point) {
+	
+		Object o[]=new Object[]{new Object(),"ZZZ",new Hashtable()};
+		point.checkpoint();
+		
+	}
+	
+	protected void setUp() throws Exception
+	{
+		try {
+			_object = defaultJavaObject(false);
+			_array = defaultJavaObject(true);
+			super.setUp();
+		} catch (TestNotImplementedException e) {
+			throw e;
+		} catch (Throwable t) {
+			//we weren't expecting any exceptions during startup so that is a test failure
+			t.printStackTrace();
+			fail();
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getJavaClass()'
+	 * 
+	 * Ensures that we get a class which has a name (that should imply that it is sane)
+	 */
+	public void testGetJavaClass()
+	{
+		JavaClass theClass = null;
+		try {
+			theClass = _object.getJavaClass();
+		} catch (CorruptDataException e) {
+		}
+		assertNotNull(theClass);
+		try {
+			assertNotNull(theClass.getName());
+		} catch (CorruptDataException e) {
+			//this would be wrong since we are supposed to get a sane object back
+			assertTrue(false);
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.isArray()'
+	 * 
+	 * Ensures that this call returns something
+	 */
+	public void testIsArray()
+	{
+		try {
+			_object.isArray();
+		} catch (CorruptDataException e) {
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getArraySize()'
+	 * 
+	 * Ensures that we only get specced behaviour for this call
+	 */
+	public void testGetArraySize()
+	{
+		try {
+			_array.getArraySize();
+		} catch (CorruptDataException e) {
+		} catch (IllegalArgumentException e) {
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures that we can copy one element from a an array
+	 */
+	public void testArraycopy()
+	{
+		try {
+			Object destination = destArray(1);
+			
+			_array.arraycopy(0, destination, 0, 1);
+		} catch (CorruptDataException e) {
+			//technically allowed
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//technically allowed
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures that we can copy all the elements from an array
+	 */
+	public void testArraycopy2()
+	{
+		try {
+			int size = _array.getArraySize();
+			Object destination = destArray(size);			
+			_array.arraycopy(0, destination, 0, size);
+		} catch (CorruptDataException e) {
+			//technically allowed
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//technically allowed
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures that we can copy most of the elements from an array
+	 */
+	public void testArraycopy2a()
+	{
+		try {
+			int size = _array.getArraySize();
+			Object destination = destArray(size);			
+			_array.arraycopy(0, destination, 0, size-1);
+		} catch (CorruptDataException e) {
+			//technically allowed
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//technically allowed
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures that we can copy most of the elements from an array
+	 */
+	public void testArraycopy2b()
+	{
+		try {
+			int size = _array.getArraySize();
+			Object destination = destArray(size);			
+			_array.arraycopy(1, destination, 0, size-1);
+		} catch (CorruptDataException e) {
+			//technically allowed
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//technically allowed
+		}
+	}
+	
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures that we can copy most of the elements from an array
+	 */
+	public void testArraycopy2c()
+	{
+		try {
+			int size = _array.getArraySize();
+			Object destination = destArray(size);			
+			_array.arraycopy(1, destination, 1, size-1);
+		} catch (CorruptDataException e) {
+			//technically allowed
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//technically allowed
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures that we can copy most of the elements from an array
+	 */
+	public void testArraycopy2d()
+	{
+		try {
+			int size = _array.getArraySize();
+			Object destination = destArray(size);			
+			_array.arraycopy(0, destination, 1, size-1);
+		} catch (CorruptDataException e) {
+			//technically allowed
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//technically allowed
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures source index out of range is detected
+	 */
+	public void testArraycopy3()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(-1, destination, 0, size);
+				fail("Expected source index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures source index out of range is detected (at the end)
+	 */
+	public void testArraycopy4()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size+1);
+			try {
+				_array.arraycopy(1, destination, 0, size);
+				fail("Expected source index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size+1, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures source index out of range is detected
+	 */
+	public void testArraycopy5()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size+1);
+			try {
+				_array.arraycopy(size, destination, 0, 1);
+				fail("Expected source index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size+1, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures destination index out of range is detected
+	 */
+	public void testArraycopy6()
+	{
+		
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(0, destination, -1, size);
+				fail("Expected source index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures destination index out of range is detected
+	 */
+	public void testArraycopy7()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(0, destination, 1, size);
+				fail("Expected destination index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures source index out of range is detected
+	 */
+	public void testArraycopy8()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(size+1, destination, 0, 0);
+				fail("Expected source index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures negative length is detected
+	 */
+	public void testArraycopy9()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(0, destination, 0, -1);
+				fail("Expected source index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures null destination is detected
+	 */
+	public void testArraycopy10()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(0, null, 0, size);
+				fail("Expected source index out of bounds");
+			} catch (NullPointerException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures bad destination is detected
+	 */
+	public void testArraycopy11()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(0, new JavaClass[size], 0, size);
+				fail("Expected source index out of bounds");
+			} catch (IllegalArgumentException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures out of range source index is detected
+	 */
+	public void failing_testArraycopy12()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(Integer.MAX_VALUE, destination, 0, 1);
+				fail("Expected source index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures out of range destination index is detected
+	 */
+	public void testArraycopy13()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(0, destination, Integer.MAX_VALUE, 1);
+				fail("Expected destination index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.arraycopy(int, Object, int, int)'
+	 * 
+	 * Ensures out of range size is detected
+	 */
+	public void failing_testArraycopy14()
+	{
+		try {
+			int size = _array.getArraySize();		
+			Object destination = destArray(size);
+			try {
+				_array.arraycopy(1, destination, 1, Integer.MAX_VALUE);
+				fail("Expected destination index out of bounds");
+			} catch (IndexOutOfBoundsException e) {
+				// Expected array unchanged
+				testArray(size, destination);
+			} catch (MemoryAccessException e) {
+				assertNotNull(e.getPointer());
+				throw new Error(e);
+			} catch (CorruptDataException e) {
+				throw new Error(e);
+			}
+		} catch (CorruptDataException e) {		
+		}
+	}
+	
+	private Object destArray(int size) throws CorruptDataException {
+		return destArray(_array, 0, size, null);
+	}
+	
+	private void testArray(int size, Object comp) throws CorruptDataException {
+		destArray(_array, 0, size, comp);
+	}
+
+	
+	/**
+	 * @param size size of array
+	 * 
+	 * @throws CorruptDataException
+	 */
+	private Object destArray(JavaObject array, int start, int end, Object comp) throws CorruptDataException {
+		boolean fill = comp == null;
+		int size = end;
+		Object destination;
+		
+		String componentType = array.getJavaClass().getComponentType().getName();
+
+		if (componentType.equals("boolean")) {
+			boolean[] destination1 = fill ? new boolean[size] : (boolean[])comp;
+			for (int i = start; i < end; ++i) {
+				if (fill)
+				destination1[i] = (i & 1) != 0;
+				assertEquals("index "+i, 
+				destination1[i] , (i & 1) != 0);						
+			}
+			destination = destination1;
+		} else if (componentType.equals("byte")) {
+			byte[] destination1 = fill ? new byte[size] : (byte[])comp;
+			for (int i = start; i < end; ++i) {
+				if (fill)
+				destination1[i] = (byte)(i*3);
+				assertEquals("index "+i,
+				destination1[i] , (byte)(i*3));
+			}
+			destination = destination1;
+		} else if (componentType.equals("char")) {
+			char[] destination1 = fill ? new char[size] : (char[])comp;
+			for (int i = start; i < end; ++i) {
+				if (fill)
+				destination1[i] = (char)(i*3);
+				assertEquals("index "+i,
+				destination1[i] , (char)(i*3));
+			}
+			destination = destination1;
+		} else if (componentType.equals("double")) {
+			double[] destination1 = fill ? new double[size] : (double[])comp;
+			for (int i = start; i < end; ++i) {
+				if (fill)
+				destination1[i] = i*0.1;
+				assertEquals("index "+i,
+				destination1[i] , i*0.1, 0.0);						
+			}
+			destination = destination1;
+		} else if (componentType.equals("float")) {
+			float[] destination1 = fill ? new float[size] : (float[])comp;
+			for (int i = start; i < end; ++i) {
+				if (fill)
+				destination1[i] = i*0.1f;
+				assertEquals("index "+i,
+				destination1[i] , i*0.1f, 0.0f);						
+			}
+			destination = destination1;
+		} else if (componentType.equals("int")) {
+			int[] destination1 = fill ? new int[size] : (int[])comp;
+			for (int i = start; i < end; ++i) {
+				if (fill)
+				destination1[i] = (int)(i*3);
+				assertEquals("index "+i,
+				destination1[i] , (int)(i*3));						
+			}
+			destination = destination1;
+		} else if (componentType.equals("long")) {
+			long[] destination1 = fill ? new long[size] : (long[])comp;
+			for (int i = start; i < end; ++i) {
+				if (fill)
+				destination1[i] = (long)(i*3);
+				assertEquals("index "+i,
+				destination1[i] , (long)(i*3));
+			}
+			destination = destination1;
+		} else if (componentType.equals("short")) {
+			short[] destination1 = fill ? new short[size] : (short[])comp;
+			for (int i = start; i < end; ++i) {
+				if (fill)
+				destination1[i] = (short)(i*3);
+				assertEquals("index "+i,
+				destination1[i] , (short)(i*3));
+			}
+			destination = destination1;
+		} else {
+			// component type is array or object
+			Object destination1[] = fill ? new Object[size] : (Object[])comp;
+			for (int i = start; i < end; ++i) {
+				if (fill)
+				destination1[i] = new Integer(i*3);
+				assertEquals("index "+i,
+				destination1[i] , new Integer(i*3));						
+			}
+			destination = destination1;
+		}
+		return destination;
+	}
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getSize()'
+	 * 
+	 * Ensures that a positive integer is returned
+	 */
+	public void testGetSize()
+	{
+		try {
+			assertTrue(_object.getSize() > 0);
+		} catch (CorruptDataException e) {
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getHashcode()'
+	 * 
+	 * Ensures that the call succeeds
+	 */
+	public void testGetHashcode()
+	{
+		try {
+			_object.getHashcode();
+		} catch (DataUnavailable e) {
+		} catch (CorruptDataException e) {
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getPersistentHashcode()'
+	 * 
+	 * Ensures that the call succeeeds
+	 */
+	public void testGetPersistentHashcode()
+	{
+		try {
+			_object.getPersistentHashcode();
+		} catch (DataUnavailable e) {
+		} catch (CorruptDataException e) {
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getID()'
+	 * 
+	 * Ensures that a non-zero pointer is returned
+	 */
+	public void testGetID()
+	{
+		assertTrue(0 != _object.getID().getAddress());
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getHeap()'
+	 * 
+	 * Ensures that a non-null heap is returned
+	 */
+	public void testGetHeap()
+	{
+		try {
+			assertTrue(null != _object.getHeap());
+		} catch (CorruptDataException e) {
+		} catch (DataUnavailable e) {
+		}
+	}
+
+	
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getSections()'
+	 * 
+	 * Ensures that at least one section is in the returned iterator
+	 */
+	public void testGetSections()
+	{
+		List sections = _object.getSections();
+		
+		assertNotNull(sections);
+		assertFalse(sections.isEmpty());
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaObject.getReferences()'
+	 * 
+	 * Ensures that the test object and test array object return non-null iterators, that any elements
+	 * are either JavaReference or CorruptData, and that any JavaReference objects have a non-null 
+	 * description.
+	 */
+	public void testGetReferences()
+	{
+		try {
+			// test references from a non-array object
+			Iterator references = _object.getReferences().iterator();
+			assertNotNull(references);
+			while (references.hasNext()) {
+				Object instance = references.next();
+				assertTrue((instance instanceof JavaReference) || (instance instanceof CorruptData));
+				if (instance instanceof JavaReference) {
+					// sniff these objects by getting the description
+					JavaReference object = (JavaReference)instance;
+					String description = object.getDescription();
+					assertNotNull(description);
+				}
+			}
+			
+			// test references from an array object
+			references = _array.getReferences().iterator();
+			assertNotNull(references);
+			while (references.hasNext()) {
+				Object instance = references.next();
+				assertTrue((instance instanceof JavaReference) || (instance instanceof CorruptData));
+				if (instance instanceof JavaReference) {
+					// sniff these objects by getting the description
+					JavaReference object = (JavaReference)instance;
+					String description = object.getDescription();
+					assertNotNull(description);
+				}
+			}
+		} catch (Exception e) {
+			// if we caught anything else, this is a failure
+			e.printStackTrace();
+			fail();
+		}	
+	}
+	
+	/**
+	 * Verify that the equals call doesn't throw
+	 */
+	public void testEquals()
+	{
+		try{
+			assertTrue(_object.equals(_object));
+		} catch (Throwable t) {
+			assertTrue(false);
+		}
+	}
+	
+	/**
+	 * Verify that hashCode() doesn't throw and returns non-zero (technically zero is ok but it will be 
+	 * flagged here to ensure that we aren't doing anything bad to create the hashcode)
+	 */
+	public void testHashCode()
+	{
+		try {
+			assertTrue(0 != _object.hashCode());
+		} catch (Throwable t) {
+			assertTrue(false);
+		}
+	}
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaObjectTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaRuntimeTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaRuntimeTest.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaRuntimeTest.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaRuntimeTest.java Mon Nov 23 15:53:48 2009
@@ -1,384 +1,384 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tests.junit;
-
-import java.util.Iterator;
-
-import javax.tools.diagnostics.image.CorruptData;
-import javax.tools.diagnostics.image.CorruptDataException;
-import javax.tools.diagnostics.image.DataUnavailable;
-import javax.tools.diagnostics.image.ImageAddressSpace;
-import javax.tools.diagnostics.image.ImagePointer;
-import javax.tools.diagnostics.image.ImageSection;
-import javax.tools.diagnostics.image.MemoryAccessException;
-import javax.tools.diagnostics.runtime.java.JavaHeap;
-import javax.tools.diagnostics.runtime.java.JavaMonitor;
-import javax.tools.diagnostics.runtime.java.JavaObject;
-import javax.tools.diagnostics.runtime.java.JavaReference;
-import javax.tools.diagnostics.runtime.java.JavaRuntime;
-import javax.tools.diagnostics.runtime.java.JavaVMInitArgs;
-import javax.tools.diagnostics.runtime.java.JavaVMOption;
-
-
-public class JavaRuntimeTest extends AbstractImageTestcase
-{
-	private JavaRuntime _runtime = null;
-	
-	protected void setUp() throws Exception
-	{
-		_runtime = defaultJavaRuntime();
-		super.setUp();
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getJavaVM()'
-	 * 
-	 * Ensure that the pointer exists
-	 */
-	public void testGetJavaVM()
-	{
-		try {
-			assertNotNull(_runtime.getJavaVM());
-		} catch (CorruptDataException e) {
-			//allowed by spec
-		} catch (Exception e) {
-			//no other exceptions should be thrown so catch it as a failure instead of an error
-			fail();
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getJavaClassLoaders()'
-	 * 
-	 * Ensures that there is at least one class loader in the VM
-	 */
-	public void testGetJavaClassLoaders()
-	{
-		try {
-			Iterator loaders = _runtime.getJavaClassLoaders().iterator();
-			assertNotNull(loaders);
-			assertTrue(loaders.hasNext());
-		} catch (Exception e) {
-			//no exceptions should be thrown so catch it as a failure instead of an error
-			fail();
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getetObjectAtAddress()'
-	 * 
-	 * Ensures that every object in the heap is also accessible by address,
-	 * and that addresses outside the heap or not pointing to an object start
-	 * throw the expected exceptions.
-	 */
-	public void testGetObjectAtAddress()
-	{
-		JavaHeap heap = defaultJavaHeap();
-		JavaRuntime runtime = defaultJavaRuntime();
-		ImageAddressSpace addressSpace = defaultAddressSpace();
-		ImagePointer address=null;
-		ImagePointer unalignedAddress=null;
-		Iterator heapSections = heap.getSections().iterator();
-
-
-		//determine the heap start and end address
-		long heapStartAddress = Long.MAX_VALUE;
-		long heapEndAddress = 0;
-
-		Object nextElement = null;
-
-		ImageSection currentSection = null;
-		long sectionStart = 0;
-
-		while (heapSections.hasNext()) {
-			nextElement = heapSections.next();
-			if (nextElement instanceof ImageSection) {
-				currentSection = (ImageSection) nextElement;
-				sectionStart = currentSection.getBaseAddress().getAddress();
-				if (sectionStart < heapStartAddress) {
-					heapStartAddress = sectionStart; 
-				}
-				if (sectionStart + currentSection.getSize() > heapEndAddress) {
-					heapEndAddress = sectionStart + currentSection.getSize(); 
-				}
-
-			}
-
-		}
-
-		//check that every object in the heap can be retrieved by address
-		boolean exception=false;
-		for (Iterator objects = heap.getObjects().iterator();objects.hasNext();) {
-			Object potentialObject = objects.next();
-			JavaObject object = null;
-			if (potentialObject instanceof JavaObject) {
-				object = (JavaObject)potentialObject;
-			} else {
-				continue;
-			}
-			address=(ImagePointer)object.getID();
-			try {
-				runtime.getObjectAtAddress(address).getJavaClass();
-				if (unalignedAddress == null) {
-					unalignedAddress = address.add(1);
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-				exception=true;
-				break;
-			}
-
-		}
-		assertFalse(exception);
-
-
-		// Check an address BEFORE the start of the heap. For some JVMs, off-heap objects are supported
-		exception=false;
-		try {
-			long addr1 = ((heapStartAddress-1000) & (Long.MAX_VALUE-7L));
-			runtime.getObjectAtAddress(addressSpace.getPointer(addr1));
-		} catch (IllegalArgumentException e) {
-            e.printStackTrace();
-			exception=true;
-		} catch (Exception e) {
-		}
-		assertFalse(exception);
-
-		// Check an address AFTER the first object but not aligned with an object boundary. 
-		// unalignedAddress is expected to throw a IllegalArgumentException
-		
-		exception=false;
-		try {
-			runtime.getObjectAtAddress(unalignedAddress);
-		} catch (IllegalArgumentException e) {
-		// IllegalArgumentException is the expected behaviour
-		} catch (CorruptDataException e) {
-			exception=true;
-			e.printStackTrace();
-		} catch (MemoryAccessException e) {
-			exception=true;
-			e.printStackTrace();
-		} catch (DataUnavailable e) {
-			exception=true;
-			e.printStackTrace();
-		}
-		assertFalse(exception);
-
-	}
-
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getThreads()'
-	 * 
-	 * Ensures that there is at least one known thread in the runtime
-	 */
-	public void testGetThreads()
-	{
-		try {
-			Iterator it = _runtime.getThreads().iterator();
-			assertNotNull(it);
-			assertTrue(it.hasNext());
-		} catch (Exception e) {
-			//no exceptions should be thrown so catch it as a failure instead of an error
-			fail();
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getCompiledMethods()'
-	 * 
-	 * Ensures that the iterator is non-null
-	 */
-	public void testGetCompiledMethods()
-	{
-		try {
-			Iterator it = _runtime.getCompiledMethods().iterator();
-			assertNotNull(it);
-		} catch (Exception e) {
-			//no exceptions should be thrown so catch it as a failure instead of an error
-			fail();
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getMonitors()'
-	 * 
-	 * Ensures that the iterator is non-null, has at least one element and it is a JavaMonitor object.
-	 */
-	public void testGetMonitors()
-	{
-		try {
-			Iterator it = _runtime.getMonitors().iterator();
-			assertNotNull(it);
-			assertTrue(it.hasNext());
-			assertTrue(it.next() instanceof JavaMonitor);
-		} catch (Exception e) {
-			//no exceptions should be thrown so catch it as a failure instead of an error
-			fail();
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getHeaps()'
-	 * 
-	 * Ensures that the iterator is non-null, has at least one element and it is a JavaHeap object.
-	 */
-	public void testGetHeaps()
-	{
-		try {
-			Iterator it = _runtime.getHeaps().iterator();
-			assertNotNull(it);
-			assertTrue(it.hasNext());
-			assertTrue(it.next() instanceof JavaHeap);
-		} catch (Exception e) {
-			//no exceptions should be thrown so catch it as a failure instead of an error
-			fail();
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getTraceBuffer(String, boolean)'
-	 * 
-	 * Ensure that something non-null comes back when we ask for the trace buffers
-	 */
-	public void testGetTraceBuffer()
-	{
-		try {
-			assertNotNull(_runtime.getTraceBuffer("trace", false));
-		} catch (CorruptDataException e) {
-			//this is considered safe since it is in the spec
-		} catch (Exception e) {
-			//no other exceptions should be thrown
-			fail();
-		}
-	}
-
-	/**
-	 * Test method for 'org.apache.kato.runtime.ManagedRuntime.getVersion()'
-	 * 
-	 * Makes sure that the full version is non-NULL.
-	 * TODO:  Make this test more strict
-	 */
-	public void testGetVersion()
-	{
-		try {
-			assertNotNull(_runtime.getVersion());
-		} catch (CorruptDataException e) {
-			//this is considered safe since it is in the spec
-		} catch (Exception e) {
-			//no other exceptions should be thrown
-			fail();
-		}
-	}
-
-	public void testGetJavaVMInitArgs() 
-	{
-		try {
-			JavaVMInitArgs args = _runtime.getJavaVMInitArgs(); 
-			assertNotNull(args);
-
-			int version = args.getVersion();
-			assertTrue((version == JavaVMInitArgs.JNI_VERSION_1_1) 
-					|| (version == JavaVMInitArgs.JNI_VERSION_1_2)
-					|| (version == JavaVMInitArgs.JNI_VERSION_1_4));
-
-			Iterator options = args.getOptions().iterator();
-			assertNotNull(options);
-			
-			// make sure there's at least one option (not strictly required)
-			//assertTrue(options.hasNext());
-
-			while (options.hasNext()) {
-				JavaVMOption option = (JavaVMOption)options.next();
-				assertNotNull(option.getOptionString());
-				// just make sure getExtraInfo() doesn't throw an exception
-				option.getExtraInfo();
-			}
-		} catch (CorruptDataException e) {
-			// this is permitted by the spec
-		} catch (DataUnavailable e) {
-			// this is permitted by the spec
-		} catch (Exception e) {
-			//no other exceptions should be thrown
-			fail();
-		}
-	}
-
-	/**
-	 * Verify that the equals call doesn't throw
-	 */
-	public void testEquals()
-	{
-		try{
-			assertTrue(_runtime.equals(_runtime));
-		} catch (Exception e) {
-			fail();
-		}
-	}
-
-	/**
-	 * Verify that hashCode() doesn't throw and returns non-zero (technically zero is ok but it will be 
-	 * flagged here to ensure that we aren't doing anything bad to create the hashcode)
-	 */
-	public void testHashCode()
-	{
-		try {
-			assertTrue(0 != _runtime.hashCode());
-		} catch (Exception e) {
-			fail();
-		}
-	}
-
-	/**
-	 * Ensures that we can walk over every object in every heap in the VM.  Note that this may take a long time on large heaps!
-	 */
-	public void AtestWalkAllHeaps()
-	{
-		try {
-			Iterator it = _runtime.getHeaps().iterator();
-			assertNotNull(it);
-			assertTrue(it.hasNext());
-			while (it.hasNext()) {
-				Object next = it.next();
-				assertTrue(next instanceof JavaHeap);
-				JavaHeap heap = (JavaHeap) next;
-				Iterator objects = heap.getObjects().iterator();
-				assertNotNull(objects);
-				while (objects.hasNext()) {
-					Object one = objects.next();
-					assertTrue(one instanceof JavaObject);
-				}
-			}
-		} catch (Exception e) {
-			//no exceptions should be thrown from here
-			e.printStackTrace();
-			fail();
-		}
-	}
-
-	/**
-	 * Ensures that we get at least one root Reference object from the JavaRuntime 
-	 * 
-	 */
-	public void testGetHeapRoots()
-	{
-
-		Iterator it = _runtime.getHeapRoots().iterator();
-		assertNotNull(it);
-		assertTrue(it.hasNext());
-		Object first = it.next();
-		assertTrue( first instanceof JavaReference || first instanceof CorruptData);
-
-	}
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tests.junit;
+
+import java.util.Iterator;
+
+import javax.tools.diagnostics.image.CorruptData;
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.image.DataUnavailable;
+import javax.tools.diagnostics.image.ImageAddressSpace;
+import javax.tools.diagnostics.image.ImagePointer;
+import javax.tools.diagnostics.image.ImageSection;
+import javax.tools.diagnostics.image.MemoryAccessException;
+import javax.tools.diagnostics.runtime.java.JavaHeap;
+import javax.tools.diagnostics.runtime.java.JavaMonitor;
+import javax.tools.diagnostics.runtime.java.JavaObject;
+import javax.tools.diagnostics.runtime.java.JavaReference;
+import javax.tools.diagnostics.runtime.java.JavaRuntime;
+import javax.tools.diagnostics.runtime.java.JavaVMInitArgs;
+import javax.tools.diagnostics.runtime.java.JavaVMOption;
+
+
+public class JavaRuntimeTest extends AbstractImageTestcase
+{
+	private JavaRuntime _runtime = null;
+	
+	protected void setUp() throws Exception
+	{
+		_runtime = defaultJavaRuntime();
+		super.setUp();
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getJavaVM()'
+	 * 
+	 * Ensure that the pointer exists
+	 */
+	public void testGetJavaVM()
+	{
+		try {
+			assertNotNull(_runtime.getJavaVM());
+		} catch (CorruptDataException e) {
+			//allowed by spec
+		} catch (Exception e) {
+			//no other exceptions should be thrown so catch it as a failure instead of an error
+			fail();
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getJavaClassLoaders()'
+	 * 
+	 * Ensures that there is at least one class loader in the VM
+	 */
+	public void testGetJavaClassLoaders()
+	{
+		try {
+			Iterator loaders = _runtime.getJavaClassLoaders().iterator();
+			assertNotNull(loaders);
+			assertTrue(loaders.hasNext());
+		} catch (Exception e) {
+			//no exceptions should be thrown so catch it as a failure instead of an error
+			fail();
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getetObjectAtAddress()'
+	 * 
+	 * Ensures that every object in the heap is also accessible by address,
+	 * and that addresses outside the heap or not pointing to an object start
+	 * throw the expected exceptions.
+	 */
+	public void testGetObjectAtAddress()
+	{
+		JavaHeap heap = defaultJavaHeap();
+		JavaRuntime runtime = defaultJavaRuntime();
+		ImageAddressSpace addressSpace = defaultAddressSpace();
+		ImagePointer address=null;
+		ImagePointer unalignedAddress=null;
+		Iterator heapSections = heap.getSections().iterator();
+
+
+		//determine the heap start and end address
+		long heapStartAddress = Long.MAX_VALUE;
+		long heapEndAddress = 0;
+
+		Object nextElement = null;
+
+		ImageSection currentSection = null;
+		long sectionStart = 0;
+
+		while (heapSections.hasNext()) {
+			nextElement = heapSections.next();
+			if (nextElement instanceof ImageSection) {
+				currentSection = (ImageSection) nextElement;
+				sectionStart = currentSection.getBaseAddress().getAddress();
+				if (sectionStart < heapStartAddress) {
+					heapStartAddress = sectionStart; 
+				}
+				if (sectionStart + currentSection.getSize() > heapEndAddress) {
+					heapEndAddress = sectionStart + currentSection.getSize(); 
+				}
+
+			}
+
+		}
+
+		//check that every object in the heap can be retrieved by address
+		boolean exception=false;
+		for (Iterator objects = heap.getObjects().iterator();objects.hasNext();) {
+			Object potentialObject = objects.next();
+			JavaObject object = null;
+			if (potentialObject instanceof JavaObject) {
+				object = (JavaObject)potentialObject;
+			} else {
+				continue;
+			}
+			address=(ImagePointer)object.getID();
+			try {
+				runtime.getObjectAtAddress(address).getJavaClass();
+				if (unalignedAddress == null) {
+					unalignedAddress = address.add(1);
+				}
+			} catch (Exception e) {
+				e.printStackTrace();
+				exception=true;
+				break;
+			}
+
+		}
+		assertFalse(exception);
+
+
+		// Check an address BEFORE the start of the heap. For some JVMs, off-heap objects are supported
+		exception=false;
+		try {
+			long addr1 = ((heapStartAddress-1000) & (Long.MAX_VALUE-7L));
+			runtime.getObjectAtAddress(addressSpace.getPointer(addr1));
+		} catch (IllegalArgumentException e) {
+            e.printStackTrace();
+			exception=true;
+		} catch (Exception e) {
+		}
+		assertFalse(exception);
+
+		// Check an address AFTER the first object but not aligned with an object boundary. 
+		// unalignedAddress is expected to throw a IllegalArgumentException
+		
+		exception=false;
+		try {
+			runtime.getObjectAtAddress(unalignedAddress);
+		} catch (IllegalArgumentException e) {
+		// IllegalArgumentException is the expected behaviour
+		} catch (CorruptDataException e) {
+			exception=true;
+			e.printStackTrace();
+		} catch (MemoryAccessException e) {
+			exception=true;
+			e.printStackTrace();
+		} catch (DataUnavailable e) {
+			exception=true;
+			e.printStackTrace();
+		}
+		assertFalse(exception);
+
+	}
+
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getThreads()'
+	 * 
+	 * Ensures that there is at least one known thread in the runtime
+	 */
+	public void testGetThreads()
+	{
+		try {
+			Iterator it = _runtime.getThreads().iterator();
+			assertNotNull(it);
+			assertTrue(it.hasNext());
+		} catch (Exception e) {
+			//no exceptions should be thrown so catch it as a failure instead of an error
+			fail();
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getCompiledMethods()'
+	 * 
+	 * Ensures that the iterator is non-null
+	 */
+	public void testGetCompiledMethods()
+	{
+		try {
+			Iterator it = _runtime.getCompiledMethods().iterator();
+			assertNotNull(it);
+		} catch (Exception e) {
+			//no exceptions should be thrown so catch it as a failure instead of an error
+			fail();
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getMonitors()'
+	 * 
+	 * Ensures that the iterator is non-null, has at least one element and it is a JavaMonitor object.
+	 */
+	public void testGetMonitors()
+	{
+		try {
+			Iterator it = _runtime.getMonitors().iterator();
+			assertNotNull(it);
+			assertTrue(it.hasNext());
+			assertTrue(it.next() instanceof JavaMonitor);
+		} catch (Exception e) {
+			//no exceptions should be thrown so catch it as a failure instead of an error
+			fail();
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getHeaps()'
+	 * 
+	 * Ensures that the iterator is non-null, has at least one element and it is a JavaHeap object.
+	 */
+	public void testGetHeaps()
+	{
+		try {
+			Iterator it = _runtime.getHeaps().iterator();
+			assertNotNull(it);
+			assertTrue(it.hasNext());
+			assertTrue(it.next() instanceof JavaHeap);
+		} catch (Exception e) {
+			//no exceptions should be thrown so catch it as a failure instead of an error
+			fail();
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaRuntime.getTraceBuffer(String, boolean)'
+	 * 
+	 * Ensure that something non-null comes back when we ask for the trace buffers
+	 */
+	public void testGetTraceBuffer()
+	{
+		try {
+			assertNotNull(_runtime.getTraceBuffer("trace", false));
+		} catch (CorruptDataException e) {
+			//this is considered safe since it is in the spec
+		} catch (Exception e) {
+			//no other exceptions should be thrown
+			fail();
+		}
+	}
+
+	/**
+	 * Test method for 'org.apache.kato.runtime.ManagedRuntime.getVersion()'
+	 * 
+	 * Makes sure that the full version is non-NULL.
+	 * TODO:  Make this test more strict
+	 */
+	public void testGetVersion()
+	{
+		try {
+			assertNotNull(_runtime.getVersion());
+		} catch (CorruptDataException e) {
+			//this is considered safe since it is in the spec
+		} catch (Exception e) {
+			//no other exceptions should be thrown
+			fail();
+		}
+	}
+
+	public void testGetJavaVMInitArgs() 
+	{
+		try {
+			JavaVMInitArgs args = _runtime.getJavaVMInitArgs(); 
+			assertNotNull(args);
+
+			int version = args.getVersion();
+			assertTrue((version == JavaVMInitArgs.JNI_VERSION_1_1) 
+					|| (version == JavaVMInitArgs.JNI_VERSION_1_2)
+					|| (version == JavaVMInitArgs.JNI_VERSION_1_4));
+
+			Iterator options = args.getOptions().iterator();
+			assertNotNull(options);
+			
+			// make sure there's at least one option (not strictly required)
+			//assertTrue(options.hasNext());
+
+			while (options.hasNext()) {
+				JavaVMOption option = (JavaVMOption)options.next();
+				assertNotNull(option.getOptionString());
+				// just make sure getExtraInfo() doesn't throw an exception
+				option.getExtraInfo();
+			}
+		} catch (CorruptDataException e) {
+			// this is permitted by the spec
+		} catch (DataUnavailable e) {
+			// this is permitted by the spec
+		} catch (Exception e) {
+			//no other exceptions should be thrown
+			fail();
+		}
+	}
+
+	/**
+	 * Verify that the equals call doesn't throw
+	 */
+	public void testEquals()
+	{
+		try{
+			assertTrue(_runtime.equals(_runtime));
+		} catch (Exception e) {
+			fail();
+		}
+	}
+
+	/**
+	 * Verify that hashCode() doesn't throw and returns non-zero (technically zero is ok but it will be 
+	 * flagged here to ensure that we aren't doing anything bad to create the hashcode)
+	 */
+	public void testHashCode()
+	{
+		try {
+			assertTrue(0 != _runtime.hashCode());
+		} catch (Exception e) {
+			fail();
+		}
+	}
+
+	/**
+	 * Ensures that we can walk over every object in every heap in the VM.  Note that this may take a long time on large heaps!
+	 */
+	public void AtestWalkAllHeaps()
+	{
+		try {
+			Iterator it = _runtime.getHeaps().iterator();
+			assertNotNull(it);
+			assertTrue(it.hasNext());
+			while (it.hasNext()) {
+				Object next = it.next();
+				assertTrue(next instanceof JavaHeap);
+				JavaHeap heap = (JavaHeap) next;
+				Iterator objects = heap.getObjects().iterator();
+				assertNotNull(objects);
+				while (objects.hasNext()) {
+					Object one = objects.next();
+					assertTrue(one instanceof JavaObject);
+				}
+			}
+		} catch (Exception e) {
+			//no exceptions should be thrown from here
+			e.printStackTrace();
+			fail();
+		}
+	}
+
+	/**
+	 * Ensures that we get at least one root Reference object from the JavaRuntime 
+	 * 
+	 */
+	public void testGetHeapRoots()
+	{
+
+		Iterator it = _runtime.getHeapRoots().iterator();
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+		Object first = it.next();
+		assertTrue( first instanceof JavaReference || first instanceof CorruptData);
+
+	}
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaRuntimeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaStackFrameTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaStackFrameTest.java?rev=883384&r1=883383&r2=883384&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaStackFrameTest.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaStackFrameTest.java Mon Nov 23 15:53:48 2009
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- ******************************************************************************/
-package org.apache.kato.tests.junit;
-
-import java.util.Iterator;
-
-import javax.tools.diagnostics.image.CorruptData;
-import javax.tools.diagnostics.image.CorruptDataException;
-import javax.tools.diagnostics.runtime.java.JavaReference;
-import javax.tools.diagnostics.runtime.java.JavaStackFrame;
-import javax.tools.diagnostics.runtime.java.JavaThread;
-
-
-public class JavaStackFrameTest extends AbstractImageTestcase
-{
-	private JavaStackFrame _frame = null;
-	
-	public  JavaStackFrame defaultJavaStackFrame()
-	{
-		JavaThread thread = defaultJavaThread();
-		Iterator it = thread.getStackFrames().iterator();
-		assertNotNull(it);
-		assertTrue(it.hasNext());
-		return (JavaStackFrame) it.next();
-	}
-	
-	protected void setUp() throws Exception
-	{
-		_frame = defaultJavaStackFrame();
-		super.setUp();
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaStackFrame.getBasePointer()'
-	 * 
-	 * Ensures that a non-null base pointer is returned
-	 */
-	public void testGetBasePointer()
-	{
-		try {
-			assertNotNull(_frame.getBasePointer());
-		} catch (CorruptDataException e) {
-			assertTrue(false);
-		}
-	}
-
-	/**
-	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaStackFrame.getLocation()'
-	 * 
-	 * Ensures that a non-null location is returned
-	 */
-	public void testGetLocation()
-	{
-		try {
-			assertNotNull(_frame.getLocation());
-		} catch (CorruptDataException e) {
-			assertTrue(false);
-		}
-	}
-
-	/**
-	 * Verify that the equals call doesn't throw
-	 */
-	public void testEquals()
-	{
-		try{
-			assertTrue(_frame.equals(_frame));
-		} catch (Throwable t) {
-			assertTrue(false);
-		}
-	}
-	
-	/**
-	 * Verify that hashCode() doesn't throw and returns non-zero (technically zero is ok but it will be 
-	 * flagged here to ensure that we aren't doing anything bad to create the hashcode)
-	 */
-	public void testHashCode()
-	{
-		
-			assertTrue(0 != _frame.hashCode());
-		
-	}
-
-	/**
-	 * Ensures that we get at least one root Reference object from the JavaStackFrame 
-	 * 
-	 */
-	public void testGetHeapRoots()
-	{
-		try {
-			Iterator it = _frame.getHeapRoots().iterator();
-			assertNotNull(it);
-			/* some frames may legitimately not have any roots */
-			if (it.hasNext()){
-				Object first = it.next();
-				assertTrue( first instanceof JavaReference || first instanceof CorruptData);
-			}
-		} catch (Throwable t) {
-			assertTrue(false);
-		}	
-	}
-}
+/*******************************************************************************
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.kato.tests.junit;
+
+import java.util.Iterator;
+
+import javax.tools.diagnostics.image.CorruptData;
+import javax.tools.diagnostics.image.CorruptDataException;
+import javax.tools.diagnostics.runtime.java.JavaReference;
+import javax.tools.diagnostics.runtime.java.JavaStackFrame;
+import javax.tools.diagnostics.runtime.java.JavaThread;
+
+
+public class JavaStackFrameTest extends AbstractImageTestcase
+{
+	private JavaStackFrame _frame = null;
+	
+	public  JavaStackFrame defaultJavaStackFrame()
+	{
+		JavaThread thread = defaultJavaThread();
+		Iterator it = thread.getStackFrames().iterator();
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+		return (JavaStackFrame) it.next();
+	}
+	
+	protected void setUp() throws Exception
+	{
+		_frame = defaultJavaStackFrame();
+		super.setUp();
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaStackFrame.getBasePointer()'
+	 * 
+	 * Ensures that a non-null base pointer is returned
+	 */
+	public void testGetBasePointer()
+	{
+		try {
+			assertNotNull(_frame.getBasePointer());
+		} catch (CorruptDataException e) {
+			assertTrue(false);
+		}
+	}
+
+	/**
+	 * Test method for 'javax.tools.diagnostics.runtime.java.JavaStackFrame.getLocation()'
+	 * 
+	 * Ensures that a non-null location is returned
+	 */
+	public void testGetLocation()
+	{
+		try {
+			assertNotNull(_frame.getLocation());
+		} catch (CorruptDataException e) {
+			assertTrue(false);
+		}
+	}
+
+	/**
+	 * Verify that the equals call doesn't throw
+	 */
+	public void testEquals()
+	{
+		try{
+			assertTrue(_frame.equals(_frame));
+		} catch (Throwable t) {
+			assertTrue(false);
+		}
+	}
+	
+	/**
+	 * Verify that hashCode() doesn't throw and returns non-zero (technically zero is ok but it will be 
+	 * flagged here to ensure that we aren't doing anything bad to create the hashcode)
+	 */
+	public void testHashCode()
+	{
+		
+			assertTrue(0 != _frame.hashCode());
+		
+	}
+
+	/**
+	 * Ensures that we get at least one root Reference object from the JavaStackFrame 
+	 * 
+	 */
+	public void testGetHeapRoots()
+	{
+		try {
+			Iterator it = _frame.getHeapRoots().iterator();
+			assertNotNull(it);
+			/* some frames may legitimately not have any roots */
+			if (it.hasNext()){
+				Object first = it.next();
+				assertTrue( first instanceof JavaReference || first instanceof CorruptData);
+			}
+		} catch (Throwable t) {
+			assertTrue(false);
+		}	
+	}
+}

Propchange: incubator/kato/trunk/org.apache.kato/kato.tck.testsuite/src/main/java/org/apache/kato/tests/junit/JavaStackFrameTest.java
------------------------------------------------------------------------------
    svn:eol-style = native