moving unit tests from .testsuite -> .transaction

fixed externals issue with .portlet that caused build failure
This commit is contained in:
Chris Beams 2008-12-17 19:46:35 +00:00
parent efcc9b6448
commit cac2c52e60
38 changed files with 137 additions and 150 deletions

View File

@ -0,0 +1,31 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.transaction.interceptor;
import org.springframework.core.NestedRuntimeException;
/**
* An example {@link RuntimeException} for use in testing rollback rules.
*
* @author Chris Beams
*/
@SuppressWarnings("serial")
class MyRuntimeException extends NestedRuntimeException {
public MyRuntimeException(String msg) {
super(msg);
}
}

View File

@ -16,24 +16,27 @@
package org.springframework.transaction.interceptor;
import javax.servlet.ServletException;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import java.io.IOException;
import junit.framework.TestCase;
import org.springframework.beans.FatalBeanException;
import org.springframework.mail.MailSendException;
/**
* Unit tests for the {@link RollbackRuleAttribute} class.
*
* @author Rod Johnson
* @author Rick Evans
* @author Chris Beams
* @since 09.04.2003
*/
public class RollbackRuleTests extends TestCase {
public void testFoundImmediatelyWithString() {
RollbackRuleAttribute rr = new RollbackRuleAttribute("java.lang.Exception");
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Exception.class.getName());
assertTrue(rr.getDepth(new Exception()) == 0);
}
@ -43,20 +46,20 @@ public class RollbackRuleTests extends TestCase {
}
public void testNotFound() {
RollbackRuleAttribute rr = new RollbackRuleAttribute("javax.servlet.ServletException");
assertTrue(rr.getDepth(new MailSendException("")) == -1);
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.io.IOException.class.getName());
assertTrue(rr.getDepth(new MyRuntimeException("")) == -1);
}
public void testAncestry() {
RollbackRuleAttribute rr = new RollbackRuleAttribute("java.lang.Exception");
// Exception -> Runtime -> NestedRuntime -> MailException -> MailSendException
assertTrue(rr.getDepth(new MailSendException("")) == 4);
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Exception.class.getName());
// Exception -> Runtime -> NestedRuntime -> MyRuntimeException
assertThat(rr.getDepth(new MyRuntimeException("")), equalTo(3));
}
public void testAlwaysTrueForThrowable() {
RollbackRuleAttribute rr = new RollbackRuleAttribute("java.lang.Throwable");
assertTrue(rr.getDepth(new MailSendException("")) > 0);
assertTrue(rr.getDepth(new ServletException()) > 0);
RollbackRuleAttribute rr = new RollbackRuleAttribute(java.lang.Throwable.class.getName());
assertTrue(rr.getDepth(new MyRuntimeException("")) > 0);
assertTrue(rr.getDepth(new IOException()) > 0);
assertTrue(rr.getDepth(new FatalBeanException(null,null)) > 0);
assertTrue(rr.getDepth(new RuntimeException()) > 0);
}

View File

@ -16,72 +16,77 @@
package org.springframework.transaction.interceptor;
import static org.junit.Assert.*;
import java.io.IOException;
import java.rmi.RemoteException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import javax.servlet.ServletException;
import junit.framework.TestCase;
import org.springframework.mail.MailSendException;
import org.junit.Test;
import org.springframework.transaction.TransactionDefinition;
/**
* @author Rod Johnson
* @author Juergen Hoeller
* @author Rick Evans
* @author Chris Beams
* @since 09.04.2003
*/
public class RuleBasedTransactionAttributeTests extends TestCase {
public class RuleBasedTransactionAttributeTests {
@Test
public void testDefaultRule() {
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute();
assertTrue(rta.rollbackOn(new RuntimeException()));
assertTrue(rta.rollbackOn(new MailSendException("")));
assertTrue(rta.rollbackOn(new MyRuntimeException("")));
assertFalse(rta.rollbackOn(new Exception()));
assertFalse(rta.rollbackOn(new ServletException()));
assertFalse(rta.rollbackOn(new IOException()));
}
/**
* Test one checked exception that should roll back.
*/
@Test
public void testRuleForRollbackOnChecked() {
List list = new LinkedList();
list.add(new RollbackRuleAttribute("javax.servlet.ServletException"));
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
list.add(new RollbackRuleAttribute(IOException.class.getName()));
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
assertTrue(rta.rollbackOn(new RuntimeException()));
assertTrue(rta.rollbackOn(new MailSendException("")));
assertTrue(rta.rollbackOn(new MyRuntimeException("")));
assertFalse(rta.rollbackOn(new Exception()));
// Check that default behaviour is overridden
assertTrue(rta.rollbackOn(new ServletException()));
assertTrue(rta.rollbackOn(new IOException()));
}
@Test
public void testRuleForCommitOnUnchecked() {
List list = new LinkedList();
list.add(new NoRollbackRuleAttribute("org.springframework.mail.MailSendException"));
list.add(new RollbackRuleAttribute("javax.servlet.ServletException"));
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
list.add(new NoRollbackRuleAttribute(MyRuntimeException.class.getName()));
list.add(new RollbackRuleAttribute(IOException.class.getName()));
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
assertTrue(rta.rollbackOn(new RuntimeException()));
// Check default behaviour is overridden
assertFalse(rta.rollbackOn(new MailSendException("")));
assertFalse(rta.rollbackOn(new MyRuntimeException("")));
assertFalse(rta.rollbackOn(new Exception()));
// Check that default behaviour is overridden
assertTrue(rta.rollbackOn(new ServletException()));
assertTrue(rta.rollbackOn(new IOException()));
}
@Test
public void testRuleForSelectiveRollbackOnCheckedWithString() {
List l = new LinkedList();
l.add(new RollbackRuleAttribute("java.rmi.RemoteException"));
List<RollbackRuleAttribute> l = new LinkedList<RollbackRuleAttribute>();
l.add(new RollbackRuleAttribute(java.rmi.RemoteException.class.getName()));
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, l);
doTestRuleForSelectiveRollbackOnChecked(rta);
}
@Test
public void testRuleForSelectiveRollbackOnCheckedWithClass() {
List l = Collections.singletonList(new RollbackRuleAttribute(RemoteException.class));
List<RollbackRuleAttribute> l = Collections.singletonList(new RollbackRuleAttribute(RemoteException.class));
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, l);
doTestRuleForSelectiveRollbackOnChecked(rta);
}
@ -95,37 +100,40 @@ public class RuleBasedTransactionAttributeTests extends TestCase {
}
/**
* Check that a rule can cause commit on a ServletException
* Check that a rule can cause commit on a IOException
* when Exception prompts a rollback.
*/
@Test
public void testRuleForCommitOnSubclassOfChecked() {
List list = new LinkedList();
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
// Note that it's important to ensure that we have this as
// a FQN: otherwise it will match everything!
list.add(new RollbackRuleAttribute("java.lang.Exception"));
list.add(new NoRollbackRuleAttribute("ServletException"));
list.add(new NoRollbackRuleAttribute("IOException"));
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
assertTrue(rta.rollbackOn(new RuntimeException()));
assertTrue(rta.rollbackOn(new Exception()));
// Check that default behaviour is overridden
assertFalse(rta.rollbackOn(new ServletException()));
assertFalse(rta.rollbackOn(new IOException()));
}
@Test
public void testRollbackNever() {
List list = new LinkedList();
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
list.add(new NoRollbackRuleAttribute("Throwable"));
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
assertFalse(rta.rollbackOn(new Throwable()));
assertFalse(rta.rollbackOn(new RuntimeException()));
assertFalse(rta.rollbackOn(new MailSendException("")));
assertFalse(rta.rollbackOn(new MyRuntimeException("")));
assertFalse(rta.rollbackOn(new Exception()));
assertFalse(rta.rollbackOn(new ServletException()));
assertFalse(rta.rollbackOn(new IOException()));
}
@Test
public void testToStringMatchesEditor() {
List list = new LinkedList();
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
list.add(new NoRollbackRuleAttribute("Throwable"));
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
@ -135,16 +143,17 @@ public class RuleBasedTransactionAttributeTests extends TestCase {
assertFalse(rta.rollbackOn(new Throwable()));
assertFalse(rta.rollbackOn(new RuntimeException()));
assertFalse(rta.rollbackOn(new MailSendException("")));
assertFalse(rta.rollbackOn(new MyRuntimeException("")));
assertFalse(rta.rollbackOn(new Exception()));
assertFalse(rta.rollbackOn(new ServletException()));
assertFalse(rta.rollbackOn(new IOException()));
}
/**
* See <a href="http://forum.springframework.org/showthread.php?t=41350">this forum post</a>.
*/
@Test
public void testConflictingRulesToDetermineExactContract() {
List list = new LinkedList();
List<RollbackRuleAttribute> list = new LinkedList<RollbackRuleAttribute>();
list.add(new NoRollbackRuleAttribute(MyBusinessWarningException.class));
list.add(new RollbackRuleAttribute(MyBusinessException.class));
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, list);
@ -154,9 +163,11 @@ public class RuleBasedTransactionAttributeTests extends TestCase {
}
public static class MyBusinessException extends Exception {}
@SuppressWarnings("serial")
private static class MyBusinessException extends Exception {}
public static final class MyBusinessWarningException extends MyBusinessException {}
@SuppressWarnings("serial")
private static final class MyBusinessWarningException extends MyBusinessException {}
}

View File

@ -16,11 +16,12 @@
package org.springframework.transaction.interceptor;
import javax.servlet.ServletException;
import junit.framework.TestCase;
import static org.junit.Assert.*;
import org.springframework.mail.MailSendException;
import java.io.IOException;
import org.junit.Test;
import org.springframework.transaction.TransactionDefinition;
/**
@ -28,10 +29,12 @@ import org.springframework.transaction.TransactionDefinition;
*
* @author Rod Johnson
* @author Juergen Hoeller
* @author Chris Beams
* @since 26.04.2003
*/
public class TransactionAttributeEditorTests extends TestCase {
public class TransactionAttributeEditorTests {
@Test
public void testNull() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText(null);
@ -39,6 +42,7 @@ public class TransactionAttributeEditorTests extends TestCase {
assertTrue(ta == null);
}
@Test
public void testEmptyString() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("");
@ -46,6 +50,7 @@ public class TransactionAttributeEditorTests extends TestCase {
assertTrue(ta == null);
}
@Test
public void testValidPropagationCodeOnly() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("PROPAGATION_REQUIRED");
@ -56,17 +61,14 @@ public class TransactionAttributeEditorTests extends TestCase {
assertTrue(!ta.isReadOnly());
}
@Test(expected=IllegalArgumentException.class)
public void testInvalidPropagationCodeOnly() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
try {
// should have failed with bogus propagation code
pe.setAsText("XXPROPAGATION_REQUIRED");
fail("Should have failed with bogus propagation code");
}
catch (IllegalArgumentException ex) {
// Ok
}
}
@Test
public void testValidPropagationCodeAndIsolationCode() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("PROPAGATION_REQUIRED, ISOLATION_READ_UNCOMMITTED");
@ -76,20 +78,17 @@ public class TransactionAttributeEditorTests extends TestCase {
assertTrue(ta.getIsolationLevel() == TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
}
@Test(expected=IllegalArgumentException.class)
public void testValidPropagationAndIsolationCodesAndInvalidRollbackRule() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
try {
// should fail with bogus rollback rule
pe.setAsText("PROPAGATION_REQUIRED,ISOLATION_READ_UNCOMMITTED,XXX");
fail("Should have failed with bogus rollback rule");
}
catch (IllegalArgumentException ex) {
// Ok
}
}
@Test
public void testValidPropagationCodeAndIsolationCodeAndRollbackRules1() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("PROPAGATION_MANDATORY,ISOLATION_REPEATABLE_READ,timeout_10,-ServletException,+MailSendException");
pe.setAsText("PROPAGATION_MANDATORY,ISOLATION_REPEATABLE_READ,timeout_10,-IOException,+MyRuntimeException");
TransactionAttribute ta = (TransactionAttribute) pe.getValue();
assertNotNull(ta);
assertEquals(ta.getPropagationBehavior(), TransactionDefinition.PROPAGATION_MANDATORY);
@ -99,13 +98,14 @@ public class TransactionAttributeEditorTests extends TestCase {
assertTrue(ta.rollbackOn(new RuntimeException()));
assertFalse(ta.rollbackOn(new Exception()));
// Check for our bizarre customized rollback rules
assertTrue(ta.rollbackOn(new ServletException()));
assertTrue(!ta.rollbackOn(new MailSendException("")));
assertTrue(ta.rollbackOn(new IOException()));
assertTrue(!ta.rollbackOn(new MyRuntimeException("")));
}
@Test
public void testValidPropagationCodeAndIsolationCodeAndRollbackRules2() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("+ServletException,readOnly,ISOLATION_READ_COMMITTED,-MailSendException,PROPAGATION_SUPPORTS");
pe.setAsText("+IOException,readOnly,ISOLATION_READ_COMMITTED,-MyRuntimeException,PROPAGATION_SUPPORTS");
TransactionAttribute ta = (TransactionAttribute) pe.getValue();
assertNotNull(ta);
assertEquals(ta.getPropagationBehavior(), TransactionDefinition.PROPAGATION_SUPPORTS);
@ -115,10 +115,11 @@ public class TransactionAttributeEditorTests extends TestCase {
assertTrue(ta.rollbackOn(new RuntimeException()));
assertFalse(ta.rollbackOn(new Exception()));
// Check for our bizarre customized rollback rules
assertFalse(ta.rollbackOn(new ServletException()));
assertTrue(ta.rollbackOn(new MailSendException("")));
assertFalse(ta.rollbackOn(new IOException()));
assertTrue(ta.rollbackOn(new MyRuntimeException("")));
}
@Test
public void testDefaultTransactionAttributeToString() {
DefaultTransactionAttribute source = new DefaultTransactionAttribute();
source.setPropagationBehavior(TransactionDefinition.PROPAGATION_SUPPORTS);
@ -143,6 +144,7 @@ public class TransactionAttributeEditorTests extends TestCase {
assertEquals(ta, source);
}
@Test
public void testRuleBasedTransactionAttributeToString() {
RuleBasedTransactionAttribute source = new RuleBasedTransactionAttribute();
source.setPropagationBehavior(TransactionDefinition.PROPAGATION_SUPPORTS);

View File

@ -16,17 +16,13 @@
package org.springframework.transaction.interceptor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.servlet.ServletException;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.transaction.TransactionDefinition;
@ -37,6 +33,7 @@ import org.springframework.transaction.TransactionDefinition;
* @author Colin Sampaleanu
* @author Juergen Hoeller
* @author Rick Evans
* @author Chris Beams
* @since 15.10.2003
* @see org.springframework.transaction.interceptor.TransactionProxyFactoryBean
*/
@ -52,17 +49,18 @@ public final class TransactionAttributeSourceTests {
tas.setTransactionAttribute(new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_SUPPORTS));
ta = tas.getTransactionAttribute(
ServletException.class.getMethod("getMessage", (Class[]) null), ServletException.class);
IOException.class.getMethod("getMessage", (Class[]) null), IOException.class);
assertNotNull(ta);
assertTrue(TransactionDefinition.PROPAGATION_SUPPORTS == ta.getPropagationBehavior());
}
@Ignore
@SuppressWarnings("unchecked")
@Ignore // no longer works now that setMethodMap has been parameterized
@Test
public void testMethodMapTransactionAttributeSource() throws NoSuchMethodException {
MethodMapTransactionAttributeSource tas = new MethodMapTransactionAttributeSource();
Map methodMap = new HashMap();
methodMap.put(Object.class.getName() + ".hashCode", "PROPAGATION_REQUIRED");
methodMap.put(Object.class.getName() + ".hashCode", TransactionDefinition.PROPAGATION_REQUIRED);
methodMap.put(Object.class.getName() + ".toString",
new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_SUPPORTS));
tas.setMethodMap(methodMap);
@ -76,7 +74,8 @@ public final class TransactionAttributeSourceTests {
assertEquals(TransactionDefinition.PROPAGATION_SUPPORTS, ta.getPropagationBehavior());
}
@Ignore
@SuppressWarnings("unchecked")
@Ignore // no longer works now that setMethodMap has been parameterized
@Test
public void testMethodMapTransactionAttributeSourceWithLazyInit() throws NoSuchMethodException {
MethodMapTransactionAttributeSource tas = new MethodMapTransactionAttributeSource();
@ -94,7 +93,8 @@ public final class TransactionAttributeSourceTests {
assertEquals(TransactionDefinition.PROPAGATION_SUPPORTS, ta.getPropagationBehavior());
}
@Ignore
@SuppressWarnings("unchecked")
@Ignore // no longer works now that setMethodMap has been parameterized
@Test
public void testNameMatchTransactionAttributeSource() throws NoSuchMethodException {
NameMatchTransactionAttributeSource tas = new NameMatchTransactionAttributeSource();

View File

@ -10,7 +10,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.core"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.web"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.web.servlet"/>
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-2.5.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-sources-2.5.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/javax.portlet/com.springsource.javax.portlet/1.0.0/com.springsource.javax.portlet-1.0.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.fileupload/1.2.0/com.springsource.org.apache.commons.fileupload-1.2.0.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.fileupload/1.2.0/com.springsource.org.apache.commons.fileupload-sources-1.2.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar" sourcepath="/IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-sources-1.1.1.jar"/>
@ -18,5 +17,10 @@
<classpathentry kind="var" path="IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3/com.springsource.org.objectweb.asm-sources-2.2.3.jar"/>
<classpathentry kind="var" path="IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-2.2.3.jar" sourcepath="/IVY_CACHE/org.objectweb.asm/com.springsource.org.objectweb.asm.commons/2.2.3/com.springsource.org.objectweb.asm.commons-sources-2.2.3.jar"/>
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp/2.1.0/com.springsource.javax.servlet.jsp-2.1.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp/2.1.0/com.springsource.javax.servlet.jsp-sources-2.1.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-2.5.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-sources-2.5.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp.jstl/1.1.2/com.springsource.javax.servlet.jsp.jstl-1.1.2.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp.jstl/1.1.2/com.springsource.javax.servlet.jsp.jstl-sources-1.1.2.jar"/>
<classpathentry kind="var" path="IVY_CACHE/org.apache.taglibs/com.springsource.org.apache.taglibs.standard/1.1.2/com.springsource.org.apache.taglibs.standard-1.1.2.jar" sourcepath="/IVY_CACHE/org.apache.taglibs/com.springsource.org.apache.taglibs.standard/1.1.2/com.springsource.org.apache.taglibs.standard-sources-1.1.2.jar"/>
<classpathentry kind="var" path="IVY_CACHE/javax.el/com.springsource.javax.el/1.0.0/com.springsource.javax.el-1.0.0.jar" sourcepath="/IVY_CACHE/javax.el/com.springsource.javax.el/1.0.0/com.springsource.javax.el-sources-1.0.0.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -20,8 +20,11 @@
</publications>
<dependencies>
<dependency org="javax.el" name="com.springsource.javax.el" rev="1.0.0" conf="provided->compile"/>
<dependency org="javax.portlet" name="com.springsource.javax.portlet" rev="1.0.0" conf="provided->compile"/>
<dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="2.5.0" conf="provided->compile"/>
<dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="2.5.0" conf="compile->compile"/>
<dependency org="javax.servlet" name="com.springsource.javax.servlet.jsp" rev="2.1.0" conf="test->compile"/>
<dependency org="javax.servlet" name="com.springsource.javax.servlet.jsp.jstl" rev="1.1.2" conf="test->compile"/>
<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.fileupload" rev="1.2.0" conf="optional, commons-fileupload->compile"/>
<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.logging" rev="1.1.1" conf="compile->compile"/>
<dependency org="org.springframework" name="org.springframework.beans" rev="latest.integration" conf="compile->compile"/>

View File

@ -1,67 +0,0 @@
/*
* Copyright 2002-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.mock.web;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.ServletInputStream;
import org.springframework.util.Assert;
/**
* Delegating implementation of {@link javax.servlet.ServletInputStream}.
*
* <p>Used by {@link org.springframework.mock.web.MockHttpServletRequest}; typically not directly
* used for testing application controllers.
*
* @author Juergen Hoeller
* @since 1.0.2
* @see org.springframework.mock.web.MockHttpServletRequest
*/
public class DelegatingServletInputStream extends ServletInputStream {
private final InputStream sourceStream;
/**
* Create a DelegatingServletInputStream for the given source stream.
* @param sourceStream the source stream (never <code>null</code>)
*/
public DelegatingServletInputStream(InputStream sourceStream) {
Assert.notNull(sourceStream, "Source InputStream must not be null");
this.sourceStream = sourceStream;
}
/**
* Return the underlying source stream (never <code>null</code>).
*/
public final InputStream getSourceStream() {
return this.sourceStream;
}
public int read() throws IOException {
return this.sourceStream.read();
}
public void close() throws IOException {
super.close();
this.sourceStream.close();
}
}