@Test public void shouldInvokeRegisterEndpoint() throws Exception { Client client = new Client(); client.setId("client-id"); client.setClientId("client-id"); client.setRedirectUris(Collections.singletonList("http: router.route().order(-1).handler(routingContext -> { routingContext.put("client", client); routingContext.next(); }); when(userService.register(eq(client), any(), any())).thenReturn(Single.just(new RegistrationResponse())); testRequest( HttpMethod.POST, "/register", null, resp -> { String location = resp.headers().get("location"); assertNotNull(location); assertTrue(location.endsWith("/register?success=registration_succeed&client_id=client-id")); }, HttpStatusCode.FOUND_302, "Found", null); }
private void register(Client client, User user, io.gravitee.am.identityprovider.api.User principal, Handler<AsyncResult<RegistrationResponse>> handler) { userService.register(client, user, principal) .subscribe( response -> handler.handle(Future.succeededFuture(response)), error -> handler.handle(Future.failedFuture(error))); }
RegisterSubmissionEndpoint extends UserRequestHandler { private void register(Client client, User user, io.gravitee.am.identityprovider.api.User principal, Handler<AsyncResult<RegistrationResponse>> handler) { userService.register(client, user, principal) .subscribe( response -> handler.handle(Future.succeededFuture(response)), error -> handler.handle(Future.failedFuture(error))); } }
RegisterSubmissionEndpoint extends UserRequestHandler { private void register(Client client, User user, io.gravitee.am.identityprovider.api.User principal, Handler<AsyncResult<RegistrationResponse>> handler) { userService.register(client, user, principal) .subscribe( response -> handler.handle(Future.succeededFuture(response)), error -> handler.handle(Future.failedFuture(error))); } RegisterSubmissionEndpoint(UserService userService, Domain domain); }
RegisterSubmissionEndpoint extends UserRequestHandler { private void register(Client client, User user, io.gravitee.am.identityprovider.api.User principal, Handler<AsyncResult<RegistrationResponse>> handler) { userService.register(client, user, principal) .subscribe( response -> handler.handle(Future.succeededFuture(response)), error -> handler.handle(Future.failedFuture(error))); } RegisterSubmissionEndpoint(UserService userService, Domain domain); @Override void handle(RoutingContext context); }
RegisterSubmissionEndpoint extends UserRequestHandler { private void register(Client client, User user, io.gravitee.am.identityprovider.api.User principal, Handler<AsyncResult<RegistrationResponse>> handler) { userService.register(client, user, principal) .subscribe( response -> handler.handle(Future.succeededFuture(response)), error -> handler.handle(Future.failedFuture(error))); } RegisterSubmissionEndpoint(UserService userService, Domain domain); @Override void handle(RoutingContext context);  }