Skip to content

Commit 836ec00

Browse files
committed
TEST
1 parent 4a23ba5 commit 836ec00

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/main/java/edu/harvard/iq/dataverse/CustomizationFilesServlet.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
6565
String mimeType = tika.detect(fileIn);
6666
response.setContentType(mimeType);
6767
} catch (Exception e) {
68+
String currentDirectory = System.getProperty("user.dir");
69+
response.setHeader("X-cur-dir", currentDirectory);
6870
logger.info("Error getting MIME Type for " + filePath + " : " + e.getMessage());
6971
}
7072
inputStream = new FileInputStream(fileIn);
@@ -77,7 +79,6 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
7779
try (PrintWriter out = response.getWriter()) {
7880

7981
while ((line = in.readLine()) != null) {
80-
line = line.replace("Copyright 2025 Payara Services Ltd and/or its affiliates.",currentDirectory);
8182
responseData.append(line);
8283
out.println(line);
8384
}

src/main/java/edu/harvard/iq/dataverse/api/Info.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package edu.harvard.iq.dataverse.api;
22

3-
import java.util.List;
4-
import java.util.Set;
53
import java.util.logging.Logger;
64

7-
import io.gdcc.xoai.model.oaipmh.results.record.Header;
85
import jakarta.ws.rs.*;
96
import jakarta.ws.rs.client.Client;
107
import jakarta.ws.rs.client.ClientBuilder;
@@ -143,7 +140,7 @@ public Response getCustomizationFile(@PathParam("customizationFileType") String
143140
.get();
144141

145142
if (response.getLength() < 1) {
146-
return notFound(customizationFileType + " not found.");
143+
return notFound(customizationFileType + " not found. " + response.getHeaderString("X-cur-dir"));
147144
} else {
148145
return response;
149146
}

src/test/java/edu/harvard/iq/dataverse/api/CustomizationIT.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@ public void after() {
1717

1818
@Test
1919
public void testGetCustomAnalytics() {
20-
// String setting = "/usr/local/glassfish4/glassfish/domains/domain1/docroot/index.html";
21-
String setting = "./appserver/glassfish/domains/domain1/docroot/index.html";
20+
String setting = "/usr/local/glassfish4/glassfish/domains/domain1/docroot/index.html";
21+
//String setting = "./appserver/glassfish/domains/domain1/docroot/index.html";
2222
UtilIT.setSetting(SettingsServiceBean.Key.WebAnalyticsCode, setting).prettyPrint();
2323

2424
Response getResponse = UtilIT.getCustomizationFile("analytics");
2525
getResponse.prettyPrint();
2626
getResponse.then().assertThat()
27-
.statusCode(200)
28-
.body(containsString("<!doctype html>"))
29-
.body(containsString("<p class=\"signoff\">/opt/payara</p>"));//TESTING PWD NOT TO BE CHECKED IN
27+
.statusCode(404)
28+
.body(containsString("not found. x"));
29+
//.statusCode(200)
30+
//.body(containsString("<!doctype html>"));
31+
3032
assert (getResponse.getHeaders().get("Content-Type").getValue().startsWith("text/html"));
3133

3234
UtilIT.deleteSetting(SettingsServiceBean.Key.WebAnalyticsCode).prettyPrint();

0 commit comments

Comments
 (0)