merged from trunk for 2.0.1 release in gCube 2.12
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/common/common-clients/2.0@67128 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d330601693
commit
4022288d1a
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-clients</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<version>2.0.1-SNAPSHOT</version>
|
||||
|
||||
<name>Common Clients</name>
|
||||
<description>A framework for client APIs</description>
|
||||
|
|
|
@ -139,7 +139,7 @@ public class DiscoveryDelegate<A,S> extends AbstractDelegate<A,S,DiscoveryConfig
|
|||
}
|
||||
catch(Exception e) {
|
||||
log.error("could not resolve "+address,e);
|
||||
lastFault = e;
|
||||
throw e;
|
||||
}
|
||||
|
||||
V result = call.call(stub);
|
||||
|
@ -152,6 +152,9 @@ public class DiscoveryDelegate<A,S> extends AbstractDelegate<A,S,DiscoveryConfig
|
|||
|
||||
lastFault= plugin.convert(fault,config());
|
||||
|
||||
if(lastFault==null)
|
||||
lastFault=fault;
|
||||
|
||||
if (isUnrecoverable(lastFault) || isAnchored()) // exit now
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,15 @@ public class DirectDelegateTest {
|
|||
|
||||
}
|
||||
|
||||
@Test(expected=IllegalStateException.class)
|
||||
public void proxiesHandleResolutionErrors() throws Exception {
|
||||
|
||||
when(plugin.resolve(address,config)).thenThrow(new Exception());
|
||||
|
||||
delegate.make(call);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void proxiesResolveAddressesAndMakeCalls() throws Exception {
|
||||
|
||||
|
|
|
@ -76,6 +76,26 @@ public class DiscoveryDelegateTest {
|
|||
delegate = new DiscoveryDelegate<Object,Object>(config);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void proxiesHandleResolutionErrors() throws Exception {
|
||||
|
||||
Exception e1 = new Exception();
|
||||
Exception e2 = new Exception();
|
||||
//stage
|
||||
when(query.fire()).thenReturn(asList(address,address2));
|
||||
when(plugin.resolve(address,config)).thenThrow(e1);
|
||||
when(plugin.resolve(address2,config)).thenThrow(e2);
|
||||
|
||||
try {
|
||||
delegate.make(call);
|
||||
fail();
|
||||
}
|
||||
catch(Exception e) {
|
||||
assertEquals(e2,e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void proxiesDiscoverCallAndCacheEndpoints() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue