-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 3153-2419-lockuser
- Loading branch information
Showing
12 changed files
with
166 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package edu.harvard.iq.dataverse.api; | ||
|
||
import edu.harvard.iq.dataverse.settings.SettingsServiceBean; | ||
import javax.ejb.EJB; | ||
import javax.json.Json; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Response; | ||
|
||
@Path("info") | ||
public class Info extends AbstractApiBean { | ||
|
||
@EJB | ||
SettingsServiceBean settingsService; | ||
|
||
@GET | ||
@Path("settings/:DatasetPublishPopupCustomText") | ||
public Response getDatasetPublishPopupCustomText() { | ||
String setting = settingsService.getValueForKey(SettingsServiceBean.Key.DatasetPublishPopupCustomText); | ||
if (setting != null) { | ||
return okResponse(Json.createObjectBuilder().add("message", setting)); | ||
} else { | ||
return notFound("Setting " + SettingsServiceBean.Key.DatasetPublishPopupCustomText + " not found"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package edu.harvard.iq.dataverse.api; | ||
|
||
import static com.jayway.restassured.RestAssured.given; | ||
import com.jayway.restassured.response.Response; | ||
import edu.harvard.iq.dataverse.settings.SettingsServiceBean; | ||
import org.junit.Test; | ||
import static org.hamcrest.CoreMatchers.equalTo; | ||
|
||
public class InfoIT { | ||
|
||
@Test | ||
public void testGetDatasetPublishPopupCustomText() { | ||
|
||
given().urlEncodingEnabled(false) | ||
.body("Hello world!") | ||
.put("/api/admin/settings/" | ||
+ SettingsServiceBean.Key.DatasetPublishPopupCustomText); | ||
|
||
Response response = given().urlEncodingEnabled(false) | ||
.get("/api/info/settings/" + SettingsServiceBean.Key.DatasetPublishPopupCustomText); | ||
response.prettyPrint(); | ||
response.then().assertThat().statusCode(200) | ||
.body("data.message", equalTo("Hello world!")); | ||
|
||
given().urlEncodingEnabled(false) | ||
.delete("/api/admin/settings/" | ||
+ SettingsServiceBean.Key.DatasetPublishPopupCustomText); | ||
|
||
response = given().urlEncodingEnabled(false) | ||
.get("/api/info/settings/" + SettingsServiceBean.Key.DatasetPublishPopupCustomText); | ||
response.prettyPrint(); | ||
response.then().assertThat().statusCode(404) | ||
.body("message", equalTo("Setting " | ||
+ SettingsServiceBean.Key.DatasetPublishPopupCustomText | ||
+ " not found")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters