Whitespace polishing: leading spaces->tabs; updated eclipse configuration to default to leading tabs for all bundles

This commit is contained in:
Chris Beams
2008-12-18 14:50:25 +00:00
parent 0f521c3bfb
commit 579280d7bf
87 changed files with 4294 additions and 654 deletions

View File

@@ -48,13 +48,13 @@ import org.springframework.transaction.TransactionDefinition;
@Inherited
@Documented
public @interface Transactional {
/**
* The transaction propagation type.
* <p>Defaults to {@link Propagation#REQUIRED}.
*/
Propagation propagation() default Propagation.REQUIRED;
/**
* The transaction isolation level.
* <p>Defaults to {@link Isolation#DEFAULT}.
@@ -72,7 +72,7 @@ public @interface Transactional {
* <p>Defaults to <code>false</code>.
*/
boolean readOnly() default false;
/**
* Defines zero (0) or more exception {@link Class classes}, which must be a
* subclass of {@link Throwable}, indicating which exception types must cause
@@ -82,7 +82,7 @@ public @interface Transactional {
* <p>Similar to {@link org.springframework.transaction.interceptor.RollbackRuleAttribute#RollbackRuleAttribute(Class clazz)}
*/
Class<? extends Throwable>[] rollbackFor() default {};
/**
* Defines zero (0) or more exception names (for exceptions which must be a
* subclass of {@link Throwable}), indicating which exception types must cause
@@ -99,17 +99,17 @@ public @interface Transactional {
* <p>Similar to {@link org.springframework.transaction.interceptor.RollbackRuleAttribute#RollbackRuleAttribute(String exceptionName)}
*/
String[] rollbackForClassName() default {};
/**
* Defines zero (0) or more exception {@link Class Classes}, which must be a
* subclass of {@link Throwable}, indicating which exception types must <b>not</b>
* cause a transaction rollback.
* <p>This is the preferred way to construct a rollback rule, matching the
* exception class and subclasses.
* exception class and subclasses.
* <p>Similar to {@link org.springframework.transaction.interceptor.NoRollbackRuleAttribute#NoRollbackRuleAttribute(Class clazz)}
*/
Class<? extends Throwable>[] noRollbackFor() default {};
/**
* Defines zero (0) or more exception names (for exceptions which must be a
* subclass of {@link Throwable}) indicating which exception types must <b>not</b>

View File

@@ -33,56 +33,56 @@ import org.junit.Test;
public final class LocalConnectionFactoryBeanTests {
@Test(expected=IllegalArgumentException.class)
public void testManagedConnectionFactoryIsRequired() throws Exception {
new LocalConnectionFactoryBean().afterPropertiesSet();
}
public void testManagedConnectionFactoryIsRequired() throws Exception {
new LocalConnectionFactoryBean().afterPropertiesSet();
}
@Test
public void testIsSingleton() throws Exception {
LocalConnectionFactoryBean factory = new LocalConnectionFactoryBean();
assertTrue(factory.isSingleton());
}
public void testIsSingleton() throws Exception {
LocalConnectionFactoryBean factory = new LocalConnectionFactoryBean();
assertTrue(factory.isSingleton());
}
@Test
public void testGetObjectTypeIsNullIfConnectionFactoryHasNotBeenConfigured() throws Exception {
LocalConnectionFactoryBean factory = new LocalConnectionFactoryBean();
assertNull(factory.getObjectType());
}
public void testGetObjectTypeIsNullIfConnectionFactoryHasNotBeenConfigured() throws Exception {
LocalConnectionFactoryBean factory = new LocalConnectionFactoryBean();
assertNull(factory.getObjectType());
}
@Test
public void testCreatesVanillaConnectionFactoryIfNoConnectionManagerHasBeenConfigured() throws Exception {
final Object CONNECTION_FACTORY = new Object();
ManagedConnectionFactory managedConnectionFactory = createMock(ManagedConnectionFactory.class);
public void testCreatesVanillaConnectionFactoryIfNoConnectionManagerHasBeenConfigured() throws Exception {
expect(managedConnectionFactory.createConnectionFactory()).andReturn(CONNECTION_FACTORY);
replay(managedConnectionFactory);
final Object CONNECTION_FACTORY = new Object();
LocalConnectionFactoryBean factory = new LocalConnectionFactoryBean();
factory.setManagedConnectionFactory(managedConnectionFactory);
factory.afterPropertiesSet();
assertEquals(CONNECTION_FACTORY, factory.getObject());
ManagedConnectionFactory managedConnectionFactory = createMock(ManagedConnectionFactory.class);
verify(managedConnectionFactory);
}
expect(managedConnectionFactory.createConnectionFactory()).andReturn(CONNECTION_FACTORY);
replay(managedConnectionFactory);
LocalConnectionFactoryBean factory = new LocalConnectionFactoryBean();
factory.setManagedConnectionFactory(managedConnectionFactory);
factory.afterPropertiesSet();
assertEquals(CONNECTION_FACTORY, factory.getObject());
verify(managedConnectionFactory);
}
@Test
public void testCreatesManagedConnectionFactoryIfAConnectionManagerHasBeenConfigured() throws Exception {
ManagedConnectionFactory managedConnectionFactory = createMock(ManagedConnectionFactory.class);
public void testCreatesManagedConnectionFactoryIfAConnectionManagerHasBeenConfigured() throws Exception {
ManagedConnectionFactory managedConnectionFactory = createMock(ManagedConnectionFactory.class);
ConnectionManager connectionManager = createMock(ConnectionManager.class);
ConnectionManager connectionManager = createMock(ConnectionManager.class);
expect(managedConnectionFactory.createConnectionFactory(connectionManager)).andReturn(null);
expect(managedConnectionFactory.createConnectionFactory(connectionManager)).andReturn(null);
replay(connectionManager, managedConnectionFactory);
replay(connectionManager, managedConnectionFactory);
LocalConnectionFactoryBean factory = new LocalConnectionFactoryBean();
factory.setManagedConnectionFactory(managedConnectionFactory);
factory.setConnectionManager(connectionManager);
factory.afterPropertiesSet();
LocalConnectionFactoryBean factory = new LocalConnectionFactoryBean();
factory.setManagedConnectionFactory(managedConnectionFactory);
factory.setConnectionManager(connectionManager);
factory.afterPropertiesSet();
verify(connectionManager, managedConnectionFactory);
}
verify(connectionManager, managedConnectionFactory);
}
}

View File

@@ -25,7 +25,7 @@ import org.springframework.core.NestedRuntimeException;
*/
@SuppressWarnings("serial")
class MyRuntimeException extends NestedRuntimeException {
public MyRuntimeException(String msg) {
super(msg);
}
}
public MyRuntimeException(String msg) {
super(msg);
}
}

View File

@@ -36,7 +36,7 @@ import org.springframework.transaction.TransactionDefinition;
*/
public class RuleBasedTransactionAttributeTests {
@Test
@Test
public void testDefaultRule() {
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute();
assertTrue(rta.rollbackOn(new RuntimeException()));
@@ -44,30 +44,30 @@ public class RuleBasedTransactionAttributeTests {
assertFalse(rta.rollbackOn(new Exception()));
assertFalse(rta.rollbackOn(new IOException()));
}
/**
* Test one checked exception that should roll back.
*/
@Test
@Test
public void testRuleForRollbackOnChecked() {
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 MyRuntimeException("")));
assertFalse(rta.rollbackOn(new Exception()));
// Check that default behaviour is overridden
assertTrue(rta.rollbackOn(new IOException()));
}
@Test
@Test
public void testRuleForCommitOnUnchecked() {
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 MyRuntimeException("")));
@@ -75,22 +75,22 @@ public class RuleBasedTransactionAttributeTests {
// Check that default behaviour is overridden
assertTrue(rta.rollbackOn(new IOException()));
}
@Test
@Test
public void testRuleForSelectiveRollbackOnCheckedWithString() {
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
@Test
public void testRuleForSelectiveRollbackOnCheckedWithClass() {
List<RollbackRuleAttribute> l = Collections.singletonList(new RollbackRuleAttribute(RemoteException.class));
RuleBasedTransactionAttribute rta = new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED, l);
doTestRuleForSelectiveRollbackOnChecked(rta);
}
private void doTestRuleForSelectiveRollbackOnChecked(RuleBasedTransactionAttribute rta) {
assertTrue(rta.rollbackOn(new RuntimeException()));
// Check default behaviour is overridden
@@ -98,7 +98,7 @@ public class RuleBasedTransactionAttributeTests {
// Check that default behaviour is overridden
assertTrue(rta.rollbackOn(new RemoteException()));
}
/**
* Check that a rule can cause commit on a IOException
* when Exception prompts a rollback.
@@ -123,7 +123,7 @@ public class RuleBasedTransactionAttributeTests {
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 MyRuntimeException("")));
@@ -164,7 +164,7 @@ public class RuleBasedTransactionAttributeTests {
@SuppressWarnings("serial")
private static class MyBusinessException extends Exception {}
private static class MyBusinessException extends Exception {}
@SuppressWarnings("serial")

View File

@@ -33,24 +33,24 @@ import org.springframework.transaction.TransactionDefinition;
* @since 26.04.2003
*/
public class TransactionAttributeEditorTests {
@Test
@Test
public void testNull() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText(null);
TransactionAttribute ta = (TransactionAttribute) pe.getValue();
assertTrue(ta == null);
}
@Test
@Test
public void testEmptyString() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("");
TransactionAttribute ta = (TransactionAttribute) pe.getValue();
assertTrue(ta == null);
}
@Test
@Test
public void testValidPropagationCodeOnly() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("PROPAGATION_REQUIRED");
@@ -60,15 +60,15 @@ public class TransactionAttributeEditorTests {
assertTrue(ta.getIsolationLevel() == TransactionDefinition.ISOLATION_DEFAULT);
assertTrue(!ta.isReadOnly());
}
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testInvalidPropagationCodeOnly() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
// should have failed with bogus propagation code
pe.setAsText("XXPROPAGATION_REQUIRED");
}
@Test
@Test
public void testValidPropagationCodeAndIsolationCode() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("PROPAGATION_REQUIRED, ISOLATION_READ_UNCOMMITTED");
@@ -77,15 +77,15 @@ public class TransactionAttributeEditorTests {
assertTrue(ta.getPropagationBehavior() == TransactionDefinition.PROPAGATION_REQUIRED);
assertTrue(ta.getIsolationLevel() == TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
}
@Test(expected=IllegalArgumentException.class)
@Test(expected=IllegalArgumentException.class)
public void testValidPropagationAndIsolationCodesAndInvalidRollbackRule() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
// should fail with bogus rollback rule
pe.setAsText("PROPAGATION_REQUIRED,ISOLATION_READ_UNCOMMITTED,XXX");
}
@Test
}
@Test
public void testValidPropagationCodeAndIsolationCodeAndRollbackRules1() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("PROPAGATION_MANDATORY,ISOLATION_REPEATABLE_READ,timeout_10,-IOException,+MyRuntimeException");
@@ -102,7 +102,7 @@ public class TransactionAttributeEditorTests {
assertTrue(!ta.rollbackOn(new MyRuntimeException("")));
}
@Test
@Test
public void testValidPropagationCodeAndIsolationCodeAndRollbackRules2() {
TransactionAttributeEditor pe = new TransactionAttributeEditor();
pe.setAsText("+IOException,readOnly,ISOLATION_READ_COMMITTED,-MyRuntimeException,PROPAGATION_SUPPORTS");
@@ -119,7 +119,7 @@ public class TransactionAttributeEditorTests {
assertTrue(ta.rollbackOn(new MyRuntimeException("")));
}
@Test
@Test
public void testDefaultTransactionAttributeToString() {
DefaultTransactionAttribute source = new DefaultTransactionAttribute();
source.setPropagationBehavior(TransactionDefinition.PROPAGATION_SUPPORTS);
@@ -144,7 +144,7 @@ public class TransactionAttributeEditorTests {
assertEquals(ta, source);
}
@Test
@Test
public void testRuleBasedTransactionAttributeToString() {
RuleBasedTransactionAttribute source = new RuleBasedTransactionAttribute();
source.setPropagationBehavior(TransactionDefinition.PROPAGATION_SUPPORTS);
@@ -171,5 +171,5 @@ public class TransactionAttributeEditorTests {
source.getRollbackRules().add(new NoRollbackRuleAttribute("IllegalStateException"));
assertEquals(ta, source);
}
}