Skip to content

Commit

Permalink
fixed weird diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonokuhn committed Jun 9, 2016
1 parent d6376cf commit 929a233
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ scripts/api/py_api_wrapper/local-data/*
doc/sphinx-guides/build
faces-config.NavData
src/main/java/BuildNumber.properties
/nbproject/

11 changes: 1 addition & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>unknown-jars-temp-repo</id>
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
<url>file:${project.basedir}/lib</url>
</repository>

</repositories>

<dependencies>
Expand Down Expand Up @@ -140,11 +136,6 @@
<version>16.0.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>javax.ws.rs-api-2.0</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/edu/harvard/iq/dataverse/api/Sys.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
package edu.harvard.iq.dataverse.api;

import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import static edu.harvard.iq.dataverse.util.json.JsonPrinter.*;
import javax.ejb.EJB;
import javax.json.Json;
import javax.json.JsonValue;
import javax.json.JsonObjectBuilder;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
Expand All @@ -35,12 +33,10 @@ public Response getDatasetPublishPopupCustomText(){
JsonObjectBuilder response = Json.createObjectBuilder();

if(setting != null){
response.add("DatasetPublishPopupCustomText", json(setting));
return okResponse(response.add("DatasetPublishPopupCustomText", setting));
} else {
response.add("DatasetPublishPopupCustomText", JsonValue.NULL);
return notFound("Setting DatasetPublishPopupCustomText not found");
}

return okResponse(response);
}

}
33 changes: 26 additions & 7 deletions src/test/java/edu/harvard/iq/dataverse/api/SysIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,44 @@
*/
package edu.harvard.iq.dataverse.api;

import com.jayway.restassured.response.Response;
import static com.jayway.restassured.RestAssured.*;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.equalTo;

/**
*
* @author jacksonokuhn
*/
public class SysIT {

/**
* Test of getDatasetPublishPopupCustomText method, of class Sys.
*/
@Test
public void testGetDatasetPublishPopupCustomText() {

System.out.println("checking getDatasetPublishPopupCustomText");
Response result = given().urlEncodingEnabled(false).get("/api/system/settings/:DatasetPublishPopupCustomText");
result.prettyPrint();
assertEquals(200, result.getStatusCode());

given().urlEncodingEnabled(false)
.get("/api/system/settings/:DatasetPublishPopupCustomText")
.then().assertThat().statusCode(404)
.body("message", equalTo("Setting DatasetPublishPopupCustomText not found"));

given().urlEncodingEnabled(false)
.body("Hello world!").put("/api/admin/settings/DatasetPublishPopupCustomText");

given().urlEncodingEnabled(false)
.get("/api/system/settings/:DatasetPublishPopupCustomText")
.then().assertThat().statusCode(200)
.body("data.DatasetPublishPopupCustomText", equalTo("Hello world!"));

given().urlEncodingEnabled(false)
.delete("/api/admin/settings/DatasetPublishPopupCustomText");

given().urlEncodingEnabled(false)
.get("/api/system/settings/:DatasetPublishPopupCustomText")
.then().assertThat().statusCode(404)
.body("message", equalTo("Setting DatasetPublishPopupCustomText not found"));
}
}
}

0 comments on commit 929a233

Please sign in to comment.