harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r480141 [23/38] - in /harmony/enhanced/jdktools/trunk/modules/jpda: ./ doc/ doc/images/ make/ src/ src/common/ src/common/other/ src/common/other/jpda/ src/common/other/jpda/jdwp/ src/common/other/jpda/jdwp/agent/ src/common/other/jpda/jdwp...
Date Tue, 28 Nov 2006 17:49:31 GMT
Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ClassType/SuperClassTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ClassType/SuperClassTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ClassType/SuperClassTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ClassType/SuperClassTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.5 $
+ */
+
+/**
+ * Created on 09.02.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.ClassType;
+
+import java.io.UnsupportedEncodingException;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+
+/**
+ * JDWP unit test for ClassType.SuperClass command.
+ * Contains three testcases: testSuperClass001, testSuperClass002, testSuperClass003.
+ */
+public class SuperClassTest extends JDWPClassTypeTestCase {
+
+    /**
+     * Starts this test by junit.textui.TestRunner.run() method.
+     */
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(SuperClassTest.class);
+    }
+
+    private ReplyPacket jdwpGetSuperClassReply(long classID, int errorExpected) {
+        CommandPacket packet = new CommandPacket(
+                JDWPCommands.ClassTypeCommandSet.CommandSetID,
+                JDWPCommands.ClassTypeCommandSet.SuperclassCommand);
+        packet.setNextValueAsClassID(classID);
+        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
+        checkReplyPacket(reply, "ClassType.Superclass command", errorExpected);
+        return reply;
+    }
+
+    private void asserSuperClassReplyIsValid(ReplyPacket reply, String expectedSignature) {
+        assertTrue(reply.getErrorCode() == JDWPConstants.Error.NONE);
+        long superClassID = reply.getNextValueAsClassID();
+        logWriter.println("superClassID=" + superClassID);
+        if (superClassID == 0) {
+            // for superclass of Object expectedSignature is null
+            assertNull
+            ("ClassType::Superclass command returned invalid expectedSignature that must be null",
+                    expectedSignature);
+        } else {
+            String signature = getClassSignature(superClassID);
+            logWriter.println("Signature: "+signature);
+            assertString("ClassType::Superclass command returned invalid signature,",
+                    expectedSignature, signature);
+        }
+    }
+
+    /**
+     * This testcase exercises ClassType.Superclass command.
+     * <BR>Starts <A HREF="ClassTypeDebuggee.html">ClassTypeDebuggee</A>. 
+     * <BR>Then does the following checks: 
+     * <BR>&nbsp;&nbsp; - superclass for java.lang.String is java.lang.Object;
+     * <BR>&nbsp;&nbsp; - superclass for array of Objects is java.lang.Object;
+     * <BR>&nbsp;&nbsp; - superclass for primitive array is java.lang.Object;
+     * <BR>&nbsp;&nbsp; - superclass for <A HREF="ClassTypeDebuggee.html">ClassTypeDebuggee</A>
+     * class is <A HREF="../../share/SyncDebuggee.html">SyncDebuggee</A> class.;
+     */
+    public void testSuperClass001() throws UnsupportedEncodingException {
+        logWriter.println("testSuperClassTest001 started");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        
+        // check that superclass for java.lang.String is java.lang.Object
+        {
+            // test with String[] class
+            long classID = getClassIDBySignature("Ljava/lang/String;");
+
+            ReplyPacket reply = jdwpGetSuperClassReply(classID, JDWPConstants.Error.NONE);
+            // complare returned signature with superclass signature
+            asserSuperClassReplyIsValid(reply, "Ljava/lang/Object;");
+        }
+
+        // check that superclass for array is java.lang.Object
+        {
+            // test with String[] class
+            long classID = getClassIDBySignature("[Ljava/lang/String;");
+
+            ReplyPacket reply = jdwpGetSuperClassReply(classID, JDWPConstants.Error.NONE);
+            // complare returned signature with superclass signature
+            asserSuperClassReplyIsValid(reply, "Ljava/lang/Object;");
+        }
+
+        // check that superclass for primitive array is java.lang.Object
+        {
+            // test with int[] class
+            long classID = getClassIDBySignature("[I");
+
+            ReplyPacket reply = jdwpGetSuperClassReply(classID, JDWPConstants.Error.NONE);
+            // complare returned signature with superclass signature
+            asserSuperClassReplyIsValid(reply, "Ljava/lang/Object;");
+        }
+
+        // check that superclass for Debuggee is SyncDebuggee
+        {
+            long classID = getClassIDBySignature(getDebuggeeSignature());
+
+            ReplyPacket reply = jdwpGetSuperClassReply(classID, JDWPConstants.Error.NONE);
+            // complare returned signature with superclass signature
+            asserSuperClassReplyIsValid(reply, "Lorg/apache/harmony/jpda/tests/share/SyncDebuggee;");
+        }
+
+        // check that there is no superclass for java.lang.Object
+        {
+            // test with java.lang.Object class
+            long classID = getClassIDBySignature("Ljava/lang/Object;");
+
+            ReplyPacket reply = jdwpGetSuperClassReply(classID, JDWPConstants.Error.NONE);
+            // complare returned signature with superclass signature 
+            // (expects null for this case) 
+            asserSuperClassReplyIsValid(reply, null);
+        }
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    /**
+     * This testcase exercises ClassType.Superclass command.
+     * <BR>Starts <A HREF="ClassTypeDebuggee.html">ClassTypeDebuggee</A>. 
+     * <BR>Then does the following checks: 
+     * <BR>&nbsp;&nbsp; - there is no superclass for interface;
+     * <BR>&nbsp;&nbsp; - INVALID_OBJECT is returned if classID is non-existent;
+     * <BR>&nbsp;&nbsp; - INVALID_OBJECT is returned if instead of classID FieldID is passed;
+     */
+    public void testSuperClass002() throws UnsupportedEncodingException {
+        logWriter.println("testSuperClassTest002 started");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        // check that there is no superclass for interface objects
+        {
+            long interfaceID = getClassIDBySignature("Ljava/lang/Cloneable;");
+
+            ReplyPacket reply = jdwpGetSuperClassReply(interfaceID, JDWPConstants.Error.NONE);
+            // compare returned signature with superclass signature
+            // (null for interfaces)
+            asserSuperClassReplyIsValid(reply, null);
+        }
+
+        // check that INVALID_OBJECT returns if classID is non-existent
+        {
+            jdwpGetSuperClassReply(10000
+                , JDWPConstants.Error.INVALID_OBJECT);
+        }
+
+        // check that reply error code is INVALID_OBJECT for a FieldID Out Data
+        {
+            long classID = getClassIDBySignature(getDebuggeeSignature());
+
+            FieldInfo[] fields = jdwpGetFields(classID);
+            // assert stringID is not null
+            assertTrue("Invalid fields.length: 0", fields.length > 0);
+            // test with the first field
+            
+            jdwpGetSuperClassReply(fields[0].getFieldID()
+                , JDWPConstants.Error.INVALID_OBJECT);
+        }
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+
+    /**
+     * This testcase exercises ClassType.Superclass command.
+     * <BR>Starts <A HREF="ClassTypeDebuggee.html">ClassTypeDebuggee</A>. 
+     * <BR>Then does the following check: 
+     * <BR>&nbsp;&nbsp; - INVALID_CLASS is returned if instead of classID ObjectID is passed;
+     */
+    public void testSuperClass003() throws UnsupportedEncodingException {
+        logWriter.println("testSuperClassTest003 started");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        // check that reply error code is INVALID_CLASS for a StringID Out Data
+        {
+            long stringID = createString("Some test string");
+            // assert stringID is not null
+            assertFalse("Invalid stringID: 0", stringID == 0);
+            jdwpGetSuperClassReply(stringID, JDWPConstants.Error.INVALID_CLASS);
+        }
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+    }
+}
\ No newline at end of file

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ClassType/SuperClassTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 07.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+;
+
+/**
+ * Debuggee for BreakpointTest unit test.
+ */
+public class BreakpointDebuggee extends SyncDebuggee {
+
+    public static void main(String[] args) {
+        runDebuggee(BreakpointDebuggee.class);
+    }
+    
+    public void breakpointTest() {
+        logWriter.println("breakpointTest");
+    }
+
+    public void run() {
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        
+        logWriter.println("BreakpointDebuggee started");
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        
+        // Test breakpoint
+        breakpointTest();
+        
+        logWriter.println("BreakpointDebuggee finished");
+    }
+    
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 11.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.Breakpoint;
+import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+
+/**
+ * JDWP Unit test for BREAKPOINT event.
+ */
+public class BreakpointTest extends JDWPEventTestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(BreakpointTest.class);
+    }
+    
+    protected String getDebuggeeClassName() {
+        return BreakpointDebuggee.class.getName();
+    }
+    
+    /**
+     * This testcase is for BREAKPOINT event.
+     * <BR>It runs BreakpointDebuggee and set breakpoint to its breakpointTest 
+     * method, then verifies that requested BREAKPOINT event occurs.
+     */
+    public void testSetBreakpointEvent() {
+        logWriter.println("testSetBreakpointEvent started");
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        Breakpoint breakpoint = new Breakpoint("Lorg/apache/harmony/jpda/tests/jdwp/Events/BreakpointDebuggee;", "breakpointTest", 1);
+        ReplyPacket reply;
+        reply = debuggeeWrapper.vmMirror.setBreakpoint(JDWPConstants.TypeTag.CLASS, breakpoint);
+        checkReplyPacket(reply, "Set BREAKPOINT event");
+
+        logWriter.println("starting thread");
+
+        // execute the breakpoint
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        CommandPacket event = null;
+        event = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+
+        assertEquals("Invalid number of events,", 1, parsedEvents.length);
+        assertEquals("Invalid event kind,",
+                JDWPConstants.EventKind.BREAKPOINT,
+                parsedEvents[0].getEventKind(),
+                JDWPConstants.EventKind.getName(JDWPConstants.EventKind.BREAKPOINT),
+                JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));
+        
+        logWriter.println("BreakpointTest done");
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/BreakpointTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/Class2Prepare.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/Class2Prepare.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/Class2Prepare.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/Class2Prepare.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 06.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.LogWriter;
+
+/**
+ * Internal class used in ClassPrepareTest
+ */
+class Class2Prepare {
+
+    public Class2Prepare(LogWriter logWriter) {
+        super();
+        logWriter.println("Class2Prepare default constructor is called");
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/Class2Prepare.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 07.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+/**
+ * Debuggee for ClassPrepareTest unit test.
+ * Loads Class2Prepare class to trace CLASS_PREPARE event.
+ */
+public class ClassPrepareDebuggee extends SyncDebuggee {
+
+    public static void main(String[] args) {
+        runDebuggee(ClassPrepareDebuggee.class);
+    }
+    
+    public void run() {
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        
+        logWriter.println("ClassPrepareDebuggee started");
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        
+        try {
+            // Test class prepare
+            logWriter.println("Try to load and prepare class Class2Prepare");
+            Class.forName("org.apache.harmony.jpda.tests.jdwp.Events.Class2Prepare");
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        
+        logWriter.println("ClassPrepareDebuggee finished");
+    }
+    
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.4 $
+ */
+
+/**
+ * Created on 06.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+
+/**
+ * JDWP Unit test for CLASS_PREPARE event.
+ */
+public class ClassPrepareTest extends JDWPEventTestCase {
+
+    protected String getDebuggeeClassName() {
+        return ClassPrepareDebuggee.class.getName();
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(ClassPrepareTest.class);
+    }
+
+    /**
+     * This testcase is for CLASS_PREPARE event.
+     * <BR>It runs ClassPrepareDebuggee to load Class2Prepare class
+     * and verify that requested CLASS_PREPARE event occurs.
+     */
+    public void testClassPrepareEvent() {
+        logWriter.println("testClassPrepareEvent started");
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        String class2prepareRegexp = "org.apache.harmony.jpda.tests.jdwp.Events.Class2Prepare"; 
+        String class2prepareSignature = "Lorg/apache/harmony/jpda/tests/jdwp/Events/Class2Prepare;"; 
+        
+        ReplyPacket reply = debuggeeWrapper.vmMirror.setClassPrepared(class2prepareRegexp);
+        checkReplyPacket(reply, "Set CLASS_PREPARE event");
+        
+        // start loading Class2Prepare class
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        
+        CommandPacket event = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+        
+        assertEquals("Invalid number of events,", 1, parsedEvents.length);
+        assertEquals("Invalid event kind,", JDWPConstants.EventKind.CLASS_PREPARE, parsedEvents[0].getEventKind()
+                , JDWPConstants.EventKind.getName(JDWPConstants.EventKind.CLASS_PREPARE)
+                , JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));
+        assertEquals("Invalid signature of prepared class,", class2prepareSignature
+                , ((ParsedEvent.Event_CLASS_PREPARE)parsedEvents[0]).getSignature());
+        
+        //logWriter.println("parsedEvent="+parsedEvents[0].getClass().getCanonicalName());
+        //logWriter.println(((ParsedEvent.Event_CLASS_PREPARE)parsedEvents[0]).getSignature());
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ClassPrepareTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/DebuggeeException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/DebuggeeException.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/DebuggeeException.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/DebuggeeException.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.3 $
+ */
+
+/**
+ * Created on 11.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+/**
+ * Internal exception used in ExceptionTest
+ */
+public class DebuggeeException extends RuntimeException {
+
+    /**
+     * Serialization id.
+     */
+    private static final long serialVersionUID = 2849656331214873095L;
+
+    public DebuggeeException(String arg0) {
+        super(arg0);
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/DebuggeeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/EventDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/EventDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/EventDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/EventDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 11.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+/**
+ * Basic debuggee for events unit tests.
+ * Runs new thread
+ */
+public class EventDebuggee extends SyncDebuggee {
+    
+    public static final String testedThreadName = "SimpleThread";
+    
+    private class SimpleThread extends Thread {
+        
+        public SimpleThread () {
+            super(testedThreadName);   
+        }
+        
+        public void run() {
+            logWriter.println("-> SimpleThread: Running...");
+        } 
+    }
+
+    public static void main(String[] args) {
+        runDebuggee(EventDebuggee.class);
+    }
+    
+    public void run() {
+        logWriter.println("-> EventDebuggee: STARTED");
+        
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+                
+        SimpleThread testThread = new SimpleThread();
+        testThread.start();
+        logWriter.println("-> EventDebuggee: SimpleThread started");
+        try {
+            testThread.join();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        logWriter.println("-> EventDebuggee: SimpleThread finished");
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        
+        logWriter.println("-> EventDebuggee: wait for signal to continue...");
+        // do NOT finish without signal (in acceptable time) in order 
+        // to do NOT generate unexpected events
+        String infoMessage = "-> EventDebuggee: TIMED OUT in waiting for signal!";
+        for (int i=0; i < 10; i++ ) {
+            if ( synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE) ) {
+                infoMessage = "-> EventDebuggee: signal received!";
+               break;
+            }
+        }
+        logWriter.println(infoMessage);
+        
+        logWriter.println("-> EventDebuggee: FINISH...");
+    }
+
+}
+

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/EventDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.4 $
+ */
+
+/**
+ * Created on 11.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+/**
+ * Debuggee for ExceptionTest unit test.
+ * Generates caught DebuggeeException exception.
+ */
+public class ExceptionDebuggee extends SyncDebuggee {
+
+    public static void main(String[] args) {
+        runDebuggee(ExceptionDebuggee.class);
+    }
+    
+    public void run(){
+        
+        logWriter.println("-- ExceptionDebuggee: STARTED");
+        // load and prepare DebuggeeException class
+        DebuggeeException ex = new DebuggeeException("dummy exception");
+        
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        
+        logWriter.println("-- ExceptionDebuggee: Wait for SGNL_CONTINUE...");
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("-- ExceptionDebuggee: SGNL_CONTINUE has been received!");
+        
+        try {
+            // throw caught exception
+            throw new DebuggeeException("Caught debuggee exception");
+        } catch (DebuggeeException e) {
+            logWriter.println("-- ExceptionDebuggee: Exception: \""+e.getMessage()+"\" was thrown");
+        }
+
+        logWriter.println("DUMP{" + ex + "}"); 
+        logWriter.println("-- ExceptionDebuggee: FINISHing...");
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.4 $
+ */
+
+/**
+ * Created on 11.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.EventPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.TaggedObject;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+
+/**
+ * JDWP Unit test for caught EXCEPTION event.
+ */
+public class ExceptionTest extends JDWPEventTestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(ExceptionTest.class);
+    }
+    
+    protected String getDebuggeeClassName() {
+        return ExceptionDebuggee.class.getName();
+    }
+    
+    /**
+     * This testcase is for caught EXCEPTION event.
+     * <BR>It runs ExceptionDebuggee that throws caught DebuggeeException
+     * and verify that requested EXCEPTION event occurs.
+     */
+    public void testExceptionEvent() {
+        logWriter.println(">> testExceptionEvent: STARTED...");
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        String exceptionSignature = "Lorg/apache/harmony/jpda/tests/jdwp/Events/DebuggeeException;";
+        boolean isCatch = true;
+        boolean isUncatch = true;
+        logWriter.println("\n>> testExceptionEvent: => setException(...)...");
+        debuggeeWrapper.vmMirror.setException(exceptionSignature, isCatch, isUncatch);
+        logWriter.println(">> testExceptionEvent: setException(...) DONE");
+
+        logWriter.println("\n>> testExceptionEvent: send to Debuggee SGNL_CONTINUE...");
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        logWriter.println("\n>> testExceptionEvent: => receiveEvent()...");
+        EventPacket event = debuggeeWrapper.vmMirror.receiveEvent();
+        logWriter.println(">> testExceptionEvent: Event is received! Check it ...");
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+        
+        // assert that event is the expected one 
+        logWriter.println(">> testExceptionEvent: parsedEvents.length = " + parsedEvents.length);
+        logWriter.println(">> testExceptionEvent: parsedEvents[0].getEventKind() = " + parsedEvents[0].getEventKind());
+        assertEquals("Invalid number of events,", 1, parsedEvents.length);
+        assertEquals("Invalid event kind,",
+                JDWPConstants.EventKind.EXCEPTION,
+                parsedEvents[0].getEventKind(),
+                JDWPConstants.EventKind.getName(JDWPConstants.EventKind.EXCEPTION),
+                JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));
+        TaggedObject returnedException =((ParsedEvent.Event_EXCEPTION)parsedEvents[0]).getException();
+        
+        // assert that exception class is the expected one
+        long typeID = getObjectReferenceType(returnedException.objectID);
+        String returnedExceptionSignature = getClassSignature(typeID);
+        logWriter.println(">> testExceptionEvent: returnedExceptionSignature = |" + returnedExceptionSignature+"|");
+        assertString("Invalid signature of returned exception,", exceptionSignature, returnedExceptionSignature);
+        
+        // resume debuggee 
+        logWriter.println("\n>> testExceptionEvent: resume debuggee...");
+        debuggeeWrapper.vmMirror.resume();
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/ExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldAccessTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldAccessTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldAccessTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldAccessTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.6 $
+ */
+
+/**
+ * Created on 11.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.EventPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.TaggedObject;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for FIELD_ACCESS event.
+ */
+public class FieldAccessTest extends JDWPEventTestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(FieldAccessTest.class);
+    }
+    
+    protected String getDebuggeeClassName() {
+        return FieldDebuggee.class.getName();
+    }
+    
+    /**
+     * This testcase is for FIELD_ACCESS event.
+     * <BR>It runs FieldDebuggee that accesses to the value of its internal field 
+     * and verify that requested FIELD_ACCESS event occurs.
+     */
+    public void testFieldAccessEvent() {
+
+        logWriter.println("ExceptionTest started");
+        
+        //check capability, relevant for this test
+        logWriter.println("=> Check capability: canWatchFieldAccess");
+        debuggeeWrapper.vmMirror.capabilities();
+        boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canWatchFieldAccess;
+        if (!isCapability) {
+            logWriter.println("##WARNING: this VM doesn't possess capability: canWatchFieldAccess");
+            return;
+        }
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        String classSignature = "Lorg/apache/harmony/jpda/tests/jdwp/Events/FieldDebuggee;";
+        ReplyPacket reply = debuggeeWrapper.vmMirror.setFieldAccess(classSignature, JDWPConstants.TypeTag.CLASS, "testIntField");
+        checkReplyPacket(reply, "Set FIELD_ACCESS event");
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        EventPacket event = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+
+        // assert that event is the expected one 
+        assertEquals("Invalid number of events,", 1, parsedEvents.length);
+        assertEquals("Invalid event kind,",
+                JDWPConstants.EventKind.FIELD_ACCESS,
+                parsedEvents[0].getEventKind(),
+                JDWPConstants.EventKind.getName(JDWPConstants.EventKind.FIELD_ACCESS),
+                JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));
+                
+        TaggedObject accessedField =((ParsedEvent.Event_FIELD_ACCESS)parsedEvents[0]).getObject();
+
+        // assert that exception class is the expected one
+        long typeID = getObjectReferenceType(accessedField.objectID);
+        String returnedExceptionSignature = getClassSignature(typeID);
+        assertString("Invalid class signature,",
+                classSignature, returnedExceptionSignature);
+
+        logWriter.println("FieldAccessTest done");
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldAccessTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 11.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+/**
+ * Debuggee for FieldAccessTest and FieldModified unit tests.
+ * Provides access and modification of testIntField field.
+ */
+public class FieldDebuggee extends SyncDebuggee {
+
+    public static void main(String[] args) {
+        runDebuggee(FieldDebuggee.class);
+    }
+    
+    private int testIntField = 0;
+    
+    public void run(){
+        
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        
+        logWriter.println("FieldDebuggee started");
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        
+        testIntField = 512;
+        logWriter.println("Access to field testIntField: value="+testIntField);
+        
+        logWriter.println("FieldDebuggee finished");
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Debuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Debuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Debuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Debuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.3 $
+ */
+
+/**
+ * Created on 11.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import java.io.File;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+/**
+ * Debuggee for FieldAccessTest and FieldModified unit tests.
+ * Provides access and modification of testIntField field.
+ */
+public class FieldModification002Debuggee extends SyncDebuggee {
+
+    public static void main(String[] args) {
+        runDebuggee(FieldModification002Debuggee.class);
+    }
+
+    public boolean testBoolField = false;
+    public byte testByteField = 0;
+    public char testCharField = 0;
+    public short testShortField = 0;
+    public int testIntField = 0;
+    public long testLongField = 0;
+    public float testFloatField = 0;
+    public double testDoubleField = 0;
+    public Object testObjectField = null;
+    public Object testThreadField = null;
+    public Object testThreadGroupField = null;
+    public Object testClassField = null;
+    public Object testClassLoaderField = null;
+    public Object testStringField = null;
+    public int [] testIntArrayField = null;
+    public String [] testStringArrayField = null;
+    public Object [] testObjectArrayField = null;
+
+    /**
+     * This debuggee accesses all class fields and synchronizes with debugger.
+     */
+    public void run() {
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        logWriter.println("FieldDebuggee started");
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testBoolField = true;
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testByteField = 'k';
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testCharField = 'Q';
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testShortField = 127;
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testIntField = -1001;
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testLongField = 4000000000000000L;
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testFloatField = 100*100*100;
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testDoubleField = -1.1/100000.999999;
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testObjectField = new File("none");
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testThreadField = new Thread("myThread001");
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testThreadGroupField = new ThreadGroup("MyThreadGroup_000001");
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testClassField = System.out.getClass();
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testClassLoaderField = this.getClass().getClassLoader();
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testStringField = "String=Strong=Strung";
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testIntArrayField = new int [] { 1, 2, 3, };
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testStringArrayField = new String[] { "abc", "xyz", };
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        testObjectArrayField = new Object[] { null, null, null, new Long(99), "objobjobj", };
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        logWriter.println("FieldDebuggee finished");
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Debuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Test.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Test.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Test.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Ruslan A. Scherbakov
+ * @version $Revision: 1.4 $
+ */
+
+/**
+ * Created on 14.06.2006
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.EventPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.TaggedObject;
+import org.apache.harmony.jpda.tests.framework.jdwp.Value;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+/**
+ * JDWP Unit test for FIELD_MODIFICATION event.
+ */
+public class FieldModification002Test extends JDWPEventTestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(FieldModification002Test.class);
+    }
+    
+    protected String getDebuggeeClassName() {
+        return FieldModification002Debuggee.class.getName();
+    }
+
+    /**
+     * This testcase is for FIELD_MODIFICATION event.
+     * <BR>It FieldModification002Debuggee that modifies the value of its own fields 
+     * and verifies that requested FIELD_MODIFICATION events occur and
+     * correct type tag is returned for each event.
+     */
+    public void testFieldModifyEvent() {
+
+        logWriter.println("FieldModification002Test started");
+        
+        //check capability, relevant for this test
+        logWriter.println("=> Check capability: canWatchFieldModification");
+        debuggeeWrapper.vmMirror.capabilities();
+        boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canWatchFieldModification;
+        if (!isCapability) {
+            logWriter.println("##WARNING: this VM doesn't possess capability: canWatchFieldModification");
+            return;
+        }
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        String classSignature = "L" + getDebuggeeClassName().replace('.', '/') + ";";
+
+        hookFieldModification(classSignature, "testBoolField", JDWPConstants.Tag.BOOLEAN_TAG);
+        hookFieldModification(classSignature, "testByteField", JDWPConstants.Tag.BYTE_TAG);
+        hookFieldModification(classSignature, "testCharField", JDWPConstants.Tag.CHAR_TAG);
+        hookFieldModification(classSignature, "testShortField", JDWPConstants.Tag.SHORT_TAG);
+        hookFieldModification(classSignature, "testIntField", JDWPConstants.Tag.INT_TAG);
+        hookFieldModification(classSignature, "testLongField", JDWPConstants.Tag.LONG_TAG);
+        hookFieldModification(classSignature, "testFloatField", JDWPConstants.Tag.FLOAT_TAG);
+        hookFieldModification(classSignature, "testDoubleField", JDWPConstants.Tag.DOUBLE_TAG);
+        hookFieldModification(classSignature, "testObjectField", JDWPConstants.Tag.OBJECT_TAG);
+        hookFieldModification(classSignature, "testThreadField", JDWPConstants.Tag.THREAD_TAG);
+        hookFieldModification(classSignature, "testThreadGroupField", JDWPConstants.Tag.THREAD_GROUP_TAG);
+        hookFieldModification(classSignature, "testClassField", JDWPConstants.Tag.CLASS_OBJECT_TAG);
+        hookFieldModification(classSignature, "testClassLoaderField", JDWPConstants.Tag.CLASS_LOADER_TAG);
+        hookFieldModification(classSignature, "testStringField", JDWPConstants.Tag.STRING_TAG);
+        hookFieldModification(classSignature, "testIntArrayField", JDWPConstants.Tag.ARRAY_TAG);
+        hookFieldModification(classSignature, "testStringArrayField", JDWPConstants.Tag.ARRAY_TAG);
+        hookFieldModification(classSignature, "testObjectArrayField", JDWPConstants.Tag.ARRAY_TAG);
+
+        logWriter.println("FieldModification002Test done");
+    }
+
+    /**
+     * Sets FIELD_MODIFICATION breakpoint,
+     * synchrinizes debuggee,
+     * expects field notification event,
+     * verifies new value assigned to the field
+     * and clears set breakpoint.
+     * 
+     * @param classSignature signature of class containing the given field
+     * @param fieldName the name of field to break on modification
+     * @param expectedTag expected type tag of new values assigned to the field
+     */
+    public void hookFieldModification(String classSignature, String fieldName, byte expectedTag) {
+
+        // set breakpoint
+        logWriter.println("Set hook for: " + fieldName);
+        ReplyPacket reply = debuggeeWrapper.vmMirror.setFieldModification(classSignature, JDWPConstants.TypeTag.CLASS, fieldName);
+        checkReplyPacket(reply, "Set FIELD_MODIFICATION event");
+        int requestID = reply.getNextValueAsInt();
+        assertAllDataRead(reply);
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        EventPacket event = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+
+        // assert that event is the expected one
+        assertEquals("Invalid number of events,", 1, parsedEvents.length);
+        assertEquals("Invalid event kind,",
+                JDWPConstants.EventKind.FIELD_MODIFICATION,
+                parsedEvents[0].getEventKind(),
+                JDWPConstants.EventKind.getName(JDWPConstants.EventKind.FIELD_MODIFICATION),
+                JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));
+
+        Value value =
+            ((ParsedEvent.Event_FIELD_MODIFICATION)parsedEvents[0]).getValueToBe();
+        byte tag = value.getTag();
+        assertEquals("Invalid value tag,",
+                expectedTag,
+                tag,
+                JDWPConstants.Tag.getName(expectedTag),
+                JDWPConstants.Tag.getName(tag));
+
+        TaggedObject modifiedField =
+            ((ParsedEvent.Event_FIELD_MODIFICATION)parsedEvents[0]).getObject();
+
+        // assert that exception class is the expected one
+        long typeID = getObjectReferenceType(modifiedField.objectID);
+        String returnedExceptionSignature = getClassSignature(typeID);
+        assertString("Invalid class signature,",
+                classSignature, returnedExceptionSignature);
+
+        logWriter.println("Field: " + fieldName +
+                ", tag of new value: " + value +
+                ", tag: " + (char)tag+ " - OK");
+
+        // clear breakpoint
+        clearEvent(JDWPConstants.EventKind.FIELD_MODIFICATION, requestID, false);
+        
+        // and resume target VM
+        resumeDebuggee();
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModification002Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModificationTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModificationTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModificationTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModificationTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.4 $
+ */
+
+/**
+ * Created on 11.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.EventPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.TaggedObject;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+/**
+ * JDWP Unit test for FIELD_MODIFICATION event.
+ */
+public class FieldModificationTest extends JDWPEventTestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(FieldModificationTest.class);
+    }
+    
+    protected String getDebuggeeClassName() {
+        return FieldDebuggee.class.getName();
+    }
+    
+    /**
+     * This testcase is for FIELD_MODIFICATION event.
+     * <BR>It runs FieldDebuggee that modifies the value of its own field 
+     * and verify that requested FIELD_MODIFICATION event occurs.
+     */
+    public void testFieldModifyEvent() {
+
+        logWriter.println("FieldModificationTest started");
+        
+        //check capability, relevant for this test
+        logWriter.println("=> Check capability: canWatchFieldModification");
+        debuggeeWrapper.vmMirror.capabilities();
+        boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canWatchFieldModification;
+        if (!isCapability) {
+            logWriter.println("##WARNING: this VM doesn't possess capability: canWatchFieldModification");
+            return;
+        }
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        String classSignature = "Lorg/apache/harmony/jpda/tests/jdwp/Events/FieldDebuggee;";
+        ReplyPacket reply = debuggeeWrapper.vmMirror.setFieldModification(classSignature, JDWPConstants.TypeTag.CLASS, "testIntField");
+        checkReplyPacket(reply, "Set FIELD_MODIFICATION event");
+        
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        EventPacket event = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+
+        // assert that event is the expected one
+        assertEquals("Invalid number of events,", 1, parsedEvents.length);
+        assertEquals("Invalid event kind,",
+                JDWPConstants.EventKind.FIELD_MODIFICATION,
+                parsedEvents[0].getEventKind(),
+                JDWPConstants.EventKind.getName(JDWPConstants.EventKind.FIELD_MODIFICATION),
+                JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));
+
+        TaggedObject modifiedField =((ParsedEvent.Event_FIELD_MODIFICATION)parsedEvents[0]).getObject();
+
+        // assert that exception class is the expected one
+        long typeID = getObjectReferenceType(modifiedField.objectID);
+        String returnedExceptionSignature = getClassSignature(typeID);
+        assertString("Invalid class signature,",
+                classSignature, returnedExceptionSignature);
+
+        logWriter.println("FieldModificationTest done");
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/FieldModificationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/JDWPEventTestCase.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/JDWPEventTestCase.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/JDWPEventTestCase.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/JDWPEventTestCase.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 11.03.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
+
+/**
+ * Internal class that extends functionality of JDWPSyncTestCase class.
+ */
+class JDWPEventTestCase extends JDWPSyncTestCase {
+
+    protected String getDebuggeeClassName() {
+        return EventDebuggee.class.getName();
+    }
+
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/JDWPEventTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.2 $
+ */
+
+/**
+ * Created on 06.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+
+/**
+ * Debuggee for MethodEntryTest unit tests.
+ * Calls it's own sampleMethod method.
+ */
+public class MethodEntryDebuggee extends SyncDebuggee {
+
+    public static void main(String[] args) {
+        runDebuggee(MethodEntryDebuggee.class);
+    }
+    
+    public void sampleMethod() {
+        logWriter.println("sampleMethod() is called");
+    }
+    
+    public void run() {
+        logWriter.println("MethodEntryDebuggee started");
+        
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        
+        sampleMethod();
+        
+        logWriter.println("MethodEntryDebuggee finished");
+    }
+
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.4 $
+ */
+
+/**
+ * Created on 06.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+
+/**
+ * JDWP Unit test for METHOD_ENTRY event.
+ */
+public class MethodEntryTest extends JDWPEventTestCase {
+
+    protected String getDebuggeeClassName() {
+        return MethodEntryDebuggee.class.getName();
+    }
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(MethodEntryTest.class);
+    }
+    
+    /**
+     * This testcase is for METHOD_ENTRY event.
+     * <BR>It runs MethodEntryDebuggee that executed its own method 
+     * and verify that requested METHOD_ENTRY event occurs.
+     */
+    public void testMethodEntry() {
+        logWriter.println("testMethodEntry started");
+
+        String methodEntryClassNameRegexp = "org.apache.harmony.jpda.tests.jdwp.Events.MethodEntryDebuggee"; 
+        //String methodEntryClassNameSignature = "Lorg/apache/harmony/jpda/tests/jdwp/Events/MethodEntryDebuggee;"; 
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        ReplyPacket reply = debuggeeWrapper.vmMirror.setMethodEntry(methodEntryClassNameRegexp);
+        checkReplyPacket(reply, "Set METHOD_ENTRY event");
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+
+        CommandPacket event = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+
+        assertEquals("Invalid number of events,", 1, parsedEvents.length);
+        assertEquals("Invalid event kind,",
+                JDWPConstants.EventKind.METHOD_ENTRY,
+                parsedEvents[0].getEventKind(),
+                JDWPConstants.EventKind.getName(JDWPConstants.EventKind.METHOD_ENTRY),
+                JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));
+
+        logWriter.println("MethodEntryTest done");
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodEntryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodExitTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodExitTest.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodExitTest.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodExitTest.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Anton V. Karnachuk
+ * @version $Revision: 1.4 $
+ */
+
+/**
+ * Created on 07.04.2005
+ */
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
+import org.apache.harmony.jpda.tests.framework.jdwp.ParsedEvent;
+import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+
+
+
+/**
+ * JDWP Unit test for METHOD_EXIT event.
+ */
+public class MethodExitTest extends JDWPEventTestCase {
+
+    protected String getDebuggeeClassName() {
+        return MethodEntryDebuggee.class.getName();
+    }
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(MethodExitTest.class);
+    }
+    
+    /**
+     * This testcase is for METHOD_EXIT event.
+     * <BR>It runs MethodEntryDebuggee that executed its own method 
+     * and verify that requested METHOD_EXIT event occurs.
+     */
+    public void testMethodExit() {
+        logWriter.println("testMethodExit started");
+
+        String methodExitClassNameRegexp = "org.apache.harmony.jpda.tests.jdwp.Events.MethodEntryDebuggee"; 
+        //String methodExitClassNameSignature = "Lorg/apache/harmony/jpda/tests/jdwp/Events/MethodEntryDebuggee;"; 
+
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+
+        ReplyPacket reply = debuggeeWrapper.vmMirror.setMethodExit(methodExitClassNameRegexp);
+        checkReplyPacket(reply, "Set METHOD_EXIT event");
+
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        
+        CommandPacket event = debuggeeWrapper.vmMirror.receiveEvent();
+        ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);
+
+        assertEquals("Invalid number of events,", 1, parsedEvents.length);
+        assertEquals("Invalid event kind,",
+                JDWPConstants.EventKind.METHOD_EXIT,
+                parsedEvents[0].getEventKind(),
+                JDWPConstants.EventKind.getName(JDWPConstants.EventKind.METHOD_EXIT),
+                JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));
+
+        logWriter.println("MethodExitTest done");
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/MethodExitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/SingleStepDebuggee.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/SingleStepDebuggee.java?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/SingleStepDebuggee.java (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/SingleStepDebuggee.java Tue Nov 28 09:49:08 2006
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  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.
+ */
+
+/**
+ * @author Aleksander V. Budniy
+ * @version $Revision: 1.3 $
+ */
+
+/**
+ * Created on 14.07.2005
+ */
+
+package org.apache.harmony.jpda.tests.jdwp.Events;
+
+import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
+import org.apache.harmony.jpda.tests.share.SyncDebuggee;
+;
+
+/**
+ * Debuggee for SingleStepTest unit test.
+ */
+public class SingleStepDebuggee extends SyncDebuggee {
+
+    public static void main(String[] args) {
+        runDebuggee(SingleStepDebuggee.class);
+    }
+    
+    public void breakpointTest() {
+        logWriter.println("Line1");
+        logWriter.println("Line2");
+        logWriter.println("Line3");
+    }
+
+    public void run() {
+        synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
+        
+        logWriter.println("SingleStepDebuggee started");
+        
+        synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+        
+        // Test breakpoint
+        breakpointTest();
+        
+        logWriter.println("SingleStepDebuggee finished");
+    }
+
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/Events/SingleStepDebuggee.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message