CVS: Tapestry/junit/src/net/sf/tapestry/junit/mock/c6 Nested.java,NONE,1.1.2.1 Four.java,NONE,1.1.2.1 FakeHandle.java,NONE,1.1.2.1 FakeEJBObject.java,NONE,1.1.2.1 Home.java,NONE,1.1.2.1 Three.java,NONE,1.1.2.1
Howard Lewis Ship <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/mock/c6
In directory sc8-pr-cvs1:/tmp/cvs-serv9155/junit/src/net/sf/tapestry/junit/mock/c6
Added Files:
Tag: hship-2-3
Nested.java Four.java FakeHandle.java FakeEJBObject.java
Home.java Three.java
Log Message:
Automatically register components as page listeners if they implement necessary interfaces
Major rework on page property persistance
[ 653358 ] IPage.getName() == qualified name
[ 608768 ] Changes saved AFTER IPage.detach()
--- NEW FILE: Nested.java ---
package net.sf.tapestry.junit.mock.c6;
import net.sf.tapestry.BaseComponent;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.event.PageDetachListener;
import net.sf.tapestry.event.PageEvent;
/**
* More testing of persistent component properties.
*
* @author Howard Lewis Ship
* @version $Id: Nested.java,v 1.1.2.1 2002/12/30 03:04:59 hship Exp $
* @since 2.4
*
**/
public class Nested extends BaseComponent implements PageDetachListener
{
private String _message;
public void initialize()
{
_message = "Nested";
}
public String getMessage()
{
return _message;
}
public void setMessage(String message)
{
_message = message;
fireObservedChange("message", message);
}
public void updateMessage(IRequestCycle cycle)
{
setMessage("Changed");
}
public void finishLoad()
{
initialize();
}
public void pageDetached(PageEvent event)
{
initialize();
}
}
--- NEW FILE: Four.java ---
package net.sf.tapestry.junit.mock.c6;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.html.BasePage;
/**
* Test a number of different property value types.
*
* @author Howard Lewis Ship
* @version $Id: Four.java,v 1.1.2.1 2002/12/30 03:04:59 hship Exp $
* @since 2.4
*
**/
public class Four extends BasePage
{
private boolean _booleanValue;
private byte _byteValue;
private short _shortValue;
private long _longValue;
private float _floatValue;
private double _doubleValue;
private char _charValue;
public void initialize()
{
_booleanValue = false;
_byteValue = 0;
_shortValue = 0;
_longValue = 0;
_floatValue = 0;
_doubleValue = 0;
_charValue = ' ';
}
public boolean getBooleanValue()
{
return _booleanValue;
}
public double getDoubleValue()
{
return _doubleValue;
}
public float getFloatValue()
{
return _floatValue;
}
public long getLongValue()
{
return _longValue;
}
public short getShortValue()
{
return _shortValue;
}
public void setBooleanValue(boolean booleanValue)
{
_booleanValue = booleanValue;
fireObservedChange("booleanValue", booleanValue);
}
public void setDoubleValue(double doubleValue)
{
_doubleValue = doubleValue;
fireObservedChange("doubleValue", _doubleValue);
}
public void setFloatValue(float floatValue)
{
_floatValue = floatValue;
fireObservedChange("floatValue", _floatValue);
}
public void setLongValue(long longValue)
{
_longValue = longValue;
fireObservedChange("longValue", _longValue);
}
public void setShortValue(short shortValue)
{
_shortValue = shortValue;
fireObservedChange("shortValue", _shortValue);
}
public char getCharValue()
{
return _charValue;
}
public void setCharValue(char charValue)
{
_charValue = charValue;
fireObservedChange("charValue", charValue);
}
public void change(IRequestCycle cycle)
{
setBooleanValue(true);
setCharValue('H');
setLongValue(1234567890123l);
setFloatValue(-1.5f);
setDoubleValue(22. / 7.);
setShortValue((short)127);
setByteValue((byte)27);
}
public byte getByteValue()
{
return _byteValue;
}
public void setByteValue(byte byteValue)
{
_byteValue = byteValue;
fireObservedChange("byteValue", byteValue);
}
}
--- NEW FILE: FakeHandle.java ---
package net.sf.tapestry.junit.mock.c6;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import javax.ejb.Handle;
/**
* Used for testing of page persistence.
*
* @author Howard Lewis Ship
* @version $Id: FakeHandle.java,v 1.1.2.1 2002/12/30 03:04:59 hship Exp $
* @since 2.4
*
**/
public class FakeHandle implements Handle
{
private FakeEJBObject _ejb;
public FakeHandle(FakeEJBObject ejb)
{
_ejb = ejb;
}
public EJBObject getEJBObject() throws RemoteException
{
return _ejb;
}
}
--- NEW FILE: FakeEJBObject.java ---
package net.sf.tapestry.junit.mock.c6;
import java.io.Serializable;
import java.rmi.RemoteException;
import javax.ejb.EJBHome;
import javax.ejb.EJBObject;
import javax.ejb.Handle;
import javax.ejb.RemoveException;
/**
* Used for testing of page persistence.
*
* @author Howard Lewis Ship
* @version $Id: FakeEJBObject.java,v 1.1.2.1 2002/12/30 03:04:59 hship Exp $
* @since 2.4
*
**/
public class FakeEJBObject implements EJBObject, Serializable
{
private int _value;
public FakeEJBObject(int value)
{
_value = value;
}
public EJBHome getEJBHome() throws RemoteException
{
return null;
}
public Handle getHandle() throws RemoteException
{
return new FakeHandle(this);
}
public Object getPrimaryKey() throws RemoteException
{
return null;
}
public boolean isIdentical(EJBObject arg0) throws RemoteException
{
return false;
}
public void remove() throws RemoteException, RemoveException
{
}
public String toString()
{
return "FakeEJBObject[" + _value + "]";
}
}
--- NEW FILE: Home.java ---
package net.sf.tapestry.junit.mock.c6;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.html.BasePage;
/**
* Used for testing page property persistance.
*
* @author Howard Lewis Ship
* @version $Id: Home.java,v 1.1.2.1 2002/12/30 03:04:59 hship Exp $
* @since 2.4
*
**/
public class Home extends BasePage
{
private String _message;
public void initialize()
{
_message = "Hello";
}
public String getMessage()
{
return _message;
}
public void setMessage(String message)
{
_message = message;
fireObservedChange("message", message);
}
public void updateMessage(IRequestCycle cycle)
{
setMessage("Changed");
}
}
--- NEW FILE: Three.java ---
package net.sf.tapestry.junit.mock.c6;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.html.BasePage;
/**
* Tests for when a persistent property is an EJB reference.
*
* @author Howard Lewis Ship
* @version $Id: Three.java,v 1.1.2.1 2002/12/30 03:04:59 hship Exp $
* @since 2.4
*
**/
public class Three extends BasePage
{
private FakeEJBObject _ejb;
public void initialize()
{
_ejb = null;
}
public FakeEJBObject getEjb()
{
return _ejb;
}
public void setEjb(FakeEJBObject ejb)
{
_ejb = ejb;
fireObservedChange("ejb", ejb);
}
public void create(IRequestCycle cycle)
{
setEjb(new FakeEJBObject(997));
}
public void discard(IRequestCycle cycle)
{
cycle.discardPage(getPageName());
}
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf