Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions README-dtq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@

# DSpace
## Overview
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you duplicate readme contents?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, it shouldn't be here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied whole content because for each point could be added additional information. I would like to keep the content from README.md.


DSpace open source software is a turnkey repository application used by more than
2,000 organizations and institutions worldwide to provide durable access to digital resources.
For more information, visit http://www.dspace.org/

DSpace consists of both a Java-based backend and an Angular-based frontend.

* Backend (this codebase) provides a REST API, along with other machine-based interfaces (e.g. OAI-PMH, SWORD, etc)
* The REST Contract is at https://github.com/DSpace/RestContract
* Frontend (https://github.com/DSpace/dspace-angular/) is the User Interface built on the REST API

Prior versions of DSpace (v6.x and below) used two different UIs (XMLUI and JSPUI). Those UIs are no longer supported in v7 (and above).
* A maintenance branch for older versions is still available, see `dspace-6_x` for 6.x maintenance.

## Downloads

* Backend (REST API): https://github.com/DSpace/DSpace/releases
* Frontend (User Interface): https://github.com/DSpace/dspace-angular/releases

## Documentation / Installation

Documentation for each release may be viewed online or downloaded via our [Documentation Wiki](https://wiki.lyrasis.org/display/DSDOC/).

The latest DSpace Installation instructions are available at:
https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace

Please be aware that, as a Java web application, DSpace requires a database (PostgreSQL or Oracle)
and a servlet container (usually Tomcat) in order to function.
More information about these and all other prerequisites can be found in the Installation instructions above.

## Running DSpace 7 in Docker

NOTE: At this time, we do not have production-ready Docker images for DSpace.
That said, we do have quick-start Docker Compose scripts for development or testing purposes.

See [Running DSpace 7 with Docker Compose](dspace/src/main/docker-compose/README.md)

## Contributing

DSpace is a community built and supported project. We do not have a centralized development or support team,
but have a dedicated group of volunteers who help us improve the software, documentation, resources, etc.

We welcome contributions of any type. Here's a few basic guides that provide suggestions for contributing to DSpace:
* [How to Contribute to DSpace](https://wiki.lyrasis.org/display/DSPACE/How+to+Contribute+to+DSpace): How to contribute in general (via code, documentation, bug reports, expertise, etc)
* [Code Contribution Guidelines](https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines): How to give back code or contribute features, bug fixes, etc.
* [DSpace Community Advisory Team (DCAT)](https://wiki.lyrasis.org/display/cmtygp/DSpace+Community+Advisory+Team): If you are not a developer, we also have an interest group specifically for repository managers. The DCAT group meets virtually, once a month, and sends open invitations to join their meetings via the [DCAT mailing list](https://groups.google.com/d/forum/DSpaceCommunityAdvisoryTeam).

We also encourage GitHub Pull Requests (PRs) at any time. Please see our [Development with Git](https://wiki.lyrasis.org/display/DSPACE/Development+with+Git) guide for more info.

In addition, a listing of all known contributors to DSpace software can be
found online at: https://wiki.lyrasis.org/display/DSPACE/DSpaceContributors

## Getting Help

DSpace provides public mailing lists where you can post questions or raise topics for discussion.
We welcome everyone to participate in these lists:

* [dspace-community@googlegroups.com](https://groups.google.com/d/forum/dspace-community) : General discussion about DSpace platform, announcements, sharing of best practices
* [dspace-tech@googlegroups.com](https://groups.google.com/d/forum/dspace-tech) : Technical support mailing list. See also our guide for [How to troubleshoot an error](https://wiki.lyrasis.org/display/DSPACE/Troubleshoot+an+error).
* [dspace-devel@googlegroups.com](https://groups.google.com/d/forum/dspace-devel) : Developers / Development mailing list

Great Q&A is also available under the [DSpace tag on Stackoverflow](http://stackoverflow.com/questions/tagged/dspace)

Additional support options are at https://wiki.lyrasis.org/display/DSPACE/Support

DSpace also has an active service provider network. If you'd rather hire a service provider to
install, upgrade, customize or host DSpace, then we recommend getting in touch with one of our
[Registered Service Providers](http://www.dspace.org/service-providers).

## Issue Tracker

DSpace uses GitHub to track issues:
* Backend (REST API) issues: https://github.com/DSpace/DSpace/issues
* Frontend (User Interface) issues: https://github.com/DSpace/dspace-angular/issues

## Testing

### Running Tests

By default, in DSpace, Unit Tests and Integration Tests are disabled. However, they are
run automatically by [GitHub Actions](https://github.com/DSpace/DSpace/actions?query=workflow%3ABuild) for all Pull Requests and code commits.

* Necessary parameters for running every Unit Test command to pass JVM memory flags: `test.argLine`, `surefireJacoco`. Example:
```
mvn <ARGS> -Dtest.argLine=-Xmx1024m -DsurefireJacoco=-XX:MaxPermSize=256m
```
* Necessary parameters for running every Integration Test command to pass JVM memory flags: `test.argLine`, `failsafeJacoco`. Example:
```
mvn <ARGS> -Dtest.argLine=-Xmx1024m -DfailsafeJacoco=-XX:MaxPermSize=256m
```
* How to run both Unit Tests (via `maven-surefire-plugin`) and Integration Tests (via `maven-failsafe-plugin`):
```
mvn install -DskipUnitTests=false -DskipIntegrationTests=false
```
* How to run _only_ Unit Tests:
```
mvn test -DskipUnitTests=false
```
* How to run a *single* Unit Test
```
# Run all tests in a specific test class
# NOTE: failIfNoTests=false is required to skip tests in other modules
mvn test -DskipUnitTests=false -Dtest=[full.package.testClassName] -DfailIfNoTests=false

# Example: mvn test -DskipUnitTests=false -Dtest=org.dspace.content.ItemTest.java -DfailIfNoTests=false -Dtest.argLine=-Xmx1024m -DsurefireJacoco=-XX:MaxPermSize=256m

# Run one test method in a specific test class
mvn test -DskipUnitTests=false -Dtest=[full.package.testClassName]#[testMethodName] -DfailIfNoTests=false
```
* How to run _only_ Integration Tests
```
mvn install -DskipIntegrationTests=false
```
* How to run a *single* Integration Test
```
# Run all integration tests in a specific test class
# NOTE: failIfNoTests=false is required to skip tests in other modules
mvn install -DskipIntegrationTests=false -Dit.test=[full.package.testClassName] -DfailIfNoTests=false

# Example:
mvn install -DskipIntegrationTests=false -Dit.test=org.dspace.content.ItemIT.java#dtqExampleTest -Dtest.argLine=-Xmx1024m -DfailsafeJacoco=-XX:MaxPermSize=256m

# Run one test method in a specific test class
mvn install -DskipIntegrationTests=false -Dit.test=[full.package.testClassName]#[testMethodName] -DfailIfNoTests=false
```
* How to run only tests of a specific DSpace module
```
# Before you can run only one module's tests, other modules may need installing into your ~/.m2
cd [dspace-src]
mvn clean install

# Then, move into a module subdirectory, and run the test command
cd [dspace-src]/dspace-server-webapp
# Choose your test command from the lists above
```

## License

DSpace source code is freely available under a standard [BSD 3-Clause license](https://opensource.org/licenses/BSD-3-Clause).
The full license is available in the [LICENSE](LICENSE) file or online at http://www.dspace.org/license/

DSpace uses third-party libraries which may be distributed under different licenses. Those licenses are listed
in the [LICENSES_THIRD_PARTY](LICENSES_THIRD_PARTY) file.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

[![codecov](https://codecov.io/gh/dataquest-dev/DSpace/branch/dtq-dev/graph/badge.svg?token=YI6CJNFI2H)](https://codecov.io/gh/dataquest-dev/DSpace)

# DSpace

[![Build](https://github.com/dataquest-dev/DSpace/actions/workflows/build.yml/badge.svg)](https://github.com/dataquest-dev/DSpace/actions/workflows/build.yml)
[![codecov](https://codecov.io/gh/dataquest-dev/DSpace/branch/dtq-dev/graph/badge.svg?token=YI6CJNFI2H)](https://codecov.io/gh/dataquest-dev/DSpace)

[DSpace Documentation](https://wiki.lyrasis.org/display/DSDOC/) |
[DSpace Releases](https://github.com/DSpace/DSpace/releases) |
[DSpace Wiki](https://wiki.lyrasis.org/display/DSPACE/Home) |
Expand Down Expand Up @@ -139,4 +140,4 @@ The full license is available in the [LICENSE](LICENSE) file or online at http:/

DSpace uses third-party libraries which may be distributed under different licenses. Those licenses are listed
in the [LICENSES_THIRD_PARTY](LICENSES_THIRD_PARTY) file.
<!-- two -->
<!-- two -->
102 changes: 102 additions & 0 deletions dspace-api/src/test/java/org/dspace/content/ItemIT.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

import java.util.UUID;

import org.apache.logging.log4j.Logger;
import org.dspace.AbstractIntegrationTestWithDatabase;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.CollectionService;
import org.dspace.content.service.CommunityService;
import org.dspace.content.service.InstallItemService;
import org.dspace.content.service.ItemService;
import org.dspace.content.service.WorkspaceItemService;
import org.junit.Test;

/**
* Integration Tests for class Item
*
* @author milanmajchrak
*/
public class ItemIT extends AbstractIntegrationTestWithDatabase {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation ?!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't understand, what with documentation?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs added


/**
* log4j category
*/
protected static final Logger log = org.apache.logging.log4j.LogManager.getLogger(ItemTest.class);

/**
* Item instance for the tests
*/
protected Item it;

protected ItemService itemService = ContentServiceFactory.getInstance()
.getItemService();
protected CommunityService communityService = ContentServiceFactory.getInstance()
.getCommunityService();
protected CollectionService collectionService = ContentServiceFactory.getInstance()
.getCollectionService();
protected WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance()
.getWorkspaceItemService();
protected InstallItemService installItemService = ContentServiceFactory.getInstance()
.getInstallItemService();


protected Collection collection;
protected Community owningCommunity;

/**
* Spy of AuthorizeService to use for tests
* (initialized / setup in @Before method)
*/
private AuthorizeService authorizeServiceSpy;

/**
* Test of update item and find method.
*/
@Test
public void dtqExampleTest() throws Exception {
// create item
//we have to create a new community in the database
context.turnOffAuthorisationSystem();
this.owningCommunity = communityService.create(null, context);
this.collection = collectionService.create(context, owningCommunity);
WorkspaceItem workspaceItem = workspaceItemService.create(context, collection, true);
this.it = installItemService.installItem(context, workspaceItem);
context.restoreAuthSystemState();

// Find by id
// Get ID of item created in init()
UUID id = it.getID();
// Make sure we can find it via its ID
Item found = itemService.find(context, id);
assertThat("dtqExampleTest 0", found.getID(), equalTo(id));

// default discoverable should be true
assertThat("dtqExampleTest 1", found.isDiscoverable(), equalTo(true));

context.turnOffAuthorisationSystem();
// set discoverable and update
found.setDiscoverable(false);
itemService.update(context, found);
context.restoreAuthSystemState();


// find by id
Item foundAfterUpdate = itemService.find(context, id);
assertThat("dtqExampleTest 2", foundAfterUpdate.getID(), equalTo(id));

// check if discoverable changed
assertThat("dtqExampleTest 1", foundAfterUpdate.isDiscoverable(), equalTo(false));
}
}
9 changes: 9 additions & 0 deletions dspace-api/src/test/java/org/dspace/content/ItemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ public void testItemFind() throws Exception {
assertThat("testItemFind 2", found.getName(), nullValue());
}

/**
* Example test of item if is not null.
*/
@Test
public void dtqExampleTest() throws Exception {
// check if it is not null
assertThat("dtqExampleTest 0", this.it, notNullValue());
}

/**
* Test of create method, of class Item.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.rest;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.dspace.app.rest.model.CommunityRest;
import org.dspace.app.rest.model.MetadataRest;
import org.dspace.app.rest.model.MetadataValueRest;
import org.dspace.app.rest.test.AbstractControllerIntegrationTest;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.builder.CommunityBuilder;
import org.dspace.core.Constants;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

/**
* Integration Tests for class Community
*
* @author milanmajchrak
*/
public class CommunityExampleIT extends AbstractControllerIntegrationTest {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs added


@Autowired
AuthorizeService authorizeService;

private ObjectMapper mapper;
private CommunityRest comm;
private String authToken;

/**
* This method will be run before every test as per @Before. It will
* initialize resources required for the tests.
*
* Other methods can be annotated with @Before here or in subclasses
* but no execution order is guaranteed
*/
@Before
public void createStructure() throws Exception {
//We turn off the authorization system in order to create the structure as defined below
context.turnOffAuthorisationSystem();

// Create a parent community
parentCommunity = CommunityBuilder.createCommunity(context)
.withName("Parent Community")
.build();

// ADD authorization on parent community
context.setCurrentUser(eperson);
authorizeService.addPolicy(context, parentCommunity, Constants.ADD, eperson);
context.restoreAuthSystemState();

this.authToken = getAuthToken(eperson.getEmail(), password);

this.mapper = new ObjectMapper();
this.comm = new CommunityRest();
// We send a name but the created community should set this to the title
this.comm.setName("Test Parent Community");
this.comm.setMetadata(new MetadataRest()
.put("dc.description",
new MetadataValueRest("<p>Some cool HTML code here</p>"))
.put("dc.description.abstract",
new MetadataValueRest("Sample top-level community created via the REST API"))
.put("dc.description.tableofcontents",
new MetadataValueRest("<p>HTML News</p>"))
.put("dc.rights",
new MetadataValueRest("Custom Copyright Text"))
.put("dc.title",
new MetadataValueRest("Title Text")));
}

/**
* Test of find the created community.
*/
@Test
public void shouldCreateCommunity() throws Exception {
AtomicReference<UUID> idRef = new AtomicReference<>();
try {
getClient(authToken).perform(post("/api/core/communities")
.content(mapper.writeValueAsBytes(comm))
.param("parent", parentCommunity.getID().toString())
.contentType(contentType))
.andExpect(status().isCreated());
} finally {
// Delete the created community (cleanup after ourselves!)
CommunityBuilder.deleteCommunity(idRef.get());
}
}
}
Loading