Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add samples

  • Loading branch information...
commit 9823d06d14ff6010b1f6f98e8b86d551b1aed9b4 1 parent 5568d61
@davidB davidB authored
View
45 samples/prj-scala-after-java/pom.xml
@@ -0,0 +1,45 @@
+<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>samples</groupId>
+ <artifactId>prj-scala-after-java</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2008</inceptionYear>
+ <properties>
+ <maven.compiler.source>1.5</maven.compiler.source>
+ <maven.compiler.target>1.5</maven.compiler.target>
+ <encoding>UTF-8</encoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.8.0.RC3</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>2.13.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>add-source</goal>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
View
8 samples/prj-scala-after-java/src/main/java/samples/JavaObj.java
@@ -0,0 +1,8 @@
+package samples;
+
+public class JavaObj {
+
+ public int doStuff() throws Exception {
+ return 33;
+ }
+}
View
11 samples/prj-scala-after-java/src/main/scala/samples/App.scala
@@ -0,0 +1,11 @@
+package samples
+
+/**
+ * Hello world!
+ *
+ */
+object App {
+ def main(args : Array[String]) {
+ println( "Hello World!" )
+ }
+}
View
10 samples/prj-scala-after-java/src/main/scala/samples/UseJavaObj.scala
@@ -0,0 +1,10 @@
+package samples
+
+/**
+ * Hello world!
+ *
+ */
+class UseJavaObj {
+ def use() : Int = use(new JavaObj())
+ def use(o : JavaObj) = o.doStuff() * 2
+}
View
22 samples/prj-scala-after-java/src/test/scala/samples/AppTest.scala
@@ -0,0 +1,22 @@
+package samples
+
+import org.junit._
+import Assert._
+
+@Test
+class AppTest {
+
+ @Test
+ def testOK() = assertTrue(true)
+
+// @Test
+// def testKO() = assertTrue(false)
+
+ @Test
+ def testJavaObj() = assertEquals(new JavaObj().doStuff(), 33)
+
+ @Test
+ def testUseJavaObj() = assertEquals(new UseJavaObj().use(), 33)
+}
+
+
View
53 samples/prj-scala-cycle-java/pom.xml
@@ -0,0 +1,53 @@
+<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>samples</groupId>
+ <artifactId>prj-scala-cycle-java</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2008</inceptionYear>
+ <properties>
+ <maven.compiler.source>1.5</maven.compiler.source>
+ <maven.compiler.target>1.5</maven.compiler.target>
+ <encoding>UTF-8</encoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.8.0.RC3</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>2.13.1</version>
+ <executions>
+ <execution>
+ <id>scala-compile-first</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>add-source</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>scala-test-compile</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
View
8 samples/prj-scala-cycle-java/src/main/java/samples/JavaObj.java
@@ -0,0 +1,8 @@
+package samples;
+
+public class JavaObj {
+
+ public int doStuff() throws Exception {
+ return 33;
+ }
+}
View
12 samples/prj-scala-cycle-java/src/main/java/samples/UseScalaObj.java
@@ -0,0 +1,12 @@
+package samples;
+
+public class UseScalaObj {
+
+ public int use() throws Exception {
+ return use(new ScalaObj());
+ }
+
+ public int use(ScalaObj o) throws Exception {
+ return -1 * o.foo();
+ }
+}
View
11 samples/prj-scala-cycle-java/src/main/scala/samples/App.scala
@@ -0,0 +1,11 @@
+package samples
+
+/**
+ * Hello world!
+ *
+ */
+object App {
+ def main(args : Array[String]) {
+ println( "Hello World!" )
+ }
+}
View
5 samples/prj-scala-cycle-java/src/main/scala/samples/ScalaObj.scala
@@ -0,0 +1,5 @@
+package samples
+
+class ScalaObj {
+ def foo() = 280
+}
View
10 samples/prj-scala-cycle-java/src/main/scala/samples/UseJavaObj.scala
@@ -0,0 +1,10 @@
+package samples
+
+/**
+ * Hello world!
+ *
+ */
+class UseJavaObj {
+ def use() : Int = use(new JavaObj())
+ def use(o : JavaObj) = o.doStuff() * 2
+}
View
28 samples/prj-scala-cycle-java/src/test/scala/samples/AppTest.scala
@@ -0,0 +1,28 @@
+package samples
+
+import org.junit._
+import Assert._
+
+@Test
+class AppTest {
+
+ @Test
+ def testOK() = assertTrue(true)
+
+// @Test
+// def testKO() = assertTrue(false)
+
+ @Test
+ def testJavaObj() = assertEquals(new JavaObj().doStuff(), 33)
+
+ @Test
+ def testUseJavaObj() = assertEquals(new UseJavaObj().use(), 66)
+
+ @Test
+ def testScalaObj() = assertEquals(new ScalaObj().foo(), 280)
+
+ @Test
+ def testUseScalaObj() = assertEquals(new UseScalaObj().use(), -280)
+}
+
+
View
75 samples/prj-scala-only/pom.xml
@@ -0,0 +1,75 @@
+<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>samples</groupId>
+ <artifactId>prj-scala-only</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2008</inceptionYear>
+ <properties>
+ <scala.version>2.8.0.RC3</scala.version>
+ <maven.compiler.source>1.5</maven.compiler.source>
+ <maven.compiler.target>1.5</maven.compiler.target>
+ <encoding>UTF-8</encoding>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>scala-tools.org</id>
+ <name>Scala-Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>scala-tools.org</id>
+ <name>Scala-Tools Maven2 Repository</name>
+ <url>http://scala-tools.org/repo-releases</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.7.7</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.specs</groupId>
+ <artifactId>specs</artifactId>
+ <version>1.2.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>src/main/scala</sourceDirectory>
+ <testSourceDirectory>src/test/scala</testSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>2.13.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <scalaVersion>${scala.version}</scalaVersion>
+ <args>
+ <arg>-target:jvm-1.5</arg>
+ </args>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
View
11 samples/prj-scala-only/src/main/scala/samples/App.scala
@@ -0,0 +1,11 @@
+package samples
+
+/**
+ * Hello world!
+ *
+ */
+object App {
+ def main(args : Array[String]) {
+ println( "Hello World!" )
+ }
+}
View
17 samples/prj-scala-only/src/test/scala/samples/AppTest.scala
@@ -0,0 +1,17 @@
+package samples
+
+import org.junit._
+import Assert._
+
+@Test
+class AppTest {
+
+ @Test
+ def testOK() = assertTrue(true)
+
+// @Test
+// def testKO() = assertTrue(false)
+
+}
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.