From fa88d8edecb61c3043f4924604c1cd58ed14ab7e Mon Sep 17 00:00:00 2001 From: Jim Anderson Date: Tue, 20 Dec 2022 20:16:06 -0600 Subject: [PATCH 1/7] remove deprecated list APIs in favor of paginated APIs --- .../auth0/client/mgmt/ClientGrantsEntity.java | 19 --- .../com/auth0/client/mgmt/ClientsEntity.java | 19 --- .../auth0/client/mgmt/ConnectionsEntity.java | 27 ---- .../com/auth0/client/mgmt/GrantsEntity.java | 23 ---- .../client/mgmt/ResourceServerEntity.java | 20 --- .../com/auth0/client/mgmt/RulesEntity.java | 27 ---- .../client/mgmt/ClientGrantsEntityTest.java | 32 ----- .../auth0/client/mgmt/ClientsEntityTest.java | 31 ----- .../client/mgmt/ConnectionsEntityTest.java | 117 ------------------ .../auth0/client/mgmt/GrantsEntityTest.java | 49 -------- .../client/mgmt/ResourceServerEntityTest.java | 19 --- .../auth0/client/mgmt/RulesEntityTest.java | 95 -------------- 12 files changed, 478 deletions(-) diff --git a/src/main/java/com/auth0/client/mgmt/ClientGrantsEntity.java b/src/main/java/com/auth0/client/mgmt/ClientGrantsEntity.java index 2cf0854f1..d33bf667f 100644 --- a/src/main/java/com/auth0/client/mgmt/ClientGrantsEntity.java +++ b/src/main/java/com/auth0/client/mgmt/ClientGrantsEntity.java @@ -51,25 +51,6 @@ public Request list(ClientGrantsFilter filter) { }); } - /** - * Request all the Client Grants. A token with scope read:client_grants is needed. - * See https://auth0.com/docs/api/management/v2#!/Client_Grants/get_client_grants - * - * @return a Request to execute. - * @deprecated Calling this method will soon stop returning the complete list of client grants and instead, limit to the first page of results. - * Please use {@link #list(ClientGrantsFilter)} instead as it provides pagination support. - */ - @Deprecated - public Request> list() { - String url = baseUrl - .newBuilder() - .addPathSegments("api/v2/client-grants") - .build() - .toString(); - return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference>() { - }); - } - /** * Create a Client Grant. A token with scope create:client_grants is needed. * See https://auth0.com/docs/api/management/v2#!/Client_Grants/post_client_grants diff --git a/src/main/java/com/auth0/client/mgmt/ClientsEntity.java b/src/main/java/com/auth0/client/mgmt/ClientsEntity.java index d3ee29dc3..4fa4be3e3 100644 --- a/src/main/java/com/auth0/client/mgmt/ClientsEntity.java +++ b/src/main/java/com/auth0/client/mgmt/ClientsEntity.java @@ -31,25 +31,6 @@ public class ClientsEntity extends BaseManagementEntity { super(client, baseUrl, tokenProvider); } - /** - * Request all the Applications. A token with scope read:clients is needed. If you also need the client_secret and encryption_key attributes the token must have read:client_keys scope. - * See https://auth0.com/docs/api/management/v2#!/Clients/get_clients - * - * @return a Request to execute. - * @deprecated Calling this method will soon stop returning the complete list of clients and instead, limit to the first page of results. - * Please use {@link #list(ClientFilter)} instead as it provides pagination support. - */ - @Deprecated - public Request> list() { - String url = baseUrl - .newBuilder() - .addPathSegments("api/v2/clients") - .build() - .toString(); - return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference>() { - }); - } - /** * Request all the Applications. A token with scope read:clients is needed. If you also need the client_secret and encryption_key attributes the token must have read:client_keys scope. * See https://auth0.com/docs/api/management/v2#!/Clients/get_clients diff --git a/src/main/java/com/auth0/client/mgmt/ConnectionsEntity.java b/src/main/java/com/auth0/client/mgmt/ConnectionsEntity.java index 1e18b0b19..80b935abe 100644 --- a/src/main/java/com/auth0/client/mgmt/ConnectionsEntity.java +++ b/src/main/java/com/auth0/client/mgmt/ConnectionsEntity.java @@ -52,33 +52,6 @@ public Request listAll(ConnectionFilter filter) { } - /** - * Request all the ConnectionsEntity. A token with scope read:connections is needed. - * See https://auth0.com/docs/api/management/v2#!/Connections/get_connections - * - * @param filter the filter to use. Can be null. - * @return a Request to execute. - * @deprecated Calling this method will soon stop returning the complete list of connections and instead, limit to the first page of results. - * Please use {@link #listAll(ConnectionFilter)} instead as it provides pagination support. - */ - @Deprecated - public Request> list(ConnectionFilter filter) { - HttpUrl.Builder builder = baseUrl - .newBuilder() - .addPathSegments("api/v2/connections"); - if (filter != null) { - for (Map.Entry e : filter.getAsMap().entrySet()) { - //This check below is to prevent JSON parsing errors - if (!e.getKey().equalsIgnoreCase("include_totals")) { - builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue())); - } - } - } - String url = builder.build().toString(); - return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference>() { - }); - } - /** * Request a Connection. A token with scope read:connections is needed. * See https://auth0.com/docs/api/management/v2#!/Connections/get_connections_by_id diff --git a/src/main/java/com/auth0/client/mgmt/GrantsEntity.java b/src/main/java/com/auth0/client/mgmt/GrantsEntity.java index 5f786b6a2..5e0b6c45c 100644 --- a/src/main/java/com/auth0/client/mgmt/GrantsEntity.java +++ b/src/main/java/com/auth0/client/mgmt/GrantsEntity.java @@ -55,29 +55,6 @@ public Request list(String userId, GrantsFilter filter) { }); } - /** - * Request all Grants. A token with scope read:grants is needed - * See https://auth0.com/docs/api/management/v2#!/Grants/get_grants - * - * @param userId The user id of the grants to retrieve - * @return a Request to execute. - * @deprecated Calling this method will soon stop returning the complete list of grants and instead, limit to the first page of results. - * Please use {@link #list(String, GrantsFilter)} instead as it provides pagination support. - */ - @Deprecated - public Request> list(String userId) { - Asserts.assertNotNull(userId, "user id"); - - String url = baseUrl - .newBuilder() - .addPathSegments("api/v2/grants") - .addQueryParameter("user_id", userId) - .build() - .toString(); - return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference>() { - }); - } - /** * Delete an existing Grant. A token with scope delete:grants is needed. * See https://auth0.com/docs/api/management/v2#!/Grants/delete_grants_by_id
diff --git a/src/main/java/com/auth0/client/mgmt/ResourceServerEntity.java b/src/main/java/com/auth0/client/mgmt/ResourceServerEntity.java index 391d0a29d..b9c271f0e 100644 --- a/src/main/java/com/auth0/client/mgmt/ResourceServerEntity.java +++ b/src/main/java/com/auth0/client/mgmt/ResourceServerEntity.java @@ -51,26 +51,6 @@ public Request list(ResourceServersFilter filter) { }); } - /** - * Creates request to fetch all resource servers. - * See API documentation - * - * @return request to execute - * @deprecated Calling this method will soon stop returning the complete list of resource servers and instead, limit to the first page of results. - * Please use {@link #list(ResourceServersFilter)} instead as it provides pagination support. - */ - @Deprecated - public Request> list() { - HttpUrl.Builder builder = baseUrl - .newBuilder() - .addPathSegments("api/v2/resource-servers"); - - String url = builder.build().toString(); - return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, - new TypeReference>() { - }); - } - /** * Cretes request for fetching single resource server by it's ID. * See API documentation diff --git a/src/main/java/com/auth0/client/mgmt/RulesEntity.java b/src/main/java/com/auth0/client/mgmt/RulesEntity.java index d216066ff..4cf81843f 100644 --- a/src/main/java/com/auth0/client/mgmt/RulesEntity.java +++ b/src/main/java/com/auth0/client/mgmt/RulesEntity.java @@ -50,33 +50,6 @@ public Request listAll(RulesFilter filter) { }); } - /** - * Request all the Rules. A token with scope read:rules is needed. - * See https://auth0.com/docs/api/management/v2#!/Rules/get_rules - * - * @param filter the filter to use. Can be null. - * @return a Request to execute. - * @deprecated Calling this method will soon stop returning the complete list of rules and instead, limit to the first page of results. - * Please use {@link #listAll(RulesFilter)} instead as it provides pagination support. - */ - @Deprecated - public Request> list(RulesFilter filter) { - HttpUrl.Builder builder = baseUrl - .newBuilder() - .addPathSegments("api/v2/rules"); - if (filter != null) { - for (Map.Entry e : filter.getAsMap().entrySet()) { - //This check below is to prevent JSON parsing errors - if (!e.getKey().equalsIgnoreCase("include_totals")) { - builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue())); - } - } - } - String url = builder.build().toString(); - return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference>() { - }); - } - /** * Request a Rule. A token with scope read:rules is needed. * See https://auth0.com/docs/api/management/v2#!/Rules/get_rules_by_id diff --git a/src/test/java/com/auth0/client/mgmt/ClientGrantsEntityTest.java b/src/test/java/com/auth0/client/mgmt/ClientGrantsEntityTest.java index 5c460728d..f4c5813d6 100644 --- a/src/test/java/com/auth0/client/mgmt/ClientGrantsEntityTest.java +++ b/src/test/java/com/auth0/client/mgmt/ClientGrantsEntityTest.java @@ -101,38 +101,6 @@ public void shouldListClientGrantsWithAdditionalProperties() throws Exception { assertThat(response.getItems(), hasSize(2)); } - - @Test - public void shouldListClientGrants() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.clientGrants().list(); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_CLIENT_GRANTS_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/client-grants")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - - @Test - public void shouldReturnEmptyClientGrants() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.clientGrants().list(); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_EMPTY_LIST, 200); - List response = request.execute().getBody(); - - assertThat(response, is(notNullValue())); - assertThat(response, is(emptyCollectionOf(ClientGrant.class))); - } - @Test public void shouldThrowOnCreateClientGrantWithNullClientId() { exception.expect(IllegalArgumentException.class); diff --git a/src/test/java/com/auth0/client/mgmt/ClientsEntityTest.java b/src/test/java/com/auth0/client/mgmt/ClientsEntityTest.java index 0d4b296ca..752da1ebe 100644 --- a/src/test/java/com/auth0/client/mgmt/ClientsEntityTest.java +++ b/src/test/java/com/auth0/client/mgmt/ClientsEntityTest.java @@ -123,37 +123,6 @@ public void shouldListClientsWithAdditionalProperties() throws Exception { assertThat(response.getItems(), hasSize(2)); } - @Test - public void shouldListClients() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.clients().list(); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_CLIENTS_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/clients")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - - @Test - public void shouldReturnEmptyClients() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.clients().list(); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_EMPTY_LIST, 200); - List response = request.execute().getBody(); - - assertThat(response, is(notNullValue())); - assertThat(response, is(emptyCollectionOf(Client.class))); - } - @Test public void shouldThrowOnGetClientWithNullId() { exception.expect(IllegalArgumentException.class); diff --git a/src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java b/src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java index 09028f757..0d59f6156 100644 --- a/src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java +++ b/src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java @@ -18,88 +18,6 @@ public class ConnectionsEntityTest extends BaseMgmtEntityTest { - @Test - public void shouldListConnections() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.connections().list(null); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_CONNECTIONS_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/connections")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - - @Test - public void shouldListConnectionsWithStrategy() throws Exception { - ConnectionFilter filter = new ConnectionFilter().withStrategy("auth0"); - - @SuppressWarnings("deprecation") - Request> request = api.connections().list(filter); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_CONNECTIONS_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/connections")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - assertThat(recordedRequest, hasQueryParameter("strategy", "auth0")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - - @Test - public void shouldListConnectionsWithName() throws Exception { - ConnectionFilter filter = new ConnectionFilter().withName("my-connection"); - - @SuppressWarnings("deprecation") - Request> request = api.connections().list(filter); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_CONNECTIONS_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/connections")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - assertThat(recordedRequest, hasQueryParameter("name", "my-connection")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - - @Test - public void shouldListConnectionsWithFields() throws Exception { - ConnectionFilter filter = new ConnectionFilter().withFields("some,random,fields", true); - - @SuppressWarnings("deprecation") - Request> request = api.connections().list(filter); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_CONNECTIONS_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/connections")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - assertThat(recordedRequest, hasQueryParameter("fields", "some,random,fields")); - assertThat(recordedRequest, hasQueryParameter("include_fields", "true")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - @Test public void shouldListConnectionsWithoutFilter() throws Exception { Request request = api.connections().listAll(null); @@ -117,27 +35,6 @@ public void shouldListConnectionsWithoutFilter() throws Exception { assertThat(response.getItems(), hasSize(2)); } - @Test - public void shouldNotListConnectionsWithTotals() throws Exception { - ConnectionFilter filter = new ConnectionFilter().withTotals(true); - - @SuppressWarnings("deprecation") - Request> request = api.connections().list(filter); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_CONNECTIONS_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/connections")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - assertThat(recordedRequest, not(hasQueryParameter("include_totals"))); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - @Test public void shouldListConnectionsWithPage() throws Exception { ConnectionFilter filter = new ConnectionFilter().withPage(23, 5); @@ -181,20 +78,6 @@ public void shouldListConnectionsWithTotals() throws Exception { assertThat(response.getLimit(), is(50)); } - - @Test - public void shouldReturnEmptyConnections() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.connections().list(null); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_EMPTY_LIST, 200); - List response = request.execute().getBody(); - - assertThat(response, is(notNullValue())); - assertThat(response, is(emptyCollectionOf(Connection.class))); - } - @Test public void shouldThrowOnGetConnectionWithNullId() { exception.expect(IllegalArgumentException.class); diff --git a/src/test/java/com/auth0/client/mgmt/GrantsEntityTest.java b/src/test/java/com/auth0/client/mgmt/GrantsEntityTest.java index 7d8694592..fec825eaf 100644 --- a/src/test/java/com/auth0/client/mgmt/GrantsEntityTest.java +++ b/src/test/java/com/auth0/client/mgmt/GrantsEntityTest.java @@ -110,55 +110,6 @@ public void shouldListGrantsWithAdditionalProperties() throws Exception { assertThat(response.getItems(), hasSize(2)); } - - @Test - public void shouldListGrants() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.grants().list("userId"); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_GRANTS_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/grants")); - assertThat(recordedRequest, hasQueryParameter("user_id", "userId")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - for (Grant grant : response) { - assertThat(grant.getAudience(), notNullValue()); - assertThat(grant.getClientId(), notNullValue()); - assertThat(grant.getId(), notNullValue()); - assertThat(grant.getScope(), notNullValue()); - assertThat(grant.getScope(), hasSize(2)); - assertThat(grant.getUserId(), equalTo("userId")); - } - } - - @SuppressWarnings("deprecation") - @Test - public void shouldThrowOnListGrantsWithNullUserId() { - exception.expect(IllegalArgumentException.class); - exception.expectMessage("'user id' cannot be null!"); - api.grants().list(null); - } - - @Test - public void shouldReturnEmptyGrants() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.grants().list("userId"); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_EMPTY_LIST, 200); - List response = request.execute().getBody(); - - assertThat(response, is(notNullValue())); - assertThat(response, is(emptyCollectionOf(Grant.class))); - } - @Test public void shouldThrowOnDeleteGrantWithNullId() { exception.expect(IllegalArgumentException.class); diff --git a/src/test/java/com/auth0/client/mgmt/ResourceServerEntityTest.java b/src/test/java/com/auth0/client/mgmt/ResourceServerEntityTest.java index e11897aba..b7ada53f9 100644 --- a/src/test/java/com/auth0/client/mgmt/ResourceServerEntityTest.java +++ b/src/test/java/com/auth0/client/mgmt/ResourceServerEntityTest.java @@ -81,25 +81,6 @@ public void shouldListResourceServerWithTotals() throws Exception { assertThat(response.getLimit(), is(50)); } - @Test - public void shouldListResourceServers() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.resourceServers().list(); - - assertThat(request, is(notNullValue())); - server.jsonResponse(MGMT_RESOURCE_SERVERS_LIST, 200); - - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/resource-servers")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - @Test public void shouldUpdateResourceServer() throws Exception { ResourceServer resourceServer = new ResourceServer("https://api.my-company.com/api/v2/"); diff --git a/src/test/java/com/auth0/client/mgmt/RulesEntityTest.java b/src/test/java/com/auth0/client/mgmt/RulesEntityTest.java index e16a8d359..56491c336 100644 --- a/src/test/java/com/auth0/client/mgmt/RulesEntityTest.java +++ b/src/test/java/com/auth0/client/mgmt/RulesEntityTest.java @@ -18,24 +18,6 @@ public class RulesEntityTest extends BaseMgmtEntityTest { - @Test - public void shouldListRules() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.rules().list(null); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_RULES_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/rules")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - @Test public void shouldListRulesWithoutFilter() throws Exception { Request request = api.rules().listAll(null); @@ -53,70 +35,6 @@ public void shouldListRulesWithoutFilter() throws Exception { assertThat(response.getItems(), hasSize(2)); } - @Test - public void shouldListRulesWithEnabled() throws Exception { - RulesFilter filter = new RulesFilter().withEnabled(true); - - @SuppressWarnings("deprecation") - Request> request = api.rules().list(filter); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_RULES_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/rules")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - assertThat(recordedRequest, hasQueryParameter("enabled", "true")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - - @Test - public void shouldListRulesWithFields() throws Exception { - RulesFilter filter = new RulesFilter().withFields("some,random,fields", true); - - @SuppressWarnings("deprecation") - Request> request = api.rules().list(filter); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_RULES_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/rules")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - assertThat(recordedRequest, hasQueryParameter("fields", "some,random,fields")); - assertThat(recordedRequest, hasQueryParameter("include_fields", "true")); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - - @Test - public void shouldNotListRulesWithTotals() throws Exception { - RulesFilter filter = new RulesFilter().withTotals(true); - - @SuppressWarnings("deprecation") - Request> request = api.rules().list(filter); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_RULES_LIST, 200); - List response = request.execute().getBody(); - RecordedRequest recordedRequest = server.takeRequest(); - - assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/rules")); - assertThat(recordedRequest, hasHeader("Content-Type", "application/json")); - assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); - assertThat(recordedRequest, not(hasQueryParameter("include_totals"))); - - assertThat(response, is(notNullValue())); - assertThat(response, hasSize(2)); - } - @Test public void shouldListRulesWithPage() throws Exception { RulesFilter filter = new RulesFilter().withPage(23, 5); @@ -160,19 +78,6 @@ public void shouldListRulesWithTotals() throws Exception { assertThat(response.getLimit(), is(50)); } - @Test - public void shouldReturnEmptyRules() throws Exception { - @SuppressWarnings("deprecation") - Request> request = api.rules().list(null); - assertThat(request, is(notNullValue())); - - server.jsonResponse(MGMT_EMPTY_LIST, 200); - List response = request.execute().getBody(); - - assertThat(response, is(notNullValue())); - assertThat(response, is(emptyCollectionOf(Rule.class))); - } - @Test public void shouldThrowOnGetRuleWithNullId() { exception.expect(IllegalArgumentException.class); From 1dfccb012b153dac35a1e2712cc6af618df7f931 Mon Sep 17 00:00:00 2001 From: Jim Anderson Date: Tue, 20 Dec 2022 20:23:08 -0600 Subject: [PATCH 2/7] remove deprecated EnrollmentTicket methods --- .../json/mgmt/guardian/EnrollmentTicket.java | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/src/main/java/com/auth0/json/mgmt/guardian/EnrollmentTicket.java b/src/main/java/com/auth0/json/mgmt/guardian/EnrollmentTicket.java index 79d4c7361..d36c7afbe 100644 --- a/src/main/java/com/auth0/json/mgmt/guardian/EnrollmentTicket.java +++ b/src/main/java/com/auth0/json/mgmt/guardian/EnrollmentTicket.java @@ -74,18 +74,6 @@ public String getUserId() { return userId; } - /** - * Setter for the id of the user this ticket is meant to. - * - * @param userId the user id to set. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("user_id") - public void setUserId(String userId) { - this.userId = userId; - } - /** * Whether to send and email for enrollment or not. * @@ -96,18 +84,6 @@ public Boolean willSendEmail() { return sendEmail; } - /** - * Sets whether to send and email for enrollment or not. - * - * @param sendEmail whether this ticket will send an email upon enrollment or not. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("send_mail") - public void setSendEmail(Boolean sendEmail) { - this.sendEmail = sendEmail; - } - /** * Getter for the email to which the ticket will be sent. * @@ -118,18 +94,6 @@ public String getEmail() { return email; } - /** - * Setter for the email to which the ticket will be sent. - * - * @param email the email to sent the ticket to. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("email") - public void setEmail(String email) { - this.email = email; - } - /** * Getter for the ticket id. * From 7fc4ed9d6a3e90016f2d5b4bb11e1c6775928809 Mon Sep 17 00:00:00 2001 From: Jim Anderson Date: Tue, 20 Dec 2022 20:30:16 -0600 Subject: [PATCH 3/7] remove deprecated SNSFactorProvider methods --- .../json/mgmt/guardian/SNSFactorProvider.java | 68 ------------------- .../mgmt/guardian/SNSFactorProviderTest.java | 9 +-- 2 files changed, 2 insertions(+), 75 deletions(-) diff --git a/src/main/java/com/auth0/json/mgmt/guardian/SNSFactorProvider.java b/src/main/java/com/auth0/json/mgmt/guardian/SNSFactorProvider.java index 88459b69c..47772125f 100644 --- a/src/main/java/com/auth0/json/mgmt/guardian/SNSFactorProvider.java +++ b/src/main/java/com/auth0/json/mgmt/guardian/SNSFactorProvider.java @@ -25,15 +25,6 @@ public class SNSFactorProvider { @JsonProperty("sns_gcm_platform_application_arn") private String snsGCMPlatformApplicationArn; - /** - * Creates an empty SNS settings object - * - * @deprecated use the full constructor instead - */ - @Deprecated - public SNSFactorProvider() { - } - /** * Creates a SNS settings object * @@ -62,18 +53,6 @@ public String getAWSAccessKeyId() { return awsAccessKeyId; } - /** - * Setter for the Amazon Web Services access key id. - * - * @param awsAccessKeyId the AWS access key id to set. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("aws_access_key_id") - public void setAWSAccessKeyId(String awsAccessKeyId) { - this.awsAccessKeyId = awsAccessKeyId; - } - /** * Getter for the Amazon Web Services secret access key. * @@ -84,18 +63,6 @@ public String getAWSSecretAccessKey() { return awsSecretAccessKey; } - /** - * Setter for the Amazon Web Services secret access key. - * - * @param awsSecretAccessKey the AWS secret access key to set. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("aws_secret_access_key") - public void setAWSSecretAccessKey(String awsSecretAccessKey) { - this.awsSecretAccessKey = awsSecretAccessKey; - } - /** * Getter for the Amazon Web Services region. * @@ -106,18 +73,6 @@ public String getAWSRegion() { return awsRegion; } - /** - * Setter for the Amazon Web Services region. - * - * @param awsRegion the AWS region to set. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("aws_region") - public void setAWSRegion(String awsRegion) { - this.awsRegion = awsRegion; - } - /** * Getter for the Simple Notification Service Apple Push Notification service platform application Amazon Resource Name. * @@ -128,18 +83,6 @@ public String getSNSAPNSPlatformApplicationARN() { return snsAPNSPlatformApplicationArn; } - /** - * Setter for the Simple Notification Service Apple Push Notification service platform application Amazon Resource Name. - * - * @param apnARN the SNS APNs ARN to set. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("sns_apns_platform_application_arn") - public void setSNSAPNSPlatformApplicationARN(String apnARN) { - this.snsAPNSPlatformApplicationArn = apnARN; - } - /** * Getter for the Simple Notification Service Google Cloud Messaging platform application Amazon Resource Name. * @@ -150,15 +93,4 @@ public String getSNSGCMPlatformApplicationARN() { return snsGCMPlatformApplicationArn; } - /** - * Setter for the Simple Notification Service Google Cloud Messaging platform application Amazon Resource Name. - * - * @param gcmARN the SNS GCM ARN to set. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("sns_gcm_platform_application_arn") - public void setSNSGCMPlatformApplicationARN(String gcmARN) { - this.snsGCMPlatformApplicationArn = gcmARN; - } } diff --git a/src/test/java/com/auth0/json/mgmt/guardian/SNSFactorProviderTest.java b/src/test/java/com/auth0/json/mgmt/guardian/SNSFactorProviderTest.java index ef87e66e4..d5bdb9a52 100644 --- a/src/test/java/com/auth0/json/mgmt/guardian/SNSFactorProviderTest.java +++ b/src/test/java/com/auth0/json/mgmt/guardian/SNSFactorProviderTest.java @@ -15,12 +15,7 @@ public class SNSFactorProviderTest extends JsonTest { @SuppressWarnings("deprecation") @Test public void shouldSerializeWithDeprecatedSetters() throws Exception { - SNSFactorProvider provider = new SNSFactorProvider(); - provider.setAWSRegion("ar"); - provider.setAWSAccessKeyId("akey"); - provider.setAWSSecretAccessKey("secretakey"); - provider.setSNSAPNSPlatformApplicationARN("arn1"); - provider.setSNSGCMPlatformApplicationARN("arn2"); + SNSFactorProvider provider = new SNSFactorProvider("akey", "secretakey", "ar", "arn1", "arn2"); String serialized = toJSON(provider); assertThat(serialized, is(notNullValue())); @@ -56,4 +51,4 @@ public void shouldDeserialize() throws Exception { assertThat(provider.getSNSGCMPlatformApplicationARN(), is("arn2")); } -} \ No newline at end of file +} From 9dc267a424fa78911e1eccaa231c0a7f6c05d466 Mon Sep 17 00:00:00 2001 From: Jim Anderson Date: Tue, 20 Dec 2022 20:43:19 -0600 Subject: [PATCH 4/7] remove TwilioProviderFactor deprecated methods --- .../mgmt/guardian/TwilioFactorProvider.java | 64 ------------------- .../guardian/TwilioFactorProviderTest.java | 32 +--------- 2 files changed, 2 insertions(+), 94 deletions(-) diff --git a/src/main/java/com/auth0/json/mgmt/guardian/TwilioFactorProvider.java b/src/main/java/com/auth0/json/mgmt/guardian/TwilioFactorProvider.java index cfbb93fbb..3fca3ab9c 100644 --- a/src/main/java/com/auth0/json/mgmt/guardian/TwilioFactorProvider.java +++ b/src/main/java/com/auth0/json/mgmt/guardian/TwilioFactorProvider.java @@ -23,15 +23,6 @@ public class TwilioFactorProvider { @JsonProperty("sid") private String sid; - /** - * Creates an empty Twilio settings object - * - * @deprecated use the full constructor instead - */ - @Deprecated - public TwilioFactorProvider() { - } - /** * Creates a Twilio settings object * @@ -65,22 +56,6 @@ public String getFrom() { return from; } - /** - * Setter for the Twilio From number. - * - * @param from the from number to set. - * @throws IllegalArgumentException when both `from` and `messagingServiceSID` are set - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("from") - public void setFrom(String from) throws IllegalArgumentException { - if (messagingServiceSID != null) { - throw new IllegalArgumentException("You must specify either `from` or `messagingServiceSID`, but not both"); - } - this.from = from; - } - /** * Getter for the Twilio Messaging Service SID. * @@ -91,22 +66,6 @@ public String getMessagingServiceSID() { return messagingServiceSID; } - /** - * Setter for the Twilio Messaging Service SID. - * - * @param messagingServiceSID the messaging service SID. - * @throws IllegalArgumentException when both `from` and `messagingServiceSID` are set - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("messaging_service_sid") - public void setMessagingServiceSID(String messagingServiceSID) throws IllegalArgumentException { - if (from != null) { - throw new IllegalArgumentException("You must specify either `from` or `messagingServiceSID`, but not both"); - } - this.messagingServiceSID = messagingServiceSID; - } - /** * Getter for the Twilio auth token. * @@ -117,18 +76,6 @@ public String getAuthToken() { return authToken; } - /** - * Setter for the Twilio auth token. - * - * @param authToken the Twilio auth token to set. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("auth_token") - public void setAuthToken(String authToken) { - this.authToken = authToken; - } - /** * Getter for the Twilio SID * @@ -139,15 +86,4 @@ public String getSID() { return sid; } - /** - * Setter for the Twilio SID - * - * @param SID the Twilio SID to set. - * @deprecated use the constructor instead - */ - @Deprecated - @JsonProperty("sid") - public void setSID(String SID) { - this.sid = SID; - } } diff --git a/src/test/java/com/auth0/json/mgmt/guardian/TwilioFactorProviderTest.java b/src/test/java/com/auth0/json/mgmt/guardian/TwilioFactorProviderTest.java index 7849d55b1..4db689e8f 100644 --- a/src/test/java/com/auth0/json/mgmt/guardian/TwilioFactorProviderTest.java +++ b/src/test/java/com/auth0/json/mgmt/guardian/TwilioFactorProviderTest.java @@ -26,35 +26,10 @@ public void shouldFailConstructionWithBothFromAndMessagingServiceSID() { new TwilioFactorProvider("+12356789", "messaging_service_sid", "atokEn", "id123"); } - @SuppressWarnings("deprecation") - @Test - public void shouldFailWhenSettingFromAndMessagingServiceSIDWasAlreadySet() { - exception.expect(IllegalArgumentException.class); - exception.expectMessage("You must specify either `from` or `messagingServiceSID`, but not both"); - - TwilioFactorProvider provider = new TwilioFactorProvider(); - provider.setFrom("+12356789"); - provider.setMessagingServiceSID("id321"); - } - - @SuppressWarnings("deprecation") - @Test - public void shouldFailWhenSettingMessagingServiceSIDAndFromWasAlreadySet() { - exception.expect(IllegalArgumentException.class); - exception.expectMessage("You must specify either `from` or `messagingServiceSID`, but not both"); - - TwilioFactorProvider provider = new TwilioFactorProvider(); - provider.setMessagingServiceSID("id321"); - provider.setFrom("+12356789"); - } - @SuppressWarnings("deprecation") @Test public void shouldSerializeWithDeprecatedSettersWithFrom() throws Exception { - TwilioFactorProvider provider = new TwilioFactorProvider(); - provider.setAuthToken("atokEn"); - provider.setFrom("+12356789"); - provider.setSID("id123"); + TwilioFactorProvider provider = new TwilioFactorProvider("+12356789", null, "atokEn", "id123"); String serialized = toJSON(provider); assertThat(serialized, is(notNullValue())); @@ -67,10 +42,7 @@ public void shouldSerializeWithDeprecatedSettersWithFrom() throws Exception { @SuppressWarnings("deprecation") @Test public void shouldSerializeWithDeprecatedSettersWithMessagingServiceSID() throws Exception { - TwilioFactorProvider provider = new TwilioFactorProvider(); - provider.setAuthToken("atokEn"); - provider.setMessagingServiceSID("id321"); - provider.setSID("id123"); + TwilioFactorProvider provider = new TwilioFactorProvider(null, "id321", "atokEn", "id123"); String serialized = toJSON(provider); assertThat(serialized, is(notNullValue())); From d5f45900cfac764eadafddca3f67a31c5735dcaa Mon Sep 17 00:00:00 2001 From: Jim Anderson Date: Tue, 20 Dec 2022 20:45:40 -0600 Subject: [PATCH 5/7] Deprecate HttpOptions in favor of DefaultHttpClient config --- src/main/java/com/auth0/client/HttpOptions.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/auth0/client/HttpOptions.java b/src/main/java/com/auth0/client/HttpOptions.java index 7ae3134f8..186f5ee14 100644 --- a/src/main/java/com/auth0/client/HttpOptions.java +++ b/src/main/java/com/auth0/client/HttpOptions.java @@ -2,7 +2,9 @@ /** * Used to configure additional configuration options when customizing the API client instance. + * @deprecated use the {@link com.auth0.net.client.DefaultHttpClient} to configure HTTP client behavior */ +@Deprecated public class HttpOptions { private ProxyOptions proxyOptions; From e8d76b5d279daf9003137130c8d08225bb733f2b Mon Sep 17 00:00:00 2001 From: Jim Anderson Date: Tue, 20 Dec 2022 21:09:16 -0600 Subject: [PATCH 6/7] deprecate HttpOptions in favor of http client config --- src/main/java/com/auth0/client/auth/AuthAPI.java | 11 ++++++----- .../java/com/auth0/client/mgmt/ManagementAPI.java | 7 ++++--- src/main/java/com/auth0/net/RateLimitInterceptor.java | 6 ++---- src/test/java/com/auth0/client/HttpOptionsTest.java | 1 + src/test/java/com/auth0/client/auth/AuthAPITest.java | 6 +++--- .../java/com/auth0/client/mgmt/ManagementAPITest.java | 6 +++--- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/auth0/client/auth/AuthAPI.java b/src/main/java/com/auth0/client/auth/AuthAPI.java index 5ea701d51..4479c2fd2 100644 --- a/src/main/java/com/auth0/client/auth/AuthAPI.java +++ b/src/main/java/com/auth0/client/auth/AuthAPI.java @@ -1,6 +1,5 @@ package com.auth0.client.auth; -import com.auth0.client.HttpOptions; import com.auth0.client.mgmt.ManagementAPI; import com.auth0.json.auth.PasswordlessEmailResponse; import com.auth0.json.auth.PasswordlessSmsResponse; @@ -71,7 +70,7 @@ public class AuthAPI { /** * Create a new instance with the given tenant's domain, application's client id and client secret. * These values can be obtained at {@code https://manage.auth0.com/#/applications/{YOUR_CLIENT_ID}/settings}. - * In addition, accepts an {@link HttpOptions} that will be used to configure the networking client. + * In addition, accepts an {@link com.auth0.client.HttpOptions} that will be used to configure the networking client. * * @deprecated Use the {@link Builder} to configure and create instances. * @@ -82,7 +81,8 @@ public class AuthAPI { * @see #AuthAPI(String, String, String) */ @Deprecated - public AuthAPI(String domain, String clientId, String clientSecret, HttpOptions options) { + @SuppressWarnings("deprecation") + public AuthAPI(String domain, String clientId, String clientSecret, com.auth0.client.HttpOptions options) { this(domain, clientId, clientSecret, buildNetworkingClient(options)); } @@ -98,7 +98,7 @@ public AuthAPI(String domain, String clientId, String clientSecret, HttpOptions */ @Deprecated public AuthAPI(String domain, String clientId, String clientSecret) { - this(domain, clientId, clientSecret, new HttpOptions()); + this(domain, clientId, clientSecret, new com.auth0.client.HttpOptions()); } /** @@ -145,7 +145,8 @@ private AuthAPI(String domain, String clientId, String clientSecret, Auth0HttpCl * @param options the options to set to the client. * @return a new networking client instance configured as requested. */ - private static Auth0HttpClient buildNetworkingClient(HttpOptions options) { + @SuppressWarnings("deprecation") + private static Auth0HttpClient buildNetworkingClient(com.auth0.client.HttpOptions options) { Asserts.assertNotNull(options, "Http options"); return DefaultHttpClient.newBuilder() .withLogging(options.getLoggingOptions()) diff --git a/src/main/java/com/auth0/client/mgmt/ManagementAPI.java b/src/main/java/com/auth0/client/mgmt/ManagementAPI.java index 20684cd2f..6e6c3f5ad 100644 --- a/src/main/java/com/auth0/client/mgmt/ManagementAPI.java +++ b/src/main/java/com/auth0/client/mgmt/ManagementAPI.java @@ -1,6 +1,5 @@ package com.auth0.client.mgmt; -import com.auth0.client.HttpOptions; import com.auth0.net.client.Auth0HttpClient; import com.auth0.net.client.DefaultHttpClient; import com.auth0.utils.Asserts; @@ -37,7 +36,8 @@ public class ManagementAPI { * @see #ManagementAPI(String, String) */ @Deprecated - public ManagementAPI(String domain, String apiToken, HttpOptions options) { + @SuppressWarnings("baz") + public ManagementAPI(String domain, String apiToken, com.auth0.client.HttpOptions options) { this(domain, SimpleTokenProvider.create(apiToken), buildNetworkingClient(options)); } @@ -86,7 +86,8 @@ private ManagementAPI(String domain, TokenProvider tokenProvider, Auth0HttpClien * @param options the options to set to the client. * @return a new networking client instance configured as requested. */ - private static DefaultHttpClient buildNetworkingClient(HttpOptions options) { + @SuppressWarnings("deprecation") + private static DefaultHttpClient buildNetworkingClient(com.auth0.client.HttpOptions options) { Asserts.assertNotNull(options, "Http options"); return DefaultHttpClient.newBuilder() .withLogging(options.getLoggingOptions()) diff --git a/src/main/java/com/auth0/net/RateLimitInterceptor.java b/src/main/java/com/auth0/net/RateLimitInterceptor.java index aa4034571..730eab5d3 100644 --- a/src/main/java/com/auth0/net/RateLimitInterceptor.java +++ b/src/main/java/com/auth0/net/RateLimitInterceptor.java @@ -1,6 +1,6 @@ package com.auth0.net; -import com.auth0.client.HttpOptions; +import com.auth0.net.client.DefaultHttpClient; import net.jodah.failsafe.Failsafe; import net.jodah.failsafe.RetryPolicy; import net.jodah.failsafe.event.ExecutionAttemptedEvent; @@ -16,11 +16,9 @@ * An OkHttp {@linkplain Interceptor} responsible for retrying rate-limit errors (429) using a configurable maximum * number of retries, and an exponential backoff on retry attempts. *

- * See {@link com.auth0.client.HttpOptions#setManagementAPIMaxRetries(int)} and {@link com.auth0.client.mgmt.ManagementAPI#ManagementAPI(String, String, HttpOptions)} - *

- *

* Note: This class is not intended for general use or extension, and may change at any time. *

+ * @see DefaultHttpClient */ public class RateLimitInterceptor implements Interceptor { diff --git a/src/test/java/com/auth0/client/HttpOptionsTest.java b/src/test/java/com/auth0/client/HttpOptionsTest.java index 44c5f4c14..1d5a34ee1 100644 --- a/src/test/java/com/auth0/client/HttpOptionsTest.java +++ b/src/test/java/com/auth0/client/HttpOptionsTest.java @@ -6,6 +6,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; +@SuppressWarnings("deprecation") public class HttpOptionsTest { @Test diff --git a/src/test/java/com/auth0/client/auth/AuthAPITest.java b/src/test/java/com/auth0/client/auth/AuthAPITest.java index 3ada20657..7052db317 100644 --- a/src/test/java/com/auth0/client/auth/AuthAPITest.java +++ b/src/test/java/com/auth0/client/auth/AuthAPITest.java @@ -1,6 +1,5 @@ package com.auth0.client.auth; -import com.auth0.client.HttpOptions; import com.auth0.client.MockServer; import com.auth0.exception.APIException; import com.auth0.json.auth.*; @@ -69,7 +68,7 @@ public void tearDown() throws Exception { @Test @SuppressWarnings("deprecation") public void shouldAcceptHttpOptions() { - AuthAPI api = new AuthAPI(DOMAIN, CLIENT_ID, CLIENT_SECRET, new HttpOptions()); + AuthAPI api = new AuthAPI(DOMAIN, CLIENT_ID, CLIENT_SECRET, new com.auth0.client.HttpOptions()); assertThat(api, is(notNullValue())); } @@ -139,11 +138,12 @@ public void shouldAcceptNullClientSecret() { } @Test + @SuppressWarnings("deprecation") public void shouldThrowOnInValidMaxRequestsPerHostConfiguration() { exception.expect(IllegalArgumentException.class); exception.expectMessage("maxRequestsPerHost must be one or greater."); - HttpOptions options = new HttpOptions(); + com.auth0.client.HttpOptions options = new com.auth0.client.HttpOptions(); options.setMaxRequestsPerHost(0); } diff --git a/src/test/java/com/auth0/client/mgmt/ManagementAPITest.java b/src/test/java/com/auth0/client/mgmt/ManagementAPITest.java index 3a0988649..62a3dceb3 100644 --- a/src/test/java/com/auth0/client/mgmt/ManagementAPITest.java +++ b/src/test/java/com/auth0/client/mgmt/ManagementAPITest.java @@ -1,6 +1,5 @@ package com.auth0.client.mgmt; -import com.auth0.client.HttpOptions; import com.auth0.client.MockServer; import com.auth0.exception.Auth0Exception; import com.auth0.net.client.Auth0HttpClient; @@ -168,7 +167,7 @@ public void shouldUpdateApiToken() throws Auth0Exception { @Test @SuppressWarnings("deprecation") public void acceptsHttpOptions() { - HttpOptions httpOptions = new HttpOptions(); + com.auth0.client.HttpOptions httpOptions = new com.auth0.client.HttpOptions(); httpOptions.setConnectTimeout(15); ManagementAPI api = new ManagementAPI(DOMAIN, "CLIENT_ID", httpOptions); assertThat(api, is(notNullValue())); @@ -181,11 +180,12 @@ public void httpOptionsShouldThrowWhenNull() { } @Test + @SuppressWarnings("deprecation") public void shouldThrowOnInValidMaxRequestsPerHostConfiguration() { exception.expect(IllegalArgumentException.class); exception.expectMessage("maxRequestsPerHost must be one or greater."); - HttpOptions options = new HttpOptions(); + com.auth0.client.HttpOptions options = new com.auth0.client.HttpOptions(); options.setMaxRequestsPerHost(0); } From 80bd13f7c646d28068e13af5088bd04a7f6f62ea Mon Sep 17 00:00:00 2001 From: Jim Anderson Date: Wed, 21 Dec 2022 10:16:30 -0600 Subject: [PATCH 7/7] fix ManagementAPI deprecation compiler warning --- src/main/java/com/auth0/client/mgmt/ManagementAPI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/auth0/client/mgmt/ManagementAPI.java b/src/main/java/com/auth0/client/mgmt/ManagementAPI.java index 6e6c3f5ad..cf7ec088a 100644 --- a/src/main/java/com/auth0/client/mgmt/ManagementAPI.java +++ b/src/main/java/com/auth0/client/mgmt/ManagementAPI.java @@ -24,7 +24,7 @@ public class ManagementAPI { /** * Create an instance with the given tenant's domain and API token. - * In addition, accepts an {@link HttpOptions} that will be used to configure the networking client. + * In addition, accepts an {@link com.auth0.client.HttpOptions} that will be used to configure the networking client. * See the Management API section in the readme or visit https://auth0.com/docs/api/management/v2/tokens * to learn how to obtain a token. *