From: <fc...@us...> - 2008-03-20 17:39:10
|
Revision: 751 http://openutils.svn.sourceforge.net/openutils/?rev=751&view=rev Author: fcarone Date: 2008-03-20 10:39:12 -0700 (Thu, 20 Mar 2008) Log Message: ----------- tests configuration almost working Modified Paths: -------------- trunk/openutils-spring-remote-callback/pom.xml trunk/openutils-spring-remote-callback/src/test/resources/spring-client.xml trunk/openutils-spring-remote-callback/src/test/resources/spring-services.xml trunk/openutils-spring-remote-callback/src/test/resources/spring-tests.xml Added Paths: ----------- trunk/openutils-spring-remote-callback/src/test/java/it/openutils/spring/remote/callback/test/ClientTest.java trunk/openutils-spring-remote-callback/src/test/resources/log4j.dtd trunk/openutils-spring-remote-callback/src/test/resources/log4j.xml trunk/openutils-spring-remote-callback/src/test/resources/spring-jms.xml Removed Paths: ------------- trunk/openutils-spring-remote-callback/src/test/java/it/openutils/spring/remote/callback/test/Client.java Property Changed: ---------------- trunk/openutils-spring-remote-callback/ Property changes on: trunk/openutils-spring-remote-callback ___________________________________________________________________ Name: svn:ignore + .settings target .checkstyle .classpath .project Modified: trunk/openutils-spring-remote-callback/pom.xml =================================================================== --- trunk/openutils-spring-remote-callback/pom.xml 2008-03-20 16:18:55 UTC (rev 750) +++ trunk/openutils-spring-remote-callback/pom.xml 2008-03-20 17:39:12 UTC (rev 751) @@ -130,6 +130,12 @@ <version>4.4</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.xbean</groupId> + <artifactId>xbean-spring-v2c</artifactId> + <version>2.8</version> + <scope>test</scope> + </dependency> </dependencies> <repositories> <repository> Deleted: trunk/openutils-spring-remote-callback/src/test/java/it/openutils/spring/remote/callback/test/Client.java =================================================================== --- trunk/openutils-spring-remote-callback/src/test/java/it/openutils/spring/remote/callback/test/Client.java 2008-03-20 16:18:55 UTC (rev 750) +++ trunk/openutils-spring-remote-callback/src/test/java/it/openutils/spring/remote/callback/test/Client.java 2008-03-20 17:39:12 UTC (rev 751) @@ -1,36 +0,0 @@ -/* - * Copyright Openmind http://www.openmindonline.it - * - * 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 it.openutils.spring.remote.callback.test; - -import it.openutils.spring.remote.callback.test.shared.DummyManager; - - -/** - * @author fcarone - * @version $Id: $ - */ -public class Client -{ - - private DummyManager dummyManager; - - public void clientTest() - { - dummyManager.findAll(); - } - -} Copied: trunk/openutils-spring-remote-callback/src/test/java/it/openutils/spring/remote/callback/test/ClientTest.java (from rev 749, trunk/openutils-spring-remote-callback/src/test/java/it/openutils/spring/remote/callback/test/Client.java) =================================================================== --- trunk/openutils-spring-remote-callback/src/test/java/it/openutils/spring/remote/callback/test/ClientTest.java (rev 0) +++ trunk/openutils-spring-remote-callback/src/test/java/it/openutils/spring/remote/callback/test/ClientTest.java 2008-03-20 17:39:12 UTC (rev 751) @@ -0,0 +1,63 @@ +/* + * Copyright Openmind http://www.openmindonline.it + * + * 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 it.openutils.spring.remote.callback.test; + +import it.openutils.spring.remote.callback.test.shared.DummyManager; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; + + +/** + * @author fcarone + * @version $Id: $ + */ +@ContextConfiguration(locations = {"/spring-tests.xml" }) +public class ClientTest extends AbstractJUnit4SpringContextTests +{ + + private DummyManager dummyManager; + + + /** + * Get the RMI version of the manager + */ + @Before + public void setupTest() + { + this.dummyManager = (DummyManager) applicationContext.getBean("dummyManager"); + } + + @Test + public void clientTest() + { + dummyManager.findAll(); + } + + + /** + * Sets the dummyManager. + * @param dummyManager the dummyManager to set + */ + public void setDummyManager(DummyManager dummyManager) + { + this.dummyManager = dummyManager; + } + +} Added: trunk/openutils-spring-remote-callback/src/test/resources/log4j.dtd =================================================================== --- trunk/openutils-spring-remote-callback/src/test/resources/log4j.dtd (rev 0) +++ trunk/openutils-spring-remote-callback/src/test/resources/log4j.dtd 2008-03-20 17:39:12 UTC (rev 751) @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- Authors: Chris Taylor, Ceki Gulcu. --> + +<!-- Version: 1.2 --> + +<!-- A configuration element consists of optional renderer +elements,appender elements, categories and an optional root +element. --> + +<!ELEMENT log4j:configuration (renderer*, appender*,(category|logger)*,root?, + categoryFactory?)> + +<!-- The "threshold" attribute takes a level value such that all --> +<!-- logging statements with a level equal or below this value are --> +<!-- disabled. --> + +<!-- Setting the "debug" enable the printing of internal log4j logging --> +<!-- statements. --> + +<!-- By default, debug attribute is "null", meaning that we not do touch --> +<!-- internal log4j logging settings. The "null" value for the threshold --> +<!-- attribute can be misleading. The threshold field of a repository --> +<!-- cannot be set to null. The "null" value for the threshold attribute --> +<!-- simply means don't touch the threshold field, the threshold field --> +<!-- keeps its old value. --> + +<!ATTLIST log4j:configuration + xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/" + threshold (all|debug|info|warn|error|fatal|off|null) "null" + debug (true|false|null) "null" +> + +<!-- renderer elements allow the user to customize the conversion of --> +<!-- message objects to String. --> + +<!ELEMENT renderer EMPTY> +<!ATTLIST renderer + renderedClass CDATA #REQUIRED + renderingClass CDATA #REQUIRED +> + +<!-- Appenders must have a name and a class. --> +<!-- Appenders may contain an error handler, a layout, optional parameters --> +<!-- and filters. They may also reference (or include) other appenders. --> +<!ELEMENT appender (errorHandler?, param*, layout?, filter*, appender-ref*)> +<!ATTLIST appender + name ID #REQUIRED + class CDATA #REQUIRED +> + +<!ELEMENT layout (param*)> +<!ATTLIST layout + class CDATA #REQUIRED +> + +<!ELEMENT filter (param*)> +<!ATTLIST filter + class CDATA #REQUIRED +> + +<!-- ErrorHandlers can be of any class. They can admit any number of --> +<!-- parameters. --> + +<!ELEMENT errorHandler (param*, root-ref?, logger-ref*, appender-ref?)> +<!ATTLIST errorHandler + class CDATA #REQUIRED +> + +<!ELEMENT root-ref EMPTY> + +<!ELEMENT logger-ref EMPTY> +<!ATTLIST logger-ref + ref IDREF #REQUIRED +> + +<!ELEMENT param EMPTY> +<!ATTLIST param + name CDATA #REQUIRED + value CDATA #REQUIRED +> + + +<!-- The priority class is org.apache.log4j.Level by default --> +<!ELEMENT priority (param*)> +<!ATTLIST priority + class CDATA #IMPLIED + value CDATA #REQUIRED +> + +<!-- The level class is org.apache.log4j.Level by default --> +<!ELEMENT level (param*)> +<!ATTLIST level + class CDATA #IMPLIED + value CDATA #REQUIRED +> + + +<!-- If no level element is specified, then the configurator MUST not --> +<!-- touch the level of the named category. --> +<!ELEMENT category (param*,(priority|level)?,appender-ref*)> +<!ATTLIST category + class CDATA #IMPLIED + name CDATA #REQUIRED + additivity (true|false) "true" +> + +<!-- If no level element is specified, then the configurator MUST not --> +<!-- touch the level of the named logger. --> +<!ELEMENT logger (level?,appender-ref*)> +<!ATTLIST logger + name ID #REQUIRED + additivity (true|false) "true" +> + + +<!ELEMENT categoryFactory (param*)> +<!ATTLIST categoryFactory + class CDATA #REQUIRED> + +<!ELEMENT appender-ref EMPTY> +<!ATTLIST appender-ref + ref IDREF #REQUIRED +> + +<!-- If no priority element is specified, then the configurator MUST not --> +<!-- touch the priority of root. --> +<!-- The root category always exists and cannot be subclassed. --> +<!ELEMENT root (param*, (priority|level)?, appender-ref*)> + + +<!-- ==================================================================== --> +<!-- A logging event --> +<!-- ==================================================================== --> +<!ELEMENT log4j:eventSet (log4j:event*)> +<!ATTLIST log4j:eventSet + xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/" + version (1.1|1.2) "1.2" + includesLocationInfo (true|false) "true" +> + + + +<!ELEMENT log4j:event (log4j:message, log4j:NDC?, log4j:throwable?, + log4j:locationInfo?) > + +<!-- The timestamp format is application dependent. --> +<!ATTLIST log4j:event + logger CDATA #REQUIRED + level CDATA #REQUIRED + thread CDATA #REQUIRED + timestamp CDATA #REQUIRED +> + +<!ELEMENT log4j:message (#PCDATA)> +<!ELEMENT log4j:NDC (#PCDATA)> + +<!ELEMENT log4j:throwable (#PCDATA)> + +<!ELEMENT log4j:locationInfo EMPTY> +<!ATTLIST log4j:locationInfo + class CDATA #REQUIRED + method CDATA #REQUIRED + file CDATA #REQUIRED + line CDATA #REQUIRED +> Added: trunk/openutils-spring-remote-callback/src/test/resources/log4j.xml =================================================================== --- trunk/openutils-spring-remote-callback/src/test/resources/log4j.xml (rev 0) +++ trunk/openutils-spring-remote-callback/src/test/resources/log4j.xml 2008-03-20 17:39:12 UTC (rev 751) @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> +<log4j:configuration> + <!-- log4j test configuration --> + <appender name="test-appender" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%-5p %c.%M(%C{1}.java:%L) %m%n" /> + <!-- <param name="ConversionPattern" value="%-5p %m%n" />--> + </layout> + </appender> + <category name="it"> + <priority value="debug" /> + </category> + <category name="org"> + <priority value="warn" /> + </category> + <category name="com"> + <priority value="warn" /> + </category> + <category name="net"> + <priority value="warn" /> + </category> + <category name="org.hibernate"> + <priority value="warn" /> + </category> + <category name="it.openutils.test.ApplicationContextHolder"> + <priority value="info" /> + </category> + <category name="it.openutils.test.BaseDAOTestCase"> + <priority value="INFO" /> + </category> + <category name="it.openutils"> + <priority value="INFO" /> + </category> + <category name="it.openutils.test"> + <priority value="INFO" /> + </category> + <category name="it.openutils.dbupdate.DbSetupManagerImpl"> + <priority value="INFO" /> + </category> + <category name="it.openutils.hibernate.spring.rmibernate"> + <priority value="DEBUG" /> + </category> + <category name="org.acegisecurity"> + <priority value="DEBUG" /> + </category> + <root> + <priority value="debug" /> + <appender-ref ref="test-appender" /> + </root> +</log4j:configuration> \ No newline at end of file Modified: trunk/openutils-spring-remote-callback/src/test/resources/spring-client.xml =================================================================== --- trunk/openutils-spring-remote-callback/src/test/resources/spring-client.xml 2008-03-20 16:18:55 UTC (rev 750) +++ trunk/openutils-spring-remote-callback/src/test/resources/spring-client.xml 2008-03-20 17:39:12 UTC (rev 751) @@ -2,15 +2,32 @@ xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> - <bean id="callbackManager" class="org.logicblaze.lingo.jms.JmsProxyFactoryBean"> + <!-- RMI CONFIG --> + <bean id="dummyManager" class="org.springframework.aop.framework.ProxyFactoryBean"> + <property name="targetName" value="dummyManagerRMI" /> + <property name="interceptorNames"> + <list> + <value>serverMethodInterceptor</value> + </list> + </property> + </bean> + <bean id="dummyManagerRMI" class="org.springframework.remoting.rmi.RmiProxyFactoryBean" lazy-init="true"> + <property name="serviceUrl" value="rmi://localhost:1099/dummyManagerRmi" /> + <property name="serviceInterface" value="it.openutils.spring.remote.callback.test.shared.DummyManager" /> + <property name="cacheStub" value="true" /> + <property name="lookupStubOnStartup" value="false" /> + <property name="refreshStubOnConnectFailure" value="true" /> + </bean> + <bean id="serverMethodInterceptor" class="it.openutils.spring.remote.callback.interceptor.CallbackInstallerInterceptor"> + <property name="callbackManager" ref="callbackManagerJMS" /> + <property name="callback" ref="clientCallback" /> + </bean> + <bean id="clientCallback" class="it.openutils.spring.remote.callback.test.ClientCallback" /> + <!-- JMS CONFIG --> + <bean id="callbackManagerJMS" class="org.logicblaze.lingo.jms.JmsProxyFactoryBean"> <property name="serviceInterface" value="it.openutils.spring.remote.callback.manager.CallbackManager" /> <property name="connectionFactory" ref="jmsFactory" /> <property name="destination" ref="callbackDestination" /> </bean> - <bean id="jmsFactory" class="org.activemq.ActiveMQConnectionFactory"> - <property name="brokerURL" value="tcp://localhost:61616" /> - </bean> - <bean id="callbackDestination" class="org.activemq.message.ActiveMQQueue"> - <constructor-arg index="0" value="callbackDestinationQ" /> - </bean> + </beans> Added: trunk/openutils-spring-remote-callback/src/test/resources/spring-jms.xml =================================================================== --- trunk/openutils-spring-remote-callback/src/test/resources/spring-jms.xml (rev 0) +++ trunk/openutils-spring-remote-callback/src/test/resources/spring-jms.xml 2008-03-20 17:39:12 UTC (rev 751) @@ -0,0 +1,9 @@ +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:util="http://www.springframework.org/schema/util" xmlns:amq="http://activemq.org/config/1.0" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd + http://activemq.org/config/1.0 http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd"> + + + +</beans> \ No newline at end of file Modified: trunk/openutils-spring-remote-callback/src/test/resources/spring-services.xml =================================================================== --- trunk/openutils-spring-remote-callback/src/test/resources/spring-services.xml 2008-03-20 16:18:55 UTC (rev 750) +++ trunk/openutils-spring-remote-callback/src/test/resources/spring-services.xml 2008-03-20 17:39:12 UTC (rev 751) @@ -1,11 +1,37 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:util="http://www.springframework.org/schema/util" + xmlns:util="http://www.springframework.org/schema/util" xmlns:amq="http://activemq.org/config/1.0" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd - http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> - <bean id="dummyManager" class="it.openutils.spring.remote.callback.test.server.DummyManagerImpl" /> + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd + http://activemq.org/config/1.0 http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd"> + <!-- MANAGERS CONFIG --> + <bean id="dummyManager" class="it.openutils.spring.remote.callback.test.server.DummyManagerImpl"> + <property name="callbackManager" ref="callbackManager" /> + </bean> <bean id="callbackManager" class="it.openutils.spring.remote.callback.manager.impl.CallbackManagerImpl" /> + <!-- RMI CONFIG --> + <bean id="dummyManagerRMI" class="org.springframework.remoting.rmi.RmiServiceExporter" lazy-init="true"> + <property name="serviceUrl" value="rmi://localhost:1099/dummyManagerRmi" /> + <property name="serviceInterface" value="it.openutils.spring.remote.callback.test.shared.DummyManager" /> + <property name="cacheStub" value="true" /> + <property name="lookupStubOnStartup" value="false" /> + <property name="refreshStubOnConnectFailure" value="true" /> + </bean> + <!-- JMS CONFIG --> + <!-- lets create an embedded ActiveMQ Broker --> + <amq:broker useJmx="false" persistent="false"> + <amq:transportConnectors> + <amq:transportConnector uri="tcp://localhost:61616"> + </amq:transportConnector> + </amq:transportConnectors> + </amq:broker> + + <!-- ActiveMQ destinations to use --> + <amq:queue id="callbackDestination" physicalName="org.apache.activemq.spring.Test.spring.embedded"/> + + <!-- JMS ConnectionFactory to use, configuring the embedded broker using XML --> + <amq:connectionFactory id="jmsFactory" brokerURL="tcp://localhost:61616"/> + <bean id="callbackManagerListener" class="org.logicblaze.lingo.jms.JmsServiceExporterMessageListener"> - <property name="destination" ref="callbackDestination" /> <property name="service" ref="callbackManager" /> <property name="serviceInterface" value="it.openutils.spring.remote.callback.manager.CallbackManager" /> <property name="connectionFactory" ref="jmsFactory" /> @@ -16,14 +42,4 @@ <property name="messageListener" ref="callbackManagerListener" /> <property name="connectionFactory" ref="jmsFactory" /> </bean> - <!-- JMS ConnectionFactory to use --> - <bean id="jmsFactory" class="org.activemq.ActiveMQConnectionFactory"> - <property name="brokerURL" value="tcp://localhost:61616" /> - <property name="useEmbeddedBroker"> - <value>true</value> - </property> - </bean> - <bean id="callbackDestination" class="org.activemq.message.ActiveMQQueue"> - <constructor-arg index="0" value="callbackDestinationQ" /> - </bean> </beans> \ No newline at end of file Modified: trunk/openutils-spring-remote-callback/src/test/resources/spring-tests.xml =================================================================== --- trunk/openutils-spring-remote-callback/src/test/resources/spring-tests.xml 2008-03-20 16:18:55 UTC (rev 750) +++ trunk/openutils-spring-remote-callback/src/test/resources/spring-tests.xml 2008-03-20 17:39:12 UTC (rev 751) @@ -3,6 +3,9 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> + <!-- any side --> + <import resource="classpath:spring-jms.xml" /> + <!-- server side --> <import resource="classpath:spring-services.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |