Skip to content

Commit 2aae8c3

Browse files
committed
rename MgmtAPI to ManagementAPI
1 parent a7cc9f2 commit 2aae8c3

4 files changed

Lines changed: 23 additions & 21 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ try {
213213

214214
The implementation is based on the [Management API Docs](https://auth0.com/docs/api/management/v2).
215215

216-
Create a new `MgmtAPI` instance by providing the domain from the [client dashboard](https://manage.auth0.com/#/clients) and the API Token. Click [here](https://auth0.com/docs/api/management/v2#!/Introduction/Getting_an_API_token) for more information on how to obtain a valid API Token.
216+
Create a new `ManagementAPI` instance by providing the domain from the [client dashboard](https://manage.auth0.com/#/clients) and the API Token. Click [here](https://auth0.com/docs/api/management/v2#!/Introduction/Getting_an_API_token) for more information on how to obtain a valid API Token.
217217

218218
```java
219-
MgmtAPI mgmt = new MgmtAPI("{YOUR_DOMAIN}", "{YOUR_API_TOKEN}");
219+
ManagementAPI mgmt = new ManagementAPI("{YOUR_DOMAIN}", "{YOUR_API_TOKEN}");
220220
```
221221

222222
### Client Grants

src/main/java/com/auth0/client/mgmt/MgmtAPI.java renamed to src/main/java/com/auth0/client/mgmt/ManagementAPI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
import okhttp3.logging.HttpLoggingInterceptor;
88
import okhttp3.logging.HttpLoggingInterceptor.Level;
99

10-
public class MgmtAPI {
10+
public class ManagementAPI {
1111

1212
private final String baseUrl;
1313
private final String apiToken;
1414
private final OkHttpClient client;
1515
private final TelemetryInterceptor telemetry;
1616
private final HttpLoggingInterceptor logging;
1717

18-
public MgmtAPI(String domain, String apiToken) {
18+
public ManagementAPI(String domain, String apiToken) {
1919
Asserts.assertNotNull(domain, "domain");
2020
Asserts.assertNotNull(apiToken, "api token");
2121

src/test/java/com/auth0/client/mgmt/BaseMgmtEntityTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@
33
import com.auth0.client.MockServer;
44
import org.junit.After;
55
import org.junit.Before;
6+
import org.junit.Rule;
67
import org.junit.rules.ExpectedException;
78

89
public class BaseMgmtEntityTest {
910

1011
private static final String API_TOKEN = "apiToken";
1112

1213
protected MockServer server;
13-
protected MgmtAPI api;
14-
@org.junit.Rule
14+
protected ManagementAPI api;
15+
@Rule
1516
public ExpectedException exception = ExpectedException.none();
1617

1718
@Before
1819
public void setUp() throws Exception {
1920
server = new MockServer();
20-
api = new MgmtAPI(server.getBaseUrl(), API_TOKEN);
21+
api = new ManagementAPI(server.getBaseUrl(), API_TOKEN);
2122
}
2223

2324
@After

src/test/java/com/auth0/client/mgmt/MgmtAPITest.java renamed to src/test/java/com/auth0/client/mgmt/ManagementAPITest.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import okhttp3.logging.HttpLoggingInterceptor;
77
import org.junit.After;
88
import org.junit.Before;
9+
import org.junit.Rule;
910
import org.junit.Test;
1011
import org.junit.rules.ExpectedException;
1112

@@ -14,20 +15,20 @@
1415
import static org.hamcrest.Matchers.*;
1516
import static org.junit.Assert.assertThat;
1617

17-
public class MgmtAPITest {
18+
public class ManagementAPITest {
1819

1920
private static final String DOMAIN = "domain.auth0.com";
2021
private static final String API_TOKEN = "apiToken";
2122

2223
private MockServer server;
23-
private MgmtAPI api;
24-
@org.junit.Rule
24+
private ManagementAPI api;
25+
@Rule
2526
public ExpectedException exception = ExpectedException.none();
2627

2728
@Before
2829
public void setUp() throws Exception {
2930
server = new MockServer();
30-
api = new MgmtAPI(server.getBaseUrl(), API_TOKEN);
31+
api = new ManagementAPI(server.getBaseUrl(), API_TOKEN);
3132
}
3233

3334
@After
@@ -39,14 +40,14 @@ public void tearDown() throws Exception {
3940

4041
@Test
4142
public void shouldAcceptDomainWithNoScheme() throws Exception {
42-
MgmtAPI api = new MgmtAPI("me.something.com", API_TOKEN);
43+
ManagementAPI api = new ManagementAPI("me.something.com", API_TOKEN);
4344

4445
assertThat(api.getBaseUrl(), isUrl("https", "me.something.com"));
4546
}
4647

4748
@Test
4849
public void shouldAcceptDomainWithHttpScheme() throws Exception {
49-
MgmtAPI api = new MgmtAPI("http://me.something.com", API_TOKEN);
50+
ManagementAPI api = new ManagementAPI("http://me.something.com", API_TOKEN);
5051

5152
assertThat(api.getBaseUrl(), isUrl("http", "me.something.com"));
5253
}
@@ -55,26 +56,26 @@ public void shouldAcceptDomainWithHttpScheme() throws Exception {
5556
public void shouldThrowWhenDomainIsInvalid() throws Exception {
5657
exception.expect(IllegalArgumentException.class);
5758
exception.expectMessage("The domain had an invalid format and couldn't be parsed as an URL.");
58-
new MgmtAPI("", API_TOKEN);
59+
new ManagementAPI("", API_TOKEN);
5960
}
6061

6162
@Test
6263
public void shouldThrowWhenDomainIsNull() throws Exception {
6364
exception.expect(IllegalArgumentException.class);
6465
exception.expectMessage("'domain' cannot be null!");
65-
new MgmtAPI(null, API_TOKEN);
66+
new ManagementAPI(null, API_TOKEN);
6667
}
6768

6869
@Test
6970
public void shouldThrowWhenApiTokenIsNull() throws Exception {
7071
exception.expect(IllegalArgumentException.class);
7172
exception.expectMessage("'api token' cannot be null!");
72-
new MgmtAPI(DOMAIN, null);
73+
new ManagementAPI(DOMAIN, null);
7374
}
7475

7576
@Test
7677
public void shouldAddAndEnableTelemetryInterceptor() throws Exception {
77-
MgmtAPI api = new MgmtAPI(DOMAIN, API_TOKEN);
78+
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN);
7879
assertThat(api.getClient().interceptors(), hasItem(isA(TelemetryInterceptor.class)));
7980

8081
for (Interceptor i : api.getClient().interceptors()) {
@@ -87,7 +88,7 @@ public void shouldAddAndEnableTelemetryInterceptor() throws Exception {
8788

8889
@Test
8990
public void shouldDisableTelemetryInterceptor() throws Exception {
90-
MgmtAPI api = new MgmtAPI(DOMAIN, API_TOKEN);
91+
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN);
9192
assertThat(api.getClient().interceptors(), hasItem(isA(TelemetryInterceptor.class)));
9293
api.doNotSendTelemetry();
9394

@@ -101,7 +102,7 @@ public void shouldDisableTelemetryInterceptor() throws Exception {
101102

102103
@Test
103104
public void shouldAddAndDisableLoggingInterceptor() throws Exception {
104-
MgmtAPI api = new MgmtAPI(DOMAIN, API_TOKEN);
105+
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN);
105106
assertThat(api.getClient().interceptors(), hasItem(isA(HttpLoggingInterceptor.class)));
106107

107108
for (Interceptor i : api.getClient().interceptors()) {
@@ -114,7 +115,7 @@ public void shouldAddAndDisableLoggingInterceptor() throws Exception {
114115

115116
@Test
116117
public void shouldEnableLoggingInterceptor() throws Exception {
117-
MgmtAPI api = new MgmtAPI(DOMAIN, API_TOKEN);
118+
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN);
118119
assertThat(api.getClient().interceptors(), hasItem(isA(HttpLoggingInterceptor.class)));
119120
api.setLoggingEnabled(true);
120121

@@ -128,7 +129,7 @@ public void shouldEnableLoggingInterceptor() throws Exception {
128129

129130
@Test
130131
public void shouldDisableLoggingInterceptor() throws Exception {
131-
MgmtAPI api = new MgmtAPI(DOMAIN, API_TOKEN);
132+
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN);
132133
assertThat(api.getClient().interceptors(), hasItem(isA(HttpLoggingInterceptor.class)));
133134
api.setLoggingEnabled(false);
134135

0 commit comments

Comments
 (0)