Author: chris.laprun(a)jboss.com
Date: 2011-09-19 09:57:13 -0400 (Mon, 19 Sep 2011)
New Revision: 7462
Modified:
components/wsrp/branches/2.0.x/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java
components/wsrp/branches/2.0.x/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
components/wsrp/branches/2.0.x/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/branches/2.0.x/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java
===================================================================
---
components/wsrp/branches/2.0.x/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java 2011-09-19
08:35:42 UTC (rev 7461)
+++
components/wsrp/branches/2.0.x/consumer/src/main/java/org/gatein/wsrp/consumer/RefreshResult.java 2011-09-19
13:57:13 UTC (rev 7462)
@@ -26,6 +26,7 @@
import org.oasis.wsrp.v2.ServiceDescription;
import static org.gatein.wsrp.consumer.RefreshResult.Status.BYPASSED;
+import static org.gatein.wsrp.consumer.RefreshResult.Status.FAILURE;
import static org.gatein.wsrp.consumer.RefreshResult.Status.SUCCESS;
/**
@@ -77,7 +78,7 @@
public boolean didRefreshHappen()
{
- return !BYPASSED.equals(status);
+ return !BYPASSED.equals(status) && !FAILURE.equals(status);
}
public boolean hasIssues()
Modified:
components/wsrp/branches/2.0.x/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
---
components/wsrp/branches/2.0.x/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-09-19
08:35:42 UTC (rev 7461)
+++
components/wsrp/branches/2.0.x/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-09-19
13:57:13 UTC (rev 7462)
@@ -443,6 +443,13 @@
assertFalse(invalid);
}
+ public void testRefreshDidNotHappenIfFailure() throws PortletInvokerException
+ {
+ serviceFactory.setFailed(true);
+ final boolean refresh = info.refresh(false);
+ assertFalse(refresh);
+ }
+
public void testGetInfoForEvent()
{
assertNull(info.getInfoForEvent(null));
Modified:
components/wsrp/branches/2.0.x/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
===================================================================
---
components/wsrp/branches/2.0.x/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java 2011-09-19
08:35:42 UTC (rev 7461)
+++
components/wsrp/branches/2.0.x/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java 2011-09-19
13:57:13 UTC (rev 7462)
@@ -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;
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,10 @@
public void start() throws Exception
{
+ if (failed)
+ {
+ throw new RuntimeException("ServiceFactory has failed!");
+ }
initialized = true;
}
Show replies by date