Author: rmannibucau
Date: Wed Jun 27 08:47:32 2012
New Revision: 1354371

URL: http://svn.apache.org/viewvc?rev=1354371&view=rev
Log:
OPENEJB-1851 groovy spock sample

Added:
    openejb/trunk/openejb/examples/groovy-spock/
    openejb/trunk/openejb/examples/groovy-spock/pom.xml
    openejb/trunk/openejb/examples/groovy-spock/src/
    openejb/trunk/openejb/examples/groovy-spock/src/main/
    openejb/trunk/openejb/examples/groovy-spock/src/main/java/
    openejb/trunk/openejb/examples/groovy-spock/src/main/java/org/
    openejb/trunk/openejb/examples/groovy-spock/src/main/java/org/superbiz/
    
openejb/trunk/openejb/examples/groovy-spock/src/main/java/org/superbiz/groovy/
    
openejb/trunk/openejb/examples/groovy-spock/src/main/java/org/superbiz/groovy/Hello.groovy
    openejb/trunk/openejb/examples/groovy-spock/src/main/resources/
    openejb/trunk/openejb/examples/groovy-spock/src/main/resources/META-INF/
    
openejb/trunk/openejb/examples/groovy-spock/src/main/resources/META-INF/beans.xml
    openejb/trunk/openejb/examples/groovy-spock/src/test/
    openejb/trunk/openejb/examples/groovy-spock/src/test/java/
    openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/
    openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/
    
openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/
    
openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy
Modified:
    openejb/trunk/openejb/examples/pom.xml

Added: openejb/trunk/openejb/examples/groovy-spock/pom.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/groovy-spock/pom.xml?rev=1354371&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/groovy-spock/pom.xml (added)
+++ openejb/trunk/openejb/examples/groovy-spock/pom.xml Wed Jun 27 08:47:32 2012
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<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/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.superbiz</groupId>
+  <artifactId>groovy-spock</artifactId>
+  <packaging>jar</packaging>
+  <version>1.1-SNAPSHOT</version>
+  <name>OpenEJB :: Examples :: Groovy Spock</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.4</version>
+        <configuration>
+          <compilerId>groovy-eclipse-compiler</compilerId>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-eclipse-compiler</artifactId>
+            <version>2.6.0-01</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.12</version>
+        <configuration>
+          <includes> <!-- we could have used *Test.java as by default but it 
is more consistent -->
+            <include>**/*Specification.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <repositories>
+    <repository>
+      <id>apache-m2-snapshot</id>
+      <name>Apache Snapshot Repository</name>
+      <url>http://repository.apache.org/snapshots</url>
+    </repository>
+    <repository>
+      <id>jboss</id>
+      <name>JBoss</name>
+      
<url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
+    </repository>
+  </repositories>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>javaee-api</artifactId>
+      <version>6.0-4</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.groovy</groupId>
+      <artifactId>groovy-all</artifactId>
+      <version>1.8.0</version> <!-- spock doesn't work with 2.0.0-rc-4 -->
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.10</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>arquillian-openejb-embedded-4</artifactId>
+      <version>4.1.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>ziplock</artifactId>
+      <version>1.1.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.arquillian.spock</groupId>
+      <artifactId>arquillian-spock-container</artifactId>
+      <version>1.0.0.Alpha1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.spockframework</groupId>
+      <artifactId>spock-core</artifactId>
+      <version>0.5-groovy-1.8</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <!-- This section allows you to configure where to publish libraries for
+    sharing. It is not required and may be deleted. For more information see:
+    http://maven.apache.org/plugins/maven-deploy-plugin/ -->
+  <distributionManagement>
+    <repository>
+      <id>localhost</id>
+      <url>file://${basedir}/target/repo/</url>
+    </repository>
+    <snapshotRepository>
+      <id>localhost</id>
+      <url>file://${basedir}/target/snapshot-repo/</url>
+    </snapshotRepository>
+  </distributionManagement>
+
+</project>
+

Added: 
openejb/trunk/openejb/examples/groovy-spock/src/main/java/org/superbiz/groovy/Hello.groovy
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/groovy-spock/src/main/java/org/superbiz/groovy/Hello.groovy?rev=1354371&view=auto
==============================================================================
--- 
openejb/trunk/openejb/examples/groovy-spock/src/main/java/org/superbiz/groovy/Hello.groovy
 (added)
+++ 
openejb/trunk/openejb/examples/groovy-spock/src/main/java/org/superbiz/groovy/Hello.groovy
 Wed Jun 27 08:47:32 2012
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.groovy
+
+class Hello {
+    def hi() {
+        "hi"
+    }
+}

Added: 
openejb/trunk/openejb/examples/groovy-spock/src/main/resources/META-INF/beans.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/groovy-spock/src/main/resources/META-INF/beans.xml?rev=1354371&view=auto
==============================================================================
--- 
openejb/trunk/openejb/examples/groovy-spock/src/main/resources/META-INF/beans.xml
 (added)
+++ 
openejb/trunk/openejb/examples/groovy-spock/src/main/resources/META-INF/beans.xml
 Wed Jun 27 08:47:32 2012
@@ -0,0 +1,19 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans>
+</beans>
\ No newline at end of file

Added: 
openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy?rev=1354371&view=auto
==============================================================================
--- 
openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy
 (added)
+++ 
openejb/trunk/openejb/examples/groovy-spock/src/test/java/org/superbiz/groovy/HelloSpecification.groovy
 Wed Jun 27 08:47:32 2012
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.groovy
+
+import org.apache.ziplock.JarLocation
+import org.jboss.arquillian.container.test.api.Deployment
+import org.jboss.shrinkwrap.api.ArchivePaths
+import org.jboss.shrinkwrap.api.ShrinkWrap
+import org.jboss.shrinkwrap.api.asset.EmptyAsset
+import org.jboss.shrinkwrap.api.spec.WebArchive
+import spock.lang.Specification
+
+import javax.inject.Inject
+
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+
+class HelloSpecification extends Specification {
+    @Inject
+    private Hello hello
+
+    @Deployment
+    def static WebArchive "create archive"() {
+        ShrinkWrap.create(WebArchive.class)
+            .addAsLibraries(JarLocation.jarLocation(GroovyObject.class))
+            .addAsWebInfResource(EmptyAsset.INSTANCE, 
ArchivePaths.create("beans.xml"))
+            .addClasses(Hello.class)
+    }
+
+    def "Hello.hi() method should return 'hi'"() {
+        when:
+            assertNotNull hello
+
+        then:
+            assertEquals "hi", hello.hi()
+    }
+}

Modified: openejb/trunk/openejb/examples/pom.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/pom.xml?rev=1354371&r1=1354370&r2=1354371&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/pom.xml (original)
+++ openejb/trunk/openejb/examples/pom.xml Wed Jun 27 08:47:32 2012
@@ -61,6 +61,7 @@
     <module>ear-testing</module>
     <module>groovy-cdi</module>
     <module>groovy-jpa</module>
+    <module>groovy-spock</module>
     <module>helloworld-weblogic</module>
     <module>injection-of-connectionfactory</module>
     <module>injection-of-datasource</module>


Reply via email to