Author: chris.laprun(a)jboss.com
Date: 2010-09-30 16:38:55 -0400 (Thu, 30 Sep 2010)
New Revision: 4452
Modified:
components/wsrp/trunk/admin-gui/pom.xml
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java
components/wsrp/trunk/consumer/pom.xml
Log:
- GTNWSRP-83:
+ Use a custom ConsumerRegistry so that we can inject a mock endpoint configuration into
"real" consumer to be able to test closer to real conditions.
+ Created attached test jar in consumer so that we can reuse the test classes in
admin-gui module.
- Improved comment in consumer POM since it wasn't accurate.
Modified: components/wsrp/trunk/admin-gui/pom.xml
===================================================================
--- components/wsrp/trunk/admin-gui/pom.xml 2010-09-30 19:26:55 UTC (rev 4451)
+++ components/wsrp/trunk/admin-gui/pom.xml 2010-09-30 20:38:55 UTC (rev 4452)
@@ -81,5 +81,13 @@
<artifactId>jsf-facelets</artifactId>
<version>1.1.15</version>
</dependency>
+
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-consumer</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Modified:
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java
===================================================================
---
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java 2010-09-30
19:26:55 UTC (rev 4451)
+++
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java 2010-09-30
20:38:55 UTC (rev 4452)
@@ -25,9 +25,13 @@
import junit.framework.TestCase;
import org.gatein.common.NotYetImplemented;
+import org.gatein.wsrp.WSRPConsumer;
import org.gatein.wsrp.admin.ui.BeanContext;
import org.gatein.wsrp.admin.ui.ConsumerBean;
+import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
import org.gatein.wsrp.consumer.registry.InMemoryConsumerRegistry;
+import org.gatein.wsrp.test.protocol.v2.BehaviorBackedServiceFactory;
+import org.gatein.wsrp.test.support.MockEndpointConfigurationInfo;
import java.util.Locale;
import java.util.Map;
@@ -42,13 +46,15 @@
public class ConsumerBeanTestCase extends TestCase
{
private static final String CONSUMER_ID = "foo";
- private static final String WSDL = "wsdl";
+
+ /** Since our consumers use the MockEndpointConfigurationInfo, this is the WSDL they
are configured with */
+ private static final String WSDL = BehaviorBackedServiceFactory.DEFAULT_WSDL_URL;
private ConsumerBean bean;
protected void setUp() throws Exception
{
bean = new ConsumerBean();
- InMemoryConsumerRegistry registry = new InMemoryConsumerRegistry();
+ ConsumerRegistry registry = new TestInMemoryConsumerRegistry();
registry.createConsumer(CONSUMER_ID, null, WSDL);
bean.setRegistry(registry);
bean.setBeanContext(new TestBeanContext());
@@ -141,4 +147,16 @@
throw new NotYetImplemented();
}
}
+
+ private static class TestInMemoryConsumerRegistry extends InMemoryConsumerRegistry
+ {
+ @Override
+ public WSRPConsumer createConsumer(String id, Integer expirationCacheSeconds,
String wsdlURL)
+ {
+ // Use a "real" consumer but with a fake endpoint configuration so we
can fake WS access
+ WSRPConsumer consumer = super.createConsumer(id, expirationCacheSeconds,
wsdlURL);
+ consumer.getProducerInfo().setEndpointConfigurationInfo(new
MockEndpointConfigurationInfo());
+ return consumer;
+ }
+ }
}
Modified: components/wsrp/trunk/consumer/pom.xml
===================================================================
--- components/wsrp/trunk/consumer/pom.xml 2010-09-30 19:26:55 UTC (rev 4451)
+++ components/wsrp/trunk/consumer/pom.xml 2010-09-30 20:38:55 UTC (rev 4452)
@@ -21,7 +21,8 @@
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-->
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-parent</artifactId>
@@ -102,7 +103,7 @@
</dependency>
</dependencies>
- <!-- Disable some tests for now until we can find some time to work on migrating
them -->
+ <!-- Ignore all classes in the org.gatein.wsrp.test packages are they are not tests
-->
<build>
<plugins>
<plugin>
@@ -114,6 +115,18 @@
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
\ No newline at end of file