001: /*
002: * Copyright (c) 2004 Your Corporation. All Rights Reserved.
003: */
004: package com.canoo.webtest.extension.applet;
005:
006: import com.canoo.webtest.steps.Step;
007: import org.netbeans.jemmy.JemmyException;
008:
009: import java.io.Serializable;
010: import java.net.URL;
011: import java.util.ArrayList;
012: import java.util.HashMap;
013: import java.util.List;
014: import java.util.Map;
015:
016: /**
017: * @author Denis N. Antonioli
018: */
019: public class AppletPluginResults implements Serializable {
020: private final Map fFrames;
021: private final List fProperties;
022:
023: private Integer fReturnValue;
024: private String fException;
025: private String fJemmyException;
026:
027: {
028: fFrames = new HashMap();
029: fProperties = new ArrayList();
030: }
031:
032: public void setFrame(String target, URL url) {
033: fFrames.put(target, url);
034: }
035:
036: public Map getFrames() {
037: return fFrames;
038: }
039:
040: public void setReturnValue(Integer returnValue) {
041: fReturnValue = returnValue;
042: }
043:
044: public Integer getReturnValue() {
045: return fReturnValue;
046: }
047:
048: public void setException(Throwable exception) {
049: // if (exception instanceof JemmyException) {
050: //
051: // }
052: fException = getExceptionMessage(exception);
053: }
054:
055: private static String getExceptionMessage(Throwable exception) {
056: final String message = exception.getMessage();
057: if (message != null) {
058: return message;
059: }
060: return exception.toString();
061: }
062:
063: public String getException() {
064: return fException;
065: }
066:
067: public void setJemmyException(JemmyException jemmyException) {
068: fJemmyException = getExceptionMessage(jemmyException);
069: }
070:
071: public String getJemmyException() {
072: return fJemmyException;
073: }
074:
075: public void setProperty(final String name, final String value,
076: final String propertyType) {
077: fProperties.add(new Property(name, value, propertyType));
078: }
079:
080: public List getProperties() {
081: return fProperties;
082: }
083:
084: public static class Property implements Serializable {
085: public static final String DEFAULT = Step.PROPERTY_TYPE_DEFAULT;
086: public static final String ANT = Step.PROPERTY_TYPE_ANT;
087: public static final String DYNAMIC = Step.PROPERTY_TYPE_DYNAMIC;
088:
089: private final String fName;
090: private final String fValue;
091: private final String fType;
092:
093: public Property(final String name, final String value,
094: final String type) {
095: fName = name;
096: fValue = value;
097: fType = type;
098: }
099:
100: public String getName() {
101: return fName;
102: }
103:
104: public String getValue() {
105: return fValue;
106: }
107:
108: public String getType() {
109: return fType;
110: }
111: }
112: }
|