Author: chris.laprun(a)jboss.com
Date: 2010-09-30 15:26:55 -0400 (Thu, 30 Sep 2010)
New Revision: 4451
Modified:
components/wsrp/trunk/admin-gui/pom.xml
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java
Log:
- GTNWSRP-83: Re-activated and improved existing tests. Lots more work needed, of course!
Modified: components/wsrp/trunk/admin-gui/pom.xml
===================================================================
--- components/wsrp/trunk/admin-gui/pom.xml 2010-09-30 19:22:55 UTC (rev 4450)
+++ components/wsrp/trunk/admin-gui/pom.xml 2010-09-30 19:26:55 UTC (rev 4451)
@@ -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>
@@ -81,20 +82,4 @@
<version>1.1.15</version>
</dependency>
</dependencies>
-
- <!-- Disable some tests for now until we can find some time to work on migrating
them -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>org/gatein/wsrp/other/*</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
</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:22:55 UTC (rev 4450)
+++
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java 2010-09-30
19:26:55 UTC (rev 4451)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -24,8 +24,14 @@
package org.gatein.wsrp.other;
import junit.framework.TestCase;
+import org.gatein.common.NotYetImplemented;
+import org.gatein.wsrp.admin.ui.BeanContext;
import org.gatein.wsrp.admin.ui.ConsumerBean;
+import org.gatein.wsrp.consumer.registry.InMemoryConsumerRegistry;
+import java.util.Locale;
+import java.util.Map;
+
/**
* TODO: re-activate tests once test-support module is updated.
*
@@ -35,36 +41,64 @@
*/
public class ConsumerBeanTestCase extends TestCase
{
+ private static final String CONSUMER_ID = "foo";
+ private static final String WSDL = "wsdl";
private ConsumerBean bean;
protected void setUp() throws Exception
{
bean = new ConsumerBean();
-// bean.setRegistry(new MockConsumerRegistry());
+ InMemoryConsumerRegistry registry = new InMemoryConsumerRegistry();
+ registry.createConsumer(CONSUMER_ID, null, WSDL);
+ bean.setRegistry(registry);
+ bean.setBeanContext(new TestBeanContext());
// consumer associated with bean is null at this point so it should be loaded from
the registry
-// bean.setId(MockConsumerRegistry.CONSUMER2);
+ bean.setId(CONSUMER_ID);
}
- // todo: remove when tests are re-activated
- public void testNothing()
+ public void testInitialState()
{
- assertTrue(true);
- }
+ assertEquals(CONSUMER_ID, bean.getId());
+ assertEquals(WSDL, bean.getWsdl());
- /*public void testInitialState()
- {
-// assertEquals(MockConsumerRegistry.CONSUMER2, bean.getId());
-// assertEquals(MockConsumerRegistry.MOCK_MARKUP, bean.getMarkup());
-// assertEquals(MockConsumerRegistry.MOCK_SERVICE_DESCRIPTION,
bean.getServiceDescription());
assertFalse(bean.isModified());
+ assertTrue(bean.isRefreshNeeded());
+
+ assertFalse(bean.isActive());
+
+ assertFalse(bean.isRegistrationChecked());
+ assertTrue(bean.isRegistrationCheckNeeded());
+ assertFalse(bean.isRegistered());
+ assertFalse(bean.isRegistrationLocallyModified());
+ assertFalse(bean.isRegistrationPropertiesExisting());
+
+ try
+ {
+ assertFalse(bean.isRegistrationRequired());
+ fail("Can't know if registration is required without a refresh");
+ }
+ catch (IllegalStateException e)
+ {
+ // expected
+ }
+ try
+ {
+ assertFalse(bean.isRegistrationValid());
+ fail("Can't know if registration is valid without a refresh");
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
}
- public void testSetId()
+ public void testSetId()
{
String newId = "newId";
bean.setId(newId);
assertEquals(newId, bean.getId());
+
assertTrue(bean.isModified());
}
@@ -106,5 +140,5 @@
{
throw new NotYetImplemented();
}
- }*/
+ }
}