Skip to content

Commit

Permalink
Non-functional update
Browse files Browse the repository at this point in the history
- Reduce unit and integration test logging in fcrepo-http-api
  • Loading branch information
Andrew Woods committed Apr 17, 2014
1 parent 3555db5 commit 8696a72
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
Expand Up @@ -134,14 +134,14 @@ protected GraphStore getGraphStore(final HttpClient client, final HttpUriRequest
assertEquals(OK.getStatusCode(), response.getStatusLine()
.getStatusCode());
final GraphStore result = parseTriples(response.getEntity());
logger.debug("Retrieved RDF: {}", result);
logger.trace("Retrieved RDF: {}", result);
return result;

}
protected GraphStore getGraphStore(final HttpResponse response) throws IOException {
assertEquals(OK.getStatusCode(), response.getStatusLine().getStatusCode());
final GraphStore result = parseTriples(response.getEntity());
logger.debug("Retrieved RDF: {}", result);
logger.trace("Retrieved RDF: {}", result);
return result;
}

Expand Down
Expand Up @@ -43,7 +43,7 @@ public void testGet() throws Exception {
final HttpGet get = new HttpGet(serverAddress + "fcr:namespaces");
final GraphStore graphStore = getGraphStore(get);

logger.debug("Got store {}", graphStore);
logger.trace("Got store {}", graphStore);
assertTrue("expected to find nt property in response", graphStore
.contains(ANY, createResource("http://www.jcp.org/jcr/nt/1.0")
.asNode(), HAS_NAMESPACE_PREFIX.asNode(),
Expand All @@ -67,7 +67,7 @@ public void testCreate() throws Exception {

final GraphStore graphStore = getGraphStore(get);

logger.debug("Got store {}", graphStore);
logger.trace("Got store {}", graphStore);
assertTrue("expected to find our new property in response", graphStore
.contains(ANY, createResource(
"http://example.com/namespace/abc").asNode(),
Expand Down Expand Up @@ -106,7 +106,7 @@ public void testUpdatePrefix() throws Exception {
final GraphStore graphStore =
parseTriples(response.getEntity());

logger.debug("Got store {}", graphStore);
logger.trace("Got store {}", graphStore);
assertTrue("expected to find our updated property in response",
graphStore.contains(ANY, createResource(
"http://example.com/namespace/abc").asNode(),
Expand Down Expand Up @@ -139,7 +139,7 @@ public void testUpdateNamespace() throws Exception {
final HttpGet get = new HttpGet(serverAddress + "fcr:namespaces");
final GraphStore graphStore = getGraphStore(get);

logger.debug("Got store {}", graphStore);
logger.trace("Got store {}", graphStore);
assertTrue("expected to find our updated property in response",
graphStore.contains(ANY, createResource(
"http://example.com/moved/to/abc").asNode(),
Expand Down Expand Up @@ -172,7 +172,7 @@ public void testDeleteNamespace() throws Exception {
final HttpGet get = new HttpGet(serverAddress + "fcr:namespaces");
final GraphStore graphStore = getGraphStore(get);

logger.debug("Got store {}", graphStore);
logger.trace("Got store {}", graphStore);
assertFalse("should not find deleted property in response", graphStore
.contains(ANY, createResource(
"http://example.com/namespace/abc").asNode(),
Expand Down
Expand Up @@ -327,7 +327,7 @@ public void testDeleteDatastream() throws Exception {
public void testGetRepositoryGraph() throws Exception {
final HttpGet getObjMethod = new HttpGet(serverAddress);
final GraphStore graphStore = getGraphStore(getObjMethod);
logger.debug("Retrieved repository graph:\n" + graphStore.toString());
logger.trace("Retrieved repository graph:\n" + graphStore.toString());

assertTrue("expected to find the root node data", graphStore.contains(
ANY, ANY, HAS_PRIMARY_TYPE.asNode(), createLiteral(ROOT)));
Expand All @@ -344,7 +344,7 @@ public void testGetObjectGraphHtml() throws Exception {
assertEquals(OK.getStatusCode(), response.getStatusLine()
.getStatusCode());
final String content = EntityUtils.toString(response.getEntity());
logger.debug("Retrieved: {}", content);
logger.trace("Retrieved: {}", content);
}

@Test
Expand Down Expand Up @@ -476,7 +476,7 @@ public void testGetObjectGraphWithChildren() throws Exception {
model.read(response.getEntity().getContent(), null);
try (final Writer w = new StringWriter()) {
model.write(w);
logger.debug(
logger.trace(
"Retrieved object graph for testGetObjectGraphWithChildren():\n {}",
w);
}
Expand Down Expand Up @@ -516,7 +516,7 @@ public void testGetObjectGraphMinimal() throws Exception {
.getStatusCode());
final String content = EntityUtils.toString(response.getEntity());

logger.debug("Retrieved object graph:\n" + content);
logger.trace("Retrieved object graph:\n" + content);

assertFalse(
"Didn't expect member resources",
Expand Down Expand Up @@ -548,7 +548,7 @@ public void testGetObjectOmitMembership() throws Exception {
.getStatusCode());
final String content = EntityUtils.toString(response.getEntity());

logger.debug("Retrieved object graph:\n" + content);
logger.trace("Retrieved object graph:\n" + content);

assertFalse(
"Didn't expect inlined member resources",
Expand All @@ -574,7 +574,7 @@ public void testGetObjectOmitContainment() throws Exception {
.getStatusCode());
final String content = EntityUtils.toString(response.getEntity());

logger.debug("Retrieved object graph:\n" + content);
logger.trace("Retrieved object graph:\n" + content);

assertTrue("Didn't find member resources",
compile(
Expand Down Expand Up @@ -672,7 +672,7 @@ public void testUpdateAndReplaceObjectGraph() throws Exception {
assertEquals(OK.getStatusCode(), getResponse.getStatusLine()
.getStatusCode());
final String content = EntityUtils.toString(getResponse.getEntity());
logger.debug("Retrieved object graph:\n" + content);
logger.trace("Retrieved object graph:\n" + content);

assertFalse("Found a triple we thought we deleted.", compile(
"<" + subjectURI + "> <info:rubydora#label> \"asdfg\" \\.",
Expand All @@ -696,7 +696,7 @@ public void testUpdateObjectGraphWithProblems() throws Exception {
if (response.getStatusLine().getStatusCode() != 403
&& response.getEntity() != null) {
final String content = EntityUtils.toString(response.getEntity());
logger.error("Got unexpected update response:\n" + content);
logger.trace("Got unexpected update response:\n" + content);
}
assertEquals(403, response.getStatusLine().getStatusCode());

Expand Down Expand Up @@ -727,7 +727,7 @@ public void testReplaceGraph() throws Exception {
model.read(getResponse.getEntity().getContent(), null);
try (final Writer w = new StringWriter()) {
model.write(w);
logger.debug(
logger.trace(
"Retrieved object graph for testReplaceGraph():\n {}", w);
}
assertTrue("Didn't find a triple we tried to create!", model.contains(
Expand Down Expand Up @@ -760,7 +760,7 @@ public void testCreateGraph() throws Exception {
model.read(getResponse.getEntity().getContent(), null);
try (final Writer w = new StringWriter()) {
model.write(w);
logger.debug("Retrieved object graph for testCreateGraph():\n {}",
logger.trace("Retrieved object graph for testCreateGraph():\n {}",
w);
}
assertTrue("Didn't find a triple we tried to create!", model.contains(
Expand Down Expand Up @@ -797,7 +797,7 @@ public void testDescribeSize() throws Exception {
final String sizeNode = randomUUID().toString();

GraphStore graphStore = getGraphStore(new HttpGet(serverAddress + ""));
logger.debug("For testDescribeSize() first size retrieved repository graph:\n"
logger.trace("For testDescribeSize() first size retrieved repository graph:\n"
+ graphStore.toString());

Iterator<Triple> iterator =
Expand All @@ -813,7 +813,7 @@ public void testDescribeSize() throws Exception {
"asdf", "1234")));

graphStore = getGraphStore(new HttpGet(serverAddress + ""));
logger.debug("For testDescribeSize() new size retrieved repository graph:\n"
logger.trace("For testDescribeSize() new size retrieved repository graph:\n"
+ graphStore.toString());

iterator =
Expand All @@ -822,7 +822,7 @@ public void testDescribeSize() throws Exception {

final String newSize = (String) iterator.next().getObject().getLiteralValue();

logger.debug("Old size was: " + oldSize + " and new size was: "
logger.trace("Old size was: " + oldSize + " and new size was: "
+ newSize);
assertTrue("No increment in size occurred when we expected one!",
Integer.parseInt(oldSize) < Integer.parseInt(newSize));
Expand All @@ -832,7 +832,7 @@ public void testDescribeSize() throws Exception {
public void testDescribeCount() throws Exception {
logger.trace("Entering testDescribeCount()...");
GraphStore graphStore = getGraphStore(new HttpGet(serverAddress + ""));
logger.debug("For testDescribeCount() first count retrieved repository graph:\n"
logger.trace("For testDescribeCount() first count retrieved repository graph:\n"
+ graphStore.toString());

Iterator<Triple> iterator =
Expand All @@ -848,7 +848,7 @@ public void testDescribeCount() throws Exception {
countNode, "asdf", "1234")));

graphStore = getGraphStore(new HttpGet(serverAddress + ""));
logger.debug("For testDescribeCount() first count repository graph:\n"
logger.trace("For testDescribeCount() first count repository graph:\n"
+ graphStore.toString());

iterator =
Expand Down Expand Up @@ -877,7 +877,7 @@ public void testGetProjectedNode() throws Exception {
final Graph result = getGraphStore(method).getDefaultGraph();

final String subjectURI = serverAddress + "files/FileSystem1";
logger.debug("For testGetProjectedNode() retrieved graph:\n"
logger.trace("For testGetProjectedNode() retrieved graph:\n"
+ result.toString());
assertTrue("Didn't find the first datastream! ", result.contains(
createURI(subjectURI), ANY, createURI(subjectURI + "/ds1")));
Expand Down Expand Up @@ -1058,7 +1058,7 @@ private void validateHTML(final String path) throws Exception {
assertEquals(OK.getStatusCode(), response.getStatusLine()
.getStatusCode());
final String content = EntityUtils.toString(response.getEntity());
logger.debug("Retrieved HTML view:\n" + content);
logger.trace("Retrieved HTML view:\n" + content);

final HtmlParser htmlParser = new HtmlParser(ALLOW);
htmlParser.setDoctypeExpectation(NO_DOCTYPE_ERRORS);
Expand All @@ -1069,7 +1069,7 @@ private void validateHTML(final String path) throws Exception {
new ByteArrayInputStream(content.getBytes())) {
htmlParser.parse(new InputSource(htmlStream));
}
logger.info("HTML found to be valid.");
logger.debug("HTML found to be valid.");
}

private void verifyResource(Model model, Resource nodeUri, Property rdfType, String namespace, String resource) {
Expand Down
Expand Up @@ -43,16 +43,16 @@ public class NamespaceConverter extends InternalIdentifierConverter {
*/
@Override
protected String doForward(final String inputId) {
log.debug("Converting identifier {} from internal to external...", inputId);
log.trace("Converting identifier {} from internal to external...", inputId);
String result = inputId;
for (final String jcrNamespace : jcrNamespacesToRDFNamespaces.keySet()) {
log.debug("Replacing namespace: {} with: {}", jcrNamespace, jcrNamespacesToRDFNamespaces.get(jcrNamespace));
log.trace("Replacing namespace: {} with: {}", jcrNamespace, jcrNamespacesToRDFNamespaces.get(jcrNamespace));
result = result.replace(jcrNamespace, jcrNamespacesToRDFNamespaces.get(jcrNamespace));
}
if (result.endsWith(JCR_CONTENT)) {
result = result.replace(JCR_CONTENT, FCR_CONTENT);
}
log.debug("Converted identifier {} from internal to external {}...", inputId, result);
log.trace("Converted identifier {} from internal to external {}...", inputId, result);
return result;
}

Expand All @@ -64,10 +64,10 @@ protected String doForward(final String inputId) {
*/
@Override
protected String doBackward(final String b) {
log.debug("Converting identifier from external to internal...");
log.trace("Converting identifier from external to internal...");
String result = b;
for (final String rdfNamespace : rdfNamespacesToJcrNamespaces.keySet()) {
log.debug("Replacing namespace: {} with: {}", rdfNamespace, rdfNamespacesToJcrNamespaces.get(rdfNamespace));
log.trace("Replacing namespace: {} with: {}", rdfNamespace, rdfNamespacesToJcrNamespaces.get(rdfNamespace));
result = result.replace(rdfNamespace, rdfNamespacesToJcrNamespaces.get(rdfNamespace));
}
if (result.endsWith(FCR_CONTENT)) {
Expand Down

0 comments on commit 8696a72

Please sign in to comment.