[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit FixedURLWebRequestSource.java,1.1,1.2 Web
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-09-27 15:49:04
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv22163/src/com/meterware/httpunit Modified Files: FixedURLWebRequestSource.java WebLink.java WebRequestSource.java Log Message: Made Link href Javascript property writeable Index: FixedURLWebRequestSource.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FixedURLWebRequestSource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FixedURLWebRequestSource.java 29 Aug 2002 15:32:44 -0000 1.1 +++ FixedURLWebRequestSource.java 27 Sep 2002 15:49:02 -0000 1.2 @@ -27,6 +27,7 @@ /** + * An implementation of web request source whose URL does not change under user action. * * @author <a href="mailto:rus...@ac...">Russell Gold</a> **/ @@ -74,6 +75,13 @@ protected void addPresetParameter( String name, String value ) { _presetParameterMap.put( name, HttpUnitUtils.withNewValue( (String[]) _presetParameterMap.get( name ), value ) ); _presetParameterList.add( new PresetParameter( name, value ) ); + } + + + protected void setDestination( String destination ) { + super.setDestination( destination ); + _presetParameterList = null; + _presetParameterMap = null; } Index: WebLink.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebLink.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- WebLink.java 13 Sep 2002 14:17:25 -0000 1.28 +++ WebLink.java 27 Sep 2002 15:49:02 -0000 1.29 @@ -46,16 +46,10 @@ /** - * Returns the URL referenced by this link. This may be a relative URL. + * Returns the URL referenced by this link. This may be a relative URL. It will not include any fragment identifier. **/ public String getURLString() { - String href = NodeUtils.getNodeAttribute( getNode(), "href" ); - final int hashIndex = href.indexOf( '#' ); - if (hashIndex < 0) { - return href; - } else { - return href.substring( 0, hashIndex ); - } + return getRelativeURL(); } @@ -104,6 +98,15 @@ return getReference().toExternalForm(); } else { return super.get( propertyName ); + } + } + + + public void set( String propertyName, Object value ) { + if (propertyName.equals( "href" )) { + setDestination( (String) value ); + } else { + super.set( propertyName, value ); } } Index: WebRequestSource.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- WebRequestSource.java 26 Sep 2002 18:22:33 -0000 1.14 +++ WebRequestSource.java 27 Sep 2002 15:49:02 -0000 1.15 @@ -112,7 +112,7 @@ } - private String getRelativeURL() { + protected String getRelativeURL() { String result = trimFragment( getDestination() ); if (result.trim().length() == 0) result = getBaseURL().getFile(); return result; |