Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2554F18DD9 for ; Fri, 23 Oct 2015 08:47:29 +0000 (UTC) Received: (qmail 2019 invoked by uid 500); 23 Oct 2015 08:47:29 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 1919 invoked by uid 500); 23 Oct 2015 08:47:29 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 1338 invoked by uid 99); 23 Oct 2015 08:47:28 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Oct 2015 08:47:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 50D87E0BB0; Fri, 23 Oct 2015 08:47:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Fri, 23 Oct 2015 08:47:44 -0000 Message-Id: <2ff91df0fc104ea2a9f55a3241af0f30@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [18/50] [abbrv] ignite git commit: IGNITE-1733 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-1655 Commit: 10ef06a14245c73cbfe66b744406a0391c4a9c08 Parents: 10cf673 Author: Anton Vinogradov Authored: Mon Oct 19 18:59:55 2015 +0300 Committer: Anton Vinogradov 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 @@ + + + scala + + + + org.apache.ignite + ignite-scalar + to_be_replaced_by_ignite_version + + + + + + + net.alchim31.maven + scala-maven-plugin + 3.2.0 + + + -Xms512m + -Xmx1024m + + + + + scala-compile-first + process-resources + + add-source + compile + + + + scala-test-compile + process-test-resources + + testCompile + + + + + + + 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. + *

+ * Remote nodes should always be started with special configuration file which + * enables P2P class loading: `'ignite.{sh|bat} examples/config/example-ignite.xml'`. + *

+ * 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. - *

- * Remote nodes should always be started with special configuration file which - * enables P2P class loading: `'ignite.{sh|bat} examples/config/example-ignite.xml'`. - *

- * 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) }