Author: chris.laprun(a)jboss.com
Date: 2007-04-17 20:15:31 -0400 (Tue, 17 Apr 2007)
New Revision: 6995
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpSession.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
Log:
- Removed get/setServiceFactory methods on WSRPConsumer and made it so that clients of
WSRPConsumer should not be aware of ServiceFactory.
- Fixed tests.
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2007-04-17
22:03:45 UTC (rev 6994)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2007-04-18
00:15:31 UTC (rev 6995)
@@ -33,8 +33,6 @@
import org.jboss.portal.wsrp.core.RegistrationData;
import org.jboss.portal.wsrp.deployment.WSRPDeployment;
import org.jboss.portal.wsrp.deployment.WSRPDeploymentFactory;
-import org.jboss.portal.wsrp.services.PerEndpointSOAPInvokerServiceFactory;
-import org.jboss.portal.wsrp.services.RemoteSOAPInvokerServiceFactory;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -87,17 +85,10 @@
assertEquals(consumer.getProducerId(), info.getId());
EndpointConfigurationInfo endInfo = info.getEndpointConfigurationInfo();
assertNotNull(endInfo);
- assertNotNull(consumer.getServiceFactory());
- assertTrue(consumer.getServiceFactory() instanceof
PerEndpointSOAPInvokerServiceFactory);
- PerEndpointSOAPInvokerServiceFactory serviceFactory =
(PerEndpointSOAPInvokerServiceFactory)consumer.getServiceFactory();
- assertEquals("http://www.example.com",
serviceFactory.getServiceDescriptionURL());
- assertEquals("http://www.example.com", serviceFactory.getMarkupURL());
- assertEquals("http://www.example.com",
serviceFactory.getRegistrationURL());
- assertEquals("http://www.example.com",
serviceFactory.getPortletManagementURL());
- assertEquals(endInfo.getServiceDescriptionURL(),
serviceFactory.getServiceDescriptionURL());
- assertEquals(endInfo.getMarkupURL(), serviceFactory.getMarkupURL());
- assertEquals(endInfo.getRegistrationURL(), serviceFactory.getRegistrationURL());
- assertEquals(endInfo.getPortletManagementURL(),
serviceFactory.getPortletManagementURL());
+ assertEquals("http://www.example.com",
endInfo.getServiceDescriptionURL());
+ assertEquals("http://www.example.com", endInfo.getMarkupURL());
+ assertEquals("http://www.example.com", endInfo.getRegistrationURL());
+ assertEquals("http://www.example.com",
endInfo.getPortletManagementURL());
// inDB2 is active and configured from the DB (configured in MockConsumerRegistry)
consumer = (WSRPConsumer)services.get(1);
@@ -114,7 +105,6 @@
assertEquals("producer1", consumer.getProducerId());
info = consumer.getProducerInfo();
assertEquals(120, info.getExpirationCacheSeconds().intValue());
- assertTrue(consumer.getServiceFactory() instanceof
RemoteSOAPInvokerServiceFactory);
endInfo = info.getEndpointConfigurationInfo();
assertNotNull(endInfo);
assertTrue(endInfo.usesWSDL());
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpSession.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpSession.java 2007-04-17
22:03:45 UTC (rev 6994)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockHttpSession.java 2007-04-18
00:15:31 UTC (rev 6995)
@@ -66,6 +66,10 @@
{
return "MockHttpSession";
}
+ else if ("getId".equals(methodName))
+ {
+ return "SESSION_ID";
+ }
else
{
throw new UnsupportedOperationException("MockHttpSession does not support:
" + method);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java 2007-04-17 22:03:45 UTC
(rev 6994)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPConsumer.java 2007-04-18 00:15:31 UTC
(rev 6995)
@@ -28,7 +28,6 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
import org.jboss.portal.wsrp.consumer.ProducerSessionInformation;
-import org.jboss.portal.wsrp.services.ServiceFactory;
import org.jboss.system.Service;
import javax.servlet.http.HttpSession;
@@ -49,21 +48,6 @@
String getProducerId();
/**
- * Sets the ServiceFactory this Consumer will use to access the associated
Producer's services. Required for wiring
- * of services.
- *
- * @param serviceFactory the ServiceFactory this Consumer will use to access the
associated Producer's services.
- */
- void setServiceFactory(ServiceFactory serviceFactory);
-
- /**
- * Retrieves the ServiceFactory this Consumer will use to access the associated
Producer's services.
- *
- * @return the ServiceFactory this Consumer will use to access the associated
Producer's services.
- */
- ServiceFactory getServiceFactory();
-
- /**
* Retrieves the session information for the producer associated with this consumer.
*
* @param invocation a portlet invocation from which the session information should be
extracted.
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2007-04-17
22:03:45 UTC (rev 6994)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java 2007-04-18
00:15:31 UTC (rev 6995)
@@ -233,6 +233,16 @@
}
+ public void start() throws Exception
+ {
+ getServiceFactory().start();
+ }
+
+ public void stop() throws Exception
+ {
+ getServiceFactory().stop();
+ }
+
public ServiceFactory getServiceFactory()
{
initServiceFactoryIfNeeded();
@@ -288,4 +298,16 @@
+ e.getLocalizedMessage(), e);
}
}
+
+ public boolean isAvailable()
+ {
+ try
+ {
+ return getServiceFactory().isAvailable();
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-04-17
22:03:45 UTC (rev 6994)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-04-18
00:15:31 UTC (rev 6995)
@@ -474,7 +474,7 @@
log.info("Consumer with id '" + getProducerId() + "'
activated");
}
- producerInfo.setActive(getServiceFactory().isAvailable());
+ producerInfo.setActive(getEndpointConfigurationInfo().isAvailable());
}
public void deactivate() throws Exception
@@ -492,14 +492,14 @@
protected void startService() throws Exception
{
super.startService();
- getServiceFactory().start();
+ getEndpointConfigurationInfo().start();
started = true;
log.info("Consumer with id '" + getProducerId() + "'
started");
}
protected void stopService() throws Exception
{
- getServiceFactory().stop();
+ getEndpointConfigurationInfo().stop();
super.stopService();
started = false;
log.info("Consumer with id '" + getProducerId() + "'
stopped");
@@ -507,38 +507,43 @@
// Web services access
**********************************************************************************************
- public ServiceFactory getServiceFactory()
+ /**
+ * Needed to wire Consumer tests.
+ *
+ * @param serviceFactory
+ */
+ public void setServiceFactory(ServiceFactory serviceFactory)
{
- return producerInfo.getEndpointConfigurationInfo().getServiceFactory();
+ getEndpointConfigurationInfo().setServiceFactory(serviceFactory);
}
- public void setServiceFactory(ServiceFactory serviceFactory)
+ private EndpointConfigurationInfo getEndpointConfigurationInfo()
{
- producerInfo.getEndpointConfigurationInfo().setServiceFactory(serviceFactory);
+ return producerInfo.getEndpointConfigurationInfo();
}
public WSRP_v1_ServiceDescription_PortType getServiceDescriptionService() throws
PortletInvokerException
{
producerInfo.refresh(false);
- return producerInfo.getEndpointConfigurationInfo().getServiceDescriptionService();
+ return getEndpointConfigurationInfo().getServiceDescriptionService();
}
public WSRP_v1_Markup_PortType getMarkupService() throws PortletInvokerException
{
producerInfo.refresh(false);
- return producerInfo.getEndpointConfigurationInfo().getMarkupService();
+ return getEndpointConfigurationInfo().getMarkupService();
}
public WSRP_v1_PortletManagement_PortType getPortletManagementService() throws
PortletInvokerException
{
producerInfo.refresh(false);
- return producerInfo.getEndpointConfigurationInfo().getPortletManagementService();
+ return getEndpointConfigurationInfo().getPortletManagementService();
}
public WSRP_v1_Registration_PortType getRegistrationService() throws
PortletInvokerException
{
producerInfo.refresh(false);
- return producerInfo.getEndpointConfigurationInfo().getRegistrationService();
+ return getEndpointConfigurationInfo().getRegistrationService();
}
public void refreshProducerInfo() throws PortletInvokerException
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-04-17
22:03:45 UTC (rev 6994)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-04-18
00:15:31 UTC (rev 6995)
@@ -325,7 +325,7 @@
}
String message;
- if (consumer.getServiceFactory().isAvailable())
+ if (consumer.getProducerInfo().getEndpointConfigurationInfo().isAvailable())
{
message = "Added consumer for producer '" +
consumer.getProducerId() + "' from xml configuration.";
deployment.getConsumers().add(consumer);