Skip to content

Commit 950b3eb

Browse files
slfan1989cnauroth
andauthored
MAPREDUCE-7497. mapreduce tests have stopped running. (#7343)
Co-authored-by: Chris Nauroth <[email protected]> Reviewed-by: Chris Nauroth <[email protected]> Signed-off-by: Shilun Fan <[email protected]>
1 parent eae63ec commit 950b3eb

File tree

9 files changed

+49
-12
lines changed
  • hadoop-mapreduce-project/hadoop-mapreduce-client
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice

9 files changed

+49
-12
lines changed

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@
168168
<artifactId>junit-platform-launcher</artifactId>
169169
<scope>test</scope>
170170
</dependency>
171+
<dependency>
172+
<groupId>org.junit.vintage</groupId>
173+
<artifactId>junit-vintage-engine</artifactId>
174+
<scope>test</scope>
175+
</dependency>
171176
</dependencies>
172177

173178
<build>

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/webapp/TestAMWebServices.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828
import java.util.Set;
2929

3030
import javax.ws.rs.core.MediaType;
31+
import javax.ws.rs.NotAcceptableException;
3132
import javax.ws.rs.NotFoundException;
32-
import javax.ws.rs.ServiceUnavailableException;
3333
import javax.ws.rs.client.WebTarget;
3434
import javax.ws.rs.core.Application;
3535
import javax.ws.rs.core.Response;
36+
37+
import static javax.ws.rs.core.Response.Status.NOT_ACCEPTABLE;
3638
import static javax.ws.rs.core.Response.Status.NOT_FOUND;
37-
import static javax.ws.rs.core.Response.Status.SERVICE_UNAVAILABLE;
3839
import javax.xml.parsers.DocumentBuilder;
3940
import javax.xml.parsers.DocumentBuilderFactory;
4041

@@ -231,15 +232,15 @@ public void testInvalidUri2() throws JSONException, Exception {
231232

232233
@Test
233234
public void testInvalidAccept() throws JSONException, Exception {
234-
WebTarget r = target();
235+
WebTarget r = targetWithJsonObject();
235236
String responseStr = "";
236237
try {
237238
responseStr = r.path("ws").path("v1").path("mapreduce")
238239
.request(MediaType.TEXT_PLAIN).get(String.class);
239240
fail("should have thrown exception on invalid uri");
240-
} catch (ServiceUnavailableException sue) {
241+
} catch (NotAcceptableException sue) {
241242
Response response = sue.getResponse();
242-
assertResponseStatusCode(SERVICE_UNAVAILABLE, response.getStatusInfo());
243+
assertResponseStatusCode(NOT_ACCEPTABLE, response.getStatusInfo());
243244
WebServicesTestUtils.checkStringMatch(
244245
"error string exists and shouldn't", "", responseStr);
245246
}

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@
9292
<artifactId>junit-platform-launcher</artifactId>
9393
<scope>test</scope>
9494
</dependency>
95+
<dependency>
96+
<groupId>org.junit.vintage</groupId>
97+
<artifactId>junit-vintage-engine</artifactId>
98+
<scope>test</scope>
99+
</dependency>
95100
</dependencies>
96101

97102
<build>

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@
115115
<artifactId>junit-platform-launcher</artifactId>
116116
<scope>test</scope>
117117
</dependency>
118+
<dependency>
119+
<groupId>org.junit.vintage</groupId>
120+
<artifactId>junit-vintage-engine</artifactId>
121+
<scope>test</scope>
122+
</dependency>
118123
</dependencies>
119124

120125
<build>

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/webapp/TestHsWebServices.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020

2121
import static org.apache.hadoop.yarn.webapp.WebServicesTestUtils.assertResponseStatusCode;
2222
import static org.junit.Assert.assertEquals;
23+
import static org.junit.Assert.fail;
2324
import static org.mockito.Mockito.mock;
2425

2526
import java.io.StringReader;
2627

2728
import javax.servlet.http.HttpServletResponse;
29+
import javax.ws.rs.NotAcceptableException;
2830
import javax.ws.rs.NotFoundException;
29-
import javax.ws.rs.ServiceUnavailableException;
3031
import javax.ws.rs.client.WebTarget;
3132
import javax.ws.rs.core.Application;
3233
import javax.ws.rs.core.MediaType;
@@ -232,12 +233,12 @@ public void testInvalidAccept() throws JSONException, Exception {
232233
WebTarget r = target();
233234
String responseStr = "";
234235
try {
235-
Response response =
236-
r.path("ws").path("v1").path("history").request(MediaType.TEXT_PLAIN).get();
237-
throw new ServiceUnavailableException(response);
238-
} catch (ServiceUnavailableException ue) {
236+
responseStr = r.path("ws").path("v1").path("history").
237+
request(MediaType.TEXT_PLAIN).get(String.class);
238+
fail("should have thrown exception on invalid uri");
239+
} catch (NotAcceptableException ue) {
239240
Response response = ue.getResponse();
240-
assertResponseStatusCode(Response.Status.SERVICE_UNAVAILABLE,
241+
assertResponseStatusCode(Response.Status.NOT_ACCEPTABLE,
241242
response.getStatusInfo());
242243
WebServicesTestUtils.checkStringMatch(
243244
"error string exists and shouldn't", "", responseStr);

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@
148148
<artifactId>junit-platform-launcher</artifactId>
149149
<scope>test</scope>
150150
</dependency>
151+
<dependency>
152+
<groupId>org.junit.vintage</groupId>
153+
<artifactId>junit-vintage-engine</artifactId>
154+
<scope>test</scope>
155+
</dependency>
151156

152157
</dependencies>
153158

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@
8080
<artifactId>junit-platform-launcher</artifactId>
8181
<scope>test</scope>
8282
</dependency>
83+
<dependency>
84+
<groupId>org.junit.vintage</groupId>
85+
<artifactId>junit-vintage-engine</artifactId>
86+
<scope>test</scope>
87+
</dependency>
8388
</dependencies>
8489

8590
<build>

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@
6666
<artifactId>junit-platform-launcher</artifactId>
6767
<scope>test</scope>
6868
</dependency>
69+
<dependency>
70+
<groupId>org.junit.vintage</groupId>
71+
<artifactId>junit-vintage-engine</artifactId>
72+
<scope>test</scope>
73+
</dependency>
6974
</dependencies>
7075

7176
<build>

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/ApplicationEntity.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package org.apache.hadoop.yarn.api.records.timelineservice;
1919

20+
import com.fasterxml.jackson.annotation.JsonInclude;
2021
import org.apache.hadoop.classification.InterfaceAudience;
2122
import org.apache.hadoop.classification.InterfaceStability;
2223

@@ -42,8 +43,12 @@ public ApplicationEntity(TimelineEntity entity) {
4243
}
4344
}
4445

46+
@JsonInclude(JsonInclude.Include.NON_NULL)
4547
public String getQueue() {
46-
return getInfo().get(QUEUE_INFO_KEY).toString();
48+
if (getInfo() != null && getInfo().containsKey(QUEUE_INFO_KEY)) {
49+
return getInfo().get(QUEUE_INFO_KEY).toString();
50+
}
51+
return null;
4752
}
4853

4954
public void setQueue(String queue) {

0 commit comments

Comments
 (0)