Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Code cleanup in ViewHelpers
  • Loading branch information
ajs6f committed Nov 3, 2015
1 parent 9d28989 commit 03aef6b
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 201 deletions.
Expand Up @@ -10,7 +10,7 @@
<dt>Children <span id="badge" class="badge"> </span></dt>
<dd>
<ol id="childList">
#foreach($quad in $helpers.getObjects($rdf, $topic, $rdfLexicon.CONTAINS))
#foreach($quad in $rdf.find($topic, $rdfLexicon.CONTAINS.asNode(), null))
<li><a href="$quad.getObject().getURI()">$esc.html($helpers.getObjectTitle($rdf, $quad.getObject()))</a></li>
#end
</ol>
Expand Down
10 changes: 5 additions & 5 deletions fcrepo-http-api/src/main/resources/views/common-node-actions.vsl
Expand Up @@ -86,7 +86,7 @@ WHERE { }
</form>
#end

#set ($serializations = $rdf.find($topic, $helpers.asNode($rdfLexicon.HAS_SERIALIZATION), $nodeany))
#set ($serializations = $rdf.find($topic, $rdfLexicon.HAS_SERIALIZATION.asNode(), $nodeany))

#if($serializations.hasNext())
<div class="btn-group">
Expand All @@ -98,7 +98,7 @@ WHERE { }

<ul class="dropdown-menu">
#foreach($quad in $helpers.getSortedTriples($model, $serializations))
<li><a href="$quad.getObject().getURI()">$helpers.getSerializationTitle($rdf, $quad.getObject())</a></li>
<li><a href="$quad.getObject().getURI()">$helpers.getSerializationTitle($rdf, $quad.getObject()).orElse("")</a></li>
#end
</ul>
</div>
Expand All @@ -108,7 +108,7 @@ WHERE { }


#if ($writable == true)
#set ($serializations = $rdf.find($topic, $helpers.asNode($rdfLexicon.HAS_SERIALIZATION), $nodeany))
#set ($serializations = $rdf.find($topic, $rdfLexicon.HAS_SERIALIZATION.asNode(), $nodeany))

#if($serializations.hasNext())
<form id="action_import" method="POST">
Expand All @@ -123,7 +123,7 @@ WHERE { }
<label class="control-label">Format</label>
<select id="import_format" name="format" class="form-control">
#foreach($quad in $helpers.getSortedTriples($model, $serializations))
<option>$helpers.getSerializationTitle($rdf, $quad.getObject())</option>
<option>$helpers.getSerializationTitle($rdf, $quad.getObject()).orElse("")</option>
#end
</select>
</div>
Expand All @@ -133,7 +133,7 @@ WHERE { }

#end

#set ($fedoraresc = $rdf.find($topic, $helpers.asNode($rdfLexicon.HAS_MIXIN_TYPE), $helpers.asLiteralStringNode("fedora:resource")))
#set ($fedoraresc = $rdf.find($topic, $rdfLexicon.HAS_MIXIN_TYPE.asNode(), $helpers.asLiteralStringNode("fedora:resource")))
#if($fedoraresc.hasNext())
<h3>Access Roles</h3>
<form id="update_rbacl" type="application/json" action="javascript:updateAccessRoles()" method="POST">
Expand Down
2 changes: 1 addition & 1 deletion fcrepo-http-api/src/main/resources/views/fcr-versions.vsl
Expand Up @@ -21,7 +21,7 @@
<div class="panel-group" id="accordion">
#foreach($subject in $helpers.getVersions($rdf, $topic))
<div class="panel panel-default" resource="$subject.getURI()">
#set($label = $helpers.getVersionLabel($rdf, $subject, "Unlabeled Version"))
#set($label = $helpers.getVersionLabel($rdf, $subject).orElse("Unlabeled Version"))
<div class="panel-heading collapsed" data-toggle="collapse" data-target="#$helpers.parameterize($subject.getURI())_triples" >
<div class="ctitle panel-title"><a href="$subject.getURI()" class="version_link">$esc.html($label)</a></div>
</div>
Expand Down
Expand Up @@ -20,7 +20,9 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.apache.http.HttpResponse;
import java.io.IOException;

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import org.junit.Test;
Expand All @@ -33,15 +35,15 @@
public class FedoraHtmlIT extends AbstractResourceIT {

@Test
public void testGetRoot() throws Exception {
public void testGetRoot() {

final HttpGet method = new HttpGet(serverAddress);
method.addHeader("Accept", "text/html");
assertEquals(200, getStatus(method));
}

@Test
public void testGetNode() throws Exception {
public void testGetNode() {

final String pid = getRandomUniqueId();
createObject(pid);
Expand All @@ -52,7 +54,7 @@ public void testGetNode() throws Exception {
}

@Test
public void testGetDatastreamNode() throws Exception {
public void testGetDatastreamNode() throws IOException {

final String pid = getRandomUniqueId();
createObject(pid);
Expand All @@ -67,15 +69,16 @@ public void testGetDatastreamNode() throws Exception {
}

@Test
public void testGetTemplate() throws Exception {
public void testGetTemplate() throws IOException {
final String pid = getRandomUniqueId();
createObject(pid);
addMixin(pid, REPOSITORY_NAMESPACE + "Resource");

final HttpGet method = new HttpGet(serverAddress + pid);
method.addHeader("Accept", "text/html");
final HttpResponse response = execute(method);
final String html = EntityUtils.toString(response.getEntity());
assertTrue(contains(html, "class=\"nt_folder\""));
try (final CloseableHttpResponse response = execute(method)) {
final String html = EntityUtils.toString(response.getEntity());
assertTrue(contains(html, "class=\"nt_folder\""));
}
}
}

0 comments on commit 03aef6b

Please sign in to comment.