Skip to content

Commit

Permalink
rm software, workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Aug 12, 2024
1 parent d781833 commit 4c8d42d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
6 changes: 4 additions & 2 deletions doc/release-notes/10517-datasetType.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### Initial Support for Dataset Types (Dataset, Software, Workflow)
### Initial Support for Dataset Types

Datasets now have types. By default the dataset type will be "dataset", but out of the box datasets can have a type of "software" or "workflow" as well. For more details see <https://dataverse-guide--10694.org.readthedocs.build/en/10694/user/dataset-management.html#dataset-types> and #10517. Please note that this feature is highly experimental and is expected to evolve.
Out of the box, all datasets have the type "dataset" but superusers can add additional types such as "software" or "workflow" to have those types sent to DataCite when the dataset is published.

For details see <https://dataverse-guide--10694.org.readthedocs.build/en/10694/user/dataset-management.html#dataset-types> and #10517. Please note that this feature is highly experimental and is expected to evolve.

Upgrade instructions
--------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
public class DatasetType implements Serializable {

public static final String DEFAULT_DATASET_TYPE = "dataset";
public static final String DATASET_TYPE_SOFTWARE = "software";

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/db/migration/V6.3.0.2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
--
-- Insert some types (dataset is the default).
INSERT INTO datasettype (name) VALUES ('dataset');
INSERT INTO datasettype (name) VALUES ('software');
INSERT INTO datasettype (name) VALUES ('workflow');
--INSERT INTO datasettype (name) VALUES ('software');
--INSERT INTO datasettype (name) VALUES ('workflow');
--
-- Add the new column (if it doesn't exist).
ALTER TABLE dataset ADD COLUMN IF NOT EXISTS datasettype_id bigint;
Expand Down
23 changes: 23 additions & 0 deletions src/test/java/edu/harvard/iq/dataverse/api/DatasetTypesIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import jakarta.json.Json;
import jakarta.json.JsonValue;
import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST;
import static jakarta.ws.rs.core.Response.Status.CREATED;
import static jakarta.ws.rs.core.Response.Status.OK;
Expand All @@ -20,6 +21,28 @@ public class DatasetTypesIT {
@BeforeAll
public static void setUpClass() {
RestAssured.baseURI = UtilIT.getRestAssuredBaseUri();

Response getSoftwareType = UtilIT.getDatasetTypeByName(DatasetType.DATASET_TYPE_SOFTWARE);
getSoftwareType.prettyPrint();

String typeFound = JsonPath.from(getSoftwareType.getBody().asString()).getString("data.name");
System.out.println("type found: " + typeFound);
if (DatasetType.DATASET_TYPE_SOFTWARE.equals(typeFound)) {
return;
}

System.out.println("The \"software\" type wasn't found. Create it.");
Response createUser = UtilIT.createRandomUser();
createUser.then().assertThat().statusCode(OK.getStatusCode());
String username = UtilIT.getUsernameFromResponse(createUser);
String apiToken = UtilIT.getApiTokenFromResponse(createUser);
UtilIT.setSuperuserStatus(username, true).then().assertThat().statusCode(OK.getStatusCode());

String jsonIn = Json.createObjectBuilder().add("name", DatasetType.DATASET_TYPE_SOFTWARE).build().toString();

Response typeAdded = UtilIT.addDatasetType(jsonIn, apiToken);
typeAdded.prettyPrint();
typeAdded.then().assertThat().statusCode(OK.getStatusCode());
}

@Test
Expand Down

0 comments on commit 4c8d42d

Please sign in to comment.