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/12/18 15:18:11 UTC
svn commit: r892274 - in /incubator/kato/trunk/org.apache.kato/kato.tck:
scenarios/142/src/main/java/org/apache/kato/tck/scenario142/
scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/
testcases/src/main/java/org/apache/kato/tck/s...
Author: monteith
Date: Fri Dec 18 15:18:05 2009
New Revision: 892274
URL: http://svn.apache.org/viewvc?rev=892274&view=rev
Log:
Add new test for uninitialized classes
Added:
incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/BlockedClass.java (with props)
incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenarioSetup.java (contents, props changed)
- copied, changed from r891608, incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenerioSetup.java
incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/SetupJavaClass_uninitialized.java (with props)
incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/scenario142/javaruntime/TestJavaClass_uninitialized.java (with props)
Removed:
incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenerioSetup.java
Modified:
incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/ScenarioLauncher142.java
Modified: incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/ScenarioLauncher142.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/ScenarioLauncher142.java?rev=892274&r1=892273&r2=892274&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/ScenarioLauncher142.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/ScenarioLauncher142.java Fri Dec 18 15:18:05 2009
@@ -13,16 +13,16 @@
******************************************************************************/
package org.apache.kato.tck.scenario142;
-import org.apache.kato.tck.scenario142.javaruntime.JavaruntimeScenerioSetup;
+import org.apache.kato.tck.scenario142.javaruntime.JavaruntimeScenarioSetup;
import org.apache.kato.tck.scenario142.process.ProcessScenarioSetup;
public class ScenarioLauncher142 {
- private JavaruntimeScenerioSetup runtime=null;
+ private JavaruntimeScenarioSetup runtime=null;
private ProcessScenarioSetup process=null;
public ScenarioLauncher142() {
- runtime=new JavaruntimeScenerioSetup();
+ runtime=new JavaruntimeScenarioSetup();
process=new ProcessScenarioSetup();
}
Added: incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/BlockedClass.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/BlockedClass.java?rev=892274&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/BlockedClass.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/BlockedClass.java Fri Dec 18 15:18:05 2009
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.tck.scenario142.javaruntime;
+
+/**
+ * A class that blocks in it's initialized.
+ * Should produce an uninitialized class in the dump.
+ *
+ */
+public class BlockedClass {
+ static Object ref1;
+ static int integer;
+
+ static {
+ ref1 = new Object();
+ integer = 2;
+
+ try {
+ synchronized(ref1) {
+ ref1.wait();
+ }
+ }catch (InterruptedException e) {
+
+ }
+ }
+}
\ No newline at end of file
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/BlockedClass.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenarioSetup.java (from r891608, incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenerioSetup.java)
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenarioSetup.java?p2=incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenarioSetup.java&p1=incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenerioSetup.java&r1=891608&r2=892274&rev=892274&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenerioSetup.java (original)
+++ incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenarioSetup.java Fri Dec 18 15:18:05 2009
@@ -17,11 +17,11 @@
-public class JavaruntimeScenerioSetup extends ScenarioElement {
+public class JavaruntimeScenarioSetup extends ScenarioElement {
- public JavaruntimeScenerioSetup() {
+ public JavaruntimeScenarioSetup() {
new SetupJavaClass_getName();
new SetupJavaClassLoader_getJavaObject();
new SetupJavaField_equals();
@@ -52,7 +52,8 @@
new SetupJavaThread_getName();
new SetupJavaThread_getStackFrames();
new SetupJavaThreadInspection();
- new SetupJavaMonitor_ObjectMonitors();
+ new SetupJavaClass_uninitialized();
+ new SetupJavaMonitor_ObjectMonitors();
}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/JavaruntimeScenarioSetup.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/SetupJavaClass_uninitialized.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/SetupJavaClass_uninitialized.java?rev=892274&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/SetupJavaClass_uninitialized.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/SetupJavaClass_uninitialized.java Fri Dec 18 15:18:05 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 org.apache.kato.tck.scenario142.javaruntime;
+
+import org.apache.kato.tck.harness.scenario.ScenarioElement;
+
+public class SetupJavaClass_uninitialized extends ScenarioElement {
+ public void configureJavaClass_uninitialized() {
+ TestThread thread =new TestThread();
+
+ synchronized (this) {
+ thread.start();
+ try {
+ while(!running) {
+ this.wait();
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+
+ volatile boolean running = false;
+ /**
+ * A thread that blocks in a class initialiser.
+ * Uses reflection to prevent enthusiastic JVMs
+ * from blocking in the wrong place.
+ *
+ */
+ public class TestThread extends Thread {
+ public void run() {
+ try {
+ // Notify our creator that the thread was at least started.
+ synchronized(SetupJavaClass_uninitialized.this) {
+ SetupJavaClass_uninitialized.this.running = true;
+ SetupJavaClass_uninitialized.this.notify();
+ }
+ // This call loads the class and initialises it.
+ Class clazz = Class.forName("BlockedClass");
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck/scenarios/142/src/main/java/org/apache/kato/tck/scenario142/javaruntime/SetupJavaClass_uninitialized.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/scenario142/javaruntime/TestJavaClass_uninitialized.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/scenario142/javaruntime/TestJavaClass_uninitialized.java?rev=892274&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/scenario142/javaruntime/TestJavaClass_uninitialized.java (added)
+++ incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/scenario142/javaruntime/TestJavaClass_uninitialized.java Fri Dec 18 15:18:05 2009
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.tck.scenario142.javaruntime;
+
+import java.util.List;
+
+import javax.tools.diagnostics.runtime.java.JavaClass;
+import javax.tools.diagnostics.runtime.java.JavaClassLoader;
+
+import org.apache.kato.tck.harness.TCKJavaRuntimeTestcase;
+
+/**
+ * Tests that an uninitialized class can be found.
+ *
+ */
+public class TestJavaClass_uninitialized extends TCKJavaRuntimeTestcase {
+ public void testFindClass() throws Exception {
+ List<JavaClassLoader> loaders = getJavaRuntime().getJavaClassLoaders();
+
+ String className = this.getClass().getPackage().getName().replace('.', '/').concat("BlockedClass");
+ JavaClass clazz = null;
+ for (JavaClassLoader loader : loaders) {
+ clazz = loader.findClass(className);
+ if (clazz != null) {
+ break;
+ }
+ }
+
+ assertNotNull("Could not find "+className,clazz);
+ }
+}
Propchange: incubator/kato/trunk/org.apache.kato/kato.tck/testcases/src/main/java/org/apache/kato/tck/scenario142/javaruntime/TestJavaClass_uninitialized.java
------------------------------------------------------------------------------
svn:mime-type = text/plain