24
24
import java .util .Collection ;
25
25
import java .util .List ;
26
26
import java .util .Set ;
27
+ import java .util .concurrent .TimeUnit ;
27
28
import java .util .stream .Collectors ;
28
29
29
30
import net .shibboleth .utilities .java .support .xml .SerializeSupport ;
@@ -89,14 +90,14 @@ public void setup() throws Exception {
89
90
@ Test
90
91
public void withMetadataUrlLocationWhenResolvableThenFindByEntityIdReturns () throws Exception {
91
92
try (MockWebServer server = new MockWebServer ()) {
92
- server .setDispatcher (new AlwaysDispatch (new MockResponse (). setBody ( this .metadata ). setResponseCode ( 200 ) ));
93
+ server .setDispatcher (new AlwaysDispatch (this .metadata ));
93
94
AssertingPartyMetadataRepository parties = OpenSamlAssertingPartyMetadataRepository
94
- .withTrustedMetadataLocation (server .url ("/" ).toString ())
95
- .build ();
95
+ .withTrustedMetadataLocation (server .url ("/" ).toString ())
96
+ .build ();
96
97
AssertingPartyMetadata party = parties .findByEntityId ("https://idp.example.com/idp/shibboleth" );
97
98
assertThat (party .getEntityId ()).isEqualTo ("https://idp.example.com/idp/shibboleth" );
98
99
assertThat (party .getSingleSignOnServiceLocation ())
99
- .isEqualTo ("https://idp.example.com/idp/profile/SAML2/POST/SSO" );
100
+ .isEqualTo ("https://idp.example.com/idp/profile/SAML2/POST/SSO" );
100
101
assertThat (party .getSingleSignOnServiceBinding ()).isEqualTo (Saml2MessageBinding .POST );
101
102
assertThat (party .getVerificationX509Credentials ()).hasSize (1 );
102
103
assertThat (party .getEncryptionX509Credentials ()).hasSize (1 );
@@ -106,8 +107,7 @@ public void withMetadataUrlLocationWhenResolvableThenFindByEntityIdReturns() thr
106
107
@ Test
107
108
public void withMetadataUrlLocationnWhenResolvableThenIteratorReturns () throws Exception {
108
109
try (MockWebServer server = new MockWebServer ()) {
109
- server .setDispatcher (
110
- new AlwaysDispatch (new MockResponse ().setBody (this .entitiesDescriptor ).setResponseCode (200 )));
110
+ server .setDispatcher (new AlwaysDispatch (this .entitiesDescriptor ));
111
111
List <AssertingPartyMetadata > parties = new ArrayList <>();
112
112
OpenSamlAssertingPartyMetadataRepository .withTrustedMetadataLocation (server .url ("/" ).toString ())
113
113
.build ()
@@ -360,7 +360,7 @@ private static final class AlwaysDispatch extends Dispatcher {
360
360
private final MockResponse response ;
361
361
362
362
private AlwaysDispatch (String body ) {
363
- this .response = new MockResponse ().setBody (body ).setResponseCode (200 );
363
+ this .response = new MockResponse ().setBody (body ).setResponseCode (200 ). setBodyDelay ( 1 , TimeUnit . MILLISECONDS ) ;
364
364
}
365
365
366
366
private AlwaysDispatch (MockResponse response ) {
0 commit comments