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 [8/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/TestNotImplementedException.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/TestNotImplementedException.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/TestNotImplementedException.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/TestNotImplementedException.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * This class exists solely so that JUnit tests which are incomplete because of a lack of underlying
+ * implementation do not pass by inaction.
+ * It will be safe to remove this once there are no more creation points
+ */
+public class TestNotImplementedException extends RuntimeException
+{
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/TestPackageInformation.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/TestPackageInformation.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/TestPackageInformation.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/junit/TestPackageInformation.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.TestCase;
+
+import com.ibm.dtfj.image.ImageFactory;
+
+/**
+ * Simple tests to show that the manifest entries that describe the 
+ * implementation and specification for DTFJ have made their way 
+ * into the relevant Package instance.
+ * 
+ *
+ */
+public class TestPackageInformation extends TestCase {
+
+	/**
+	 * Test that the specification title is what is expected
+	 */
+	
+	public void testSpecificationTitle() {
+
+		Package p = ImageFactory.class.getPackage();
+		assertEquals("Diagnostic Tool Framework for Java", p
+				.getSpecificationTitle());
+	}
+
+	/**
+	 * Test that the specification version matches  
+	 */
+	public void testSpecificationVersion() {
+
+		String versionString=ImageFactory.DTFJ_MAJOR_VERSION+"."+ImageFactory.DTFJ_MINOR_VERSION;
+		Package p = ImageFactory.class.getPackage();
+		assertEquals(versionString, p.getSpecificationVersion());
+	}
+
+	
+	/**
+	 * Test Implementation version is present 
+	 */
+	
+	public void testImplementationVersion() {
+
+		Package p = ImageFactory.class.getPackage();
+		assertNotNull(p.getImplementationVersion());
+	}
+
+	/**
+	 * Test implementation title is present
+	 */
+	public void testImplementationTitle() {
+		Package p = ImageFactory.class.getPackage();
+		assertNotNull(p.getImplementationTitle());
+
+	}
+
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/scenarios/ArrayletTest.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/scenarios/ArrayletTest.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/scenarios/ArrayletTest.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/scenarios/ArrayletTest.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.scenarios;
+
+public class ArrayletTest {
+	public static volatile Thread a, b;
+	private static final int DTFJ_ARRAYLET_LENGTH = 7000;
+	private static ArrayletTestInstance DTFJ_ARRAYLET_TEST_INSTANCE  = new ArrayletTestInstance(DTFJ_ARRAYLET_LENGTH);;
+
+//	public static void main(String[] args) throws InterruptedException {
+//		//create the arraylet test instance so that the DTFJ test can read it to verify that RT VMs work
+//		if (null != DTFJ_ARRAYLET_TEST_INSTANCE) {
+//			System.err.println("This null check is only here to make a compiler warning go away.  "
+//					+ "If we actually print out this message, it means that the class's main ran twice (which can't happen)");
+//		}
+//		DTFJ_ARRAYLET_TEST_INSTANCE = new ArrayletTestInstance(DTFJ_ARRAYLET_LENGTH);
+//		//now, on with the actual test
+//		a = new Thread() {
+//			public void run() {
+//				synchronized (a) {
+//					try {
+//						Thread.sleep(1000);
+//					} catch (InterruptedException e) {
+//					}
+//					synchronized(b) {
+//						System.out.println("Deadlock avoided?");
+//					}
+//				}
+//			}
+//		};
+//
+//		b = new Thread() {
+//			public void run() {
+//				synchronized (b) {
+//					try {
+//						Thread.sleep(1000);
+//					} catch (InterruptedException e) {
+//					}
+//					synchronized(a) {
+//						System.out.println("Deadlock avoided?");
+//					}
+//				}
+//			}
+//		};
+//
+//		a.start();
+//		b.start();
+//		
+//		Thread.sleep(2000);
+//		
+//		new GPTest().gpWrite();
+//		
+//		// should be unreachable
+//		System.err.println("gpWrite failed to stop program. Exiting.");
+//		System.exit(-1);
+//	}
+}

Added: incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/scenarios/ArrayletTestInstance.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/scenarios/ArrayletTestInstance.java?rev=754945&view=auto
==============================================================================
--- incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/scenarios/ArrayletTestInstance.java (added)
+++ incubator/kato/trunk/import/org.apache.kato.tck.tests/src/com/ibm/dtfj/tests/scenarios/ArrayletTestInstance.java Mon Mar 16 16:42:39 2009
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.scenarios;
+
+public class ArrayletTestInstance
+{
+	private int[] DTFJ_ARRAYLET_INTS;
+	private byte[] DTFJ_ARRAYLET_BYTES;
+	private StringContainer[] DTFJ_ARRAYLET_STRINGCONTAINER;
+	
+	public ArrayletTestInstance(int length)
+	{
+		DTFJ_ARRAYLET_INTS = new int[length];
+		DTFJ_ARRAYLET_BYTES = new byte[length];
+		DTFJ_ARRAYLET_STRINGCONTAINER = new StringContainer[length];
+		
+		for (int i = 0; i < length; i++)
+		{
+			int value = length - i;
+			DTFJ_ARRAYLET_INTS[i] = value;
+			DTFJ_ARRAYLET_BYTES[i] = (byte)value;
+			DTFJ_ARRAYLET_STRINGCONTAINER[i] = new StringContainer(value);
+		}
+	}
+	
+	private class StringContainer
+	{
+		private String _stringField;
+		
+		public StringContainer(int value)
+		{
+			_stringField = Integer.toString(value);
+		}
+		
+		public String toString()
+		{
+			return _stringField;
+		}
+	}
+}