Skip to content

Commit

Permalink
trivial formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Shin committed May 31, 2013
1 parent 337f731 commit 353a78d
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 83 deletions.
113 changes: 57 additions & 56 deletions src/test/java/org/fcrepo/serialization/bagit/AbstractResourceIT.java
@@ -1,3 +1,4 @@

package org.fcrepo.serialization.bagit;

import java.io.IOException;
Expand All @@ -24,60 +25,60 @@
@ContextConfiguration("/spring-test/test-container.xml")
public abstract class AbstractResourceIT {

protected Logger logger;

@Before
public void setLogger() {
logger = LoggerFactory.getLogger(this.getClass());
}

protected static final int SERVER_PORT = Integer.parseInt(System
.getProperty("test.port", "8080"));

protected static final String HOSTNAME = "localhost";

protected static final String serverAddress = "http://" + HOSTNAME + ":" +
SERVER_PORT + "/rest/";

protected final PoolingClientConnectionManager connectionManager =
new PoolingClientConnectionManager();

protected static HttpClient client;

public AbstractResourceIT() {
connectionManager.setMaxTotal(Integer.MAX_VALUE);
connectionManager.setDefaultMaxPerRoute(5);
connectionManager.closeIdleConnections(3, TimeUnit.SECONDS);
client = new DefaultHttpClient(connectionManager);
}

protected static HttpPost postObjMethod(final String pid) {
return new HttpPost(serverAddress + "objects/" + pid);
}

protected static HttpPost postDSMethod(final String pid, final String ds,
final String content) throws UnsupportedEncodingException {
final HttpPost post =
new HttpPost(serverAddress + "objects/" + pid +
"/" + ds + "/fcr:content");
post.setEntity(new StringEntity(content));
return post;
}

protected HttpResponse execute(final HttpUriRequest method)
throws ClientProtocolException, IOException {
logger.debug("Executing: " + method.getMethod() + " to " +
method.getURI());
return client.execute(method);
}

protected int getStatus(final HttpUriRequest method)
throws ClientProtocolException, IOException {
HttpResponse response = execute(method);
int result = response.getStatusLine().getStatusCode();
if (!(result > 199) || !(result < 400)){
logger.warn(EntityUtils.toString(response.getEntity()));
}
return result;
}
protected Logger logger;

@Before
public void setLogger() {
logger = LoggerFactory.getLogger(this.getClass());
}

protected static final int SERVER_PORT = Integer.parseInt(System
.getProperty("test.port", "8080"));

protected static final String HOSTNAME = "localhost";

protected static final String serverAddress = "http://" + HOSTNAME + ":" +
SERVER_PORT + "/rest/";

protected final PoolingClientConnectionManager connectionManager =
new PoolingClientConnectionManager();

protected static HttpClient client;

public AbstractResourceIT() {
connectionManager.setMaxTotal(Integer.MAX_VALUE);
connectionManager.setDefaultMaxPerRoute(5);
connectionManager.closeIdleConnections(3, TimeUnit.SECONDS);
client = new DefaultHttpClient(connectionManager);
}

protected static HttpPost postObjMethod(final String pid) {
return new HttpPost(serverAddress + "objects/" + pid);
}

protected static HttpPost postDSMethod(final String pid, final String ds,
final String content) throws UnsupportedEncodingException {
final HttpPost post =
new HttpPost(serverAddress + "objects/" + pid + "/" + ds +
"/fcr:content");
post.setEntity(new StringEntity(content));
return post;
}

protected HttpResponse execute(final HttpUriRequest method)
throws ClientProtocolException, IOException {
logger.debug("Executing: " + method.getMethod() + " to " +
method.getURI());
return client.execute(method);
}

protected int getStatus(final HttpUriRequest method)
throws ClientProtocolException, IOException {
HttpResponse response = execute(method);
int result = response.getStatusLine().getStatusCode();
if (!(result > 199) || !(result < 400)) {
logger.warn(EntityUtils.toString(response.getEntity()));
}
return result;
}
}
2 changes: 0 additions & 2 deletions src/test/resources/spring-test/repo.xml
Expand Up @@ -16,8 +16,6 @@
</bean>

<bean class="org.modeshape.jcr.JcrRepositoryFactory"/>


<bean class="org.fcrepo.services.ObjectService"/>
<bean class="org.fcrepo.services.NodeService"/>
<bean class="org.fcrepo.services.LowLevelStorageService"/>
Expand Down
50 changes: 25 additions & 25 deletions src/test/resources/spring-test/rest.xml
@@ -1,36 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

<context:property-placeholder/>
<context:annotation-config/>
<context:property-placeholder />
<context:annotation-config />

<util:map id="serializers" key-type="java.lang.String"
value-type="org.fcrepo.serialization.FedoraObjectSerializer">
<description>Map from formats to serializers for Fedora objects</description>
<entry key="bagit">
<bean class="org.fcrepo.serialization.bagit.BagItSerializer">
<property name="prefixes">
<set value-type="java.lang.String">
<value>fedora</value>
<value>dc</value>
</set>
</property>
</bean>
</entry>
</util:map>
<util:map id="serializers" key-type="java.lang.String"
value-type="org.fcrepo.serialization.FedoraObjectSerializer">
<description>Map from formats to serializers for Fedora objects
</description>
<entry key="bagit">
<bean class="org.fcrepo.serialization.bagit.BagItSerializer">
<property name="prefixes">
<set value-type="java.lang.String">
<value>fedora</value>
<value>dc</value>
</set>
</property>
</bean>
</entry>
</util:map>


<context:component-scan base-package="org.modeshape.web.jcr.rest, org.fcrepo.api, org.fcrepo.serialization, org.fcrepo.responses, org.fcrepo.exceptionhandlers"/>
<context:component-scan
base-package="org.modeshape.web.jcr.rest, org.fcrepo.api, org.fcrepo.serialization, org.fcrepo.responses, org.fcrepo.exceptionhandlers" />

<!-- Mints PIDs-->
<bean class="org.fcrepo.identifiers.UUIDPidMinter"/>
<bean class="org.fcrepo.session.SessionFactory"/>
<!-- Mints PIDs -->
<bean class="org.fcrepo.identifiers.UUIDPidMinter" />
<bean class="org.fcrepo.session.SessionFactory" />

</beans>

0 comments on commit 353a78d

Please sign in to comment.