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 28.02.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 SetValuesDebuggee extends SyncDebuggee {
032:
033: static SetValuesDebuggee setValuesDebuggeeObject;
034: static String passedStatus = "PASSED";
035: static String failedStatus = "FAILED";
036: static String status = passedStatus;
037:
038: int intField;
039: long longField;
040: SetValuesDebuggee objectField;
041: static int staticIntField;
042: private int privateIntField;
043: final int finalIntField = 12345;
044:
045: public void run() {
046: logWriter.println("--> Debuggee: SetValuesDebuggee: START");
047: setValuesDebuggeeObject = new SetValuesDebuggee();
048:
049: synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY);
050: synchronizer
051: .receiveMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
052: logWriter
053: .println("--> Debuggee: SetValuesDebuggee: CHECK for set fields...");
054: String status = passedStatus;
055:
056: logWriter.println("\n--> intField value = "
057: + setValuesDebuggeeObject.intField);
058: if (setValuesDebuggeeObject.intField != 1111) {
059: logWriter
060: .println("##> Debuggee: FAILURE: Unexpected value");
061: logWriter.println("##> Expected value = 1111");
062: status = failedStatus;
063: } else {
064: logWriter.println("--> Debuggee: PASSED: Expected value");
065: }
066:
067: logWriter.println("\n--> longField value = "
068: + setValuesDebuggeeObject.longField);
069: if (setValuesDebuggeeObject.longField != 22222222) {
070: logWriter
071: .println("##> Debuggee: FAILURE: Unexpected value");
072: logWriter.println("##> Expected value = 22222222");
073: status = failedStatus;
074: } else {
075: logWriter.println("--> Debuggee: PASSED: Expected value");
076: }
077:
078: logWriter.println("\n--> objectField value = "
079: + setValuesDebuggeeObject.objectField);
080: if (!setValuesDebuggeeObject
081: .equals(setValuesDebuggeeObject.objectField)) {
082: logWriter
083: .println("##> Debuggee: FAILURE: Unexpected value");
084: logWriter.println("##> Expected value = "
085: + setValuesDebuggeeObject);
086: status = failedStatus;
087: } else {
088: logWriter.println("--> Debuggee: PASSED: Expected value");
089: }
090:
091: logWriter.println("\n--> staticIntField value = "
092: + staticIntField);
093: if (staticIntField != 5555) {
094: logWriter
095: .println("##> Debuggee: FAILURE: Unexpected value");
096: logWriter.println("##> Expected value = 5555");
097: status = failedStatus;
098: } else {
099: logWriter.println("--> Debuggee: PASSED: Expected value");
100: }
101:
102: logWriter.println("\n--> privateIntField value = "
103: + setValuesDebuggeeObject.privateIntField);
104: if (setValuesDebuggeeObject.privateIntField != 7777) {
105: logWriter
106: .println("##> Debuggee: FAILURE: Unexpected value");
107: logWriter.println("##> Expected value = 7777");
108: status = failedStatus;
109: } else {
110: logWriter.println("--> Debuggee: PASSED: Expected value");
111: }
112:
113: logWriter.println("\n--> finalIntField value = "
114: + setValuesDebuggeeObject.finalIntField);
115: if (setValuesDebuggeeObject.finalIntField != 12345) {
116: logWriter
117: .println("##> Debuggee: FAILURE: Unexpected value");
118: logWriter.println("##> Expected value = 12345");
119: status = failedStatus;
120: } else {
121: logWriter.println("--> Debuggee: PASSED: Expected value");
122: }
123:
124: if (status.equals(failedStatus)) {
125: logWriter.println("\n##> Debuggee: Check status = FAILED");
126: } else {
127: logWriter.println("\n--> Debuggee: Check status = PASSED");
128: }
129:
130: logWriter
131: .println("--> Debuggee: Send check status for SetValuesTest...\n");
132: synchronizer.sendMessage(status);
133: logWriter.println("--> Debuggee: SetValuesDebuggee: FINISH");
134: }
135:
136: public static void main(String[] args) {
137: runDebuggee(SetValuesDebuggee.class);
138: }
139:
140: }
|