INT-1471, more polishing, pushing tests that I worgot to 'git add'

This commit is contained in:
Oleg Zhurakousky
2010-10-28 11:50:56 -04:00
committed by Chris Beams
parent 969ac122f1
commit 838b783517
2 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans
xmlns="http://www.springframework.org/schema/integration"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:tool="http://www.springframework.org/schema/tool"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:twitter="http://www.springframework.org/schema/integration/twitter"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool-3.0.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd http://www.springframework.org/schema/integration/twitter http://www.springframework.org/schema/integration/twitter/spring-integration-twitter.xsd">
<beans:bean id="tc" class="org.springframework.integration.twitter.config.TestSendingMessageHandlerParserTests.MockOathConfigurationFactoryBean"/>
<channel id="inbound_mentions"/>
<channel id="inputChannel"/>
<twitter:outbound-dm-channel-adapter twitter-connection="tc" channel="inputChannel"/>
<twitter:outbound-update-channel-adapter twitter-connection="tc" channel="inputChannel"/>
</beans:beans>

View File

@@ -0,0 +1,60 @@
/*
* Copyright 2002-2010 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.integration.twitter.config;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Test;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.twitter.oauth.OAuthConfiguration;
import twitter4j.Twitter;
/**
* @author Oleg Zhurakousky
*
*/
public class TestSendingMessageHandlerParserTests {
@Test
public void testSendingMessageHandlerSuccessfullBootstrap(){
new ClassPathXmlApplicationContext("TestSendingMessageHandlerParser-context.xml", this.getClass());
// the fact that no exception was thrown satisfies this test
}
public static class MockOathConfigurationFactoryBean implements FactoryBean<OAuthConfiguration>{
@Override
public OAuthConfiguration getObject() throws Exception {
OAuthConfiguration config = mock(OAuthConfiguration.class);
Twitter twitter = mock(Twitter.class);
when(config.getTwitter()).thenReturn(twitter);
return config;
}
@Override
public Class<?> getObjectType() {
return OAuthConfiguration.class;
}
@Override
public boolean isSingleton() {
return true;
}
}
}