Skip to content

Commit

Permalink
MAPREDUCE-7497. mapreduce tests have stopped running. (#7343)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Nauroth <[email protected]>
Reviewed-by: Chris Nauroth <[email protected]>
Signed-off-by: Shilun Fan <[email protected]>
  • Loading branch information
slfan1989 and cnauroth authored Feb 4, 2025
1 parent eae63ec commit 950b3eb
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
import java.util.Set;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.NotAcceptableException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.ServiceUnavailableException;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Response;

import static javax.ws.rs.core.Response.Status.NOT_ACCEPTABLE;
import static javax.ws.rs.core.Response.Status.NOT_FOUND;
import static javax.ws.rs.core.Response.Status.SERVICE_UNAVAILABLE;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

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

@Test
public void testInvalidAccept() throws JSONException, Exception {
WebTarget r = target();
WebTarget r = targetWithJsonObject();
String responseStr = "";
try {
responseStr = r.path("ws").path("v1").path("mapreduce")
.request(MediaType.TEXT_PLAIN).get(String.class);
fail("should have thrown exception on invalid uri");
} catch (ServiceUnavailableException sue) {
} catch (NotAcceptableException sue) {
Response response = sue.getResponse();
assertResponseStatusCode(SERVICE_UNAVAILABLE, response.getStatusInfo());
assertResponseStatusCode(NOT_ACCEPTABLE, response.getStatusInfo());
WebServicesTestUtils.checkStringMatch(
"error string exists and shouldn't", "", responseStr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

import static org.apache.hadoop.yarn.webapp.WebServicesTestUtils.assertResponseStatusCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;

import java.io.StringReader;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.NotAcceptableException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.ServiceUnavailableException;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
Expand Down Expand Up @@ -232,12 +233,12 @@ public void testInvalidAccept() throws JSONException, Exception {
WebTarget r = target();
String responseStr = "";
try {
Response response =
r.path("ws").path("v1").path("history").request(MediaType.TEXT_PLAIN).get();
throw new ServiceUnavailableException(response);
} catch (ServiceUnavailableException ue) {
responseStr = r.path("ws").path("v1").path("history").
request(MediaType.TEXT_PLAIN).get(String.class);
fail("should have thrown exception on invalid uri");
} catch (NotAcceptableException ue) {
Response response = ue.getResponse();
assertResponseStatusCode(Response.Status.SERVICE_UNAVAILABLE,
assertResponseStatusCode(Response.Status.NOT_ACCEPTABLE,
response.getStatusInfo());
WebServicesTestUtils.checkStringMatch(
"error string exists and shouldn't", "", responseStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.hadoop.yarn.api.records.timelineservice;

import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;

Expand All @@ -42,8 +43,12 @@ public ApplicationEntity(TimelineEntity entity) {
}
}

@JsonInclude(JsonInclude.Include.NON_NULL)
public String getQueue() {
return getInfo().get(QUEUE_INFO_KEY).toString();
if (getInfo() != null && getInfo().containsKey(QUEUE_INFO_KEY)) {
return getInfo().get(QUEUE_INFO_KEY).toString();
}
return null;
}

public void setQueue(String queue) {
Expand Down

0 comments on commit 950b3eb

Please sign in to comment.