Author: chris.laprun(a)jboss.com
Date: 2011-09-16 07:25:56 -0400 (Fri, 16 Sep 2011)
New Revision: 7453
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
Log:
- GTNWSRP-241: if status is FAILURE, then didRefreshHappen should return false. Added test
case.
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java 2011-09-16
11:25:45 UTC (rev 7452)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java 2011-09-16
11:25:56 UTC (rev 7453)
@@ -25,8 +25,7 @@
import org.oasis.wsrp.v2.ServiceDescription;
-import static org.gatein.wsrp.consumer.RefreshResult.Status.BYPASSED;
-import static org.gatein.wsrp.consumer.RefreshResult.Status.SUCCESS;
+import static org.gatein.wsrp.consumer.RefreshResult.Status.*;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
@@ -77,7 +76,7 @@
public boolean didRefreshHappen()
{
- return !BYPASSED.equals(status);
+ return !BYPASSED.equals(status) && !FAILURE.equals(status);
}
public boolean hasIssues()
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-09-16
11:25:45 UTC (rev 7452)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-09-16
11:25:56 UTC (rev 7453)
@@ -96,6 +96,13 @@
assertEquals(info, regInfo2.getParent());
}
+ public void testRefreshDidNotHappenIfFailure() throws PortletInvokerException
+ {
+ serviceFactory.setFailed(true);
+ final boolean refresh = info.refresh(false);
+ assertFalse(refresh);
+ }
+
public void testSetNullRegistrationInfo()
{
try
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java 2011-09-16
11:25:45 UTC (rev 7452)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java 2011-09-16
11:25:56 UTC (rev 7453)
@@ -69,6 +69,7 @@
private String wsdl = DEFAULT_WSDL_URL;
public static final String DEFAULT_WSDL_URL =
"http://example.com/producer?wsdl";
private int timeout = DEFAULT_TIMEOUT_MS;
+ private boolean failed = false;
public BehaviorBackedServiceFactory()
@@ -167,12 +168,12 @@
public boolean isFailed()
{
- return false;
+ return failed;
}
public void setFailed(boolean failed)
{
- // do nothing
+ this.failed = failed;
}
public void setWSOperationTimeOut(int msBeforeTimeOut)
@@ -197,6 +198,11 @@
public void start() throws Exception
{
+ if (failed)
+ {
+ throw new RuntimeException("ServiceFactory has failed!");
+ }
+
initialized = true;
}
Show replies by date