File Cleanup - JPA to RMI
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
|
||||
<import resource="classpath:/hibernateJpa-context.xml" />
|
||||
|
||||
</beans>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -18,12 +18,9 @@ package org.springframework.integration.jpa.core;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -36,12 +33,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@ContextConfiguration
|
||||
public class HibernateJpaOperationsTests extends AbstractJpaOperationsTests {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Autowired
|
||||
private LocalContainerEntityManagerFactoryBean fb;
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testExecuteUpdate() {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
|
||||
<import resource="classpath:/hibernateJpa-context.xml" />
|
||||
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
package org.springframework.integration.jpa.core;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.text.ParseException;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
||||
import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
|
||||
import org.apache.openjpa.jdbc.meta.MappingTool;
|
||||
@@ -28,8 +29,10 @@ import org.apache.openjpa.lib.conf.Configurations;
|
||||
import org.apache.openjpa.lib.util.Options;
|
||||
import org.apache.openjpa.persistence.InvalidStateException;
|
||||
import org.apache.openjpa.persistence.PersistenceException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -47,6 +50,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* </pre>
|
||||
*
|
||||
* @author Gunnar Hillert
|
||||
* @author Gary Russell
|
||||
* @since 2.2
|
||||
*
|
||||
*/
|
||||
@@ -101,6 +105,7 @@ public class OpenJpaJpaOperationsTests extends AbstractJpaOperationsTests {
|
||||
|
||||
boolean ret = Configurations.runAgainstAllAnchors(opts,
|
||||
new Configurations.Runnable() {
|
||||
@Override
|
||||
public boolean run(Options opts) throws IOException, SQLException {
|
||||
JDBCConfiguration conf = new JDBCConfigurationImpl();
|
||||
conf.setConnectionDriverName("org.h2.Driver");
|
||||
@@ -116,7 +121,7 @@ public class OpenJpaJpaOperationsTests extends AbstractJpaOperationsTests {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
assertTrue(ret);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
package org.springframework.integration.mail.config;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
public class FailedMailConfigurationTests {
|
||||
@@ -30,13 +32,13 @@ public class FailedMailConfigurationTests {
|
||||
*/
|
||||
@Test(expected = XmlBeanDefinitionStoreException.class)
|
||||
public void testImapIdleWithNoDeleteMessageAttribute() {
|
||||
new ClassPathXmlApplicationContext("failed-imap-config.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("failed-imap-config.xml", this.getClass()).close();
|
||||
}
|
||||
/**
|
||||
* validates that if 'should-delete-messages' is not set the context fails
|
||||
*/
|
||||
@Test(expected = XmlBeanDefinitionStoreException.class)
|
||||
public void testAdapterWithNoDeleteMessageAttribute() {
|
||||
new ClassPathXmlApplicationContext("failed-adapter-config.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("failed-adapter-config.xml", this.getClass()).close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -22,18 +22,19 @@ import static org.junit.Assert.assertNotNull;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.integration.endpoint.PollingConsumer;
|
||||
import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice;
|
||||
import org.springframework.integration.mail.MailSendingMessageHandler;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.mail.MailSender;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -46,7 +47,7 @@ public class MailOutboundChannelAdapterParserTests {
|
||||
|
||||
@Test
|
||||
public void adapterWithMailSenderReference() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"mailOutboundChannelAdapterParserTests.xml", this.getClass());
|
||||
Object adapter = context.getBean("adapterWithMailSenderReference.adapter");
|
||||
MailSendingMessageHandler handler = (MailSendingMessageHandler)
|
||||
@@ -55,22 +56,24 @@ public class MailOutboundChannelAdapterParserTests {
|
||||
MailSender mailSender = (MailSender) fieldAccessor.getPropertyValue("mailSender");
|
||||
assertNotNull(mailSender);
|
||||
assertEquals(23, fieldAccessor.getPropertyValue("order"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void advised() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"mailOutboundChannelAdapterParserTests.xml", this.getClass());
|
||||
Object adapter = context.getBean("advised.adapter");
|
||||
MessageHandler handler = (MessageHandler)
|
||||
new DirectFieldAccessor(adapter).getPropertyValue("handler");
|
||||
handler.handleMessage(new GenericMessage<String>("foo"));
|
||||
assertEquals(1, adviceCalled);
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void adapterWithHostProperty() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"mailOutboundChannelAdapterParserTests.xml", this.getClass());
|
||||
Object adapter = context.getBean("adapterWithHostProperty.adapter");
|
||||
MailSendingMessageHandler handler = (MailSendingMessageHandler)
|
||||
@@ -78,20 +81,22 @@ public class MailOutboundChannelAdapterParserTests {
|
||||
DirectFieldAccessor fieldAccessor = new DirectFieldAccessor(handler);
|
||||
MailSender mailSender = (MailSender) fieldAccessor.getPropertyValue("mailSender");
|
||||
assertNotNull(mailSender);
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void adapterWithPollableChannel() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"mailOutboundChannelAdapterParserTests.xml", this.getClass());
|
||||
PollingConsumer pc = context.getBean("adapterWithPollableChannel", PollingConsumer.class);
|
||||
QueueChannel pollableChannel = TestUtils.getPropertyValue(pc, "inputChannel", QueueChannel.class);
|
||||
assertEquals("pollableChannel", pollableChannel.getComponentName());
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void adapterWithJavaMailProperties() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"MailOutboundWithJavamailProperties-context.xml", this.getClass());
|
||||
Object adapter = context.getBean("adapterWithHostProperty.adapter");
|
||||
MailSendingMessageHandler handler = (MailSendingMessageHandler)
|
||||
@@ -103,6 +108,7 @@ public class MailOutboundChannelAdapterParserTests {
|
||||
assertEquals(7, javaMailProperties.size());
|
||||
assertNotNull(javaMailProperties);
|
||||
assertEquals("true", javaMailProperties.get("mail.smtps.auth"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
public static class FooAdvice extends AbstractRequestHandlerAdvice {
|
||||
|
||||
@@ -73,7 +73,8 @@ public class MailToStringTransformerParserTests {
|
||||
@Test(expected = BeanDefinitionStoreException.class)
|
||||
public void topLevelTransformerMissingInput() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("mailToStringTransformerWithoutInputChannel.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("mailToStringTransformerWithoutInputChannel.xml", this.getClass())
|
||||
.close();
|
||||
}
|
||||
catch (BeanDefinitionStoreException e) {
|
||||
assertTrue(e.getMessage().contains("input-channel"));
|
||||
|
||||
@@ -12,27 +12,27 @@
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<int:channel id="inputChannel"/>
|
||||
|
||||
|
||||
<int-mail:header-enricher input-channel="inputChannel" output-channel="mailChannel">
|
||||
<int-mail:to value="mailto"/>
|
||||
<int-mail:from value="mailfrom"/>
|
||||
<int-mail:subject value="With Content Type"/>
|
||||
<int-mail:content-type value="text/html"/>
|
||||
</int-mail:header-enricher>
|
||||
|
||||
|
||||
<int:channel id="mailChannel"/>
|
||||
|
||||
<int-mail:outbound-channel-adapter channel="mailChannel"
|
||||
|
||||
<int-mail:outbound-channel-adapter channel="mailChannel"
|
||||
host="smtp.gmail.com"
|
||||
port="587"
|
||||
username="user"
|
||||
password="password"
|
||||
java-mail-properties="javaMailProperties"/>
|
||||
|
||||
|
||||
<util:properties id="javaMailProperties">
|
||||
<prop key="mail.debug">true</prop>
|
||||
<prop key="mail.smtps.auth">true</prop>
|
||||
<prop key="mail.smtp.starttls.enable">true</prop>
|
||||
</util:properties>
|
||||
<prop key="mail.smtps.auth">true</prop>
|
||||
<prop key="mail.smtp.starttls.enable">true</prop>
|
||||
</util:properties>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -36,19 +36,20 @@ import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.mail.MailHeaders;
|
||||
import org.springframework.integration.mail.MailSendingMessageHandler;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
public class MessageWithContentTypeTests {
|
||||
@@ -56,12 +57,14 @@ public class MessageWithContentTypeTests {
|
||||
@Test
|
||||
@Ignore
|
||||
public void testSendEmail() throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("MessageWithContentTypeTests-context.xml", this.getClass());
|
||||
ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext(
|
||||
"MessageWithContentTypeTests-context.xml", this.getClass());
|
||||
MessageChannel inputChannel = ac.getBean("inputChannel", MessageChannel.class);
|
||||
StringWriter writer = new StringWriter();
|
||||
FileReader reader = new FileReader("src/test/java/org/springframework/integration/mail/config/test.html");
|
||||
FileCopyUtils.copy(reader, writer);
|
||||
inputChannel.send(new GenericMessage<String>(writer.getBuffer().toString()));
|
||||
ac.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -80,6 +83,7 @@ public class MessageWithContentTypeTests {
|
||||
// MOCKS
|
||||
when(sender.createMimeMessage()).thenReturn(mMessage);
|
||||
doAnswer(new Answer<Object>() {
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
MimeMessage mimeMessage = (MimeMessage) invocation.getArguments()[0];
|
||||
assertEquals("text/html", mimeMessage.getDataHandler().getContentType());
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
xmlns:int-mail="http://www.springframework.org/schema/integration/mail">
|
||||
|
||||
<int:channel id="receiveChannel"/>
|
||||
|
||||
|
||||
<int-mail:inbound-channel-adapter store-uri="imaps://[username]:[password]@imap.gmail.com/INBOX"
|
||||
channel="receiveChannel">
|
||||
<int:poller max-messages-per-poll="1">
|
||||
<int:interval-trigger interval="5000"/>
|
||||
</int:poller>
|
||||
</int-mail:inbound-channel-adapter>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
xmlns:int-mail="http://www.springframework.org/schema/integration/mail">
|
||||
|
||||
<int:channel id="receiveChannel"/>
|
||||
|
||||
|
||||
<int-mail:imap-idle-channel-adapter store-uri="imaps://[username]:[password]@imap.gmail.com/INBOX"
|
||||
channel="receiveChannel"/>
|
||||
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xmlns:util="http://www.springframework.org/schema/util">
|
||||
|
||||
<!--
|
||||
|
||||
<!--
|
||||
|
||||
IMAP and IMAP IDLE sample configuration to use with Gmail
|
||||
There is no test to back this up, just a sample config to use with your tests
|
||||
-->
|
||||
@@ -23,30 +23,28 @@
|
||||
auto-startup="true"
|
||||
should-delete-messages="false"
|
||||
java-mail-properties="javaMailProperties"/>
|
||||
|
||||
|
||||
<int-mail:inbound-channel-adapter id="imapAdapter"
|
||||
store-uri="imaps://[username]:[password]@imap.gmail.com/INBOX"
|
||||
java-mail-properties="javaMailProperties"
|
||||
channel="receiveChannel"
|
||||
should-delete-messages="true"
|
||||
java-mail-properties="javaMailProperties"
|
||||
channel="receiveChannel"
|
||||
should-delete-messages="true"
|
||||
auto-startup="true">
|
||||
<int:poller max-messages-per-poll="1">
|
||||
<int:interval-trigger interval="5000"/>
|
||||
</int:poller>
|
||||
<int:poller max-messages-per-poll="1" fixed-delay="5000" />
|
||||
</int-mail:inbound-channel-adapter>
|
||||
|
||||
|
||||
<int:channel id="receiveChannel"/>
|
||||
|
||||
|
||||
<int:service-activator input-channel="receiveChannel">
|
||||
<bean class="org.springframework.integration.mail.config.GoogleTest.SampleReceiver"/>
|
||||
</int:service-activator>
|
||||
|
||||
|
||||
<util:properties id="javaMailProperties">
|
||||
<prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
|
||||
<prop key="mail.imap.socketFactory.fallback">false</prop>
|
||||
<prop key="mail.store.protocol">imaps</prop>
|
||||
<prop key="mail.debug">false</prop>
|
||||
</util:properties>
|
||||
|
||||
|
||||
<task:executor id="executor" pool-size="5"/>
|
||||
</beans>
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
<int-mail:outbound-channel-adapter id="adapterWithMailSenderReference"
|
||||
order="23"
|
||||
mail-sender="mailSender"/>
|
||||
|
||||
|
||||
<int-mail:outbound-channel-adapter id="adapterWithPollableChannel" channel="pollableChannel"
|
||||
order="23"
|
||||
mail-sender="mailSender">
|
||||
<int:poller fixed-rate="100" max-messages-per-poll="4"/>
|
||||
</int-mail:outbound-channel-adapter>
|
||||
|
||||
|
||||
<int:channel id="pollableChannel">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
|
||||
<int-mail:outbound-channel-adapter id="adapterWithHostProperty"
|
||||
host="somehost" username="someuser" password="somepassword"/>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -797,7 +797,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
this.payload = message.getPayload();
|
||||
this.headers = message.getHeaders();
|
||||
if (message instanceof AdviceMessage) {
|
||||
this.inputMessage = ((AdviceMessage) message).getInputMessage();
|
||||
this.inputMessage = ((AdviceMessage<?>) message).getInputMessage();
|
||||
}
|
||||
else {
|
||||
this.inputMessage = null;
|
||||
@@ -816,6 +816,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
return this._group_complete;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public Object get_GroupId() {
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.integration.mongodb.inbound.MongoDbMessageSource;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class MongoDbInboundChannelAdapterParserTests {
|
||||
|
||||
@@ -47,6 +48,7 @@ public class MongoDbInboundChannelAdapterParserTests {
|
||||
assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
|
||||
assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof LiteralExpression);
|
||||
assertEquals("data", TestUtils.getPropertyValue(source, "collectionNameExpression.literalValue"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,6 +65,7 @@ public class MongoDbInboundChannelAdapterParserTests {
|
||||
assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
|
||||
assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof SpelExpression);
|
||||
assertEquals("'foo'", TestUtils.getPropertyValue(source, "collectionNameExpression.expression"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -79,6 +82,7 @@ public class MongoDbInboundChannelAdapterParserTests {
|
||||
assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
|
||||
assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof LiteralExpression);
|
||||
assertEquals("foo", TestUtils.getPropertyValue(source, "collectionNameExpression.literalValue"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -94,15 +98,18 @@ public class MongoDbInboundChannelAdapterParserTests {
|
||||
assertNotNull(TestUtils.getPropertyValue(source, "evaluationContext"));
|
||||
assertTrue(TestUtils.getPropertyValue(source, "collectionNameExpression") instanceof LiteralExpression);
|
||||
assertEquals("foo", TestUtils.getPropertyValue(source, "collectionNameExpression.literalValue"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void templateAndFactoryFail() {
|
||||
new ClassPathXmlApplicationContext("inbound-adapter-parser-fail-template-factory-config.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("inbound-adapter-parser-fail-template-factory-config.xml", this.getClass())
|
||||
.close();
|
||||
}
|
||||
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void templateAndConverterFail() {
|
||||
new ClassPathXmlApplicationContext("inbound-adapter-parser-fail-template-converter-config.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("inbound-adapter-parser-fail-template-converter-config.xml", this.getClass())
|
||||
.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.data.mongodb.MongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.BasicQuery;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.mongodb.rules.MongoDbAvailable;
|
||||
import org.springframework.integration.mongodb.rules.MongoDbAvailableTests;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.util.JSON;
|
||||
@@ -50,6 +50,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila
|
||||
MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
|
||||
MongoTemplate template = new MongoTemplate(mongoDbFactory);
|
||||
assertNotNull(template.find(new BasicQuery("{'name' : 'Bob'}"), Person.class, "data"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -64,6 +65,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila
|
||||
|
||||
MongoTemplate template = new MongoTemplate(mongoDbFactory);
|
||||
assertNotNull(template.find(new BasicQuery("{'name' : 'Bob'}"), Person.class, "foo"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -78,6 +80,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila
|
||||
|
||||
MongoTemplate template = new MongoTemplate(mongoDbFactory);
|
||||
assertNotNull(template.find(new BasicQuery("{'name' : 'Bob'}"), Person.class, "foo"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -95,6 +98,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila
|
||||
|
||||
MongoTemplate template = new MongoTemplate(mongoDbFactory);
|
||||
assertNotNull(template.find(new BasicQuery("{'foo' : 'bar'}"), BasicDBObject.class, "foo"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -112,6 +116,7 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila
|
||||
|
||||
MongoTemplate template = new MongoTemplate(mongoDbFactory);
|
||||
assertNotNull(template.find(new BasicQuery("{'foo' : 'bar'}"), BasicDBObject.class, "foo"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -126,5 +131,6 @@ public class MongoDbOutboundChannelAdapterIntegrationTests extends MongoDbAvaila
|
||||
MongoDbFactory mongoDbFactory = this.prepareMongoFactory();
|
||||
MongoTemplate template = new MongoTemplate(mongoDbFactory);
|
||||
assertNotNull(template.find(new BasicQuery("{'name' : 'Bob'}"), Person.class, "data"));
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.expression.spel.standard.SpelExpression;
|
||||
@@ -41,6 +40,7 @@ import org.springframework.messaging.MessageHandler;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class MongoDbOutboundChannelAdapterParserTests {
|
||||
|
||||
@@ -57,6 +57,7 @@ public class MongoDbOutboundChannelAdapterParserTests {
|
||||
assertNotNull(TestUtils.getPropertyValue(handler, "evaluationContext"));
|
||||
assertTrue(TestUtils.getPropertyValue(handler, "collectionNameExpression") instanceof LiteralExpression);
|
||||
assertEquals("data", TestUtils.getPropertyValue(handler, "collectionNameExpression.literalValue"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -72,6 +73,7 @@ public class MongoDbOutboundChannelAdapterParserTests {
|
||||
assertNotNull(TestUtils.getPropertyValue(handler, "evaluationContext"));
|
||||
assertTrue(TestUtils.getPropertyValue(handler, "collectionNameExpression") instanceof SpelExpression);
|
||||
assertEquals("headers.collectionName", TestUtils.getPropertyValue(handler, "collectionNameExpression.expression"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -87,6 +89,7 @@ public class MongoDbOutboundChannelAdapterParserTests {
|
||||
assertNotNull(TestUtils.getPropertyValue(handler, "evaluationContext"));
|
||||
assertTrue(TestUtils.getPropertyValue(handler, "collectionNameExpression") instanceof LiteralExpression);
|
||||
assertEquals("foo", TestUtils.getPropertyValue(handler, "collectionNameExpression.literalValue"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -101,27 +104,33 @@ public class MongoDbOutboundChannelAdapterParserTests {
|
||||
assertNotNull(TestUtils.getPropertyValue(handler, "evaluationContext"));
|
||||
assertTrue(TestUtils.getPropertyValue(handler, "collectionNameExpression") instanceof LiteralExpression);
|
||||
assertEquals("foo", TestUtils.getPropertyValue(handler, "collectionNameExpression.literalValue"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void templateAndFactoryFail() {
|
||||
new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-factory-config.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-factory-config.xml", this.getClass())
|
||||
.close();
|
||||
}
|
||||
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void templateAndConverterFail() {
|
||||
new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-converter-config.xml", this.getClass());
|
||||
new ClassPathXmlApplicationContext("outbound-adapter-parser-fail-template-converter-config.xml",
|
||||
this.getClass()).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInt3024PollerAndRequestHandlerAdviceChain() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("outbound-adapter-parser-config.xml", this.getClass());
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"outbound-adapter-parser-config.xml", this.getClass());
|
||||
AbstractEndpoint endpoint = context.getBean("pollableAdapter", AbstractEndpoint.class);
|
||||
assertThat(endpoint, Matchers.instanceOf(PollingConsumer.class));
|
||||
MessageHandler handler = TestUtils.getPropertyValue(endpoint, "handler", MessageHandler.class);
|
||||
assertTrue(AopUtils.isAopProxy(handler));
|
||||
List<?> advisors = TestUtils.getPropertyValue(handler, "h.advised.advisors", List.class);
|
||||
assertThat(TestUtils.getPropertyValue(advisors.get(0), "advice"), Matchers.instanceOf(RequestHandlerRetryAdvice.class));
|
||||
assertThat(TestUtils.getPropertyValue(advisors.get(0), "advice"),
|
||||
Matchers.instanceOf(RequestHandlerRetryAdvice.class));
|
||||
context.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<int:transactional synchronization-factory="syncFactory"/>
|
||||
</int:poller>
|
||||
</int-mongodb:inbound-channel-adapter>
|
||||
|
||||
|
||||
<int:transaction-synchronization-factory id="syncFactory">
|
||||
<int:after-commit expression="@documentCleaner.remove(#mongoTemplate, payload, headers.mongo_collectionName)"/>
|
||||
</int:transaction-synchronization-factory>
|
||||
|
||||
@@ -195,7 +195,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT
|
||||
assertTrue(retrievedMessage instanceof AdviceMessage);
|
||||
assertEquals(messageToStore.getPayload(), retrievedMessage.getPayload());
|
||||
assertEquals(messageToStore.getHeaders(), retrievedMessage.getHeaders());
|
||||
assertEquals(inputMessage, ((AdviceMessage) retrievedMessage).getInputMessage());
|
||||
assertEquals(inputMessage, ((AdviceMessage<?>) retrievedMessage).getInputMessage());
|
||||
assertEquals(messageToStore, retrievedMessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ public class RedisLockRegistryTests extends RedisAvailableTests {
|
||||
lock.lock();
|
||||
}
|
||||
assertEquals(10,
|
||||
((Collection) TestUtils.getPropertyValue(registry, "hardThreadLocks", ThreadLocal.class).get()).size());
|
||||
((Collection<?>) TestUtils.getPropertyValue(registry, "hardThreadLocks", ThreadLocal.class).get()).size());
|
||||
assertNull(TestUtils.getPropertyValue(registry, "weakThreadLocks", ThreadLocal.class).get());
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
||||
@@ -21,13 +21,13 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.rmi.RmiInboundGateway;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -37,7 +37,7 @@ public class RmiInboundGatewayParserTests {
|
||||
|
||||
@Test
|
||||
public void gatewayWithDefaultsAndHistory() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"rmiInboundGatewayParserTests.xml", this.getClass());
|
||||
MessageChannel channel = (MessageChannel) context.getBean("testChannel");
|
||||
RmiInboundGateway gateway = (RmiInboundGateway) context.getBean("gatewayWithDefaults");
|
||||
@@ -51,11 +51,12 @@ public class RmiInboundGatewayParserTests {
|
||||
DirectFieldAccessor templateAccessor = new DirectFieldAccessor(template);
|
||||
assertEquals(1000L, templateAccessor.getPropertyValue("sendTimeout"));
|
||||
assertEquals(1000L, templateAccessor.getPropertyValue("receiveTimeout"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gatewayWithCustomProperties() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"rmiInboundGatewayParserTests.xml", this.getClass());
|
||||
MessageChannel channel = (MessageChannel) context.getBean("testChannel");
|
||||
RmiInboundGateway gateway = (RmiInboundGateway) context.getBean("gatewayWithCustomProperties");
|
||||
@@ -67,37 +68,41 @@ public class RmiInboundGatewayParserTests {
|
||||
DirectFieldAccessor templateAccessor = new DirectFieldAccessor(template);
|
||||
assertEquals(123L, templateAccessor.getPropertyValue("sendTimeout"));
|
||||
assertEquals(456L, templateAccessor.getPropertyValue("receiveTimeout"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gatewayWithHost() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"rmiInboundGatewayParserTests.xml", this.getClass());
|
||||
RmiInboundGateway gateway = (RmiInboundGateway) context.getBean("gatewayWithHostAndErrorChannel");
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
|
||||
assertEquals("localhost", accessor.getPropertyValue("registryHost"));
|
||||
assertSame(context.getBean("testErrorChannel"),
|
||||
TestUtils.getPropertyValue(gateway, "errorChannel"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gatewayWithPort() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"rmiInboundGatewayParserTests.xml", this.getClass());
|
||||
RmiInboundGateway gateway = (RmiInboundGateway) context.getBean("gatewayWithPort");
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
|
||||
assertEquals(1234, accessor.getPropertyValue("registryPort"));
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gatewayWithRemoteInvocationExecutorReference() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"rmiInboundGatewayParserTests.xml", this.getClass());
|
||||
RmiInboundGateway gateway = (RmiInboundGateway) context.getBean("gatewayWithExecutorRef");
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
|
||||
Object remoteInvocationExecutor = accessor.getPropertyValue("remoteInvocationExecutor");
|
||||
assertNotNull(remoteInvocationExecutor);
|
||||
assertEquals(StubRemoteInvocationExecutor.class, remoteInvocationExecutor.getClass());
|
||||
context.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</rmi:request-handler-advice-chain>
|
||||
</rmi:outbound-gateway>
|
||||
|
||||
<beans:bean id="advice"
|
||||
<beans:bean id="advice"
|
||||
class="org.springframework.integration.rmi.config.RmiOutboundGatewayParserTests$FooAdvice" />
|
||||
|
||||
<chain input-channel="rmiOutboundGatewayInsideChain">
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/rmi
|
||||
http://www.springframework.org/schema/integration/rmi/spring-integration-rmi.xsd">
|
||||
|
||||
|
||||
<message-history/>
|
||||
|
||||
<channel id="testChannel"/>
|
||||
@@ -30,4 +30,4 @@
|
||||
|
||||
<beans:bean id="invocationExecutor" class="org.springframework.integration.rmi.config.StubRemoteInvocationExecutor"/>
|
||||
|
||||
</beans:beans>
|
||||
</beans:beans>
|
||||
|
||||
Reference in New Issue
Block a user