Add @Override annotations to test sources

Issue: SPR-10129
This commit is contained in:
Chris Beams
2012-12-28 13:59:24 +01:00
parent 6f0c7eb8c1
commit 4c8cd7b0bd
797 changed files with 4745 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean {
this.company = (company != null ? company : "");
}
@Override
public String getCompany() {
return company;
}

View File

@@ -137,6 +137,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
}
@Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
@@ -145,6 +146,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return beanName;
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@@ -161,10 +163,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return postProcessed;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@@ -180,10 +184,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
}
}
@Override
public int getAge() {
return age;
}
@Override
public void setAge(int age) {
this.age = age;
}
@@ -196,14 +202,17 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.jedi = jedi;
}
@Override
public ITestBean getSpouse() {
return (spouses != null ? spouses[0] : null);
}
@Override
public void setSpouse(ITestBean spouse) {
this.spouses = new ITestBean[] {spouse};
}
@Override
public ITestBean[] getSpouses() {
return spouses;
}
@@ -230,10 +239,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.country = country;
}
@Override
public String[] getStringArray() {
return stringArray;
}
@Override
public void setStringArray(String[] stringArray) {
this.stringArray = stringArray;
}
@@ -302,6 +313,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someProperties = someProperties;
}
@Override
public INestedTestBean getDoctor() {
return doctor;
}
@@ -310,6 +322,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.doctor = doctor;
}
@Override
public INestedTestBean getLawyer() {
return lawyer;
}
@@ -342,6 +355,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someBoolean = someBoolean;
}
@Override
public IndexedTestBean getNestedIndexedBean() {
return nestedIndexedBean;
}
@@ -370,18 +384,21 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
/**
* @see ITestBean#exceptional(Throwable)
*/
@Override
public void exceptional(Throwable t) throws Throwable {
if (t != null) {
throw t;
}
}
@Override
public void unreliableFileOperation() throws IOException {
throw new IOException();
}
/**
* @see ITestBean#returnsThis()
*/
@Override
public Object returnsThis() {
return this;
}
@@ -389,9 +406,11 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
/**
* @see IOther#absquatulate()
*/
@Override
public void absquatulate() {
}
@Override
public int haveBirthday() {
return age++;
}
@@ -421,6 +440,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
return this.age;
}
@Override
public int compareTo(Object other) {
if (this.name != null && other instanceof TestBean) {
return this.name.compareTo(((TestBean) other).getName());

View File

@@ -21,6 +21,7 @@ package org.springframework.core.task;
*/
public class StubTaskExecutor implements TaskExecutor {
@Override
public void execute(Runnable task) {
}

View File

@@ -26,13 +26,16 @@ import javax.resource.spi.ResourceAdapter;
*/
public class StubActivationSpec implements ActivationSpec {
@Override
public void validate() throws InvalidPropertyException {
}
@Override
public ResourceAdapter getResourceAdapter() {
return null;
}
@Override
public void setResourceAdapter(ResourceAdapter resourceAdapter) throws ResourceException {
}

View File

@@ -29,18 +29,23 @@ import javax.transaction.xa.XAResource;
*/
public class StubResourceAdapter implements ResourceAdapter {
@Override
public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException {
}
@Override
public void stop() {
}
@Override
public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws ResourceException {
}
@Override
public void endpointDeactivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) {
}
@Override
public XAResource[] getXAResources(ActivationSpec[] activationSpecs) throws ResourceException {
return null;
}

View File

@@ -27,10 +27,12 @@ import javax.jms.JMSException;
*/
public class StubConnectionFactory implements ConnectionFactory {
@Override
public Connection createConnection() throws JMSException {
return null;
}
@Override
public Connection createConnection(String username, String password) throws JMSException {
return null;
}

View File

@@ -39,6 +39,7 @@ public class StubQueue implements Queue {
}
@Override
public String getQueueName() {
return this.queueName;
}

View File

@@ -39,6 +39,7 @@ public class StubTopic implements Topic {
}
@Override
public String getTopicName() {
return this.topicName;
}

View File

@@ -58,10 +58,12 @@ public class JmsNamespaceHandlerTests extends TestCase {
private ToolingTestApplicationContext context;
@Override
protected void setUp() throws Exception {
this.context = new ToolingTestApplicationContext("jmsNamespaceHandlerTests.xml", getClass());
}
@Override
protected void tearDown() throws Exception {
this.context.close();
}
@@ -211,6 +213,7 @@ public class JmsNamespaceHandlerTests extends TestCase {
public Message message;
@Override
public void onMessage(Message message) {
this.message = message;
}
@@ -229,6 +232,7 @@ public class JmsNamespaceHandlerTests extends TestCase {
super(path, clazz);
}
@Override
protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
this.registeredComponents = new HashSet<ComponentDefinition>();
beanDefinitionReader.setEventListener(new StoringReaderEventListener(this.registeredComponents));
@@ -268,6 +272,7 @@ public class JmsNamespaceHandlerTests extends TestCase {
this.registeredComponents = registeredComponents;
}
@Override
public void componentRegistered(ComponentDefinition componentDefinition) {
this.registeredComponents.add(componentDefinition);
}
@@ -276,6 +281,7 @@ public class JmsNamespaceHandlerTests extends TestCase {
static class TestErrorHandler implements ErrorHandler {
@Override
public void handleError(Throwable t) {
}
}

View File

@@ -79,6 +79,7 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
JmsTemplate jt = new JmsTemplate(cf);
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -118,6 +119,7 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
JmsTemplate jt = new JmsTemplate(cf);
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -157,6 +159,7 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
final JmsTemplate jt = new JmsTemplate(cf);
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -164,8 +167,10 @@ public class JmsTransactionManagerTests extends TestCase {
});
TransactionTemplate tt = new TransactionTemplate(tm);
tt.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -207,6 +212,7 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
final JmsTemplate jt = new JmsTemplate(cf);
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -214,8 +220,10 @@ public class JmsTransactionManagerTests extends TestCase {
});
TransactionTemplate tt = new TransactionTemplate(tm);
tt.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -270,6 +278,7 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
final JmsTemplate jt = new JmsTemplate(cf);
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -278,8 +287,10 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionTemplate tt = new TransactionTemplate(tm);
tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
tt.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess != session);
return null;
@@ -288,6 +299,7 @@ public class JmsTransactionManagerTests extends TestCase {
}
});
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -335,6 +347,7 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
final JmsTemplate jt = new JmsTemplate(cf);
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -343,8 +356,10 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionTemplate tt = new TransactionTemplate(tm);
tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
tt.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess != session);
return null;
@@ -353,6 +368,7 @@ public class JmsTransactionManagerTests extends TestCase {
}
});
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -407,6 +423,7 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
JmsTemplate jt = new JmsTemplate(cf);
jt.send(dest, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return message;
}
@@ -446,6 +463,7 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
JmsTemplate jt = new JmsTemplate102(cf, false);
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -485,6 +503,7 @@ public class JmsTransactionManagerTests extends TestCase {
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
JmsTemplate jt = new JmsTemplate102(cf, true);
jt.execute(new SessionCallback() {
@Override
public Object doInJms(Session sess) {
assertTrue(sess == session);
return null;
@@ -497,6 +516,7 @@ public class JmsTransactionManagerTests extends TestCase {
cfControl.verify();
}
@Override
protected void tearDown() {
assertTrue(TransactionSynchronizationManager.getResourceMap().isEmpty());
assertFalse(TransactionSynchronizationManager.isSynchronizationActive());

View File

@@ -38,44 +38,55 @@ public class TestConnection implements Connection {
private int closeCount;
@Override
public Session createSession(boolean b, int i) throws JMSException {
return null;
}
@Override
public String getClientID() throws JMSException {
return null;
}
@Override
public void setClientID(String paramName) throws JMSException {
}
@Override
public ConnectionMetaData getMetaData() throws JMSException {
return null;
}
@Override
public ExceptionListener getExceptionListener() throws JMSException {
return exceptionListener;
}
@Override
public void setExceptionListener(ExceptionListener exceptionListener) throws JMSException {
this.exceptionListener = exceptionListener;
}
@Override
public void start() throws JMSException {
this.startCount++;
}
@Override
public void stop() throws JMSException {
}
@Override
public void close() throws JMSException {
this.closeCount++;
}
@Override
public ConnectionConsumer createConnectionConsumer(Destination destination, String paramName, ServerSessionPool serverSessionPool, int i) throws JMSException {
return null;
}
@Override
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String paramName, String paramName1, ServerSessionPool serverSessionPool, int i) throws JMSException {
return null;
}

View File

@@ -26,6 +26,7 @@ public class TestExceptionListener implements ExceptionListener {
private int count = 0;
@Override
public void onException(JMSException ex) {
this.count++;
}

View File

@@ -22,10 +22,12 @@ package org.springframework.jms.core;
*/
public class JmsTemplate102JtaTests extends JmsTemplate102Tests {
@Override
protected boolean useTransactedSession() {
return true;
}
@Override
protected boolean useTransactedTemplate() {
return false;
}

View File

@@ -102,6 +102,7 @@ public class JmsTemplate102Tests extends TestCase {
/**
* Create the mock objects for testing.
*/
@Override
protected void setUp() throws Exception {
mockJndiControl = MockControl.createControl(Context.class);
mockJndiContext = (Context) this.mockJndiControl.getMock();
@@ -169,6 +170,7 @@ public class JmsTemplate102Tests extends TestCase {
JmsTemplate102 template = new JmsTemplate102();
JndiDestinationResolver destMan = new JndiDestinationResolver();
destMan.setJndiTemplate(new JndiTemplate() {
@Override
protected Context createInitialContext() {
return mockJndiContext;
}
@@ -203,6 +205,7 @@ public class JmsTemplate102Tests extends TestCase {
topicConnectionControl.replay();
template.execute(new SessionCallback() {
@Override
public Object doInJms(Session session) throws JMSException {
boolean b = session.getTransacted();
return null;
@@ -244,6 +247,7 @@ public class JmsTemplate102Tests extends TestCase {
topicConnectionControl.replay();
template.execute(new ProducerCallback() {
@Override
public Object doInJms(Session session, MessageProducer producer) throws JMSException {
boolean b = session.getTransacted();
int i = producer.getPriority();
@@ -292,6 +296,7 @@ public class JmsTemplate102Tests extends TestCase {
topicConnectionControl.replay();
template.execute(new ProducerCallback() {
@Override
public Object doInJms(Session session, MessageProducer producer) throws JMSException {
boolean b = session.getTransacted();
int i = producer.getPriority();
@@ -324,6 +329,7 @@ public class JmsTemplate102Tests extends TestCase {
queueConnectionControl.replay();
template.execute(new SessionCallback() {
@Override
public Object doInJms(Session session) throws JMSException {
boolean b = session.getTransacted();
return null;
@@ -365,6 +371,7 @@ public class JmsTemplate102Tests extends TestCase {
queueConnectionControl.replay();
template.execute(new ProducerCallback() {
@Override
public Object doInJms(Session session, MessageProducer producer)
throws JMSException {
boolean b = session.getTransacted();
@@ -411,6 +418,7 @@ public class JmsTemplate102Tests extends TestCase {
queueConnectionControl.replay();
template.execute(new ProducerCallback() {
@Override
public Object doInJms(Session session, MessageProducer producer) throws JMSException {
boolean b = session.getTransacted();
int i = producer.getPriority();
@@ -611,6 +619,7 @@ public class JmsTemplate102Tests extends TestCase {
if (useDefaultDestination) {
template.send(new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage("just testing");
}
@@ -619,6 +628,7 @@ public class JmsTemplate102Tests extends TestCase {
else {
if (explicitQueue) {
template.send(mockQueue, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage("just testing");
}
@@ -626,6 +636,7 @@ public class JmsTemplate102Tests extends TestCase {
}
else {
template.send("testQueue", new MessageCreator() {
@Override
public Message createMessage(Session session)
throws JMSException {
return session.createTextMessage("just testing");
@@ -689,6 +700,7 @@ public class JmsTemplate102Tests extends TestCase {
if (explicitTopic) {
template.send(mockTopic, new MessageCreator() {
@Override
public Message createMessage(Session session)
throws JMSException {
return session.createTextMessage("just testing");
@@ -697,6 +709,7 @@ public class JmsTemplate102Tests extends TestCase {
}
else {
template.send("testTopic", new MessageCreator() {
@Override
public Message createMessage(Session session)
throws JMSException {
return session.createTextMessage("just testing");

View File

@@ -22,10 +22,12 @@ package org.springframework.jms.core;
*/
public class JmsTemplate102TransactedTests extends JmsTemplate102Tests {
@Override
protected boolean useTransactedSession() {
return true;
}
@Override
protected boolean useTransactedTemplate() {
return true;
}

View File

@@ -22,10 +22,12 @@ package org.springframework.jms.core;
*/
public class JmsTemplateJtaTests extends JmsTemplateTests {
@Override
protected boolean useTransactedSession() {
return true;
}
@Override
protected boolean useTransactedTemplate() {
return false;
}

View File

@@ -91,6 +91,7 @@ public class JmsTemplateTests extends TestCase {
/**
* Create the mock objects for testing.
*/
@Override
protected void setUp() throws Exception {
mockJndiControl = MockControl.createControl(Context.class);
mockJndiContext = (Context) this.mockJndiControl.getMock();
@@ -131,6 +132,7 @@ public class JmsTemplateTests extends TestCase {
JmsTemplate template = new JmsTemplate();
JndiDestinationResolver destMan = new JndiDestinationResolver();
destMan.setJndiTemplate(new JndiTemplate() {
@Override
protected Context createInitialContext() {
return mockJndiContext;
}
@@ -186,6 +188,7 @@ public class JmsTemplateTests extends TestCase {
connectionControl.replay();
template.execute(new ProducerCallback() {
@Override
public Object doInJms(Session session, MessageProducer producer) throws JMSException {
boolean b = session.getTransacted();
int i = producer.getPriority();
@@ -229,6 +232,7 @@ public class JmsTemplateTests extends TestCase {
connectionControl.replay();
template.execute(new ProducerCallback() {
@Override
public Object doInJms(Session session, MessageProducer producer) throws JMSException {
boolean b = session.getTransacted();
int i = producer.getPriority();
@@ -258,6 +262,7 @@ public class JmsTemplateTests extends TestCase {
connectionControl.replay();
template.execute(new SessionCallback() {
@Override
public Object doInJms(Session session) throws JMSException {
boolean b = session.getTransacted();
return null;
@@ -296,12 +301,14 @@ public class JmsTemplateTests extends TestCase {
TransactionSynchronizationManager.initSynchronization();
try {
template.execute(new SessionCallback() {
@Override
public Object doInJms(Session session) throws JMSException {
boolean b = session.getTransacted();
return null;
}
});
template.execute(new SessionCallback() {
@Override
public Object doInJms(Session session) throws JMSException {
boolean b = session.getTransacted();
return null;
@@ -472,6 +479,7 @@ public class JmsTemplateTests extends TestCase {
if (useDefaultDestination) {
template.send(new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage("just testing");
}
@@ -480,6 +488,7 @@ public class JmsTemplateTests extends TestCase {
else {
if (explicitDestination) {
template.send(mockQueue, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage("just testing");
}
@@ -487,6 +496,7 @@ public class JmsTemplateTests extends TestCase {
}
else {
template.send(destinationName, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage("just testing");
}

View File

@@ -22,10 +22,12 @@ package org.springframework.jms.core;
*/
public class JmsTemplateTransactedTests extends JmsTemplateTests {
@Override
protected boolean useTransactedSession() {
return true;
}
@Override
protected boolean useTransactedTemplate() {
return true;
}

View File

@@ -37,6 +37,7 @@ public class JmsGatewaySupportTests extends TestCase {
connectionFactoryControl.replay();
final List test = new ArrayList();
JmsGatewaySupport gateway = new JmsGatewaySupport() {
@Override
protected void initGateway() {
test.add("test");
}
@@ -53,6 +54,7 @@ public class JmsGatewaySupportTests extends TestCase {
JmsTemplate template = new JmsTemplate();
final List test = new ArrayList();
JmsGatewaySupport gateway = new JmsGatewaySupport() {
@Override
protected void initGateway() {
test.add("test");
}

View File

@@ -63,6 +63,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener
this.container = (SimpleMessageListenerContainer) getContainer();
}
@Override
protected AbstractMessageListenerContainer getContainer() {
return new SimpleMessageListenerContainer();
}
@@ -234,6 +235,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener
this.container.setConnectionFactory(connectionFactory);
this.container.setDestinationName(DESTINATION_NAME);
this.container.setMessageListener(new SessionAwareMessageListener() {
@Override
public void onMessage(Message message, Session sess) {
try {
// Check correct Session passed into SessionAwareMessageListener.
@@ -301,6 +303,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener
this.container.setDestinationName(DESTINATION_NAME);
this.container.setMessageListener(listener);
this.container.setTaskExecutor(new TaskExecutor() {
@Override
public void execute(Runnable task) {
listener.executorInvoked = true;
assertFalse(listener.listenerInvoked);
@@ -364,6 +367,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener
this.container.setConnectionFactory(connectionFactory);
this.container.setDestinationName(DESTINATION_NAME);
this.container.setMessageListener(new SessionAwareMessageListener() {
@Override
public void onMessage(Message message, Session session) throws JMSException {
throw theException;
}
@@ -430,6 +434,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener
this.container.setConnectionFactory(connectionFactory);
this.container.setDestinationName(DESTINATION_NAME);
this.container.setMessageListener(new SessionAwareMessageListener() {
@Override
public void onMessage(Message message, Session session) throws JMSException {
throw theException;
}
@@ -491,6 +496,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener
this.container.setConnectionFactory(connectionFactory);
this.container.setDestinationName(DESTINATION_NAME);
this.container.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message message) {
throw new UnsupportedOperationException();
}
@@ -555,6 +561,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener
this.container.setConnectionFactory(connectionFactory);
this.container.setDestinationName(DESTINATION_NAME);
this.container.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message message) {
throw new UnsupportedOperationException();
}
@@ -644,6 +651,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener
public boolean listenerInvoked = false;
@Override
public void onMessage(Message message) {
this.listenerInvoked = true;
}
@@ -658,30 +666,37 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener
this.messageListener.onMessage(message);
}
@Override
public String getMessageSelector() throws JMSException {
throw new UnsupportedOperationException();
}
@Override
public MessageListener getMessageListener() throws JMSException {
return this.messageListener;
}
@Override
public void setMessageListener(MessageListener messageListener) throws JMSException {
this.messageListener = messageListener;
}
@Override
public Message receive() throws JMSException {
throw new UnsupportedOperationException();
}
@Override
public Message receive(long l) throws JMSException {
throw new UnsupportedOperationException();
}
@Override
public Message receiveNoWait() throws JMSException {
throw new UnsupportedOperationException();
}
@Override
public void close() throws JMSException {
throw new UnsupportedOperationException();
}

View File

@@ -169,6 +169,7 @@ public final class MessageListenerAdapter102Tests {
mockDelegate.replay();
MessageListenerAdapter102 adapter = new MessageListenerAdapter102(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -230,6 +231,7 @@ public final class MessageListenerAdapter102Tests {
mockDelegate.replay();
MessageListenerAdapter102 adapter = new MessageListenerAdapter102(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -291,6 +293,7 @@ public final class MessageListenerAdapter102Tests {
mockDelegate.replay();
MessageListenerAdapter102 adapter = new MessageListenerAdapter102(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -337,6 +340,7 @@ public final class MessageListenerAdapter102Tests {
mockDelegate.replay();
final MessageListenerAdapter102 adapter = new MessageListenerAdapter102(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -399,6 +403,7 @@ public final class MessageListenerAdapter102Tests {
mockDelegate.replay();
final MessageListenerAdapter102 adapter = new MessageListenerAdapter102(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -434,6 +439,7 @@ public final class MessageListenerAdapter102Tests {
mockDelegate.replay();
final MessageListenerAdapter102 adapter = new MessageListenerAdapter102(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}

View File

@@ -216,6 +216,7 @@ public class MessageListenerAdapterTests {
mockDelegate.replay();
MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
@Override
protected void handleListenerException(Throwable ex) {
assertNotNull("The Throwable passed to the handleListenerException(..) method must never be null.", ex);
assertTrue("The Throwable passed to the handleListenerException(..) method must be of type [ListenerExecutionFailedException].",
@@ -320,6 +321,7 @@ public class MessageListenerAdapterTests {
mockDelegate.replay();
MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -382,6 +384,7 @@ public class MessageListenerAdapterTests {
mockDelegate.replay();
MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -427,6 +430,7 @@ public class MessageListenerAdapterTests {
mockDelegate.replay();
final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -488,6 +492,7 @@ public class MessageListenerAdapterTests {
mockDelegate.replay();
final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -522,6 +527,7 @@ public class MessageListenerAdapterTests {
mockDelegate.replay();
final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -546,6 +552,7 @@ public class MessageListenerAdapterTests {
mockMessage.replay();
final MessageListenerAdapter adapter = new MessageListenerAdapter() {
@Override
protected void handleListenerException(Throwable ex) {
assertTrue(ex instanceof IllegalStateException);
}
@@ -566,9 +573,11 @@ public class MessageListenerAdapterTests {
mockMessage.replay();
final MessageListenerAdapter adapter = new MessageListenerAdapter() {
@Override
protected void handleListenerException(Throwable ex) {
assertTrue(ex instanceof javax.jms.IllegalStateException);
}
@Override
protected String getListenerMethodName(Message originalMessage, Object extractedMessage) {
return null;
}
@@ -596,6 +605,7 @@ public class MessageListenerAdapterTests {
mockDelegate.replay();
final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}
@@ -654,6 +664,7 @@ public class MessageListenerAdapterTests {
mockDelegate.replay();
final MessageListenerAdapter adapter = new MessageListenerAdapter(delegate) {
@Override
protected Object extractMessage(Message message) {
return message;
}

View File

@@ -35,6 +35,7 @@ public class StubMessageListenerAdapter extends MessageListenerAdapter {
this.wasCalled = true;
}
@Override
protected void handleListenerException(Throwable ex) {
System.out.println(ex);
}

View File

@@ -35,6 +35,7 @@ public class StubMessageListenerAdapter102 extends MessageListenerAdapter102 {
this.wasCalled = true;
}
@Override
protected void handleListenerException(Throwable ex) {
System.out.println(ex);
}

View File

@@ -34,6 +34,7 @@ public class DefaultJmsActivationSpecFactoryTests extends TestCase {
private JmsActivationSpecConfig activationSpecConfig;
@Override
protected void setUp() throws Exception {
activationSpecConfig = new JmsActivationSpecConfig();
activationSpecConfig.setMaxConcurrency(5);

View File

@@ -26,6 +26,7 @@ import org.springframework.jca.StubActivationSpec;
*/
public class StubJmsActivationSpecFactory implements JmsActivationSpecFactory {
@Override
public ActivationSpec createActivationSpec(ResourceAdapter adapter, JmsActivationSpecConfig config) {
return new StubActivationSpec();
}

View File

@@ -56,6 +56,7 @@ public class JmsInvokerTests extends TestCase {
private Queue mockQueue;
@Override
protected void setUp() throws Exception {
connectionFactoryControl = MockControl.createControl(QueueConnectionFactory.class);
mockConnectionFactory = (QueueConnectionFactory) connectionFactoryControl.getMock();
@@ -107,6 +108,7 @@ public class JmsInvokerTests extends TestCase {
exporter.afterPropertiesSet();
JmsInvokerProxyFactoryBean pfb = new JmsInvokerProxyFactoryBean() {
@Override
protected Message doExecuteRequest(Session session, Queue queue, Message requestMessage) throws JMSException {
MockControl exporterSessionControl = MockControl.createControl(Session.class);
Session mockExporterSession = (Session) exporterSessionControl.getMock();
@@ -167,59 +169,75 @@ public class JmsInvokerTests extends TestCase {
public boolean closed = false;
@Override
public void setDisableMessageID(boolean b) throws JMSException {
}
@Override
public boolean getDisableMessageID() throws JMSException {
return false;
}
@Override
public void setDisableMessageTimestamp(boolean b) throws JMSException {
}
@Override
public boolean getDisableMessageTimestamp() throws JMSException {
return false;
}
@Override
public void setDeliveryMode(int i) throws JMSException {
}
@Override
public int getDeliveryMode() throws JMSException {
return 0;
}
@Override
public void setPriority(int i) throws JMSException {
}
@Override
public int getPriority() throws JMSException {
return 0;
}
@Override
public void setTimeToLive(long l) throws JMSException {
}
@Override
public long getTimeToLive() throws JMSException {
return 0;
}
@Override
public Destination getDestination() throws JMSException {
return null;
}
@Override
public void close() throws JMSException {
this.closed = true;
}
@Override
public void send(Message message) throws JMSException {
this.response = message;
}
@Override
public void send(Message message, int i, int i1, long l) throws JMSException {
}
@Override
public void send(Destination destination, Message message) throws JMSException {
}
@Override
public void send(Destination destination, Message message, int i, int i1, long l) throws JMSException {
}
}
@@ -235,169 +253,216 @@ public class JmsInvokerTests extends TestCase {
this.serializable = serializable;
}
@Override
public void setObject(Serializable serializable) throws JMSException {
this.serializable = serializable;
}
@Override
public Serializable getObject() throws JMSException {
return serializable;
}
@Override
public String getJMSMessageID() throws JMSException {
return null;
}
@Override
public void setJMSMessageID(String string) throws JMSException {
}
@Override
public long getJMSTimestamp() throws JMSException {
return 0;
}
@Override
public void setJMSTimestamp(long l) throws JMSException {
}
@Override
public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
return new byte[0];
}
@Override
public void setJMSCorrelationIDAsBytes(byte[] bytes) throws JMSException {
}
@Override
public void setJMSCorrelationID(String string) throws JMSException {
}
@Override
public String getJMSCorrelationID() throws JMSException {
return null;
}
@Override
public Destination getJMSReplyTo() throws JMSException {
return replyTo;
}
@Override
public void setJMSReplyTo(Destination destination) throws JMSException {
this.replyTo = destination;
}
@Override
public Destination getJMSDestination() throws JMSException {
return null;
}
@Override
public void setJMSDestination(Destination destination) throws JMSException {
}
@Override
public int getJMSDeliveryMode() throws JMSException {
return 0;
}
@Override
public void setJMSDeliveryMode(int i) throws JMSException {
}
@Override
public boolean getJMSRedelivered() throws JMSException {
return false;
}
@Override
public void setJMSRedelivered(boolean b) throws JMSException {
}
@Override
public String getJMSType() throws JMSException {
return null;
}
@Override
public void setJMSType(String string) throws JMSException {
}
@Override
public long getJMSExpiration() throws JMSException {
return 0;
}
@Override
public void setJMSExpiration(long l) throws JMSException {
}
@Override
public int getJMSPriority() throws JMSException {
return 0;
}
@Override
public void setJMSPriority(int i) throws JMSException {
}
@Override
public void clearProperties() throws JMSException {
}
@Override
public boolean propertyExists(String string) throws JMSException {
return false;
}
@Override
public boolean getBooleanProperty(String string) throws JMSException {
return false;
}
@Override
public byte getByteProperty(String string) throws JMSException {
return 0;
}
@Override
public short getShortProperty(String string) throws JMSException {
return 0;
}
@Override
public int getIntProperty(String string) throws JMSException {
return 0;
}
@Override
public long getLongProperty(String string) throws JMSException {
return 0;
}
@Override
public float getFloatProperty(String string) throws JMSException {
return 0;
}
@Override
public double getDoubleProperty(String string) throws JMSException {
return 0;
}
@Override
public String getStringProperty(String string) throws JMSException {
return null;
}
@Override
public Object getObjectProperty(String string) throws JMSException {
return null;
}
@Override
public Enumeration getPropertyNames() throws JMSException {
return null;
}
@Override
public void setBooleanProperty(String string, boolean b) throws JMSException {
}
@Override
public void setByteProperty(String string, byte b) throws JMSException {
}
@Override
public void setShortProperty(String string, short i) throws JMSException {
}
@Override
public void setIntProperty(String string, int i) throws JMSException {
}
@Override
public void setLongProperty(String string, long l) throws JMSException {
}
@Override
public void setFloatProperty(String string, float v) throws JMSException {
}
@Override
public void setDoubleProperty(String string, double v) throws JMSException {
}
@Override
public void setStringProperty(String string, String string1) throws JMSException {
}
@Override
public void setObjectProperty(String string, Object object) throws JMSException {
}
@Override
public void acknowledge() throws JMSException {
}
@Override
public void clearBody() throws JMSException {
}
}
@@ -405,6 +470,7 @@ public class JmsInvokerTests extends TestCase {
private static class MockSimpleMessageConverter extends SimpleMessageConverter {
@Override
public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
return new MockObjectMessage((Serializable) object);
}

View File

@@ -49,12 +49,14 @@ public final class SimpleMessageConverter102Tests extends TestCase {
messageControl.setVoidCallable(1);
message.readBytes(new byte[SimpleMessageConverter102.BUFFER_SIZE]);
messageControl.setMatcher(new ArgumentsMatcher() {
@Override
public boolean matches(Object[] arg0, Object[] arg1) {
byte[] one = (byte[]) arg0[0];
byte[] two = (byte[]) arg1[0];
return Arrays.equals(one, two);
}
@Override
public String toString(Object[] arg0) {
return "bla";
}

View File

@@ -87,12 +87,14 @@ public final class SimpleMessageConverterTests {
messageControl.setReturnValue(content.length, 1);
message.readBytes(new byte[content.length]);
messageControl.setMatcher(new ArgumentsMatcher() {
@Override
public boolean matches(Object[] arg0, Object[] arg1) {
byte[] one = (byte[]) arg0[0];
byte[] two = (byte[]) arg1[0];
return Arrays.equals(one, two);
}
@Override
public String toString(Object[] arg0) {
return "bla";
}

View File

@@ -88,6 +88,7 @@ public class JndiDestinationResolverTests {
mockDestinationResolver.replay();
JndiDestinationResolver resolver = new JndiDestinationResolver() {
@Override
protected Object lookup(String jndiName, Class requiredClass) throws NamingException {
throw new NamingException();
}
@@ -114,6 +115,7 @@ public class JndiDestinationResolverTests {
mockDestinationResolver.replay();
final JndiDestinationResolver resolver = new JndiDestinationResolver() {
@Override
protected Object lookup(String jndiName, Class requiredClass) throws NamingException {
throw new NamingException();
}
@@ -134,6 +136,7 @@ public class JndiDestinationResolverTests {
private boolean called;
@Override
protected Object lookup(String jndiName, Class requiredType) throws NamingException {
if (called) {
fail("Must not be delegating to lookup(..), must be resolving from cache.");
@@ -152,6 +155,7 @@ public class JndiDestinationResolverTests {
return this.callCount;
}
@Override
protected Object lookup(String jndiName, Class requiredType) throws NamingException {
++this.callCount;
return DESTINATION;

View File

@@ -32,21 +32,25 @@ public class CallCountingTransactionManager extends AbstractPlatformTransactionM
public int rollbacks;
public int inflight;
@Override
protected Object doGetTransaction() {
return new Object();
}
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) {
this.lastDefinition = definition;
++begun;
++inflight;
}
@Override
protected void doCommit(DefaultTransactionStatus status) {
++commits;
--inflight;
}
@Override
protected void doRollback(DefaultTransactionStatus status) {
++rollbacks;
--inflight;