Skip to content

Commit

Permalink
minor enhancements, fixes and dep upgrades
Browse files Browse the repository at this point in the history
- upgrade to JBoss AS 7.1.1.Final
- update build.gradle to work with Arquillian 1.0.0.Final
- fix jaxws project
- add test for named query in jpa project
- add fest library to autodiscover extension
- don't includle version of dep in UI test war
- fix spacing in pom files
  • Loading branch information
mojavelinux committed May 21, 2012
1 parent 70a4a97 commit fc5572a
Show file tree
Hide file tree
Showing 25 changed files with 708 additions and 601 deletions.
13 changes: 8 additions & 5 deletions cdi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ apply plugin: JavaPlugin
buildDir = 'target/gradle-build'

libraryVersions = [
junit: '4.8.1', arquillian: '1.0.0.CR1', jbossJavaeeSpec: '1.0.0.Final', weld: '1.1.1.Final',
slf4j: '1.5.10', log4j: '1.2.14', jbossas: '6.0.0.Final', glassfish: '3.1', cdi: '1.0-SP4',
hamcrest: '1.2', jbossAS7: '7.0.0.CR1'
junit: '4.8.1', arquillian: '1.0.0.Final', jbossJavaeeSpec: '1.0.0.Final', weld: '1.1.1.Final',
slf4j: '1.5.10', log4j: '1.2.14', jbossAS6: '6.0.0.Final', glassfish: '3.1.2', cdi: '1.0-SP4',
hamcrest: '1.2', jbossAS7: '7.1.1.Final', shrinkwrapDesc: '2.0.0-alpha-2'
]

repositories {
Expand All @@ -32,16 +32,19 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: libraryVersions.junit
testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: libraryVersions.hamcrest
testCompile group: 'org.jboss.arquillian.junit', name: 'arquillian-junit-container', version: libraryVersions.arquillian
testCompile group: 'org.jboss.shrinkwrap.descriptors', name: 'shrinkwrap-descriptors-api-javaee', version: libraryVersions.shrinkwrapDesc

weldEmbeddedTestRuntime group: 'org.jboss.arquillian.container', name: 'arquillian-weld-ee-embedded-1.1', version: libraryVersions.arquillian
testRuntime group: 'org.jboss.shrinkwrap.descriptors', name: 'shrinkwrap-descriptors-impl-javaee', version: libraryVersions.shrinkwrapDesc

weldEmbeddedTestRuntime group: 'org.jboss.arquillian.container', name: 'arquillian-weld-ee-embedded-1.1', version: '1.0.0.CR3'
weldEmbeddedTestRuntime group: 'org.jboss.spec', name: 'jboss-javaee-6.0', version: libraryVersions.jbossJavaeeSpec
weldEmbeddedTestRuntime group: 'org.jboss.weld', name: 'weld-core', version: libraryVersions.weld
weldEmbeddedTestRuntime group: 'org.slf4j', name: 'slf4j-log4j12', version: libraryVersions.slf4j
weldEmbeddedTestRuntime group: 'log4j', name: 'log4j', version: libraryVersions.log4j

jbossAS6RemoteTestRuntime group: 'org.jboss.arquillian.container', name: 'arquillian-jbossas-remote-6', version: libraryVersions.arquillian
jbossAS6RemoteTestRuntime group: 'org.jboss.spec', name: 'jboss-javaee-6.0', version: libraryVersions.jbossJavaeeSpec
jbossAS6RemoteTestRuntime group: 'org.jboss.jbossas', name: 'jboss-as-profileservice-client', version: libraryVersions.jbossas
jbossAS6RemoteTestRuntime group: 'org.jboss.jbossas', name: 'jboss-as-profileservice-client', version: libraryVersions.jbossAS6

jbossAS7ManagedTestRuntime group: 'org.jboss.as', name: 'jboss-as-arquillian-container-managed', version: libraryVersions.jbossAS7
jbossAS7ManagedTestRuntime group: 'org.jboss.spec', name: 'jboss-javaee-6.0', version: libraryVersions.jbossJavaeeSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ public static JavaArchive createDeployment() {

@Test
public void shouldFailDeployment() {
// this method forces the deployment to be attempted
}
}
24 changes: 12 additions & 12 deletions ejb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
<name>Arquillian Showcase: EJB</name>
<description>Examples that demonstrate how to test EJB components using Arquillian</description>

<repositories>
<repository>
<id>apache-snapshots-repository</id>
<name>Apache Snapshots Repository</name>
<url>https://repository.apache.org/content/groups/snapshots</url>
<releases>
<repositories>
<repository>
<id>apache-snapshots-repository</id>
<name>Apache Snapshots Repository</name>
<url>https://repository.apache.org/content/groups/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
<dependency>
Expand Down
7 changes: 6 additions & 1 deletion extensions/autodiscover/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@
<version>1.8.3</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,41 @@ public class ArchiveProcessor implements ApplicationArchiveProcessor
{
private static final String ANNOTATION_CLASS_NAME = "org.mockito.Mock";
private static final String MOCKITO_ARTIFACT = "org.mockito:mockito-all";

private static final String FEST_ASSERTIONS_CLASS_NAME = "org.fest.assertions.Assertions";
private static final String FEST_ARTIFACT = "org.easytesting:fest-assert";

@Override
public void process(Archive<?> applicationArchive, TestClass testClass)
{
if(ReflectionHelper.isClassPresent(FEST_ASSERTIONS_CLASS_NAME))
{
appendFestLibrary(applicationArchive);
}

if(ReflectionHelper.isClassPresent(ANNOTATION_CLASS_NAME))
{
if(ReflectionHelper.getFieldsWithAnnotation(testClass.getJavaClass(), Mock.class).size() > 0)
{
appendLibrary(applicationArchive);
appendMockitoLibrary(applicationArchive);
}
}
}

private void appendFestLibrary(Archive<?> applicationArchive)
{
if(applicationArchive instanceof LibraryContainer)
{
LibraryContainer<?> container = (LibraryContainer<?>) applicationArchive;
container.addAsLibraries(
DependencyResolvers.use(MavenDependencyResolver.class)
.loadMetadataFromPom("pom.xml")
.artifact(FEST_ARTIFACT)
.resolveAsFiles());
}
}

private void appendLibrary(Archive<?> applicationArchive)
private void appendMockitoLibrary(Archive<?> applicationArchive)
{
if(applicationArchive instanceof LibraryContainer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
*/
package org.jboss.arquillian.showcase.extension.autodiscover;

import static org.fest.assertions.Assertions.assertThat;

import javax.enterprise.inject.Produces;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;

/**
*
* @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
* @version $Revision: $
*/
Expand All @@ -56,6 +56,6 @@ public void setupMock() {

@Test
public void shouldBeAbleToMock(Manager manager) throws Exception {
Assert.assertEquals(100, manager.execute(100));
assertThat(manager.execute(100)).isEqualTo(100);
}
}
2 changes: 1 addition & 1 deletion extensions/autodiscover/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<container qualifier="jbossas7" default="true">
<configuration>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.0.Final}</property>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.1.Final}</property>
</configuration>
</container>

Expand Down
2 changes: 1 addition & 1 deletion extensions/declarative/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<container qualifier="jbossas7" default="true">
<configuration>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.0.Final}</property>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.1.Final}</property>
</configuration>
</container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<container qualifier="jbossas7" default="true">
<configuration>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.0.Final}</property>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.1.Final}</property>
</configuration>
</container>

Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<container qualifier="jbossas7" default="true">
<configuration>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.0.Final}</property>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.1.Final}</property>
</configuration>
</container>

Expand Down
6 changes: 3 additions & 3 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

<modules>
<module>declarative</module>
<module>autodiscover</module>
<module>autodiscover</module>
<module>lifecycle</module>
<module>deploymentscenario</module>
<module>deploymentscenario</module>
<module>systemproperties</module>
<module>resteasy</module>
<module>weld-servlet</module>
<module>weld-servlet</module>
</modules>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<container qualifier="jbossas7" default="true">
<configuration>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.0.Final}</property>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.1.Final}</property>
</configuration>
</container>

Expand Down
6 changes: 3 additions & 3 deletions jaxrs/src/test/resources/arquillian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@

<container qualifier="dev" default="true">
<configuration>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.0.Final}</property>
<property name="jbossHome">target/jboss-as-${jboss.version:7.1.1.Final}</property>
</configuration>
</container>

<container qualifier="qa">
<configuration>
<property name="managementPort">19999</property>
<property name="managementPort">10099</property>
<property name="jmxPort">1190</property>
<property name="httpPort">8180</property>
</configuration>
</container>

<container qualifier="stage">
<configuration>
<property name="managementPort">29999</property>
<property name="managementPort">10199</property>
<property name="jmxPort">1290</property>
<property name="httpPort">8280</property>
</configuration>
Expand Down
52 changes: 48 additions & 4 deletions jaxws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

Expand All @@ -47,7 +54,7 @@
</profile>

<profile>
<!-- TODO needs standalone-preview.xml, set using jboss.server.config.file.name property -->
<!-- TODO needs standalone-full.xml, set using jboss.server.config.file.name property -->
<id>arq-jbossas-managed-7</id>
<activation>
<activeByDefault>true</activeByDefault>
Expand All @@ -59,14 +66,51 @@
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-web-6.0</artifactId>
<artifactId>jboss-javaee-6.0</artifactId>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<jboss.version>${version.jbossas_7}</jboss.version>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
<version>${version.jbossas_7}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<!-- Use standalone-preview.xml server config -->
<!-- Use standalone-full.xml server config -->
<id>arq-jbossas-remote-7</id>
<dependencies>
<dependency>
Expand All @@ -75,7 +119,7 @@
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-web-6.0</artifactId>
<artifactId>jboss-javaee-6.0</artifactId>
<type>pom</type>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.descriptor.api.Descriptors;
import org.jboss.shrinkwrap.descriptor.api.spec.servlet.web.WebAppDescriptor;
import org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -20,25 +21,29 @@
* Tests simple stateless web service endpoint invocation.
*
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @author <a href="http://community.jboss.org/people/dan.j.allen">Dan Allen</a>
*/
@RunWith(Arquillian.class)
public class EchoWebServiceEndpointTestCase {

@Deployment
private static final String ECHO_SERVICE_NAME = "EchoService";

@Deployment(testable = false)
public static WebArchive createDeployment() {
WebAppDescriptor webXml = Descriptors.create(WebAppDescriptor.class);

return ShrinkWrap.create(WebArchive.class, "jaxws-endpoint-test.war")
.addPackage(EchoWebServiceEndpointBean.class.getPackage())
.setWebXML(new StringAsset(webXml
.servlet("EchoService", EchoWebServiceEndpointBean.class.getName(), new String[] { "/EchoService" })
.setWebXML(new StringAsset(webXml.createServlet()
.servletName(ECHO_SERVICE_NAME).servletClass(EchoWebServiceEndpointBean.class.getName()).up()
.createServletMapping().servletName(ECHO_SERVICE_NAME).urlPattern("/" + ECHO_SERVICE_NAME).up()
.exportAsString()));
}

@Test
public void testSimpleStatelessWebServiceEndpoint() throws Exception {
final QName serviceName = new QName("com.acme.jaxws", "EchoService");
final URL wsdlURL = new URL("http://localhost:8080/jaxws-endpoint-test/EchoService?wsdl");
public void testSimpleStatelessWebServiceEndpoint(@ArquillianResource URL deploymentUrl) throws Exception {
final QName serviceName = new QName("com.acme.jaxws", ECHO_SERVICE_NAME);
final URL wsdlURL = new URL(deploymentUrl, ECHO_SERVICE_NAME + "?wsdl");
final Service service = Service.create(wsdlURL, serviceName);
final EchoWebServiceEndpoint port = service.getPort(EchoWebServiceEndpoint.class);
final String result = port.echo("hello");
Expand Down
Loading

0 comments on commit fc5572a

Please sign in to comment.