Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing up tests in fcrepo-jms for better instrumentation; splitting f…
…alsafe and surefire into separate jacoco reports
- Loading branch information
Showing
8 changed files
with
126 additions
and
58 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
fcrepo-jms/src/main/java/org/fcrepo/messaging/legacy/EntryFactory.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,49 @@ | ||
package org.fcrepo.messaging.legacy; | ||
|
||
import java.io.Reader; | ||
import java.io.StringReader; | ||
import java.util.UUID; | ||
|
||
import org.apache.abdera.Abdera; | ||
import org.apache.abdera.model.Entry; | ||
import org.apache.abdera.parser.Parser; | ||
|
||
public abstract class EntryFactory { | ||
|
||
private static final Abdera ABDERA = new Abdera(); | ||
|
||
private static final Parser ABDERA_PARSER = ABDERA.getParser(); | ||
|
||
public static final String FORMAT = | ||
"info:fedora/fedora-system:ATOM-APIM-1.0"; | ||
|
||
//TODO get this out of the build properties | ||
public static final String SERVER_VERSION = "4.0.0-SNAPSHOT"; | ||
|
||
private static final String TYPES_NS = | ||
"http://www.fedora.info/definitions/1/0/types/"; | ||
|
||
public static final String VERSION_PREDICATE = | ||
"info:fedora/fedora-system:def/view#version"; | ||
|
||
private static final String XSD_NS = "http://www.w3.org/2001/XMLSchema"; | ||
|
||
public static final String FORMAT_PREDICATE = | ||
"http://www.fedora.info/definitions/1/0/types/formatURI"; | ||
|
||
static Entry newEntry() { | ||
final Entry entry = ABDERA.newEntry(); | ||
entry.declareNS(XSD_NS, "xsd"); | ||
entry.declareNS(TYPES_NS, "fedora-types"); | ||
entry.setId("urn:uuid:" + UUID.randomUUID().toString()); | ||
entry.addCategory(FORMAT_PREDICATE, FORMAT, "format"); | ||
entry.addCategory(VERSION_PREDICATE, SERVER_VERSION, "version"); | ||
return entry; | ||
} | ||
|
||
static Entry parse(Reader input) { | ||
return (Entry) ABDERA_PARSER.parse(input) | ||
.getRoot(); | ||
} | ||
|
||
} |
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
33 changes: 33 additions & 0 deletions
33
fcrepo-jms/src/test/java/org/fcrepo/messaging/legacy/EntryFactoryTest.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,33 @@ | ||
package org.fcrepo.messaging.legacy; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import java.io.StringReader; | ||
import java.util.List; | ||
|
||
import org.apache.abdera.model.Category; | ||
import org.apache.abdera.model.Entry; | ||
import org.junit.Test; | ||
|
||
public class EntryFactoryTest { | ||
|
||
private static String ATOM = | ||
"<entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:fedora-types=\"http://www.fedora.info/definitions/1/0/types/\"><id>urn:uuid:a447ba5a-4ff5-42e1-8d4d-b728ea86155c</id><category term=\"info:fedora/fedora-system:ATOM-APIM-1.0\" scheme=\"http://www.fedora.info/definitions/1/0/types/formatURI\" label=\"format\"/><category term=\"4.0.0-SNAPSHOT\" scheme=\"info:fedora/fedora-system:def/view#version\" label=\"version\"/></entry>"; | ||
|
||
|
||
@Test | ||
public void testNewEntry() { | ||
Entry actual = EntryFactory.newEntry(); | ||
List<Category> categories = actual.getCategories(EntryFactory.FORMAT_PREDICATE); | ||
assertEquals(1, categories.size()); | ||
Category category = categories.get(0); | ||
System.out.println("HELLO! " + actual.toString()); | ||
assertEquals(EntryFactory.FORMAT, category.getTerm()); | ||
assertEquals("format", category.getLabel()); | ||
} | ||
|
||
@Test | ||
public void testParse() { | ||
EntryFactory.parse(new StringReader(ATOM)); | ||
} | ||
} |
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