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 cc...@apache.org on 2009/03/16 16:42:41 UTC

svn commit: r754945 [6/8] - in /incubator/kato/trunk/import/org.apache.kato.tck.tests: ./ .settings/ src/ src/com/ src/com/ibm/ src/com/ibm/dtfj/ src/com/ibm/dtfj/tck/ src/com/ibm/dtfj/tck/tests/ src/com/ibm/dtfj/tck/tests/javaruntime/ src/com/ibm/dtfj...

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/AbstractDTFJTestcase.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/AbstractDTFJTestcase.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/AbstractDTFJTestcase.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/AbstractDTFJTestcase.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,266 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+
+import com.ibm.dtfj.image.CorruptData;
+import com.ibm.dtfj.image.CorruptDataException;
+import com.ibm.dtfj.image.DataUnavailable;
+import com.ibm.dtfj.image.Image;
+import com.ibm.dtfj.image.ImageAddressSpace;
+import com.ibm.dtfj.image.ImageFactory;
+import com.ibm.dtfj.image.ImageModule;
+import com.ibm.dtfj.image.ImageProcess;
+import com.ibm.dtfj.image.ImageThread;
+import com.ibm.dtfj.java.JavaClass;
+import com.ibm.dtfj.java.JavaClassLoader;
+import com.ibm.dtfj.java.JavaHeap;
+import com.ibm.dtfj.java.JavaMethod;
+import com.ibm.dtfj.java.JavaObject;
+import com.ibm.dtfj.java.JavaRuntime;
+import com.ibm.dtfj.java.JavaThread;
+import com.ibm.dtfj.tck.harness.TCKProcessTestcase;
+import com.ibm.dtfj.tests.junit.DTFJImageLoader.Capabilities;
+
+public abstract class AbstractDTFJTestcase extends TCKProcessTestcase {
+
+	private static Capabilities capabilities = null;
+	
+	public  ImageProcess defaultImageProcess() {
+		if(_proc==null)  _proc= defaultAddressSpace().getCurrentProcess();
+		return _proc;
+	}
+
+	public  ImageAddressSpace defaultAddressSpace() {
+		Image image = defaultTestingImage();
+		
+		//TODO: come up with a good way to test each address space.  For now we will just grab the first one
+		return (ImageAddressSpace) image.getAddressSpaces().next();
+	}
+
+	/**
+	 * Returns the Image for testing, creating it if necessary
+	 * @return The default testing image
+	 */
+	public  Image defaultTestingImage() {
+		
+		
+		try {
+			if (null == capabilities) {
+				capabilities=new DTFJImageLoader().getCapabilities();
+			}
+		} catch (Throwable t) {
+			t.printStackTrace();
+			fail();
+		}
+		return capabilities.image;
+	}
+
+	
+	private ImageProcess _proc = null;
+	private ImageModule _module = null;
+
+	
+
+	public ImageModule defaultImageModule() {
+		
+		if(_module!=null)  return _module;
+		
+		ImageProcess proc = defaultImageProcess();
+		Iterator it = null;
+		
+		try {
+			it = proc.getLibraries();
+		} catch (DataUnavailable e) {
+			//ok
+		} catch (CorruptDataException e) {
+			//ok
+		}
+		if (null == it) {
+			//we have nothing to test so throw unimplemented so we know it isn't a real bug
+			throw new TestNotImplementedException();
+		}
+		_module=(ImageModule) it.next();
+		return _module;
+	}
+
+	public ImageFactory getFactory() {
+		return capabilities.factory;
+	}
+
+	public JavaRuntime defaultJavaRuntime() {
+		JavaRuntime runtime = null;
+		Iterator it = defaultImageProcess().getRuntimes();
+		
+		assertFalse(null == it);
+		while ((null == runtime) && (it.hasNext())) {
+			Object maybeRuntime = it.next();
+			if (maybeRuntime instanceof JavaRuntime) {
+				runtime = (JavaRuntime) maybeRuntime;
+			} else {
+				throw new TestNotImplementedException();
+			}
+		}
+		assertNotNull(runtime);
+		return runtime;
+	}
+
+	public JavaThread defaultJavaThread() {
+		JavaRuntime time = defaultJavaRuntime();
+		assertNotNull(time);
+		Iterator it = time.getThreads();
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+		//threads without stack frames aren't very useful for testing so ignore them
+		// unless they are the only ones
+		JavaThread candidate = null;
+		do {
+			candidate = (JavaThread) it.next();
+		} while ((it.hasNext()) && (!candidate.getStackFrames().hasNext()));
+		return candidate;
+	}
+
+	public JavaClassLoader defaultJavaClassLoader() {
+		Iterator loaders =  defaultJavaRuntime().getJavaClassLoaders();
+		assertTrue(loaders.hasNext());
+		JavaClassLoader loader = (JavaClassLoader) loaders.next();
+		while ((!loader.getDefinedClasses().hasNext()) && (loaders.hasNext())) {
+			loader = (JavaClassLoader) loaders.next();
+		}
+		return loader;
+	}
+
+	public JavaClass defaultJavaClass() {
+		// Choose a class loader
+		JavaClassLoader loader = defaultJavaClassLoader();
+		
+		// Choose a class which has a superclass
+		try {
+			for (Iterator iter = loader.getDefinedClasses(); iter.hasNext();) {
+				JavaClass clazz = (JavaClass) iter.next();
+				if ( !clazz.getName().equals("java/lang/Object") &&
+				     !clazz.getName().equals("boolean"         ) &&
+				     !clazz.getName().equals("byte"            ) &&						
+				     !clazz.getName().equals("char"            ) &&		
+				     !clazz.getName().equals("double"          ) &&		
+				     !clazz.getName().equals("float"           ) &&		
+				     !clazz.getName().equals("int"             ) &&		
+				     !clazz.getName().equals("long"            ) &&		
+				     !clazz.getName().equals("short"           ) &&		
+				     !clazz.getName().equals("void"            ) &&		
+				     !clazz.isArray()                               ) {			
+					return clazz;
+				}
+			}
+		} catch (CorruptDataException e) {
+			//allowed by the spec
+		} catch (Exception e) {
+			//if we caught anything else, this is an error
+			fail();
+		}
+		return null;
+	}
+
+	public JavaHeap defaultJavaHeap() {
+		JavaRuntime runtime  = defaultJavaRuntime();
+		Iterator it = runtime.getHeaps();
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+		JavaHeap heap = (JavaHeap) it.next();
+
+		// This should use Middleware Heap as default
+		// move on to Middleware Heap
+		if (heap.getName().equalsIgnoreCase("System Heap")){
+			heap = (JavaHeap) it.next();
+			if (heap.getName().equalsIgnoreCase("Transient Heap")){
+				heap = (JavaHeap) it.next();
+			}				
+		}
+
+		return (JavaHeap) heap;
+	}
+
+	public JavaObject defaultJavaObject(boolean isArray) {
+		JavaObject foundObject = null;
+		JavaHeap heap = defaultJavaHeap();
+		Iterator objects = heap.getObjects();
+		
+		while ((null == foundObject) && (objects.hasNext())) {
+			JavaObject oneObject = (JavaObject) objects.next();
+			
+			try {
+				if (isArray) {
+					// We need any array object with at least one element
+					if (oneObject.isArray()) {
+						if (oneObject.getArraySize() > 0) {
+							foundObject = oneObject;
+						}
+					}
+				} else {
+					// We need a non-array, non-trivial object with at least two declared fields
+					if ( (!oneObject.isArray()) && (!oneObject.getJavaClass().getName().equals("java/lang/Object"))) {
+						Iterator declaredFields=oneObject.getJavaClass().getDeclaredFields();
+						if (declaredFields.hasNext()) {
+							declaredFields.next();
+							if (declaredFields.hasNext()) {
+								foundObject = oneObject;
+							}
+						}
+					}
+				}
+			} catch (CorruptDataException e) {
+				//just ignore this one
+			}
+		}
+		return foundObject;
+	}
+
+	public ImageThread defaultImageThread() {
+		Iterator it = defaultImageProcess().getThreads();
+		
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+		
+		ImageThread thread = null;
+		while (null == thread && it.hasNext()) {
+			Object next = it.next();
+			if (next instanceof CorruptData)
+				continue;
+			thread = (ImageThread) next;
+		}
+		
+		if (null == thread)
+			throw new TestNotImplementedException();
+	
+		return thread;
+	}
+
+	public JavaMethod defaultJavaMethod() {
+		JavaRuntime runtime = defaultJavaRuntime();
+		Iterator it = runtime.getCompiledMethods();
+		if (it.hasNext()) {
+			return (JavaMethod) it.next();
+		} else {
+			System.err.println("Warning:  No compiled methods found!  This core must have been without JIT!");
+			throw new TestNotImplementedException();
+		}
+	}
+
+	protected void setUp() throws Exception {
+		
+		if(capabilities==null) capabilities=new DTFJImageLoader().getCapabilities();
+	}
+
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/AllTests.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/AllTests.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/AllTests.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite("Test for com.ibm.dtfj.tests.junit");
+		//$JUnit-BEGIN$
+		suite.addTestSuite(JavaRuntimeTest.class);
+		suite.addTestSuite(ImageProcessTest.class);
+		suite.addTestSuite(ImageTest.class);
+		suite.addTestSuite(ImageAddressSpaceTest.class);
+		suite.addTestSuite(ImageModuleTest.class);
+		suite.addTestSuite(JavaThreadTest.class);
+		suite.addTestSuite(ImageThreadTest.class);
+		suite.addTestSuite(JavaStackFrameTest.class);
+		suite.addTestSuite(JavaMonitorTest.class);
+		suite.addTestSuite(JavaMethodTest.class);
+		suite.addTestSuite(ImageSectionTest.class);
+		suite.addTestSuite(JavaHeapTest.class);
+		suite.addTestSuite(JavaClassLoaderTest.class);
+		suite.addTestSuite(JavaClassTest.class);
+		suite.addTestSuite(JavaObjectTest.class);
+		suite.addTestSuite(ImagePointerTest.class);
+		suite.addTestSuite(ImageRegisterTest.class);
+		suite.addTestSuite(ImageStackFrameTest.class);
+		suite.addTestSuite(ImageSymbolTest.class);
+		suite.addTestSuite(JavaFieldTest.class);
+		suite.addTestSuite(JavaLocationTest.class);
+		suite.addTestSuite(ImageFactoryTest.class);
+		//$JUnit-END$
+		return suite;
+	}
+
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/DTFJImageLoader.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/DTFJImageLoader.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/DTFJImageLoader.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/DTFJImageLoader.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+
+import com.ibm.dtfj.image.Image;
+import com.ibm.dtfj.image.ImageFactory;
+import com.ibm.dtfj.tck.api.IImageCreator;
+import com.ibm.dtfj.tck.api.TCKConfiguration;
+
+public class DTFJImageLoader {
+
+	
+	
+	public  Capabilities getCapabilities() throws Exception {
+		
+			
+	    TCKConfiguration config=TCKConfiguration.getConfiguration();
+	    
+	    
+	    
+	    
+	    IImageCreator creator=config.getImageCreator();
+	    
+	    Capabilities c=new Capabilities(); 
+	    
+	    c.image=creator.createProcessImage(config);
+		
+	    String vendor=config.getVendor();
+
+	    //TODO: instantiate vm-specific factory class
+	    //see example below
+	    
+//	    		Class factoryClass = Class.forName("<factory class name>");
+//	    		c.factory = (ImageFactory) factoryClass.newInstance();
+//	    		c.hasRootSupport=false;
+		return c;
+		
+	}
+		
+	
+
+	
+	
+	
+	
+	public class Capabilities {
+		public Image image=null;
+		public ImageFactory factory=null;
+		public boolean hasRootSupport=false;
+		public Exception loadError=null;
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/DTFJManifestTests.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/DTFJManifestTests.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/DTFJManifestTests.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/DTFJManifestTests.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import junit.framework.TestCase;
+
+import com.ibm.dtfj.image.ImageFactory;
+
+public class DTFJManifestTests extends TestCase {
+
+	
+	private static final String COM_IBM_DTFJ_IMAGE = "com/ibm/dtfj/image/";
+	private static final String MANIFEST_ROUTE = "/META-INF/MANIFEST.MF";
+	private static String resource="/"+ImageFactory.class.getName().replace('.', '/')+".class";
+	private URL getKnownResourceURL() {
+		URL knownResourceURL=ImageFactory.class.getResource(resource);
+		return knownResourceURL;
+	}
+	
+	
+	private Manifest getManifest() throws IOException {
+		InputStream in=openManifestStream();
+		Manifest m=new Manifest(in);
+		in.close();
+		return m;
+	}
+
+	/**
+	 * Locates the manifest for DTFJ.  This manifest may either
+	 * be local to the source code (in on the filesystem) on within
+	 * the jar
+	 * 
+	 * @return manifest inputstream or null 
+	 * @throws IOException
+	 */
+	
+	private InputStream openManifestStream() throws IOException {
+		
+		
+		URL knownResourceURL = getKnownResourceURL();
+		String u=knownResourceURL.toExternalForm();
+		
+		String protocol=knownResourceURL.getProtocol();
+		String manifestLocation=null;
+		
+		if(protocol.equals("file")) {
+			manifestLocation=u.substring(0,u.length()-resource.length())+"/.."+MANIFEST_ROUTE;
+		}
+		else {
+			manifestLocation=u.substring(0,u.length()-resource.length())+MANIFEST_ROUTE;	
+		}
+		// create expected manifest location...
+		
+		
+		URL u2=new URL(manifestLocation);
+		InputStream  manifestStream=u2.openStream();
+		return manifestStream;
+	}
+	
+	public void testHasAValidManifestStructure() throws IOException {
+		
+		InputStream in=openManifestStream();
+		Manifest m=new Manifest(in);
+		in.close();
+		
+	}
+	public void testHasAManifest() throws IOException {
+		
+		InputStream manifestStream = openManifestStream();
+		assertNotNull(manifestStream);
+		manifestStream.close();
+		
+		
+}
+	public void testHasBundleVendor() throws IOException {
+		
+		Manifest m = getManifest();
+		Attributes attrs=m.getMainAttributes();
+		Object value=attrs.getValue("Bundle-Vendor");
+		assertEquals("Bundle Vendor is incorrect","IBM",value.toString());
+		
+		
+	}
+	public void testHasBundleVersion() throws IOException {
+	
+		InputStream in=openManifestStream();
+		Manifest m=new Manifest(in);
+		Attributes attrs=m.getMainAttributes();
+		in.close();
+		Object value=attrs.getValue("Bundle-Version");
+		assertEquals("Bundle Version is incorrect","1.3.0.qualifier",value.toString());
+		
+		
+	}
+	public void testHasDTFJAPINameSection() throws IOException {
+		
+		Manifest m = getManifest();
+		Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+		
+		assertNotNull("missing DTFJ API Name section ["+COM_IBM_DTFJ_IMAGE+"] in manifest",attrs);
+		
+	}
+public void testHasDTFJImplementationTitle() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Implementation-Title");
+	assertNotNull("Implementation-Title is missing in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest",value);
+	
+}
+
+
+public void testHasDTFJImplementationVendor() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Implementation-Vendor");
+	assertNotNull("Implementation-Vendor is missing in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest",value);
+	
+}
+
+public void testHasDTFJImplementationVersion() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Implementation-Version");
+	assertNotNull("Implementation-Version is missing in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest",value);
+	
+}
+
+public void testHasDTFJSpecificationTitle() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Specification-Title");
+	assertNotNull("Specification-Title is missing in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest",value);
+	
+}
+public void testHasDTFJSpecificationVendor() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Specification-Vendor");
+	assertNotNull("Specification-Vendor is missing in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest",value);
+	
+}
+public void testHasDTFJSpecificationVersion() throws IOException {
+		
+		Manifest m = getManifest();
+		Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+		Object value=attrs.getValue("Specification-Version");
+		assertNotNull("Specification-Version is missing in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest",value);
+		
+	}
+public void testHasValidDTFJSpecificationVendor() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Specification-Vendor");
+	assertEquals("Specification-Vendor is incorrect in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest","IBM",value.toString());
+	
+}
+public void testHasValidDTFJSpecificationVersion() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Specification-Version");
+	assertEquals("Specification-Version is incorrect in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest","1.3",value.toString());
+	
+}
+public void testHasValidDTFJSpecificationTitle() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Specification-Title");
+	assertEquals("Specification-Title is incorrect in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest","Diagnostic Tool Framework for Java",value.toString());
+	
+}
+public void testHasValidDTFJImplementationVendor() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Implementation-Vendor");
+	assertEquals("Implementation-Vendor is incorrect in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest","IBM",value.toString());
+	
+}
+
+public void testHasValidDTFJImplementationVersion() throws IOException {
+	
+	Manifest m = getManifest();
+	Attributes attrs =m.getAttributes(COM_IBM_DTFJ_IMAGE);
+	Object value=attrs.getValue("Implementation-Version");
+	int buildNo=Integer.parseInt(value.toString());
+	assertTrue("Implementation Version is incorrect in  ["+COM_IBM_DTFJ_IMAGE+"] section of manifest",buildNo>0);
+	
+}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageAddressSpaceTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageAddressSpaceTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageAddressSpaceTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageAddressSpaceTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+
+import com.ibm.dtfj.image.CorruptData;
+import com.ibm.dtfj.image.ImageAddressSpace;
+import com.ibm.dtfj.image.ImageSection;
+
+public class ImageAddressSpaceTest extends AbstractDTFJTestcase {
+	private ImageAddressSpace _space = null;
+	public static final long TEST_ADDRESS = 0x7FFFFFFF;	//TODO: don't test with this specific value
+	
+	protected void setUp() throws Exception {
+		_space = defaultAddressSpace();
+		super.setUp();
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageAddressSpace.getCurrentProcess()'
+	 * 
+	 * Ensures that the process is non-null
+	 */
+	public void testGetCurrentProcess() {
+		assertNotNull(_space.getCurrentProcess());
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageAddressSpace.getProcesses()'
+	 * 
+	 * Ensures that the process iterator is non-null and has at least one process
+	 */
+	public void testGetProcesses() {
+		Iterator it = _space.getProcesses();
+		
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageAddressSpace.getPointer(long)'
+	 * 
+	 * Ensures that pointers can be created which point at entities within the address space.
+	 * TODO:  this needs to be tested in a less arbitrary way.
+	 */
+	public void testGetPointer() {
+		assertNotNull(_space.getPointer(TEST_ADDRESS));
+	}
+	
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageAddressSpace.getImageSections()'
+	 * 
+	 * Ensures that there is at least one section and it is of type ImageSection
+	 */
+	public void testGetImageSections()
+	{
+		Iterator it = _space.getImageSections();
+		assertTrue(it.hasNext());
+		// empty iterator is a valid return from getImageSections
+		while (it.hasNext()) {
+			Object section = it.next();
+			assertTrue((section instanceof ImageSection) || (section instanceof CorruptData));
+		}
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageFactoryTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageFactoryTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageFactoryTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import com.ibm.dtfj.image.ImageFactory;
+
+public class ImageFactoryTest extends AbstractDTFJTestcase
+{
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageFactory.getDTFJMajorVersion()'
+	 * 
+	 * Ensures that the major version is at least 1
+	 */
+	public void testGetDTFJMajorVersion()
+	{
+		assertTrue(getFactory().getDTFJMajorVersion() >= 1);
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageFactory.getDTFJMinorVersion()'
+	 * 
+	 * Ensures that the minor version is at least 0
+	 */
+	public void testGetDTFJMinorVersion()
+	{
+		assertTrue(getFactory().getDTFJMinorVersion() >= 0);
+	}
+	
+	/**
+	 * Test that the modification level is greater than or equal to 0
+	 */
+	
+	public void testGetDTFJModificationLevel()
+	{
+		assertTrue(getFactory().getDTFJModificationLevel() >= 0);
+	}
+	
+	/**
+	 * Test that the modification level matches the implementation build no
+	 * Note that the existence of the implementation version string is tested
+	 * in the TestPackageInformation class
+	 */
+	
+	public void testGetDTFJModificationLevelAsBuildNo()
+	{
+		String implementationVersion=ImageFactory.class.getPackage().getImplementationVersion();
+		int buildNumber=0;
+		try {
+		buildNumber=Integer.parseInt(implementationVersion);
+		} catch(NumberFormatException nfe) {
+			buildNumber=-1;
+		}
+		assertTrue(getFactory().getDTFJModificationLevel()==buildNumber);
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageModuleTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageModuleTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageModuleTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageModuleTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+import com.ibm.dtfj.image.CorruptDataException;
+
+public class ImageModuleTest extends AbstractDTFJTestcase {
+	
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageModule.getName()'
+	 * 
+	 * Ensures that the name is non-null
+	 */
+	public void testGetName() {
+		try {
+			assertNotNull(defaultImageModule().getName());
+		} catch (CorruptDataException e) {
+			//acceptable
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageModule.getSections()'
+	 * 
+	 * Ensures that the sections iterator is non-null and non-empty
+	 */
+	public void testGetSections() {
+		Iterator it = defaultImageModule().getSections();
+		
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageModule.getSymbols()'
+	 * 
+	 * Ensures that symbols exist in the module
+	 * 
+	 */
+	public void testGetSymbols() {
+		Iterator it = defaultImageModule().getSymbols();
+		
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageModule.getProperties()'
+	 * 
+	 * Ensures that the module has a properties structure
+	 */
+	public void testGetProperties() {
+		Properties props = null;
+		
+		try {
+			props = defaultImageModule().getProperties();
+		} catch (CorruptDataException e) {
+			assertTrue(false);
+		}
+		assertNotNull(props);
+	}
+
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImagePointerTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImagePointerTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImagePointerTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImagePointerTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import com.ibm.dtfj.image.CorruptDataException;
+import com.ibm.dtfj.image.DataUnavailable;
+import com.ibm.dtfj.image.ImageAddressSpace;
+import com.ibm.dtfj.image.ImagePointer;
+import com.ibm.dtfj.image.MemoryAccessException;
+
+public class ImagePointerTest extends AbstractDTFJTestcase
+{
+	private static ImageAddressSpace _parent;	//used for comparisons
+	private static long _address;	//used for comparisons
+	private static final long OFFSET = 0x100;
+	private ImagePointer _testPointer;
+	
+	public  ImagePointer defaultImagePointer()
+	{
+		_parent = defaultAddressSpace();
+		_address = ImageAddressSpaceTest.TEST_ADDRESS;
+		
+		return _parent.getPointer(_address);
+	}
+	
+	protected void setUp() throws Exception
+	{
+		_testPointer = defaultImagePointer();
+		super.setUp();
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.getAddress()'
+	 * 
+	 * Ensure that the address is what we created it with
+	 */
+	public void testGetAddress()
+	{
+		assertTrue(_address == _testPointer.getAddress());
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.getAddressSpace()'
+	 * 
+	 * Ensures that the parent address space is equal to the one we used to create it
+	 */
+	public void testGetAddressSpace()
+	{
+		assertTrue(_parent.equals(_testPointer.getAddressSpace()));
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.add(long)'
+	 * 
+	 * Ensures that adding an offset yields a pointer at the expected address
+	 */
+	public void testAdd()
+	{
+		ImagePointer newPointer = _testPointer.add(OFFSET);
+		assertTrue(newPointer.getAddress() == (_testPointer.getAddress() + OFFSET));
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.isExecutable()'
+	 * 
+	 * Ensures that the method can be called
+	 */
+	public void testIsExecutable()
+	{
+		try {
+			_testPointer.isExecutable();
+		} catch (DataUnavailable e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.isReadOnly()'
+	 * 
+	 * Ensures that the method can be called
+	 */
+	public void testIsReadOnly()
+	{
+		try {
+			_testPointer.isReadOnly();
+		} catch (DataUnavailable e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.isShared()'
+	 * 
+	 * Ensures that the method can be called
+	 */
+	public void testIsShared()
+	{
+		try {
+			_testPointer.isShared();
+		} catch (DataUnavailable e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.getPointerAt(long)'
+	 * 
+	 * Ensure that we can read a pointer at the given address without throwing anything unexpected
+	 */
+	public void testGetPointerAt()
+	{
+		try {
+			_testPointer.getPointerAt(0);
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//accepted by spec
+		} catch (CorruptDataException e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.getLongAt(long)'
+	 * 
+	 * Ensure that we can read a long at the given address without throwing anything unexpected
+	 */
+	public void testGetLongAt()
+	{
+		try {
+			_testPointer.getLongAt(0);
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//accepted by spec
+		} catch (CorruptDataException e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.getIntAt(long)'
+	 * 
+	 * Ensure that we can read an int at the given address without throwing anything unexpected
+	 */
+	public void testGetIntAt()
+	{
+		try {
+			_testPointer.getIntAt(0);
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//accepted by spec
+		} catch (CorruptDataException e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.getShortAt(long)'
+	 * 
+	 * Ensure that we can read a short at the given address without throwing anything unexpected
+	 */
+	public void testGetShortAt()
+	{
+		try {
+			_testPointer.getShortAt(0);
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//accepted by spec
+		} catch (CorruptDataException e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.getByteAt(long)'
+	 * 
+	 * Ensure that we can read a byte at the given address without throwing anything unexpected
+	 */
+	public void testGetByteAt()
+	{
+		try {
+			_testPointer.getByteAt(0);
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//accepted by spec
+		} catch (CorruptDataException e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.getFloatAt(long)'
+	 * 
+	 * Ensure that we can read a float at the given address without throwing anything unexpected
+	 */
+	public void testGetFloatAt()
+	{
+		try {
+			_testPointer.getFloatAt(0);
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//accepted by spec
+		} catch (CorruptDataException e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImagePointer.getDoubleAt(long)'
+	 * 
+	 * Ensure that we can read a double at the given address without throwing anything unexpected
+	 */
+	public void testGetDoubleAt()
+	{
+		try {
+			_testPointer.getDoubleAt(0);
+		} catch (MemoryAccessException e) {
+			assertNotNull(e.getPointer());
+			//accepted by spec
+		} catch (CorruptDataException e) {
+			//accepted by spec
+		}
+	}
+	
+	/**
+	 * Verify that the equals call doesn't throw
+	 */
+	public void testEquals()
+	{
+		try{
+			assertTrue(_testPointer.equals(_testPointer));
+		} 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 != _testPointer.hashCode());
+		} catch (Throwable t) {
+			assertTrue(false);
+		}
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageProcessTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageProcessTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageProcessTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageProcessTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+import com.ibm.dtfj.image.CorruptData;
+import com.ibm.dtfj.image.CorruptDataException;
+import com.ibm.dtfj.image.DTFJException;
+import com.ibm.dtfj.image.DataUnavailable;
+import com.ibm.dtfj.image.ImageProcess;
+import com.ibm.dtfj.image.ImageThread;
+import com.ibm.dtfj.runtime.ManagedRuntime;
+
+public class ImageProcessTest extends AbstractDTFJTestcase {
+	
+	ImageProcess _proc=null;
+	
+	protected void setUp() throws Exception {
+		_proc = defaultImageProcess();
+		super.setUp();
+	}
+
+	/*
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getCommandLine()'
+	 */
+	public void testGetCommandLine()
+	{
+		try {
+			assertNotNull(_proc.getCommandLine());
+		} catch (DTFJException e) {
+			//acceptable
+			assertTrue(true);
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getEnvironment()'
+	 * 
+	 * Ensures that the properties are non-null
+	 */
+	public void testGetEnvironment()
+	{
+		try {
+			Properties env = _proc.getEnvironment();
+			assertNotNull(env);
+		} catch (DataUnavailable e) {
+			//acceptable
+		} catch (CorruptDataException e) {
+			//acceptable
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getID()'
+	 * 
+	 * Ensures that the process ID is non-null and non-empty
+	 */
+	public void testGetID()
+	{
+		try {
+			String id = _proc.getID();
+			assertNotNull(id);
+			assertTrue(id.length() > 0);
+		} catch (DataUnavailable e) {
+			//acceptable
+		} catch (CorruptDataException e) {
+			//acceptable
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getLibraries()'
+	 * 
+	 * Make sure that the libraries iterator is non-null
+	 */
+	public void testGetLibraries()
+	{
+		try {
+			assertNotNull(_proc.getLibraries());
+		} catch (DataUnavailable e) {
+			//this is considered correct
+		} catch (CorruptDataException e) {
+			//this is considered correct
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getExecutable()'
+	 * 
+	 * Make sure that the module is non-null
+	 */
+	public void testGetExecutable()
+	{
+		try {
+			assertNotNull(_proc.getExecutable());
+		} catch (DataUnavailable e) {
+			//this will be considered a success
+		} catch (CorruptDataException e) {
+			//normally we won't be testing corrupt data so this is a failure
+			assertTrue(false);
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getThreads()'
+	 * 
+	 * Ensures that there is at least one thread and it is an instance of ImageThread or CorruptData
+	 */
+	public void testGetThreads()
+	{
+		Iterator threads = _proc.getThreads();
+		assertNotNull(threads);
+		assertTrue(threads.hasNext());
+		Object instance = threads.next();
+		assertTrue((instance instanceof ImageThread) || (instance instanceof CorruptData));
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getCurrentThread()'
+	 * 
+	 * Ensures that anything (even null) is returned or the correct exception is thrown
+	 */
+	public void testGetCurrentThread()
+	{
+		try {
+			_proc.getCurrentThread();
+		} catch (CorruptDataException e) {
+			//acceptable
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getRuntimes()'
+	 * 
+	 * Ensures that at least one runtime is returned and that it is an instance of ManagedRuntime or CorruptData
+	 */
+	public void testGetRuntimes()
+	{
+		Iterator runtimes = _proc.getRuntimes();
+		assertNotNull(runtimes);
+		assertTrue(runtimes.hasNext());
+		Object instance = runtimes.next();
+		assertTrue((instance instanceof ManagedRuntime) || (instance instanceof CorruptData));
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getSignalNumber()'
+	 * 
+	 * Ensures that no unexpected exceptions are thrown
+	 */
+	public void testGetSignalNumber()
+	{
+		try {
+			_proc.getSignalNumber();
+		} catch (DataUnavailable e) {
+			//acceptable in the spec
+		} catch (CorruptDataException e) {
+			//acceptable in the spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getSignalName()'
+	 * 
+	 * Ensures that anything (even null) is returned or the correct exceptions are thrown
+	 */
+	public void testGetSignalName()
+	{
+		try {
+			_proc.getSignalName();
+		} catch (DataUnavailable e) {
+			//acceptable
+		} catch (CorruptDataException e) {
+			//acceptable
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageProcess.getPointerSize()'
+	 * 
+	 * This should return 31, 32, or 64
+	 */
+	public void testGetPointerSize()
+	{
+		int size = _proc.getPointerSize();
+		assertTrue((31 == size) || (32 == size) || (64 == size));
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageRegisterTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageRegisterTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageRegisterTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageRegisterTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+import com.ibm.dtfj.image.CorruptDataException;
+import com.ibm.dtfj.image.ImageRegister;
+
+public class ImageRegisterTest extends AbstractDTFJTestcase
+{
+	private ImageRegister _testRegister;
+
+	public  ImageRegister defaultImageRegister()
+	{
+		// if getRegisters() returns an empty iterator (which is valid)
+		// then defaultImageRegisters returns null
+		Iterator theR = defaultImageThread().getRegisters();
+		ImageRegister theIR = null;
+		while (theR.hasNext()){
+			theIR = (ImageRegister) theR.next();
+		}
+		return theIR;
+	}
+
+	protected void setUp() throws Exception
+	{
+		_testRegister = defaultImageRegister();
+		super.setUp();
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageRegister.getName()'
+	 * 
+	 * Ensures that the register has a non-null non-empty name
+	 */
+	public void testGetName()
+	{
+		// _testRegister == null if the registers are empty 
+		// ie the iterator is empty which is valid
+		if (null != _testRegister){
+			String name = _testRegister.getName();
+			assertNotNull(name);
+			assertTrue(name.length() > 0);
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageRegister.toString()'
+	 * 
+	 */
+	public void testToString()
+	{
+		// _testRegister == null if the registers are empty 
+		// ie the iterator is empty which is valid
+		if (null != _testRegister){
+			String name = null;
+			name = _testRegister.toString();
+
+			assertNotNull(name);
+			assertTrue(name.length() > 0);
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageRegister.getValue()'
+	 * 
+	 * Ensures that we can make the call without unexpected exceptions occurring
+	 */
+	public void testGetValue()
+	{
+		// _testRegister == null if the registers are empty 
+		// ie the iterator is empty which is valid
+		if (null != _testRegister){
+			try {
+				_testRegister.getValue();
+			} catch (CorruptDataException e) {
+				//accepted by spec
+			}
+		}
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageSectionTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageSectionTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageSectionTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageSectionTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+
+import com.ibm.dtfj.image.DataUnavailable;
+import com.ibm.dtfj.image.ImageSection;
+import com.ibm.dtfj.java.JavaMethod;
+
+public class ImageSectionTest extends AbstractDTFJTestcase
+{
+	private ImageSection _section = null;
+	
+	public  ImageSection defaultImageSection()
+	{
+		//for now we will just grab a compiled method section
+		JavaMethod method = defaultJavaMethod();
+		Iterator it = method.getCompiledSections();
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+		return (ImageSection) it.next();
+	}
+	
+	
+	protected void setUp() throws Exception
+	{
+		_section = defaultImageSection();
+		super.setUp();
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageSection.getBaseAddress()'
+	 * 
+	 * Ensure that we get a non-null base address
+	 */
+	public void testGetBaseAddress()
+	{
+		assertNotNull(_section.getBaseAddress());
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageSection.getSize()'
+	 * 
+	 * Ensure that we get a >0 size
+	 */
+	public void testGetSize()
+	{
+		assertTrue(_section.getSize() > 0);
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageSection.getName()'
+	 * 
+	 * Ensure that we get a non-null name
+	 */
+	public void testGetName()
+	{
+		assertNotNull(_section.getName());
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageSection.isExecutable()'
+	 * 
+	 * Ensures that the method can be called
+	 */
+	public void testIsExecutable()
+	{
+		try {
+			_section.isExecutable();
+		} catch (DataUnavailable e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageSection.isReadOnly()'
+	 * 
+	 * Ensures that the method can be called
+	 */
+	public void testIsReadOnly()
+	{
+		try {
+			_section.isReadOnly();
+		} catch (DataUnavailable e) {
+			//accepted by spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageSection.isShared()'
+	 * 
+	 * Ensures that the method can be called
+	 */
+	public void testIsShared()
+	{
+		try {
+			_section.isShared();
+		} catch (DataUnavailable e) {
+			//accepted by spec
+		}
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageStackFrameTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageStackFrameTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageStackFrameTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageStackFrameTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+
+import com.ibm.dtfj.image.CorruptDataException;
+import com.ibm.dtfj.image.DataUnavailable;
+import com.ibm.dtfj.image.ImagePointer;
+import com.ibm.dtfj.image.ImageStackFrame;
+import com.ibm.dtfj.image.ImageThread;
+
+public class ImageStackFrameTest extends AbstractDTFJTestcase
+{
+	private ImageStackFrame _stackFrame;
+	
+	public  ImageStackFrame defaultStackFrame()
+	{
+//		try {
+//			return (ImageStackFrame) defaultImageThread().getStackFrames().next();
+//		} catch (DataUnavailable e) {
+			// Try harder to find a thread with a stack.
+			Iterator it = defaultImageProcess().getThreads();
+			while (it.hasNext()) {
+				ImageThread thread = (ImageThread) it.next();
+				try {
+					if (thread.getStackFrames().hasNext()) {
+						return (ImageStackFrame) thread.getStackFrames().next();
+					}
+				} catch (DataUnavailable e1) {
+					// Ignore
+				}
+			}
+			// although this is accepted by the spec, it has no real meaning for the test so just choose to be unimplemented
+			throw new TestNotImplementedException();
+//		}
+	}
+	
+	protected void setUp() throws Exception
+	{
+		_stackFrame = defaultStackFrame();
+		super.setUp();
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageStackFrame.getProcedureAddress()'
+	 * 
+	 * Ensures that we get a non-null address
+	 */
+	public void testGetProcedureAddress()
+	{
+		try {
+			ImagePointer address = _stackFrame.getProcedureAddress();
+			assertNotNull(address);
+		} catch (CorruptDataException e) {
+			//accepted
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageStackFrame.getBasePointer()'
+	 * 
+	 * Ensures that we get a non-null base pointer
+	 */
+	public void testGetBasePointer()
+	{
+		try {
+			ImagePointer address = _stackFrame.getBasePointer();
+			assertNotNull(address);
+			assertTrue(address.getAddress() != 0);
+		} catch (CorruptDataException e) {
+			//accepted
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageStackFrame.getProcedureName()'
+	 * 
+	 * Ensures that we get a non-null, non-empty name
+	 */
+	public void testGetProcedureName()
+	{
+		try {
+			String name = _stackFrame.getProcedureName();
+			assertNotNull(name);
+			assertTrue(name.length() > 0);
+		} catch (CorruptDataException e) {
+			//accepted
+		}
+	}
+
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageSymbolTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageSymbolTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageSymbolTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageSymbolTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+
+import com.ibm.dtfj.image.ImagePointer;
+import com.ibm.dtfj.image.ImageSymbol;
+
+public class ImageSymbolTest extends AbstractDTFJTestcase
+{
+	private ImageSymbol _symbol;
+	
+	public  ImageSymbol defaultImageSymbol()
+	{
+		Iterator symbols = defaultImageModule().getSymbols();
+		if(symbols.hasNext()) {
+			return (ImageSymbol) symbols.next();
+		} else {		
+			return null;
+		}
+	}
+	
+	protected void setUp() throws Exception
+	{
+		_symbol = defaultImageSymbol();
+		super.setUp();
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageSymbol.getAddress()'
+	 * Ensures that the address is non-null
+	 */
+	public void testGetAddress()
+	{
+		ImagePointer address = _symbol.getAddress();
+		assertNotNull(address);
+		assertTrue(address.getAddress() != 0);
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageSymbol.getName()'
+	 * Ensures that the name is non-null and non-empty
+	 */
+	public void testGetName()
+	{
+		String name = _symbol.getName();
+		assertNotNull(name);
+		assertTrue(name.length() > 0);
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+
+import com.ibm.dtfj.image.CorruptData;
+import com.ibm.dtfj.image.CorruptDataException;
+import com.ibm.dtfj.image.DataUnavailable;
+import com.ibm.dtfj.image.Image;
+
+/**
+ * 
+ * A collection of simple test-cases to make sure that the DTFJ Image Interface agrees with its documented
+ * behaviour.
+ */
+public class ImageTest extends AbstractDTFJTestcase
+{
+	private Image _core=null;
+	protected void setUp() throws Exception
+	{
+		try {
+			//this is required to load the core file image which is to be tested so that we don't have to load each time
+			_core = defaultTestingImage();
+		} catch (Throwable t) {
+			t.printStackTrace();
+			fail();
+		}
+		super.setUp();
+	}
+	
+	
+	//now, onto the testing
+	
+	/**
+	 * ensure that the core has non-null address spaces and at least one
+	 */
+	public void testGetAddressSpaces() {
+		Iterator it = _core.getAddressSpaces();
+		
+		assertNotNull(it);
+		assertTrue(it.hasNext());
+	}
+	
+	/**
+	 * make sure that the creation time is sane (>0)
+	 */
+	public void testGetCreationTime() {
+		try {
+			assertTrue(_core.getCreationTime() > 0);
+		} catch (DataUnavailable e) {
+			//spec correct
+		} catch (Throwable t) {
+			//exception fall-through
+			fail();
+		}
+	}
+	
+	/**
+	 * test that the installed memory is sane or not known
+	 */
+	public void testGetInstalledMemory() {
+		try {
+			assertTrue(_core.getInstalledMemory() > 0);
+		} catch (DataUnavailable e) {
+			//this is considered acceptable behaviour
+		} catch (Throwable t) {
+			//exception fall-through
+			fail();
+		}
+	}
+	
+	/**
+	 * make sure that we get a sane number of processors or unknown
+	 */
+	public void testGetProcessorCount() {
+		try {
+			assertTrue(_core.getProcessorCount() > 0);
+		} catch (DataUnavailable e) {
+			//this is considered acceptable behaviour
+		} catch (Throwable t) {
+			//exception fall-through
+			fail();
+		}
+	}
+	
+	/**
+	 * Make sure that the processor subtype is non-null
+	 * TODO:  this probably isn't the right way to test this
+	 */
+	public void testGetProcessorSubtype() {
+		try {
+			assertNotNull(_core.getProcessorSubType());
+		} catch (DataUnavailable e) {
+			//accepted in spec
+		} catch (CorruptDataException e) {
+			//accepted in spec
+		} catch (Throwable t) {
+			//exception fall-through
+			fail();
+		}
+	}
+	
+	/**
+	 * Make sure that we get a processor name
+	 */
+	public void testGetProcessorType() {
+		try {
+			assertNotNull(_core.getProcessorType());
+		} catch (DataUnavailable e) {
+			//this exception is supported by the API so it is ok
+		} catch (CorruptDataException e) {
+			//this exception is supported by the API so it is ok
+		} catch (Throwable t) {
+			//exception fall-through
+			fail();
+		}
+	}
+	
+	/**
+	 * Make sure that there is a system sub-type
+	 * TODO:  this probably isn't the right way to test this
+	 */
+	public void testGetSystemSubType() {
+		try {
+			assertNotNull(_core.getSystemSubType());
+		} catch (DataUnavailable e) {
+			//accepted in spec
+		} catch (CorruptDataException e) {
+			//accepted in spec
+		} catch (Throwable t) {
+			//exception fall-through
+			fail();
+		}
+	}
+	
+	/**
+	 * Make sure that there is a system type
+	 */
+	public void testGetSystemType() {
+		try {
+			assertNotNull(_core.getSystemType());
+		} catch (DataUnavailable e) {
+			//this exception is supported by the API so it is ok
+		} catch (CorruptDataException e) {
+			//this exception is supported by the API so it is ok
+		} catch (Throwable t) {
+			//exception fall-through
+			fail();
+		}
+	}
+	
+	/**
+	 * Ensures that the string is non-null and throws no unexpected exceptions
+	 */
+	public void testGetHostName()
+	{
+		try {
+			assertNotNull(_core.getHostName());
+		} catch (DataUnavailable e) {
+			//this exception is supported by the API so it is ok
+		} catch (CorruptDataException e) {
+			//this exception is supported by the API so it is ok
+		} catch (Throwable t) {
+			//exception fall-through
+			fail();
+		}
+	}
+	
+	/**
+	 * Ensures that the iterator is non-null, throws no expected exceptions, and every member is an InetAddress
+	 */
+	public void testGetIPAddresses()
+	{
+		try {
+			Iterator addresses = _core.getIPAddresses();
+			assertNotNull(addresses);
+			while (addresses.hasNext()) {
+				Object address = addresses.next();
+				assertTrue((address instanceof java.net.InetAddress) 
+						|| (address instanceof CorruptData));
+			}
+		} catch (DataUnavailable e) {
+			//this exception is supported by the API so it is ok
+		} catch (Throwable t) {
+			//exception fall-through
+			fail();
+		}
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageThreadTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageThreadTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageThreadTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/ImageThreadTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+
+import com.ibm.dtfj.image.CorruptData;
+import com.ibm.dtfj.image.DataUnavailable;
+import com.ibm.dtfj.image.ImageRegister;
+import com.ibm.dtfj.image.ImageStackFrame;
+import com.ibm.dtfj.image.ImageSection;
+import com.ibm.dtfj.image.ImageThread;
+
+public class ImageThreadTest extends AbstractDTFJTestcase
+{
+	private ImageThread _thread = null;
+	
+	protected void setUp() throws Exception
+	{
+		_thread = defaultImageThread();
+		assertNotNull(_thread);
+		super.setUp();
+	}
+
+	/*
+	 * Test method for 'com.ibm.dtfj.image.ImageThread.getID()'
+	 */
+	public void testGetID()
+	{
+		try {
+			String id = _thread.getID();
+			assertNotNull(id);
+			Long.decode(id);
+		} catch (Exception e) {
+			fail();
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageThread.getStackFrames()'
+	 * 
+	 * Ensures that a non-null iterator is returned with at lzero or more elements
+	 * of type ImageStackFrame or CorruptData.
+	 * 
+	 */
+	public void testGetStackFrames()
+	{
+		try {
+			Iterator frames = _thread.getStackFrames();
+			
+			assertNotNull(frames);
+			while (frames.hasNext()) {
+				Object frame = frames.next();
+				assertTrue((frame instanceof ImageStackFrame) || (frame instanceof CorruptData));
+			}
+		} catch (DataUnavailable e) {
+			//acceptable in spec
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageThread.getStackSections()'
+	 * 
+	 * Ensures that at least one stack section exists
+	 */
+	public void testGetStackSections()
+	{
+		Iterator it = _thread.getStackSections();
+		assertNotNull(it);
+		// empty iterator is a valid return from getStackFrames
+		while (it.hasNext()) {
+			Object section = it.next();
+			assertTrue((section instanceof ImageSection) || (section instanceof CorruptData));
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageThread.getRegisters()'
+	 * 
+	 * Ensures that a non-null, non-empty iterator is returned and all instances
+	 * are of type ImageRegister
+	 */
+	public void testGetRegisters()
+	{
+		Iterator regs = _thread.getRegisters();
+		
+		assertNotNull(regs);
+		// Empty iterator is a valid return from getRegisters
+		while (regs.hasNext()) {
+			Object reg = regs.next();
+			// if there are registers check they are valid
+			assertTrue(reg instanceof ImageRegister);
+		}
+	}
+
+	/**
+	 * Test method for 'com.ibm.dtfj.image.ImageThread.getProperties()'
+	 * 
+	 * Ensures that non-null properties are returned
+	 */
+	public void testGetProperties()
+	{
+		assertNotNull(_thread.getProperties());
+	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/JavaClassLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/JavaClassLoaderTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/JavaClassLoaderTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/JavaClassLoaderTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * 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 com.ibm.dtfj.tests.junit;
+
+import java.util.Iterator;
+
+import com.ibm.dtfj.image.CorruptDataException;
+import com.ibm.dtfj.java.JavaClass;
+import com.ibm.dtfj.java.JavaClassLoader;
+import com.ibm.dtfj.java.JavaObject;
+
+public class JavaClassLoaderTest extends AbstractDTFJTestcase
+{
+	private JavaClassLoader _loader;
+	
+	protected void setUp() throws Exception
+	{
+		_loader = defaultJavaClassLoader();
+		super.setUp();
+	}
+	
+	
+	/**
+	 * Ensure that the classes iterator is non-null
+	 */
+	public void testGetDefinedClasses()
+	{
+		Iterator iter = _loader.getDefinedClasses();
+		assertNotNull(iter);
+	}
+
+	/**
+	 * Ensure that the cached classes iterator is non-null
+	 */
+	public void testGetCachedClasses()
+	{
+		Iterator iter = _loader.getCachedClasses();
+		assertNotNull(iter);
+	}
+
+	/**
+	 * 
+	 * Grab any class, then try looking up a class with that name since we know it is there
+	 */
+	public void testFindClass()
+	{
+		JavaClass oneClass = (JavaClass) _loader.getDefinedClasses().next();
+		try {
+			String name = oneClass.getName();
+			JavaClass foundClass = _loader.findClass(name);
+			//make sure that it came out
+			assertNotNull(foundClass);
+			//classes might not be the same instance but they should be comparable to each other if they are the same entity
+			assertTrue(foundClass.equals(oneClass));
+		} catch (CorruptDataException e) {
+		}
+	}
+
+	/**
+	 * 
+	 * Ensure that the class loader object exists and is an instance of java.lang.ClassLoader
+	 * or some class that inherits from it
+	 */
+	public void testGetObject()
+	{
+		try {
+			JavaObject loader = _loader.getObject();
+			boolean didMatch = false;
+			JavaClass oneClass = loader.getJavaClass();
+			while ((!didMatch) && (null != oneClass)) {
+				if (oneClass.getName().equals("java/lang/ClassLoader")) {
+					didMatch = true;
+				}
+				oneClass = oneClass.getSuperclass();
+			}
+			assertTrue(didMatch);
+		} catch (CorruptDataException e) {
+			//technically, this is valid
+		}
+		
+	}
+
+	/**
+	 * Verify that the equals call doesn't throw
+	 */
+	public void testEquals()
+	{
+		try{
+			assertTrue(_loader.equals(_loader));
+		} 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 != _loader.hashCode());
+		} catch (Throwable t) {
+			assertTrue(false);
+		}
+	}
+}