Skip to content

Commit ed0c658

Browse files
committed
Add namespace tests
1 parent 3a6a31d commit ed0c658

25 files changed

+327
-77
lines changed

config/checkstyle/checkstyle.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
<property name="option" value="nl"/>
110110
</module>
111111
<module name="PackageName">
112-
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
113112
<message key="name.invalidPattern"
114113
value="Package name ''{0}'' must match pattern ''{1}''."/>
115114
</module>

src/main/java/com/amadeus/Amadeus.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ public class Amadeus extends HTTPClient {
2222
*/
2323
public static final String VERSION = "1.0.0";
2424

25+
public ReferenceData referenceData;
26+
2527
protected Amadeus(Configuration configuration) {
2628
super(configuration);
29+
this.referenceData = new ReferenceData(this);
2730
}
2831

2932
/**

src/main/java/com/amadeus/AuthenticationException.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/main/java/com/amadeus/ClientException.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/main/java/com/amadeus/HTTPClient.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.amadeus;
22

3+
import com.amadeus.client.AccessToken;
4+
import com.amadeus.exceptions.NetworkException;
5+
import com.amadeus.exceptions.ResponseException;
36
import java.io.BufferedWriter;
47
import java.io.IOException;
58
import java.io.OutputStream;
@@ -106,7 +109,15 @@ protected Response request(String verb, String path, Params params) throws Respo
106109
// A generic method for making any authenticated or unauthenticated request,
107110
// passing in the bearer token explicitly. Used primarily by the
108111
// AccessToken to get the first AccessToken.
109-
protected Response unauthenticatedRequest(String verb, String path, Params params,
112+
113+
/**
114+
* A generic method for making any authenticated or unauthenticated request,
115+
* passing in the bearer token explicitly. Used primarily by the
116+
* AccessToken to get the first AccessToken.
117+
*
118+
* @hides as only used internally
119+
*/
120+
public Response unauthenticatedRequest(String verb, String path, Params params,
110121
String bearerToken) throws ResponseException {
111122
Request request = buildRequest(verb, path, params, bearerToken);
112123
log(request);

src/main/java/com/amadeus/NetworkException.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/main/java/com/amadeus/ParserException.java

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.amadeus;
2+
3+
import com.amadeus.referenceData.Urls;
4+
5+
/**
6+
* <p>
7+
* A namespaced client for the
8+
* <code>/v2/reference-data</code> endpoints.
9+
* </p>
10+
*
11+
* <p>
12+
* Access via the Amadeus client object.
13+
* </p>
14+
*
15+
* <pre>
16+
* Amadeus amadeus = Amadeus.builder("clientId", "secret").build();
17+
* amadeus.referenceData;</pre>
18+
*/
19+
public class ReferenceData {
20+
/**
21+
* <p>
22+
* A namespaced client for the
23+
* <code>/v2/reference-data/urls</code> endpoints.
24+
* </p>
25+
*/
26+
public Urls urls;
27+
28+
/**
29+
* Constructor.
30+
* @hide
31+
*/
32+
public ReferenceData(Amadeus client) {
33+
this.urls = new Urls(client);
34+
}
35+
}

src/main/java/com/amadeus/Response.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package com.amadeus;
22

3+
import com.amadeus.exceptions.AuthenticationException;
4+
import com.amadeus.exceptions.ClientException;
5+
import com.amadeus.exceptions.NotFoundException;
6+
import com.amadeus.exceptions.ParserException;
7+
import com.amadeus.exceptions.ResponseException;
8+
import com.amadeus.exceptions.ServerException;
39
import com.google.gson.JsonArray;
410
import com.google.gson.JsonObject;
511
import com.google.gson.JsonParser;
@@ -53,7 +59,7 @@ protected void parse(HTTPClient client) {
5359
parseData(client);
5460
}
5561

56-
// Detects of any errors have occured and throws the appropriate errors.
62+
// Detects of any exceptions have occured and throws the appropriate exceptions.
5763
protected void detectError(HTTPClient client) throws ResponseException {
5864
ResponseException exception = null;
5965
if (statusCode >= 500) {
@@ -74,7 +80,7 @@ protected void detectError(HTTPClient client) throws ResponseException {
7480
}
7581
}
7682

77-
// Tries to parse the status code. Catches any errors and defaults to
83+
// Tries to parse the status code. Catches any exceptions and defaults to
7884
// status 0 if an error occurred.
7985
private void parseStatusCode() {
8086
try {

src/main/java/com/amadeus/ServerException.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)