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 3F8F918047 for ; Tue, 28 Apr 2015 09:03:57 +0000 (UTC) Received: (qmail 54708 invoked by uid 500); 28 Apr 2015 09:03:57 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 54680 invoked by uid 500); 28 Apr 2015 09:03:57 -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 54671 invoked by uid 99); 28 Apr 2015 09:03:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2015 09:03:57 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of root@apache.org designates 54.76.25.247 as permitted sender) Received: from [54.76.25.247] (HELO mx1-eu-west.apache.org) (54.76.25.247) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2015 09:03:32 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id E277D2AA86 for ; Tue, 28 Apr 2015 09:03:02 +0000 (UTC) Received: (qmail 50944 invoked by uid 99); 28 Apr 2015 09:03:00 -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, 28 Apr 2015 09:03:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 85FD0E01E2; Tue, 28 Apr 2015 09:03:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yzhdanov@apache.org To: commits@ignite.incubator.apache.org Date: Tue, 28 Apr 2015 09:03:30 -0000 Message-Id: In-Reply-To: <3f1af497608940e2923e333c4ebc12fe@git.apache.org> References: <3f1af497608940e2923e333c4ebc12fe@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [34/50] incubator-ignite git commit: ignite-779 X-Virus-Checked: Checked by ClamAV on apache.org ignite-779 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/39823749 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/39823749 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/39823749 Branch: refs/heads/ignite-790 Commit: 39823749f374ac608e6ed98ef0f0a05a56938bfc Parents: 5718e8a Author: avinogradov Authored: Fri Apr 24 18:26:50 2015 +0300 Committer: avinogradov Committed: Fri Apr 24 18:26:50 2015 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/internal/IgnitionEx.java | 15 +++--- .../util/spring/IgniteSpringHelper.java | 7 +-- .../util/spring/IgniteSpringHelperImpl.java | 31 ++++++------ .../spring/IgniteStartFromStreamCfgTest.java | 50 -------------------- .../IgniteStartFromStreamConfigurationTest.java | 50 ++++++++++++++++++++ .../testsuites/IgniteSpringTestSuite.java | 2 +- 6 files changed, 80 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/39823749/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java index 469ba7b..c5145d6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java @@ -560,8 +560,8 @@ public class IgnitionEx { * read. This exception will be thrown also if grid with given name has already * been started or Spring XML configuration file is invalid. */ - public static IgniteBiTuple, ? extends GridSpringResourceContext> loadConfigurations( - URL springCfgUrl) throws IgniteCheckedException { + public static IgniteBiTuple, ? extends GridSpringResourceContext> + loadConfigurations(URL springCfgUrl) throws IgniteCheckedException { IgniteSpringHelper spring = SPRING.create(false); return spring.loadConfigurations(springCfgUrl); @@ -580,8 +580,8 @@ public class IgnitionEx { * read. This exception will be thrown also if grid with given name has already * been started or Spring XML configuration file is invalid. */ - public static IgniteBiTuple, ? extends GridSpringResourceContext> loadConfigurations( - InputStream springCfgStream) throws IgniteCheckedException { + public static IgniteBiTuple, ? extends GridSpringResourceContext> + loadConfigurations(InputStream springCfgStream) throws IgniteCheckedException { IgniteSpringHelper spring = SPRING.create(false); return spring.loadConfigurations(springCfgStream); @@ -600,8 +600,8 @@ public class IgnitionEx { * read. This exception will be thrown also if grid with given name has already * been started or Spring XML configuration file is invalid. */ - public static IgniteBiTuple, ? extends GridSpringResourceContext> loadConfigurations( - String springCfgPath) throws IgniteCheckedException { + public static IgniteBiTuple, ? extends GridSpringResourceContext> + loadConfigurations(String springCfgPath) throws IgniteCheckedException { A.notNull(springCfgPath, "springCfgPath"); URL url; @@ -636,7 +636,8 @@ public class IgnitionEx { */ public static IgniteBiTuple loadConfiguration(URL springCfgUrl) throws IgniteCheckedException { - IgniteBiTuple, ? extends GridSpringResourceContext> t = loadConfigurations(springCfgUrl); + IgniteBiTuple, ? extends GridSpringResourceContext> t = + loadConfigurations(springCfgUrl); return F.t(F.first(t.get1()), t.get2()); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/39823749/modules/core/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelper.java b/modules/core/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelper.java index 4b377f0..82ef421 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelper.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelper.java @@ -75,7 +75,7 @@ public interface IgniteSpringHelper { * @throws IgniteCheckedException If configuration could not be read. */ public IgniteBiTuple, ? extends GridSpringResourceContext> loadConfigurations( - URL cfgUrl, Class cl, String... excludedProps) throws IgniteCheckedException; + URL cfgUrl, Class cls, String... excludedProps) throws IgniteCheckedException; /** * Loads all configurations with given type specified within given configuration input stream. @@ -87,7 +87,7 @@ public interface IgniteSpringHelper { * @throws IgniteCheckedException If configuration could not be read. */ public IgniteBiTuple, ? extends GridSpringResourceContext> loadConfigurations( - InputStream cfgStream, Class cl, String... excludedProps) throws IgniteCheckedException; + InputStream cfgStream, Class cls, String... excludedProps) throws IgniteCheckedException; /** * Loads bean instances that match the given types from given configuration file. @@ -119,7 +119,8 @@ public interface IgniteSpringHelper { * map value is {@code null}. * @throws IgniteCheckedException If failed to load configuration. */ - public Map, Object> loadBeans(InputStream cfgStream, Class... beanClasses) throws IgniteCheckedException; + public Map, Object> loadBeans(InputStream cfgStream, Class... beanClasses) + throws IgniteCheckedException; /** * Loads bean instance by name. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/39823749/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java ---------------------------------------------------------------------- diff --git a/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java b/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java index 17bc7a0..f05e991 100644 --- a/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java +++ b/modules/spring/src/main/java/org/apache/ignite/internal/util/spring/IgniteSpringHelperImpl.java @@ -76,22 +76,22 @@ public class IgniteSpringHelperImpl implements IgniteSpringHelper { } /** {@inheritDoc} */ - @Override public IgniteBiTuple, ? extends GridSpringResourceContext> loadConfigurations( - URL cfgUrl, String... excludedProps) throws IgniteCheckedException { + @Override public IgniteBiTuple, ? extends GridSpringResourceContext> + loadConfigurations(URL cfgUrl, String... excludedProps) throws IgniteCheckedException { return loadConfigurations(cfgUrl, IgniteConfiguration.class, excludedProps); } /** {@inheritDoc} */ - @Override public IgniteBiTuple, ? extends GridSpringResourceContext> loadConfigurations( - URL cfgUrl, Class cl, String... excludedProps) throws IgniteCheckedException { + @Override public IgniteBiTuple, ? extends GridSpringResourceContext> + loadConfigurations(URL cfgUrl, Class cls, String... excludedProps) throws IgniteCheckedException { ApplicationContext springCtx = applicationContext(cfgUrl, excludedProps); Map cfgMap; try { - cfgMap = springCtx.getBeansOfType(cl); + cfgMap = springCtx.getBeansOfType(cls); } catch (BeansException e) { - throw new IgniteCheckedException("Failed to instantiate bean [type=" + cl + + throw new IgniteCheckedException("Failed to instantiate bean [type=" + cls + ", err=" + e.getMessage() + ']', e); } @@ -102,22 +102,22 @@ public class IgniteSpringHelperImpl implements IgniteSpringHelper { } /** {@inheritDoc} */ - @Override public IgniteBiTuple, ? extends GridSpringResourceContext> loadConfigurations( - InputStream cfgStream, String... excludedProps) throws IgniteCheckedException { + @Override public IgniteBiTuple, ? extends GridSpringResourceContext> + loadConfigurations(InputStream cfgStream, String... excludedProps) throws IgniteCheckedException { return loadConfigurations(cfgStream, IgniteConfiguration.class, excludedProps); } /** {@inheritDoc} */ @Override public IgniteBiTuple, ? extends GridSpringResourceContext> loadConfigurations( - InputStream cfgStream, Class cl, String... excludedProps) throws IgniteCheckedException { + InputStream cfgStream, Class cls, String... excludedProps) throws IgniteCheckedException { ApplicationContext springCtx = applicationContext(cfgStream, excludedProps); Map cfgMap; try { - cfgMap = springCtx.getBeansOfType(cl); + cfgMap = springCtx.getBeansOfType(cls); } catch (BeansException e) { - throw new IgniteCheckedException("Failed to instantiate bean [type=" + cl + + throw new IgniteCheckedException("Failed to instantiate bean [type=" + cls + ", err=" + e.getMessage() + ']', e); } @@ -160,7 +160,8 @@ public class IgniteSpringHelperImpl implements IgniteSpringHelper { } /** {@inheritDoc} */ - @Override public Map, Object> loadBeans(InputStream cfgStream, Class... beanClasses) throws IgniteCheckedException { + @Override public Map, Object> loadBeans(InputStream cfgStream, Class... beanClasses) + throws IgniteCheckedException { assert beanClasses.length > 0; ApplicationContext springCtx = initContext(cfgStream); @@ -336,7 +337,8 @@ public class IgniteSpringHelperImpl implements IgniteSpringHelper { * @return Spring application context. * @throws IgniteCheckedException If configuration could not be read. */ - public static ApplicationContext applicationContext(URL cfgUrl, final String... excludedProps) throws IgniteCheckedException { + public static ApplicationContext applicationContext(URL cfgUrl, final String... excludedProps) + throws IgniteCheckedException { try { GenericApplicationContext springCtx = prepareSpringContext(excludedProps); @@ -368,7 +370,8 @@ public class IgniteSpringHelperImpl implements IgniteSpringHelper { * @return Spring application context. * @throws IgniteCheckedException If configuration could not be read. */ - public static ApplicationContext applicationContext(InputStream cfgStream, final String... excludedProps) throws IgniteCheckedException { + public static ApplicationContext applicationContext(InputStream cfgStream, final String... excludedProps) + throws IgniteCheckedException { try { GenericApplicationContext springCtx = prepareSpringContext(excludedProps); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/39823749/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamCfgTest.java ---------------------------------------------------------------------- diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamCfgTest.java b/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamCfgTest.java deleted file mode 100644 index f47c6e0..0000000 --- a/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamCfgTest.java +++ /dev/null @@ -1,50 +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.spring; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.testframework.junits.common.*; - -import java.io.*; -import java.net.*; - -/** - * Checks starts from Stream. - */ -public class IgniteStartFromStreamCfgTest extends GridCommonAbstractTest { - /** Tests starts from Stream. */ - public void testStartFromStream() throws Exception { - String cfg = "examples/config/example-cache.xml"; - - URL cfgLocation = U.resolveIgniteUrl(cfg); - - Ignite grid = Ignition.start(new FileInputStream(cfgLocation.getFile())); - - grid.cache(null).put("1", "1"); - - assert grid.cache(null).get("1").equals("1"); - - IgniteConfiguration icfg = Ignition.loadSpringBean(new FileInputStream(cfgLocation.getFile()), "ignite.cfg"); - - assert icfg.getCacheConfiguration()[0].getAtomicityMode() == CacheAtomicityMode.ATOMIC; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/39823749/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java ---------------------------------------------------------------------- diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java b/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java new file mode 100644 index 0000000..4ebfcdc --- /dev/null +++ b/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java @@ -0,0 +1,50 @@ +/* + * 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.spring; + +import org.apache.ignite.*; +import org.apache.ignite.cache.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.testframework.junits.common.*; + +import java.io.*; +import java.net.*; + +/** + * Checks starts from Stream. + */ +public class IgniteStartFromStreamConfigurationTest extends GridCommonAbstractTest { + /** Tests starts from Stream. */ + public void testStartFromStream() throws Exception { + String cfg = "examples/config/example-cache.xml"; + + URL cfgLocation = U.resolveIgniteUrl(cfg); + + Ignite grid = Ignition.start(new FileInputStream(cfgLocation.getFile())); + + grid.cache(null).put("1", "1"); + + assert grid.cache(null).get("1").equals("1"); + + IgniteConfiguration icfg = Ignition.loadSpringBean(new FileInputStream(cfgLocation.getFile()), "ignite.cfg"); + + assert icfg.getCacheConfiguration()[0].getAtomicityMode() == CacheAtomicityMode.ATOMIC; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/39823749/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java index dd3bb79..8251c18 100644 --- a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java +++ b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java @@ -45,7 +45,7 @@ public class IgniteSpringTestSuite extends TestSuite { suite.addTest(new TestSuite(IgniteDynamicCacheConfigTest.class)); - suite.addTest(new TestSuite(IgniteStartFromStreamCfgTest.class)); + suite.addTest(new TestSuite(IgniteStartFromStreamConfigurationTest.class)); return suite; }