Skip to content

Commit

Permalink
wrapping up progress on modularization and Pax-Exam
Browse files Browse the repository at this point in the history
  • Loading branch information
barmintor committed Nov 19, 2013
1 parent 995e305 commit 1bf1da7
Show file tree
Hide file tree
Showing 17 changed files with 271 additions and 49 deletions.
104 changes: 92 additions & 12 deletions fcrepo-http-api/pom.xml
Expand Up @@ -39,14 +39,32 @@
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- test gear -->
Expand Down Expand Up @@ -115,6 +133,11 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down Expand Up @@ -176,12 +199,24 @@
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<scope>test</scope>
<version>3.3.0</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
Expand All @@ -200,30 +235,70 @@
<artifactId>pax-exam-link-mvn</artifactId>
<scope>test</scope>
<version>3.3.0</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>1.6.0</version>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
<version>1.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-cache</artifactId>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<scope>test</scope>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<groupId>org.ops4j.pax.cdi</groupId>
<artifactId>pax-cdi-extender</artifactId>
<version>0.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<groupId>org.ops4j.pax.cdi</groupId>
<artifactId>pax-cdi-test-support</artifactId>
<version>0.5.0</version>
<scope>test</scope>
<version>4.2.1</version>
</dependency>
</dependencies>

Expand All @@ -234,6 +309,11 @@
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Import-Package>
org.osgi.framework,
org.apache.http,
*;resolution:=optional
</Import-Package>
<Export-Package>
org.fcrepo.http.api.*
</Export-Package>
Expand Down
Expand Up @@ -8,14 +8,12 @@ public class Activator implements BundleActivator {

@Override
public void start(BundleContext context) throws Exception {
// TODO Auto-generated method stub

System.out.println("Activated " + getClass().getName());
}

@Override
public void stop(BundleContext context) throws Exception {
// TODO Auto-generated method stub

System.out.println("Deactivated " + getClass().getName());
}

}
}
Expand Up @@ -28,6 +28,8 @@
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;

import java.util.Locale;

import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -79,7 +81,7 @@ public void setUp() throws Exception {
@Test
public void testFieldSearch() throws RepositoryException {
when(mockRequest.selectVariant(anyListOf(Variant.class))).thenReturn(
new Variant(MediaType.valueOf("application/n-triples"), (String)null,
new Variant(MediaType.valueOf("application/n-triples"), (Locale)null,
null));
when(
mockNodeService
Expand Down
Expand Up @@ -41,7 +41,7 @@ public class FedoraTransactionsTest {

private FedoraTransactions testObj;

private Session mockSession;
private TxAwareSession mockSession;

@Mock
private Session regularSession;
Expand Down
Expand Up @@ -22,7 +22,10 @@
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.jena.riot.WebContent.contentTypeToLang;
import static org.junit.Assert.assertEquals;
import static org.ops4j.pax.exam.CoreOptions.*;
import static org.ops4j.pax.cdi.test.support.TestConfiguration.regressionDefaults;
import static org.ops4j.pax.cdi.test.support.TestConfiguration.workspaceBundle;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.slf4j.LoggerFactory.getLogger;

import java.io.IOException;
Expand All @@ -49,22 +52,27 @@
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
import org.slf4j.Logger;

import com.hp.hpl.jena.rdf.model.Model;

@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public abstract class AbstractResourceIT {

protected Logger logger;

@Configuration
public Option[] configurationBase() {
return new Option[] {
junitBundles(),
org.ops4j.pax.exam.CoreOptions.mavenBundle("org.apache.httpcomponents", "httpclient"),
org.ops4j.pax.exam.CoreOptions.mavenBundle("org.apache.httpcomponents", "httpcore"),
};
// regressionDefaults() requires using the PAX mvn plugin
// defaults to PAX CDI version?! workspaceBundle("org.fcrepo", "fcrepo-kernel"),
// defaults to PAX CDI version?! workspaceBundle("org.fcrepo", "fcrepo-http-commons"),
return options(
mavenBundle("org.apache.httpcomponents", "httpclient").version("3.1"),
mavenBundle("org.apache.httpcomponents", "httpcore").version("3.1")
);
}

@Before
Expand Down
11 changes: 11 additions & 0 deletions fcrepo-http-commons/pom.xml
Expand Up @@ -232,6 +232,11 @@
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-rio-turtle</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
Expand All @@ -244,6 +249,12 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-Activator>org.frepo.http.commons.Activator</Bundle-Activator>
<Export-Package>org.fcrepo.http.commons.*</Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
@@ -0,0 +1,18 @@
package org.fcrepo.http.commons;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

@Override
public void start(BundleContext context) throws Exception {
System.out.println("Activated " + getClass().getName());
}

@Override
public void stop(BundleContext context) throws Exception {
System.out.println("Deactivated " + getClass().getName());
}

}
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.fcrepo.http;
package org.fcrepo.http.commons;

import javax.jcr.Session;

Expand Down
Expand Up @@ -18,7 +18,7 @@ public WeldJUnit4ClassRunner(Class<?> klass) throws InitializationError {
this.klass = klass;
this.weld = new Weld();
IntegrationTestConfig config = weld.select(IntegrationTestConfig.class).get();

if (klass.isAnnotationPresent(IntegrationTestPort.class)) {
config.setPort(klass.getAnnotation(IntegrationTestPort.class).value());
}
Expand All @@ -27,8 +27,7 @@ public WeldJUnit4ClassRunner(Class<?> klass) throws InitializationError {
}
ContainerWrapper cw = weld.select(ContainerWrapper.class).get();
}



@Override
protected Object createTest() throws Exception {
return this.weld.select(this.klass).get();
Expand Down

0 comments on commit 1bf1da7

Please sign in to comment.