ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [05/10] ignite git commit: IGNITE-1733
Date Tue, 20 Oct 2015 14:47:41 GMT
IGNITE-1733


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/10ef06a1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/10ef06a1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/10ef06a1

Branch: refs/heads/ignite-1607
Commit: 10ef06a14245c73cbfe66b744406a0391c4a9c08
Parents: 10cf673
Author: Anton Vinogradov <av@apache.org>
Authored: Mon Oct 19 18:59:55 2015 +0300
Committer: Anton Vinogradov <av@apache.org>
Committed: Mon Oct 19 18:59:55 2015 +0300

----------------------------------------------------------------------
 examples-lgpl/pom-standalone.xml                | 45 +++++++++++++
 .../scalar/examples/ScalarScheduleExample.scala | 66 ++++++++++++++++++++
 .../ScalarLgplExamplesMultiNodeSelfTest.scala   | 33 ++++++++++
 .../examples/ScalarLgplExamplesSelfTest.scala   | 36 +++++++++++
 .../ScalarLgplExamplesSelfTestSuite.scala       | 37 +++++++++++
 .../scalar/examples/ScalarScheduleExample.scala | 66 --------------------
 .../tests/examples/ScalarExamplesSelfTest.scala |  5 --
 7 files changed, 217 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/10ef06a1/examples-lgpl/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples-lgpl/pom-standalone.xml b/examples-lgpl/pom-standalone.xml
index d2a00d1..2e3bf8f 100644
--- a/examples-lgpl/pom-standalone.xml
+++ b/examples-lgpl/pom-standalone.xml
@@ -137,5 +137,50 @@
                 </plugins>
             </build>
         </profile>
+
+        <profile>
+            <id>scala</id>
+
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.ignite</groupId>
+                    <artifactId>ignite-scalar</artifactId>
+                    <version>to_be_replaced_by_ignite_version</version>
+                </dependency>
+            </dependencies>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>net.alchim31.maven</groupId>
+                        <artifactId>scala-maven-plugin</artifactId>
+                        <version>3.2.0</version>
+                        <configuration>
+                            <jvmArgs>
+                                <jvmArg>-Xms512m</jvmArg>
+                                <jvmArg>-Xmx1024m</jvmArg>
+                            </jvmArgs>
+                        </configuration>
+                        <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>
+        </profile>
     </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/10ef06a1/examples-lgpl/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
b/examples-lgpl/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
new file mode 100644
index 0000000..8734a23
--- /dev/null
+++ b/examples-lgpl/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
@@ -0,0 +1,66 @@
+/*
+ * 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.apache.ignite.scalar.examples
+
+import org.apache.ignite.scalar.scalar
+import org.apache.ignite.scalar.scalar._
+
+/**
+ * Demonstrates a cron-based `Runnable` execution scheduling.
+ * Test runnable object broadcasts a phrase to all cluster nodes every minute
+ * three times with initial scheduling delay equal to five seconds.
+ * <p/>
+ * Remote nodes should always be started with special configuration file which
+ * enables P2P class loading: `'ignite.{sh|bat} examples/config/example-ignite.xml'`.
+ * <p/>
+ * Alternatively you can run `ExampleNodeStartup` in another JVM which will
+ * start node with `examples/config/example-ignite.xml` configuration.
+ */
+object ScalarScheduleExample extends App {
+    scalar("examples/config/example-ignite.xml") {
+        println()
+        println("Compute schedule example started.")
+
+        val g = ignite$
+
+        var invocations = 0
+
+        // Schedule callable that returns incremented value each time.
+        val fut = ignite$.scheduleLocalCall(
+            () => {
+                invocations += 1
+
+                g.bcastRun(() => {
+                    println()
+                    println("Howdy! :)")
+                }, null)
+
+                invocations
+            },
+            "{5, 3} * * * * *" // Cron expression.
+        )
+
+        while (!fut.isDone)
+            println(">>> Invocation #: " + fut.get)
+
+        // Prints.
+        println()
+        println(">>> Schedule future is done and has been unscheduled.")
+        println(">>> Check all nodes for hello message output.")
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/10ef06a1/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesMultiNodeSelfTest.scala
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesMultiNodeSelfTest.scala
b/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesMultiNodeSelfTest.scala
new file mode 100644
index 0000000..fca44e3
--- /dev/null
+++ b/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesMultiNodeSelfTest.scala
@@ -0,0 +1,33 @@
+/*
+ *  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.apache.ignite.scalar.tests.examples
+
+/**
+ * Scalar examples multi-node self test.
+ */
+class ScalarLgplExamplesMultiNodeSelfTest extends ScalarExamplesSelfTest {
+    /** */
+    protected override def beforeTest() {
+        startRemoteNodes()
+    }
+
+    /** */
+    protected override def getTestTimeout: Long = {
+        10 * 60 * 1000
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/10ef06a1/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesSelfTest.scala
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesSelfTest.scala
b/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesSelfTest.scala
new file mode 100644
index 0000000..25a5fe4
--- /dev/null
+++ b/examples-lgpl/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarLgplExamplesSelfTest.scala
@@ -0,0 +1,36 @@
+/*
+ *  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.apache.ignite.scalar.tests.examples
+
+import org.apache.ignite.scalar.examples._
+import org.apache.ignite.scalar.scalar
+import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest
+import org.scalatest.junit.JUnitSuiteLike
+
+/**
+ * Scalar examples self test.
+ */
+class ScalarLgplExamplesSelfTest extends GridAbstractExamplesTest with JUnitSuiteLike {
+    /** */
+    private def EMPTY_ARGS = Array.empty[String]
+
+    /** */
+    def testScalarScheduleCallableExample() {
+        ScalarScheduleExample.main(EMPTY_ARGS)
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/10ef06a1/examples-lgpl/src/test/scala/org/apache/ignite/scalar/testsuites/ScalarLgplExamplesSelfTestSuite.scala
----------------------------------------------------------------------
diff --git a/examples-lgpl/src/test/scala/org/apache/ignite/scalar/testsuites/ScalarLgplExamplesSelfTestSuite.scala
b/examples-lgpl/src/test/scala/org/apache/ignite/scalar/testsuites/ScalarLgplExamplesSelfTestSuite.scala
new file mode 100644
index 0000000..4f3195e
--- /dev/null
+++ b/examples-lgpl/src/test/scala/org/apache/ignite/scalar/testsuites/ScalarLgplExamplesSelfTestSuite.scala
@@ -0,0 +1,37 @@
+/*
+ *  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.apache.ignite.scalar.testsuites
+
+import org.apache.ignite.IgniteSystemProperties._
+import org.apache.ignite.scalar.tests.examples.{ScalarExamplesMultiNodeSelfTest, ScalarExamplesSelfTest}
+import org.apache.ignite.testframework.GridTestUtils
+import org.junit.runner.RunWith
+import org.scalatest._
+import org.scalatest.junit.JUnitRunner
+
+/**
+ *
+ */
+@RunWith(classOf[JUnitRunner])
+class ScalarLgplExamplesSelfTestSuite extends Suites(
+    new ScalarLgplExamplesSelfTest,
+    new ScalarLgplExamplesMultiNodeSelfTest
+) {
+    System.setProperty(IGNITE_OVERRIDE_MCAST_GRP,
+        GridTestUtils.getNextMulticastGroup(classOf[ScalarLgplExamplesSelfTest]))
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/10ef06a1/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
b/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
deleted file mode 100644
index 8734a23..0000000
--- a/examples/src/main/scala/org/apache/ignite/scalar/examples/ScalarScheduleExample.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.apache.ignite.scalar.examples
-
-import org.apache.ignite.scalar.scalar
-import org.apache.ignite.scalar.scalar._
-
-/**
- * Demonstrates a cron-based `Runnable` execution scheduling.
- * Test runnable object broadcasts a phrase to all cluster nodes every minute
- * three times with initial scheduling delay equal to five seconds.
- * <p/>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: `'ignite.{sh|bat} examples/config/example-ignite.xml'`.
- * <p/>
- * Alternatively you can run `ExampleNodeStartup` in another JVM which will
- * start node with `examples/config/example-ignite.xml` configuration.
- */
-object ScalarScheduleExample extends App {
-    scalar("examples/config/example-ignite.xml") {
-        println()
-        println("Compute schedule example started.")
-
-        val g = ignite$
-
-        var invocations = 0
-
-        // Schedule callable that returns incremented value each time.
-        val fut = ignite$.scheduleLocalCall(
-            () => {
-                invocations += 1
-
-                g.bcastRun(() => {
-                    println()
-                    println("Howdy! :)")
-                }, null)
-
-                invocations
-            },
-            "{5, 3} * * * * *" // Cron expression.
-        )
-
-        while (!fut.isDone)
-            println(">>> Invocation #: " + fut.get)
-
-        // Prints.
-        println()
-        println(">>> Schedule future is done and has been unscheduled.")
-        println(">>> Check all nodes for hello message output.")
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/10ef06a1/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
----------------------------------------------------------------------
diff --git a/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
b/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
index 52d5ce1..ef56434 100644
--- a/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
+++ b/examples/src/test/scala/org/apache/ignite/scalar/tests/examples/ScalarExamplesSelfTest.scala
@@ -77,11 +77,6 @@ class ScalarExamplesSelfTest extends GridAbstractExamplesTest with JUnitSuiteLik
     }
 
     /** */
-    def testScalarScheduleCallableExample() {
-        ScalarScheduleExample.main(EMPTY_ARGS)
-    }
-
-    /** */
     def testScalarTaskExample() {
         ScalarTaskExample.main(EMPTY_ARGS)
     }


Mime
View raw message