
package org.fcrepo.integration.syndication;

import static java.util.regex.Pattern.DOTALL;
import static java.util.regex.Pattern.compile;
import static org.fcrepo.services.PathService.OBJECT_PATH;
import static org.fcrepo.utils.FedoraJcrTypes.FEDORA_OBJECT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import org.junit.Test;
import org.modeshape.jcr.api.JcrTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

@ContextConfiguration({"/spring-test/repo.xml", "/spring-test/test-container.xml"})
public class RSSIT extends AbstractResourceIT {

    final private Logger logger = LoggerFactory.getLogger(RSSIT.class);
    
    @Autowired
    Repository repo;
    
    JcrTools jcrTools = new JcrTools(true);
    
    @Test
    public void testRSS() throws Exception {

        final Session session = repo.login();
        final Node object =
                jcrTools.findOrCreateChild(session.getNode(OBJECT_PATH), "RSSTESTPID");
        object.addMixin(FEDORA_OBJECT);
        session.save();
        session.logout();

        HttpGet getRSSMethod = new HttpGet(serverAddress + "/rss");
        HttpResponse response = client.execute(getRSSMethod);
        assertEquals(200, response.getStatusLine().getStatusCode());
        String content = EntityUtils.toString(response.getEntity());
        logger.debug("Retrieved RSS feed:\n" + content);
        assertTrue("Didn't find the test PID in RSS!", compile("RSSTESTPID",
                DOTALL).matcher(content).find());
    }
}
@@ -136,128 +136,8 @@
 le;%0A
-import static org.fcrepo.services.PathService.OBJECT_PATH;%0Aimport static org.fcrepo.utils.FedoraJcrTypes.FEDORA_OBJECT;%0A
 impo
@@ -173,24 +173,24 @@
 sertEquals;%0A
+
 import stati
@@ -421,24 +421,66 @@
 ntityUtils;%0A
+import org.fcrepo.services.ObjectService;%0A
 import org.j
@@ -958,16 +958,60 @@
 y repo;%0A
+%0A%09@Autowired%0A%09ObjectService objectService;%0A%0A
     %0A   
@@ -1170,102 +1170,46 @@
     
-final Node object =%0A                jcrTools.findOrCreateChild(session.getNode(OBJECT_PATH)
+objectService.createObject(session
 , %22
+/
 RSST
@@ -1222,48 +1222,8 @@
 %22);%0A
-        object.addMixin(FEDORA_OBJECT);%0A
     

fix up fcrepo-rss