// Path: fcrepo-api-x-model/src/main/java/org/fcrepo/apix/model/components/Updateable.java
// public interface Updateable {
// 
//     /**
//      * Update internal state, in whatever manner is appropriate.
//      */
//     void update();
// 
//     /**
//      * Update internal state in response to changes to the given resource.
//      * <p>
//      * Given the identity of a resource that mat have changed, an implementation may decide if and how to update
//      * itself.
//      * </p>
//      *
//      * @param inResponseTo URI of some web resource.
//      */
//     void update(URI inResponseTo);
// 
// }


import static org.fcrepo.apix.integration.KarafIT.attempt;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
import java.net.URI;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import org.fcrepo.apix.model.components.Updateable;
import org.apache.camel.CamelContext;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.options.MavenUrlReference;
import org.ops4j.pax.exam.util.Filter;
import org.osgi.framework.BundleContext;

    @Override
    public String testMethodName() {
        return name.getMethodName();
    }

    @BeforeClass
    public static void init() throws Exception {
        KarafIT.createContainers();
    }

    @Override
    public List<Option> additionalKarafConfig() {
        final MavenUrlReference apixRepo =
                maven().groupId("org.fcrepo.apix")
                        .artifactId("fcrepo-api-x-karaf").versionAsInProject()
                        .classifier("features").type("xml");

        return Arrays.asList(
                features(apixRepo, "fcrepo-api-x-listener"),
                deployFile("cfg/org.fcrepo.camel.service.activemq.cfg"));
    }

    // Verify that we can add an Updateable service,
    // and that it updates itself when a new object is deposited into the repo
    @Test
    public void addUpdateableTest() throws Exception {

        final BlockingQueue<URI> objects = new LinkedBlockingQueue<>();

// Path: fcrepo-api-x-model/src/main/java/org/fcrepo/apix/model/components/Updateable.java
// public interface Updateable {
// 
//     /**
//      * Update internal state, in whatever manner is appropriate.
//      */
//     void update();
// 
//     /**
//      * Update internal state in response to changes to the given resource.
//      * <p>
//      * Given the identity of a resource that mat have changed, an implementation may decide if and how to update
//      * itself.
//      * </p>
//      *
//      * @param inResponseTo URI of some web resource.
//      */
//     void update(URI inResponseTo);
// 
// }


// Path: fcrepo-api-x-integration/src/test/java/org/fcrepo/apix/integration/ListenerUpdateIT.java
import static org.fcrepo.apix.integration.KarafIT.attempt;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
import java.net.URI;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import org.fcrepo.apix.model.components.Updateable;
import org.apache.camel.CamelContext;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.options.MavenUrlReference;
import org.ops4j.pax.exam.util.Filter;
import org.osgi.framework.BundleContext;


    @Override
    public String testMethodName() {
        return name.getMethodName();
    }

    @BeforeClass
    public static void init() throws Exception {
        KarafIT.createContainers();
    }

    @Override
    public List<Option> additionalKarafConfig() {
        final MavenUrlReference apixRepo =
                maven().groupId("org.fcrepo.apix")
                        .artifactId("fcrepo-api-x-karaf").versionAsInProject()
                        .classifier("features").type("xml");

        return Arrays.asList(
                features(apixRepo, "fcrepo-api-x-listener"),
                deployFile("cfg/org.fcrepo.camel.service.activemq.cfg"));
    }

    // Verify that we can add an Updateable service,
    // and that it updates itself when a new object is deposited into the repo
    @Test
    public void addUpdateableTest() throws Exception {

        final BlockingQueue<URI> objects = new LinkedBlockingQueue<>();

        cxt.registerService(Updateable.class, new Updateable() {