[portal-commits] JBoss Portal SVN: r8893 - in branches/JBoss_Portal_Branch_2_6: wsrp/src/main/org/jboss/portal/test/wsrp/consumer and 1 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Tue Nov 13 01:48:06 EST 2007


Author: chris.laprun at jboss.com
Date: 2007-11-13 01:48:05 -0500 (Tue, 13 Nov 2007)
New Revision: 8893

Modified:
   branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
   branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/EndpointConfigurationInfoTestCase.java
   branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
Log:
- JBPORTAL-1566: use WSDL by default. Still needs more testing.
- Updated and added tests to check behavior wrt WSDL.

Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java	2007-11-13 05:45:17 UTC (rev 8892)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java	2007-11-13 06:48:05 UTC (rev 8893)
@@ -55,6 +55,11 @@
    private String registration;
    private String wsdl;
 
+   public ConsumerBean()
+   {
+      useWSDL = Boolean.TRUE; // use WSDL by default
+   }
+
    public void setRegistry(ConsumerRegistry registry)
    {
       this.registry = registry;
@@ -112,6 +117,7 @@
          portletManagement = endpoint.getPortletManagementURL();
          registration = endpoint.getRegistrationURL();
          wsdl = endpoint.getWsdlDefinitionURL();
+         useWSDL = endpoint.usesWSDL();
       }
    }
 
@@ -205,15 +211,23 @@
 
    public boolean isRegistrationCheckNeeded()
    {
-      RegistrationInfo regInfo = getProducerInfo().getRegistrationInfo();
-      if (regInfo == null)
+      ProducerInfo info = getProducerInfo();
+      if (info.isRefreshNeeded(true))
       {
-         return true;
+         RegistrationInfo regInfo = info.getRegistrationInfo();
+         if (regInfo == null)
+         {
+            return true;
+         }
+         else
+         {
+            Boolean consistent = regInfo.isConsistentWithProducerExpectations();
+            return consistent == null || !consistent.booleanValue();
+         }
       }
       else
       {
-         Boolean consistent = regInfo.isConsistentWithProducerExpectations();
-         return consistent == null || !consistent.booleanValue();
+         return false;
       }
    }
 

Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/EndpointConfigurationInfoTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/EndpointConfigurationInfoTestCase.java	2007-11-13 05:45:17 UTC (rev 8892)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/EndpointConfigurationInfoTestCase.java	2007-11-13 06:48:05 UTC (rev 8893)
@@ -47,8 +47,15 @@
 
    public void testSetURLs() throws InvokerUnavailableException
    {
+      // default state is to use WSDL
+      assertTrue(info.usesWSDL());
+
+
       info.setServiceDescriptionURL(url);
       assertEquals(url, info.getServiceDescriptionURL());
+
+      // changing the URLs should switch to not using WSDL anymore...
+      assertFalse(info.usesWSDL());
       try
       {
          info.getServiceFactory();
@@ -59,6 +66,7 @@
       }
 
       info.setMarkupURL(url);
+      assertFalse(info.usesWSDL());
       assertNotNull(info.getServiceFactory());
       assertEquals(url, info.getServiceFactory().getServiceDescriptionURL());
       assertEquals(url, info.getServiceFactory().getMarkupURL());
@@ -67,6 +75,8 @@
 
    public void testSetWSDLURL() throws InvokerUnavailableException
    {
+      assertTrue(info.usesWSDL());
+
       info.setServiceDescriptionURL(url);
       info.setMarkupURL(url);
       assertTrue(info.getServiceFactory() instanceof PerEndpointSOAPInvokerServiceFactory);
@@ -82,7 +92,14 @@
       info.setMarkupURL(url);
       assertEquals(url, info.getMarkupURL());
       assertEquals(url, info.getServiceFactory().getMarkupURL());
+      assertFalse(info.usesWSDL());
+   }
+
+   public void testSetInvalidWSDLURL()
+   {
+      info.setWsdlDefinitionURL(url);
       assertTrue(info.usesWSDL());
+      assertEquals(url, info.getWsdlDefinitionURL());
    }
 
    public void testSetNullWSDLURL()
@@ -92,6 +109,8 @@
 
       // it should be possible to set the WSDL to null for Hibernate
       info.setWsdlDefinitionURL(null);
+
+      assertFalse(info.usesWSDL());
    }
 
    public void testRefreshWSDL() throws Exception

Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java	2007-11-13 05:45:17 UTC (rev 8892)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java	2007-11-13 06:48:05 UTC (rev 8893)
@@ -52,7 +52,7 @@
    private String persistentMarkupURL = UNSET;
    private String persistentRegistrationURL;
    private String persistentPortletManagementURL;
-   private String persistentWsdlDefinitionURL;
+   private String persistentWsdlDefinitionURL = UNSET;
 
    // transient variables
    /** Access to the WS */
@@ -73,6 +73,9 @@
    private final static int PM = 2;
    private final static int R = 3;
 
+   /** Whether we're using information from a WSDL or not. */
+   private boolean usingWSDL = true;
+
    // todo: public for tests
    public EndpointConfigurationInfo()
    {
@@ -103,7 +106,7 @@
 
    public boolean usesWSDL()
    {
-      return serviceFactory instanceof RemoteSOAPInvokerServiceFactory || persistentWsdlDefinitionURL != null;
+      return usingWSDL;
    }
 
    public String getWsdlDefinitionURL()
@@ -196,8 +199,10 @@
       // WSDL url is optional so can be null (and in particular, it is when loaded from Hibernate most of the time)
       // do not attempt to set the URL if the service factory hasn't been created yet to avoid issues when
       // ConsumerRegistry starts (in particular, raising an exception if the WSDL is not available)
-      if (wsdlDefinitionURL != null && serviceFactory != null)
+      if (wsdlDefinitionURL != null && !UNSET.equals(wsdlDefinitionURL) && serviceFactory != null)
       {
+         usingWSDL = true;
+
          if (!(serviceFactory instanceof RemoteSOAPInvokerServiceFactory))
          {
             serviceFactory = new RemoteSOAPInvokerServiceFactory();
@@ -212,6 +217,7 @@
       {
          oldValue = newValue;
          clean.clear(whichURL);
+         usingWSDL = false;
       }
 
       return oldValue;
@@ -221,7 +227,7 @@
    {
       if (serviceFactory == null)
       {
-         if (usesWSDL())
+         if (usesWSDL() && !UNSET.equals(persistentWsdlDefinitionURL))
          {
             serviceFactory = new RemoteSOAPInvokerServiceFactory();
             internalSetWsdlURL();
@@ -274,6 +280,13 @@
       try
       {
          ((RemoteSOAPInvokerServiceFactory)serviceFactory).setWsdlDefinitionURL(persistentWsdlDefinitionURL);
+
+         // update the URLs based on WSDL information
+         persistentMarkupURL = serviceFactory.getMarkupURL();
+         persistentPortletManagementURL = serviceFactory.getPortletManagementURL();
+         persistentRegistrationURL = serviceFactory.getRegistrationURL();
+         persistentServiceDescriptionURL = serviceFactory.getServiceDescriptionURL();
+
          clean.set(0, 4); // if setting the WSDL URL worked, consider everything clean
       }
       catch (Exception e)




More information about the portal-commits mailing list