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 Anatoly F. Bondarenko
021: * @version $Revision: 1.2 $
022: */
023:
024: /**
025: * Created on 13.07.2005
026: */package org.apache.harmony.jpda.tests.jdwp.ObjectReference;
027:
028: import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
029: import org.apache.harmony.jpda.tests.share.SyncDebuggee;
030:
031: public class SetValues004Debuggee extends SyncDebuggee {
032:
033: static String passedStatus = "PASSED";
034: static String failedStatus = "FAILED";
035: static String status = passedStatus;
036:
037: static SetValues004Debuggee testedObject;
038:
039: int intArrayField[]; // JDWP_TAG_ARRAY = 91
040: SetValues004Debuggee objectArrayField[]; // JDWP_TAG_ARRAY = 91
041: SetValues004Debuggee objectField; // JDWP_TAG_OBJECT = 76
042: String stringField; // JDWP_TAG_STRING = 115
043: Thread threadField; // JDWP_TAG_THREAD = 116
044: ThreadGroup threadGroupField; // JDWP_TAG_THREAD_GROUP = 103
045: Class classField; // JDWP_TAG_CLASS_OBJECT = 99
046: ClassLoader classLoaderField; // DWP_TAG_CLASS_LOADER = 108
047:
048: public void run() {
049:
050: logWriter.println("--> Debuggee: SetValues004Debuggee: START");
051: testedObject = new SetValues004Debuggee();
052:
053: testedObject.intArrayField = new int[1];
054: testedObject.intArrayField[0] = 999;
055: testedObject.objectArrayField = new SetValues004Debuggee[1];
056: testedObject.objectArrayField[0] = new SetValues004Debuggee();
057: testedObject.objectField = new SetValues004Debuggee();
058: testedObject.stringField = "stringField";
059: testedObject.threadField = new SetValues004DebuggeeThread();
060: testedObject.threadGroupField = new ThreadGroup(
061: "ThreadGroupName");
062: testedObject.classField = SetValues004Debuggee.class;
063: testedObject.classLoaderField = testedObject.classField
064: .getClassLoader();
065:
066: logWriter
067: .println("\n--> Debuggee: SetValues004Debuggee: Before ObjectReference::SetValues command:");
068: logWriter.println("--> intArrayField value = "
069: + testedObject.intArrayField);
070: logWriter.println("--> objectArrayField value = "
071: + testedObject.objectArrayField);
072: logWriter.println("--> objectField value = "
073: + testedObject.objectField);
074: logWriter.println("--> stringField value = "
075: + testedObject.stringField);
076: logWriter.println("--> threadField value = "
077: + testedObject.threadField);
078: logWriter.println("--> threadGroupField value = "
079: + testedObject.threadGroupField);
080: logWriter.println("--> classField value = "
081: + testedObject.classField);
082: logWriter.println("--> classLoaderField value = "
083: + testedObject.classLoaderField);
084:
085: synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
086: synchronizer
087: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
088:
089: logWriter
090: .println("\n--> Debuggee: SetValues004Debuggee: After ObjectReference::SetValues command:");
091: logWriter.println("--> intArrayField value = "
092: + testedObject.intArrayField);
093: if (testedObject.intArrayField != null) {
094: logWriter
095: .println("##> Debuggee: FAILURE: Unexpected value");
096: logWriter.println("##> Expected value = " + null);
097: status = failedStatus;
098: } else {
099: logWriter.println("--> Debuggee: OK. Expected value");
100: }
101:
102: logWriter.println("--> objectArrayField value = "
103: + testedObject.objectArrayField);
104: if (testedObject.objectArrayField != null) {
105: logWriter
106: .println("##> Debuggee: FAILURE: Unexpected value");
107: logWriter.println("##> Expected value = " + null);
108: status = failedStatus;
109: } else {
110: logWriter.println("--> Debuggee: OK. Expected value");
111: }
112:
113: logWriter.println("--> objectField value = "
114: + testedObject.objectField);
115: if (testedObject.objectField != null) {
116: logWriter
117: .println("##> Debuggee: FAILURE: Unexpected value");
118: logWriter.println("##> Expected value = " + null);
119: status = failedStatus;
120: } else {
121: logWriter.println("--> Debuggee: OK. Expected value");
122: }
123:
124: logWriter.println("--> stringField value = "
125: + testedObject.stringField);
126: if (testedObject.stringField != null) {
127: logWriter
128: .println("##> Debuggee: FAILURE: Unexpected value");
129: logWriter.println("##> Expected value = " + null);
130: status = failedStatus;
131: } else {
132: logWriter.println("--> Debuggee: OK. Expected value");
133: }
134:
135: logWriter.println("--> threadField value = "
136: + testedObject.threadField);
137: if (testedObject.threadField != null) {
138: logWriter
139: .println("##> Debuggee: FAILURE: Unexpected value");
140: logWriter.println("##> Expected value = " + null);
141: status = failedStatus;
142: } else {
143: logWriter.println("--> Debuggee: OK. Expected value");
144: }
145:
146: logWriter.println("--> threadGroupField value = "
147: + testedObject.threadGroupField);
148: if (testedObject.threadGroupField != null) {
149: logWriter
150: .println("##> Debuggee: FAILURE: Unexpected value");
151: logWriter.println("##> Expected value = " + null);
152: status = failedStatus;
153: } else {
154: logWriter.println("--> Debuggee: OK. Expected value");
155: }
156:
157: logWriter.println("--> classField value = "
158: + testedObject.classField);
159: if (testedObject.classField != null) {
160: logWriter
161: .println("##> Debuggee: FAILURE: Unexpected value");
162: logWriter.println("##> Expected value = " + null);
163: status = failedStatus;
164: } else {
165: logWriter.println("--> Debuggee: OK. Expected value");
166: }
167:
168: logWriter.println("--> classLoaderField value = "
169: + testedObject.classLoaderField);
170: if (testedObject.classLoaderField != null) {
171: logWriter
172: .println("##> Debuggee: FAILURE: Unexpected value");
173: logWriter.println("##> Expected value = " + null);
174: status = failedStatus;
175: } else {
176: logWriter.println("--> Debuggee: OK. Expected value");
177: }
178:
179: if (status.equals(failedStatus)) {
180: logWriter.println("\n##> Debuggee: Check status = FAILED");
181: } else {
182: logWriter.println("\n--> Debuggee: Check status = PASSED");
183: }
184:
185: logWriter
186: .println("--> Debuggee: Send check status for SetValues004Test...\n");
187: synchronizer.sendMessage(status);
188:
189: logWriter.println("--> Debuggee: SetValues004Debuggee: FINISH");
190: }
191:
192: public static void main(String[] args) {
193: runDebuggee(SetValues004Debuggee.class);
194: }
195: }
196:
197: class SetValues004DebuggeeThread extends Thread {
198: public void myMethod() {
199: }
200: }
|