001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: *
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */
018:
019: /**
020: * @author Anton V. Karnachuk
021: * @version $Revision: 1.3 $
022: */
023:
024: /**
025: * Created on 11.04.2005
026: */package org.apache.harmony.jpda.tests.jdwp.Events;
027:
028: import java.io.File;
029:
030: import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
031: import org.apache.harmony.jpda.tests.share.SyncDebuggee;
032:
033: /**
034: * Debuggee for FieldAccessTest and FieldModified unit tests.
035: * Provides access and modification of testIntField field.
036: */
037: public class FieldModification002Debuggee extends SyncDebuggee {
038:
039: public static void main(String[] args) {
040: runDebuggee(FieldModification002Debuggee.class);
041: }
042:
043: public boolean testBoolField = false;
044: public byte testByteField = 0;
045: public char testCharField = 0;
046: public short testShortField = 0;
047: public int testIntField = 0;
048: public long testLongField = 0;
049: public float testFloatField = 0;
050: public double testDoubleField = 0;
051: public Object testObjectField = null;
052: public Object testThreadField = null;
053: public Object testThreadGroupField = null;
054: public Object testClassField = null;
055: public Object testClassLoaderField = null;
056: public Object testStringField = null;
057: public int[] testIntArrayField = null;
058: public String[] testStringArrayField = null;
059: public Object[] testObjectArrayField = null;
060:
061: /**
062: * This debuggee accesses all class fields and synchronizes with debugger.
063: */
064: public void run() {
065:
066: synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
067: logWriter.println("FieldDebuggee started");
068:
069: synchronizer
070: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
071: testBoolField = true;
072:
073: synchronizer
074: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
075: testByteField = 'k';
076:
077: synchronizer
078: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
079: testCharField = 'Q';
080:
081: synchronizer
082: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
083: testShortField = 127;
084:
085: synchronizer
086: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
087: testIntField = -1001;
088:
089: synchronizer
090: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
091: testLongField = 4000000000000000L;
092:
093: synchronizer
094: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
095: testFloatField = 100 * 100 * 100;
096:
097: synchronizer
098: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
099: testDoubleField = -1.1 / 100000.999999;
100:
101: synchronizer
102: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
103: testObjectField = new File("none");
104:
105: synchronizer
106: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
107: testThreadField = new Thread("myThread001");
108:
109: synchronizer
110: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
111: testThreadGroupField = new ThreadGroup("MyThreadGroup_000001");
112:
113: synchronizer
114: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
115: testClassField = System.out.getClass();
116:
117: synchronizer
118: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
119: testClassLoaderField = this .getClass().getClassLoader();
120:
121: synchronizer
122: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
123: testStringField = "String=Strong=Strung";
124:
125: synchronizer
126: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
127: testIntArrayField = new int[] { 1, 2, 3, };
128:
129: synchronizer
130: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
131: testStringArrayField = new String[] { "abc", "xyz", };
132:
133: synchronizer
134: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
135: testObjectArrayField = new Object[] { null, null, null,
136: new Long(99), "objobjobj", };
137:
138: synchronizer
139: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
140: logWriter.println("FieldDebuggee finished");
141: }
142: }
|