Skip to content

Commit 6d194bc

Browse files
committed
Merge pull request javaee-samples#310 from kubamarchwicki/spock-tests
Removing Groovy support. Closes javaee-samples#308. Closes javaee-samples#291
2 parents b3dd29b + cfe64e3 commit 6d194bc

File tree

28 files changed

+590
-263
lines changed

28 files changed

+590
-263
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ When developing and runing them from IDE, remember to activate the profile befor
136136

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

139-
### Importing in Eclipse ###
140-
141-
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.
142-
143139
## How to contribute ##
144140

145141
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!
@@ -148,7 +144,9 @@ There is just a bunch of things you should keep in mind before sending a pull re
148144

149145
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`.
150146

151-
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.
147+
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.
148+
149+
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.
152150

153151
### Some coding principles ###
154152

extra/camel/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<artifactId>camel</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15+
<name>Java EE 7 Samples: extras - camel</name>
1516

1617
<properties>
1718
<camel.version>2.13.0</camel.version>

extra/nosql/cassandra/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<artifactId>cassandra</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15-
15+
<name>Java EE 7 Samples: extras - nosql: cassandra</name>
16+
1617
<dependencies>
1718
<dependency>
1819
<groupId>com.datastax.cassandra</groupId>

extra/nosql/couchbase/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<artifactId>couchbase</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15-
15+
<name>Java EE 7 Samples: extras - nosql: couchbase</name>
16+
1617
<dependencies>
1718
<dependency>
1819
<groupId>com.couchbase.client</groupId>

extra/nosql/hbase/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<artifactId>hbase</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15-
15+
<name>Java EE 7 Samples: extras - nosql: hbase</name>
16+
1617
<dependencies>
1718
<dependency>
1819
<groupId>org.apache.hadoop</groupId>

extra/nosql/hibernate-ogm/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>hibernate-ogm</artifactId>
13+
<name>Java EE 7 Samples: extras - nosql: hibernate-ogm</name>
1314

1415
</project>

extra/nosql/hibernate-ogm/src/test/java/org/javaee7/extra/nosql/hibernateogm/EhcacheTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
import org.jboss.arquillian.container.test.api.Deployment;
55
import org.jboss.arquillian.junit.Arquillian;
66
import org.jboss.shrinkwrap.api.spec.WebArchive;
7+
import org.junit.Ignore;
78
import org.junit.runner.RunWith;
89

910
/**
1011
* @author Guillaume Scheibel <guillaume.scheibel@gmail.com>
1112
*/
1213
@RunWith(Arquillian.class)
14+
@Ignore("This test is probably a sad panda; never been successful sad panda.")
1315
public class EhcacheTest extends AbstractOgmTest {
1416

1517
@Deployment

extra/nosql/mongo/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<artifactId>mongo</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15+
<name>Java EE 7 Samples: extras - nosql: mongo</name>
1516

1617
<dependencies>
1718
<dependency>

extra/nosql/neo4j/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<artifactId>neo4j</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15-
15+
<name>Java EE 7 Samples: extras - nosql: neo4j</name>
16+
1617
<dependencies>
1718
<dependency>
1819
<groupId>org.neo4j</groupId>

extra/nosql/oracle/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<artifactId>oracle</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15-
15+
<name>Java EE 7 Samples: extras - nosql: oracle</name>
16+
1617
<dependencies>
1718
<dependency>
1819
<groupId>com.oracle.nosql</groupId>

extra/nosql/pom.xml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<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">
3-
<modelVersion>4.0.0</modelVersion>
4-
<parent>
5-
<groupId>org.javaee7.extra</groupId>
6-
<artifactId>extra-samples</artifactId>
7-
<version>1.0-SNAPSHOT</version>
8-
<relativePath>../pom.xml</relativePath>
9-
</parent>
10-
11-
<groupId>org.javaee7.extra.nosql</groupId>
12-
<artifactId>extra-nosql-samples</artifactId>
13-
<version>1.0-SNAPSHOT</version>
14-
<packaging>pom</packaging>
15-
<name>Java EE 7 Extra NoSQL Samples</name>
16-
17-
<modules>
18-
<module>mongo</module>
19-
<module>couchbase</module>
20-
<module>redis</module>
21-
<module>cassandra</module>
22-
<module>neo4j</module>
23-
<module>hbase</module>
24-
<module>voldemort</module>
25-
<module>riak</module>
26-
<module>hibernate-ogm</module>
27-
<!--
28-
<module>oracle</module>
29-
-->
30-
</modules>
31-
</project>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.javaee7.extra</groupId>
6+
<artifactId>extra-samples</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<relativePath>../pom.xml</relativePath>
9+
</parent>
10+
11+
<groupId>org.javaee7.extra.nosql</groupId>
12+
<artifactId>extra-nosql-samples</artifactId>
13+
<version>1.0-SNAPSHOT</version>
14+
<packaging>pom</packaging>
15+
<name>Java EE 7 Samples: extras - nosql</name>
16+
17+
<modules>
18+
<module>mongo</module>
19+
<module>couchbase</module>
20+
<module>redis</module>
21+
<module>cassandra</module>
22+
<module>neo4j</module>
23+
<module>hbase</module>
24+
<module>voldemort</module>
25+
<module>riak</module>
26+
<module>hibernate-ogm</module>
27+
<!--
28+
<module>oracle</module>
29+
-->
30+
</modules>
31+
</project>

extra/nosql/redis/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<artifactId>redis</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15-
15+
<name>Java EE 7 Samples: extras - nosql: redis</name>
16+
1617
<dependencies>
1718
<dependency>
1819
<groupId>redis.clients</groupId>

extra/nosql/riak/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<artifactId>riak</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15+
<name>Java EE 7 Samples: extras - nosql: riak</name>
1516

1617
<repositories>
1718
<repository>

extra/nosql/voldemort/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<artifactId>voldemort</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15+
<name>Java EE 7 Samples: extras - nosql: voldemort</name>
1516

1617
<repositories>
1718
<repository>

extra/pom.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<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">
33
<modelVersion>4.0.0</modelVersion>
4+
45
<parent>
56
<groupId>org.javaee7</groupId>
6-
<artifactId>javaee7-samples</artifactId>
7+
<artifactId>samples-parent</artifactId>
78
<version>1.0-SNAPSHOT</version>
89
<relativePath>../pom.xml</relativePath>
910
</parent>
1011

1112
<groupId>org.javaee7.extra</groupId>
1213
<artifactId>extra-samples</artifactId>
13-
<version>1.0-SNAPSHOT</version>
1414
<packaging>pom</packaging>
15-
<name>Java EE 7 Extra Samples</name>
15+
<name>Java EE 7 Samples: extras</name>
1616

1717
<modules>
18+
<module>camel</module>
19+
<module>nosql</module>
1820
<module>quartz</module>
19-
<!--
2021
<module>twitter-search</module>
21-
-->
22-
<module>nosql</module>
22+
<module>webjars</module>
23+
<module>spock-tests</module>
2324
</modules>
2425
<dependencies>
2526
<dependency>

extra/quartz/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<artifactId>quartz</artifactId>
1313
<version>1.0-SNAPSHOT</version>
1414
<packaging>war</packaging>
15-
15+
<name>Java EE 7 Samples: extras - quartz</name>
16+
1617
<dependencies>
1718
<dependency>
1819
<groupId>org.quartz-scheduler</groupId>

extra/spock-tests/pom.xml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>org.javaee7.extra</groupId>
7+
<artifactId>extra-samples</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>spock-tests</artifactId>
13+
14+
<properties>
15+
<org.jboss.arquillian.spock>1.0.0.Beta2</org.jboss.arquillian.spock>
16+
<spock.version>0.7-groovy-2.0</spock.version>
17+
<groovy.version>2.3.0</groovy.version>
18+
</properties>
19+
20+
<dependencies>
21+
<!-- projects -->
22+
<dependency>
23+
<groupId>org.javaee7</groupId>
24+
<artifactId>jpa-listeners-injection</artifactId>
25+
<version>${project.version}</version>
26+
<classifier>classes</classifier>
27+
<scope>test</scope>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.javaee7</groupId>
31+
<artifactId>jpa-extended-pc</artifactId>
32+
<version>${project.version}</version>
33+
<classifier>classes</classifier>
34+
<scope>test</scope>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.javaee7</groupId>
38+
<artifactId>servlet-servlet-filters</artifactId>
39+
<version>${project.version}</version>
40+
<classifier>classes</classifier>
41+
<scope>test</scope>
42+
</dependency>
43+
44+
<!-- test libs -->
45+
<dependency>
46+
<groupId>org.jboss.arquillian.spock</groupId>
47+
<artifactId>arquillian-spock-container</artifactId>
48+
<version>${org.jboss.arquillian.spock}</version>
49+
<scope>test</scope>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.spockframework</groupId>
53+
<artifactId>spock-core</artifactId>
54+
<version>${spock.version}</version>
55+
<scope>test</scope>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.codehaus.groovy</groupId>
59+
<artifactId>groovy-all</artifactId>
60+
<version>${groovy.version}</version>
61+
<scope>test</scope>
62+
</dependency>
63+
</dependencies>
64+
65+
<build>
66+
<plugins>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-compiler-plugin</artifactId>
70+
<version>3.1</version>
71+
<configuration>
72+
<source>${java.min.version}</source>
73+
<target>${java.min.version}</target>
74+
<compilerId>groovy-eclipse-compiler</compilerId>
75+
</configuration>
76+
<dependencies>
77+
<dependency>
78+
<groupId>org.codehaus.groovy</groupId>
79+
<artifactId>groovy-eclipse-compiler</artifactId>
80+
<version>2.8.0-01</version>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.codehaus.groovy</groupId>
84+
<artifactId>groovy-eclipse-batch</artifactId>
85+
<version>2.1.5-03</version>
86+
</dependency>
87+
</dependencies>
88+
</plugin>
89+
<plugin>
90+
<groupId>org.codehaus.groovy</groupId>
91+
<artifactId>groovy-eclipse-compiler</artifactId>
92+
<version>2.8.0-01</version>
93+
<extensions>true</extensions>
94+
</plugin>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-surefire-plugin</artifactId>
98+
<version>2.17</version>
99+
<executions>
100+
<execution>
101+
<id>default-test</id>
102+
<phase>test</phase>
103+
<goals>
104+
<goal>test</goal>
105+
</goals>
106+
<configuration>
107+
<classpathDependencyExcludes>
108+
<classpathDependencyExcludes>org.jboss.arquillian.spock:arquillian-spock-container</classpathDependencyExcludes>
109+
</classpathDependencyExcludes>
110+
</configuration>
111+
</execution>
112+
<execution>
113+
<id>spock-test</id>
114+
<phase>test</phase>
115+
<goals>
116+
<goal>test</goal>
117+
</goals>
118+
<configuration>
119+
<includes>
120+
<include>**/*Specification.java</include>
121+
</includes>
122+
<classpathDependencyExcludes>
123+
<classpathDependencyExcludes>org.jboss.arquillian.junit:arquillian-junit-container</classpathDependencyExcludes>
124+
</classpathDependencyExcludes>
125+
</configuration>
126+
</execution>
127+
</executions>
128+
</plugin>
129+
</plugins>
130+
</build>
131+
132+
</project>

0 commit comments

Comments
 (0)