Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added getLabel() and setLabel() to Datastream
- Loading branch information
Showing
6 changed files
with
128 additions
and
14 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
44 changes: 44 additions & 0 deletions
44
fcrepo-kernel/src/test/java/org/fcrepo/DatastreamTest.java
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,44 @@ | ||
|
||
package org.fcrepo; | ||
|
||
import static org.fcrepo.services.DatastreamService.createDatastreamNode; | ||
import static org.fcrepo.services.DatastreamService.getDatastream; | ||
import static org.fcrepo.services.ObjectService.createObjectNodeByName; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
|
||
import javax.inject.Inject; | ||
import javax.jcr.Node; | ||
import javax.jcr.Repository; | ||
import javax.jcr.RepositoryException; | ||
import javax.jcr.Session; | ||
|
||
import org.junit.Test; | ||
import org.springframework.test.context.ContextConfiguration; | ||
|
||
@ContextConfiguration({"/spring-test/repo.xml"}) | ||
public class DatastreamTest extends AbstractTest { | ||
|
||
@Inject | ||
Repository repo; | ||
|
||
@Test | ||
public void testLabel() throws RepositoryException, IOException { | ||
Session session = repo.login(); | ||
createObjectNodeByName(session, "testObject"); | ||
Node dsNode = | ||
createDatastreamNode(session, | ||
"/objects/testObject/testDatastreamNode", | ||
"application/octet-stream", new ByteArrayInputStream( | ||
"asdf".getBytes())); | ||
new Datastream(dsNode).setLabel("Best datastream ever!"); | ||
session.save(); | ||
session.logout(); | ||
|
||
session = repo.login(); | ||
final Datastream ds = getDatastream("testObject", "testDatastreamNode"); | ||
assertEquals("Wrong label!", "Best datastream ever!", ds.getLabel()); | ||
} | ||
} |
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