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 3AB9518E37 for ; Tue, 7 Jul 2015 06:51:03 +0000 (UTC) Received: (qmail 56063 invoked by uid 500); 7 Jul 2015 06:51:03 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 56030 invoked by uid 500); 7 Jul 2015 06:51:03 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 56021 invoked by uid 99); 7 Jul 2015 06:51:03 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2015 06:51:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id ABCDBC068C for ; Tue, 7 Jul 2015 06:51:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.791 X-Spam-Level: * X-Spam-Status: No, score=1.791 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id fyOwVA436ODN for ; Tue, 7 Jul 2015 06:50:47 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 69F0427602 for ; Tue, 7 Jul 2015 06:50:34 +0000 (UTC) Received: (qmail 50044 invoked by uid 99); 7 Jul 2015 06:50:34 -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; Tue, 07 Jul 2015 06:50:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 25E57E3A9F; Tue, 7 Jul 2015 06:50:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agoncharuk@apache.org To: commits@ignite.incubator.apache.org Date: Tue, 07 Jul 2015 06:50:51 -0000 Message-Id: In-Reply-To: <2c54863ca65f44b3adb38a22306f2b87@git.apache.org> References: <2c54863ca65f44b3adb38a22306f2b87@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [19/50] incubator-ignite git commit: ignite-1060 ignite-1060 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d685e82a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d685e82a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d685e82a Branch: refs/heads/ignite-950 Commit: d685e82a5f4858a79e40a39eeb45c42ba9713f70 Parents: 3a0ccb5 Author: avinogradov Authored: Tue Jun 30 16:40:22 2015 +0300 Committer: avinogradov Committed: Tue Jun 30 16:40:22 2015 +0300 ---------------------------------------------------------------------- assembly/dependencies-fabric.xml | 1 + modules/core/src/test/resources/helloworld.gar | Bin 6092 -> 0 bytes modules/core/src/test/resources/helloworld1.gar | Bin 6092 -> 0 bytes modules/core/src/test/resources/readme.txt | 6 -- modules/extdata/uri/META-INF/ignite.xml | 38 +++++++++ .../extdata/uri/modules/uri-dependency/pom.xml | 42 ++++++++++ .../deployment/uri/tasks/GarHelloWorldBean.java | 61 ++++++++++++++ .../src/main/resources/gar-example.properties | 18 ++++ modules/extdata/uri/pom.xml | 60 +++++++++++++- .../deployment/uri/tasks/GarHelloWorldTask.java | 82 +++++++++++++++++++ .../deployment/uri/tasks/gar-spring-bean.xml | 29 +++++++ modules/urideploy/pom.xml | 14 ++++ .../GridTaskUriDeploymentDeadlockSelfTest.java | 13 +-- 13 files changed, 344 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/assembly/dependencies-fabric.xml ---------------------------------------------------------------------- diff --git a/assembly/dependencies-fabric.xml b/assembly/dependencies-fabric.xml index c6668f6..b4808e7 100644 --- a/assembly/dependencies-fabric.xml +++ b/assembly/dependencies-fabric.xml @@ -110,6 +110,7 @@ org.apache.ignite:ignite-tools org.apache.ignite:ignite-extdata-p2p org.apache.ignite:ignite-extdata-uri + org.apache.ignite:ignite-extdata-uri-dep org.apache.ignite:ignite-examples org.apache.ignite:ignite-indexing org.apache.ignite:ignite-visor-console http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/core/src/test/resources/helloworld.gar ---------------------------------------------------------------------- diff --git a/modules/core/src/test/resources/helloworld.gar b/modules/core/src/test/resources/helloworld.gar deleted file mode 100644 index 3b4555a..0000000 Binary files a/modules/core/src/test/resources/helloworld.gar and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/core/src/test/resources/helloworld1.gar ---------------------------------------------------------------------- diff --git a/modules/core/src/test/resources/helloworld1.gar b/modules/core/src/test/resources/helloworld1.gar deleted file mode 100644 index 3b4555a..0000000 Binary files a/modules/core/src/test/resources/helloworld1.gar and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/core/src/test/resources/readme.txt ---------------------------------------------------------------------- diff --git a/modules/core/src/test/resources/readme.txt b/modules/core/src/test/resources/readme.txt deleted file mode 100644 index 195d655..0000000 --- a/modules/core/src/test/resources/readme.txt +++ /dev/null @@ -1,6 +0,0 @@ -This folder is created for test GridTaskUriDeploymentDeadlockSelfTest. It contains helloworld.gar and helloworld1.gar -which are the same and were copied from Apache Ignite GAR example. - -We put two files here to have a collision and make deployment SPI to unregister class loaders. - -This is intended to test GG-2852 issue. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/extdata/uri/META-INF/ignite.xml ---------------------------------------------------------------------- diff --git a/modules/extdata/uri/META-INF/ignite.xml b/modules/extdata/uri/META-INF/ignite.xml new file mode 100644 index 0000000..5ac671a --- /dev/null +++ b/modules/extdata/uri/META-INF/ignite.xml @@ -0,0 +1,38 @@ + + + + + + + Ignite Spring configuration file in gar-file. + + + + org.apache.ignite.spi.deployment.uri.tasks.GarHelloWorldTask + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/extdata/uri/modules/uri-dependency/pom.xml ---------------------------------------------------------------------- diff --git a/modules/extdata/uri/modules/uri-dependency/pom.xml b/modules/extdata/uri/modules/uri-dependency/pom.xml new file mode 100644 index 0000000..5f45bbe --- /dev/null +++ b/modules/extdata/uri/modules/uri-dependency/pom.xml @@ -0,0 +1,42 @@ + + + + + + org.apache.ignite + ignite-parent + 1 + ../../../../../parent + + + ignite-extdata-uri-dep + jar + + 1.1.6-SNAPSHOT + 4.0.0 + + + + org.apache.ignite + ignite-core + ${project.version} + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/extdata/uri/modules/uri-dependency/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java ---------------------------------------------------------------------- diff --git a/modules/extdata/uri/modules/uri-dependency/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java b/modules/extdata/uri/modules/uri-dependency/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java new file mode 100644 index 0000000..bf329be --- /dev/null +++ b/modules/extdata/uri/modules/uri-dependency/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldBean.java @@ -0,0 +1,61 @@ +package org.apache.ignite.spi.deployment.uri.tasks; +/* + * 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. + */ + +import org.apache.ignite.internal.util.typedef.internal.*; +import org.jetbrains.annotations.*; + +import java.io.*; +import java.util.*; + +/** + * Imported class which should be placed in JAR file in GAR/lib folder. + * Loads message resource file via class loader. + */ +public class GarHelloWorldBean { + /** */ + public static final String RESOURCE = "gar-example.properties"; + + /** + * Gets keyed message. + * + * @param key Message key. + * @return Keyed message. + */ + @Nullable + public String getMessage(String key) { + InputStream in = null; + + try { + in = getClass().getClassLoader().getResourceAsStream(RESOURCE); + + Properties props = new Properties(); + + props.load(in); + + return props.getProperty(key); + } + catch (IOException e) { + e.printStackTrace(); + } + finally { + U.close(in, null); + } + + return null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/extdata/uri/modules/uri-dependency/src/main/resources/gar-example.properties ---------------------------------------------------------------------- diff --git a/modules/extdata/uri/modules/uri-dependency/src/main/resources/gar-example.properties b/modules/extdata/uri/modules/uri-dependency/src/main/resources/gar-example.properties new file mode 100644 index 0000000..e892a3c --- /dev/null +++ b/modules/extdata/uri/modules/uri-dependency/src/main/resources/gar-example.properties @@ -0,0 +1,18 @@ +# +# 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. +# + +HELLOWORLD.MSG=Hello World! \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/extdata/uri/pom.xml ---------------------------------------------------------------------- diff --git a/modules/extdata/uri/pom.xml b/modules/extdata/uri/pom.xml index 3d43040..a88bced 100644 --- a/modules/extdata/uri/pom.xml +++ b/modules/extdata/uri/pom.xml @@ -20,8 +20,10 @@ - + 4.0.0 + pom org.apache.ignite @@ -51,8 +53,18 @@ spring-beans ${spring.version} + + + org.apache.ignite + ignite-extdata-uri-dep + ${project.version} + + + modules/uri-dependency + + @@ -86,6 +98,21 @@ org.apache.maven.plugins + maven-compiler-plugin + + + compile + compile + + + compile + + + + + + + org.apache.maven.plugins maven-antrun-plugin 1.7 @@ -110,11 +137,36 @@ compile - + + + + + + + + + + + + + + + - + - + + + http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java ---------------------------------------------------------------------- diff --git a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java new file mode 100644 index 0000000..13b2641 --- /dev/null +++ b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GarHelloWorldTask.java @@ -0,0 +1,82 @@ +/* + * 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.spi.deployment.uri.tasks; + +import org.apache.ignite.*; +import org.apache.ignite.compute.*; +import org.jetbrains.annotations.*; +import org.springframework.beans.factory.support.*; +import org.springframework.beans.factory.xml.*; +import org.springframework.core.io.*; + +import java.io.*; +import java.util.*; + +/** + * This class defines grid task for this example. Grid task is responsible for splitting the task into jobs. This + * particular implementation splits given string into individual words and creates grid jobs for each word. Task class + * in that example should be placed in GAR file. + */ +@ComputeTaskName("GarHelloWorldTask") +public class GarHelloWorldTask extends ComputeTaskSplitAdapter { + /** {@inheritDoc} */ + @Override public Collection split(int gridSize, String arg) throws IgniteException { + // Create Spring context. + AbstractBeanFactory fac = new XmlBeanFactory( + new ClassPathResource("org/apache/ignite/spi/deployment/uri/tasks/gar-spring-bean.xml", getClass().getClassLoader())); + + fac.setBeanClassLoader(getClass().getClassLoader()); + + // Load imported bean from GAR/lib folder. + GarHelloWorldBean bean = (GarHelloWorldBean)fac.getBean("example.bean"); + + String msg = bean.getMessage(arg); + + assert msg != null; + + // Split the passed in phrase into multiple words separated by spaces. + List words = Arrays.asList(msg.split(" ")); + + Collection jobs = new ArrayList<>(words.size()); + + // Use imperative OOP APIs. + for (String word : words) { + // Every job gets its own word as an argument. + jobs.add(new ComputeJobAdapter(word) { + /* + * Simply prints the job's argument. + */ + @Nullable + @Override public Serializable execute() { + System.out.println(">>>"); + System.out.println(">>> Printing '" + argument(0) + "' on this node from grid job."); + System.out.println(">>>"); + + // This job does not return any result. + return null; + } + }); + } + + return jobs; + } + + @Nullable @Override public String reduce(List results) throws IgniteException { + return String.valueOf(results.size()); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/gar-spring-bean.xml ---------------------------------------------------------------------- diff --git a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/gar-spring-bean.xml b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/gar-spring-bean.xml new file mode 100644 index 0000000..c3cf3e4 --- /dev/null +++ b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/gar-spring-bean.xml @@ -0,0 +1,29 @@ + + + + + Spring file for GAR example. + + + + http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/urideploy/pom.xml ---------------------------------------------------------------------- diff --git a/modules/urideploy/pom.xml b/modules/urideploy/pom.xml index 0add261..d14cff7 100644 --- a/modules/urideploy/pom.xml +++ b/modules/urideploy/pom.xml @@ -143,5 +143,19 @@ log4j test + + + org.apache.ignite + ignite-extdata-uri + ${project.version} + test + + + + org.apache.ignite + ignite-extdata-p2p + ${project.version} + test + http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d685e82a/modules/urideploy/src/test/java/org/apache/ignite/internal/GridTaskUriDeploymentDeadlockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/urideploy/src/test/java/org/apache/ignite/internal/GridTaskUriDeploymentDeadlockSelfTest.java b/modules/urideploy/src/test/java/org/apache/ignite/internal/GridTaskUriDeploymentDeadlockSelfTest.java index a060868..d41542f 100644 --- a/modules/urideploy/src/test/java/org/apache/ignite/internal/GridTaskUriDeploymentDeadlockSelfTest.java +++ b/modules/urideploy/src/test/java/org/apache/ignite/internal/GridTaskUriDeploymentDeadlockSelfTest.java @@ -44,7 +44,7 @@ public class GridTaskUriDeploymentDeadlockSelfTest extends GridCommonAbstractTes UriDeploymentSpi deploymentSpi = new UriDeploymentSpi(); deploymentSpi.setUriList( - Arrays.asList(U.resolveIgniteUrl("modules/core/src/test/resources/").toURI().toString())); + Arrays.asList(U.resolveIgniteUrl("modules/extdata/uri/target/resources/").toURI().toString())); if (gridName.endsWith("2")) { // Delay deployment for 2nd grid only. @@ -91,18 +91,11 @@ public class GridTaskUriDeploymentDeadlockSelfTest extends GridCommonAbstractTes info(">>> Starting task."); - executeAsync(compute(g.cluster().forPredicate(F.equalTo(F.first(g.cluster().forRemotes().nodes())))), - "GridGarHelloWorldTask", "HELLOWORLD.MSG").get(60000); + assert "2".equals(executeAsync(compute(g.cluster().forPredicate(F.equalTo(F.first(g.cluster().forRemotes().nodes())))), + "GarHelloWorldTask", "HELLOWORLD.MSG").get(60000)); f.get(); } - catch (Exception e) { - error("Test failed.", e); - - // With former version of GridDeploymentLocalStore test hangs forever. - // So, we need to forcibly exit. - // System.exit(1); - } finally { stopAllGrids(); }