Skip to content

Commit

Permalink
Merge pull request #310 from kubamarchwicki/spock-tests
Browse files Browse the repository at this point in the history
Removing Groovy support. Closes #308. Closes #291
  • Loading branch information
arun-gupta committed Jun 24, 2015
2 parents b3dd29b + cfe64e3 commit 6d194bc
Show file tree
Hide file tree
Showing 28 changed files with 590 additions and 263 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ When developing and runing them from IDE, remember to activate the profile befor

To learn more about Arquillian please refer to the [Arquillian Guides](http://arquillian.org/guides/)

### Importing in Eclipse ###

To import the samples in an Eclipse workspace, please install the [Groovy plugins for your Eclipse version](http://groovy.codehaus.org/Eclipse+Plugin) first, then import the sample projects you want using File>Import>Existing Maven Projects.

## How to contribute ##

With your help we can improve this set of samples, learn from each other and grow the community full of passionate people who care about the technology, innovation and code quality. Every contribution matters!
Expand All @@ -148,7 +144,9 @@ There is just a bunch of things you should keep in mind before sending a pull re

Standard tests are jUnit based - for example [this commit](servlet/servlet-filters/src/test/java/org/javaee7/servlet/filters/FilterServletTest.java). Test classes naming must comply with surefire naming standards `**/*Test.java`, `**/*Test*.java` or `**/*TestCase.java`.

However, if you fancy something new, hip and fashionable we also accept Spock specifications - [like here](/servlet/servlet-filters/src/test/groovy/org/javaee7/servlet/filters/FilterServletSpecification.groovy). The spec files are included in the maven test phase if and only if you follow Spock naming convention and give your `Specification` suffix the magic will happen.
However, if you fancy something new, hip and fashionable it is perfectly legal to write Spock specifications as standard JavaEE integration test. For the sake of clarity and consistency, to minimize the upfront complexity, in this project we prefare standard jUnit test. However, some Spock example are provided in the `extra/spock-tests` folder - [like here](extra/spock-tests/src/test/java/org/javaee7/servlet/filters/FilterServletSpecification.groovy). The `spock-tests` project also showcases the Maven configuration. In this particular case the Groovy Specification files are included in the maven test phase if and only if you follow Spock naming convention and give your `Specification` suffix the magic will happen.

The extras folder is not included by default, to limit Groovy dependency. If you want to import the extra samples in an Eclipse workspace (including the Spock tests), please install the [Groovy plugins for your Eclipse version](http://groovy.codehaus.org/Eclipse+Plugin) first, then import the sample projects you want using File>Import>Existing Maven Projects.

### Some coding principles ###

Expand Down
1 change: 1 addition & 0 deletions extra/camel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<artifactId>camel</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Java EE 7 Samples: extras - camel</name>

<properties>
<camel.version>2.13.0</camel.version>
Expand Down
3 changes: 2 additions & 1 deletion extra/nosql/cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<artifactId>cassandra</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Java EE 7 Samples: extras - nosql: cassandra</name>

<dependencies>
<dependency>
<groupId>com.datastax.cassandra</groupId>
Expand Down
3 changes: 2 additions & 1 deletion extra/nosql/couchbase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<artifactId>couchbase</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Java EE 7 Samples: extras - nosql: couchbase</name>

<dependencies>
<dependency>
<groupId>com.couchbase.client</groupId>
Expand Down
3 changes: 2 additions & 1 deletion extra/nosql/hbase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<artifactId>hbase</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Java EE 7 Samples: extras - nosql: hbase</name>

<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
Expand Down
1 change: 1 addition & 0 deletions extra/nosql/hibernate-ogm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>hibernate-ogm</artifactId>
<name>Java EE 7 Samples: extras - nosql: hibernate-ogm</name>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Ignore;
import org.junit.runner.RunWith;

/**
* @author Guillaume Scheibel <[email protected]>
*/
@RunWith(Arquillian.class)
@Ignore("This test is probably a sad panda; never been successful sad panda.")
public class EhcacheTest extends AbstractOgmTest {

@Deployment
Expand Down
1 change: 1 addition & 0 deletions extra/nosql/mongo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<artifactId>mongo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Java EE 7 Samples: extras - nosql: mongo</name>

<dependencies>
<dependency>
Expand Down
3 changes: 2 additions & 1 deletion extra/nosql/neo4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<artifactId>neo4j</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Java EE 7 Samples: extras - nosql: neo4j</name>

<dependencies>
<dependency>
<groupId>org.neo4j</groupId>
Expand Down
3 changes: 2 additions & 1 deletion extra/nosql/oracle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<artifactId>oracle</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Java EE 7 Samples: extras - nosql: oracle</name>

<dependencies>
<dependency>
<groupId>com.oracle.nosql</groupId>
Expand Down
62 changes: 31 additions & 31 deletions extra/nosql/pom.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.javaee7.extra</groupId>
<artifactId>extra-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>org.javaee7.extra.nosql</groupId>
<artifactId>extra-nosql-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Java EE 7 Extra NoSQL Samples</name>

<modules>
<module>mongo</module>
<module>couchbase</module>
<module>redis</module>
<module>cassandra</module>
<module>neo4j</module>
<module>hbase</module>
<module>voldemort</module>
<module>riak</module>
<module>hibernate-ogm</module>
<!--
<module>oracle</module>
-->
</modules>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.javaee7.extra</groupId>
<artifactId>extra-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>org.javaee7.extra.nosql</groupId>
<artifactId>extra-nosql-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Java EE 7 Samples: extras - nosql</name>

<modules>
<module>mongo</module>
<module>couchbase</module>
<module>redis</module>
<module>cassandra</module>
<module>neo4j</module>
<module>hbase</module>
<module>voldemort</module>
<module>riak</module>
<module>hibernate-ogm</module>
<!--
<module>oracle</module>
-->
</modules>
</project>
3 changes: 2 additions & 1 deletion extra/nosql/redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<artifactId>redis</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Java EE 7 Samples: extras - nosql: redis</name>

<dependencies>
<dependency>
<groupId>redis.clients</groupId>
Expand Down
1 change: 1 addition & 0 deletions extra/nosql/riak/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<artifactId>riak</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Java EE 7 Samples: extras - nosql: riak</name>

<repositories>
<repository>
Expand Down
1 change: 1 addition & 0 deletions extra/nosql/voldemort/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<artifactId>voldemort</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Java EE 7 Samples: extras - nosql: voldemort</name>

<repositories>
<repository>
Expand Down
13 changes: 7 additions & 6 deletions extra/pom.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.javaee7</groupId>
<artifactId>javaee7-samples</artifactId>
<artifactId>samples-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>org.javaee7.extra</groupId>
<artifactId>extra-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Java EE 7 Extra Samples</name>
<name>Java EE 7 Samples: extras</name>

<modules>
<module>camel</module>
<module>nosql</module>
<module>quartz</module>
<!--
<module>twitter-search</module>
-->
<module>nosql</module>
<module>webjars</module>
<module>spock-tests</module>
</modules>
<dependencies>
<dependency>
Expand Down
3 changes: 2 additions & 1 deletion extra/quartz/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<artifactId>quartz</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>Java EE 7 Samples: extras - quartz</name>

<dependencies>
<dependency>
<groupId>org.quartz-scheduler</groupId>
Expand Down
132 changes: 132 additions & 0 deletions extra/spock-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.javaee7.extra</groupId>
<artifactId>extra-samples</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>spock-tests</artifactId>

<properties>
<org.jboss.arquillian.spock>1.0.0.Beta2</org.jboss.arquillian.spock>
<spock.version>0.7-groovy-2.0</spock.version>
<groovy.version>2.3.0</groovy.version>
</properties>

<dependencies>
<!-- projects -->
<dependency>
<groupId>org.javaee7</groupId>
<artifactId>jpa-listeners-injection</artifactId>
<version>${project.version}</version>
<classifier>classes</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.javaee7</groupId>
<artifactId>jpa-extended-pc</artifactId>
<version>${project.version}</version>
<classifier>classes</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.javaee7</groupId>
<artifactId>servlet-servlet-filters</artifactId>
<version>${project.version}</version>
<classifier>classes</classifier>
<scope>test</scope>
</dependency>

<!-- test libs -->
<dependency>
<groupId>org.jboss.arquillian.spock</groupId>
<artifactId>arquillian-spock-container</artifactId>
<version>${org.jboss.arquillian.spock}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.min.version}</source>
<target>${java.min.version}</target>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.8.0-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.1.5-03</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.8.0-01</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<classpathDependencyExcludes>
<classpathDependencyExcludes>org.jboss.arquillian.spock:arquillian-spock-container</classpathDependencyExcludes>
</classpathDependencyExcludes>
</configuration>
</execution>
<execution>
<id>spock-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/*Specification.java</include>
</includes>
<classpathDependencyExcludes>
<classpathDependencyExcludes>org.jboss.arquillian.junit:arquillian-junit-container</classpathDependencyExcludes>
</classpathDependencyExcludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit 6d194bc

Please sign in to comment.