http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0e6cace/modules/spring/src/test/java/org/gridgain/grid/kernal/GridFactorySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/spring/src/test/java/org/gridgain/grid/kernal/GridFactorySelfTest.java
 
b/modules/spring/src/test/java/org/gridgain/grid/kernal/GridFactorySelfTest.java
deleted file mode 100644
index b12c26b..0000000
--- 
a/modules/spring/src/test/java/org/gridgain/grid/kernal/GridFactorySelfTest.java
+++ /dev/null
@@ -1,791 +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.gridgain.grid.kernal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lifecycle.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.gridgain.grid.*;
-import org.apache.ignite.spi.collision.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.internal.util.lang.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.config.*;
-import org.apache.ignite.testframework.http.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-import org.springframework.beans.*;
-import org.springframework.beans.factory.config.*;
-import org.springframework.beans.factory.support.*;
-import org.springframework.beans.factory.xml.*;
-import org.springframework.context.*;
-import org.springframework.context.support.*;
-import org.springframework.core.io.*;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.IgniteState.*;
-import static org.apache.ignite.IgniteSystemProperties.*;
-
-/**
- * Tests for {@link org.apache.ignite.Ignition}.
- * @see GridFactoryVmShutdownTest
- */
-@SuppressWarnings("UnusedDeclaration")
-@GridCommonTest(group = "NonDistributed Kernal Self")
-public class GridFactorySelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final AtomicInteger cnt = new AtomicInteger();
-
-    /** */
-    private static final String CUSTOM_CFG_PATH = 
"modules/core/src/test/config/factory/custom-grid-name-spring-test.xml";
-
-    /**
-     *
-     */
-    public GridFactorySelfTest() {
-        super(false);
-
-        System.setProperty(GG_OVERRIDE_MCAST_GRP,
-            GridTestUtils.getNextMulticastGroup(GridFactorySelfTest.class));
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        cnt.set(0);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStartGridWithConfigUrlString() throws Exception {
-        GridEmbeddedHttpServer srv = null;
-        String gridName = "grid_with_url_config";
-
-        try {
-            srv = 
GridEmbeddedHttpServer.startHttpServer().withFileDownloadingHandler(null,
-                
GridTestUtils.resolveGridGainPath("/modules/core/src/test/config/default-spring-url-testing.xml"));
-
-            Ignite ignite = G.start(srv.getBaseUrl());
-
-            assert gridName.equals(ignite.name()) : "Unexpected grid name: " + 
ignite.name();
-        }
-        finally {
-            if (srv != null)
-                srv.stop(1);
-
-            G.stop(gridName, false);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStartGridWithConfigUrl() throws Exception {
-        GridEmbeddedHttpServer srv = null;
-        String gridName = "grid_with_url_config";
-
-        try {
-            srv = 
GridEmbeddedHttpServer.startHttpServer().withFileDownloadingHandler(null,
-                
GridTestUtils.resolveGridGainPath("modules/core/src/test/config/default-spring-url-testing.xml"));
-
-            Ignite ignite = G.start(new URL(srv.getBaseUrl()));
-
-            assert gridName.equals(ignite.name()) : "Unexpected grid name: " + 
ignite.name();
-        }
-        finally {
-            if (srv != null)
-                srv.stop(1);
-
-            G.stop(gridName, false);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLifecycleBeansNullGridName() throws Exception {
-        checkLifecycleBeans(null);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLifecycleBeansNotNullGridName() throws Exception {
-        checkLifecycleBeans("testGrid");
-    }
-
-    /**
-     * @param gridName Grid name.
-     * @throws Exception If test failed.
-     */
-    private void checkLifecycleBeans(@Nullable String gridName) throws 
Exception {
-        TestLifecycleBean bean1 = new TestLifecycleBean();
-        TestLifecycleBean bean2 = new TestLifecycleBean();
-
-        IgniteConfiguration cfg = new IgniteConfiguration();
-
-        cfg.setLifecycleBeans(bean1, bean2);
-        cfg.setGridName(gridName);
-
-        cfg.setRestEnabled(false);
-
-        try (Ignite g = GridGainSpring.start(cfg, new 
GenericApplicationContext())) {
-            bean1.checkState(gridName, true);
-            bean2.checkState(gridName, true);
-        }
-
-        bean1.checkState(gridName, false);
-        bean2.checkState(gridName, false);
-
-        checkLifecycleBean(bean1, gridName);
-        checkLifecycleBean(bean2, gridName);
-    }
-
-    /**
-     * @param bean Bean to check.
-     * @param gridName Grid name to check for.
-     */
-    private void checkLifecycleBean(TestLifecycleBean bean, String gridName) {
-        bean.checkErrors();
-
-        List<LifecycleEventType> evts = bean.getLifecycleEvents();
-
-        List<String> gridNames = bean.getGridNames();
-
-        assert evts.get(0) == LifecycleEventType.BEFORE_GRID_START : "Invalid 
lifecycle event: " + evts.get(0);
-        assert evts.get(1) == LifecycleEventType.AFTER_GRID_START : "Invalid 
lifecycle event: " + evts.get(1);
-        assert evts.get(2) == LifecycleEventType.BEFORE_GRID_STOP : "Invalid 
lifecycle event: " + evts.get(2);
-        assert evts.get(3) == LifecycleEventType.AFTER_GRID_STOP : "Invalid 
lifecycle event: " + evts.get(3);
-
-        checkGridNameEquals(gridNames.get(0), gridName);
-        checkGridNameEquals(gridNames.get(1), gridName);
-        checkGridNameEquals(gridNames.get(2), gridName);
-        checkGridNameEquals(gridNames.get(3), gridName);
-    }
-
-    /**
-     * @param n1 First name.
-     * @param n2 Second name.
-     */
-    private void checkGridNameEquals(String n1, String n2) {
-        if (n1 == null) {
-            assert n2 == null;
-
-            return;
-        }
-
-        assert n1.equals(n2) : "Invalid grid names [name1=" + n1 + ", name2=" 
+ n2 + ']';
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter"})
-    public void testStartMultipleGridsFromSpring() throws Exception {
-        File cfgFile =
-            
GridTestUtils.resolveGridGainPath(GridTestProperties.getProperty("loader.self.multipletest.config"));
-
-        assert cfgFile != null;
-
-        String path = cfgFile.getAbsolutePath();
-
-        info("Loading Grid from configuration file: " + path);
-
-        final GridTuple<IgniteState> gridState1 = F.t(null);
-        final GridTuple<IgniteState> gridState2 = F.t(null);
-
-        final Object mux = new Object();
-
-        IgniteListener factoryLsnr = new IgniteListener() {
-            @Override public void onStateChange(String name, IgniteState 
state) {
-                synchronized (mux) {
-                    if ("grid-factory-test-1".equals(name))
-                        gridState1.set(state);
-                    else if ("grid-factory-test-2".equals(name))
-                        gridState2.set(state);
-                }
-            }
-        };
-
-        G.addListener(factoryLsnr);
-
-        G.start(path);
-
-        assert G.ignite("grid-factory-test-1") != null;
-        assert G.ignite("grid-factory-test-2") != null;
-
-        synchronized (mux) {
-            assert gridState1.get() == STARTED :
-                "Invalid grid state [expected=" + STARTED + ", returned=" + 
gridState1 + ']';
-            assert gridState2.get() == STARTED :
-                "Invalid grid state [expected=" + STARTED + ", returned=" + 
gridState2 + ']';
-        }
-
-        G.stop("grid-factory-test-1", true);
-        G.stop("grid-factory-test-2", true);
-
-        synchronized (mux) {
-            assert gridState1.get() == STOPPED :
-                "Invalid grid state [expected=" + STOPPED + ", returned=" + 
gridState1 + ']';
-            assert gridState2.get() == STOPPED :
-                "Invalid grid state [expected=" + STOPPED + ", returned=" + 
gridState2 + ']';
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStartMultipleDefaultGrids() throws Exception {
-        try {
-            multithreaded(
-                new Callable<Object>() {
-                    @Nullable @Override public Object call() throws Exception {
-                        try {
-                            IgniteConfiguration cfg = new 
IgniteConfiguration();
-
-                            cfg.setRestEnabled(false);
-
-                            G.start(cfg);
-                        }
-                        catch (Throwable t) {
-                            error("Caught exception while starting grid.", t);
-                        }
-
-                        info("Thread finished.");
-
-                        return null;
-                    }
-                },
-                5,
-                "grid-starter"
-            );
-
-            assert G.allGrids().size() == 1;
-
-            assert G.ignite() != null;
-        }
-        finally {
-            G.stopAll(true);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStartMultipleNonDefaultGrids() throws Exception {
-        try {
-            multithreaded(
-                new Callable<Object>() {
-                    @Nullable @Override public Object call() throws Exception {
-                        try {
-                            IgniteConfiguration cfg = new 
IgniteConfiguration();
-
-                            cfg.setGridName("TEST_NAME");
-                            cfg.setRestEnabled(false);
-
-                            G.start(cfg);
-                        }
-                        catch (Throwable t) {
-                            error("Caught exception while starting grid.", t);
-                        }
-
-                        info("Thread finished.");
-
-                        return null;
-                    }
-                },
-                5,
-                "grid-starter"
-            );
-
-            assert G.allGrids().size() == 1;
-
-            assert G.ignite("TEST_NAME") != null;
-        }
-        finally {
-            G.stopAll(true);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConcurrentStartStop() throws Exception {
-        checkConcurrentStartStop("TEST_NAME");
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConcurrentStartStopDefaultGrid() throws Exception {
-        checkConcurrentStartStop(null);
-    }
-
-    /**
-     * @param gridName Grid name ({@code null} for default grid).
-     * @throws Exception If failed.
-     */
-    private void checkConcurrentStartStop(@Nullable final String gridName) 
throws Exception {
-        final AtomicInteger startedCnt = new AtomicInteger();
-        final AtomicInteger stoppedCnt = new AtomicInteger();
-
-        IgniteListener lsnr = new IgniteListener() {
-            @SuppressWarnings("StringEquality")
-            @Override public void onStateChange(@Nullable String name, 
IgniteState state) {
-                assert name == gridName;
-
-                info("On state change fired: " + state);
-
-                if (state == STARTED)
-                    startedCnt.incrementAndGet();
-                else {
-                    assert state == STOPPED : "Unexpected state: " + state;
-
-                    stoppedCnt.incrementAndGet();
-                }
-            }
-        };
-
-        G.addListener(lsnr);
-
-        try {
-            final int iterCnt = 3;
-
-            multithreaded(
-                new Callable<Object>() {
-                    @Nullable @Override public Object call() throws Exception {
-                        for (int i = 0; i < iterCnt; i++) {
-                            try {
-                                IgniteConfiguration cfg = 
getConfiguration(gridName);
-
-                                G.start(cfg);
-                            }
-                            catch (Exception e) {
-                                String msg = e.getMessage();
-
-                                if (msg != null &&
-                                    (msg.contains("Default grid instance has 
already been started.") ||
-                                    msg.contains("Grid instance with this name 
has already been started:")))
-                                    info("Caught expected exception: " + msg);
-                                else
-                                    throw e; // Unexpected exception.
-                            }
-                            finally {
-                                stopGrid(gridName);
-                            }
-                        }
-
-                        info("Thread finished.");
-
-                        return null;
-                    }
-                },
-                5,
-                "tester"
-            );
-
-            assert G.allGrids().isEmpty();
-
-            assert startedCnt.get() == iterCnt;
-            assert stoppedCnt.get() == iterCnt;
-        }
-        finally {
-            G.removeListener(lsnr);
-
-            G.stopAll(true);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGridStartRollback() throws Exception {
-        GridTestUtils.assertThrows(
-            log,
-            new Callable<Object>() {
-                @Nullable @Override public Object call() throws Exception {
-                    IgniteConfiguration cfg = new IgniteConfiguration();
-
-                    cfg.setRestEnabled(false);
-
-                    cfg.setDiscoverySpi(new TcpDiscoverySpi() {
-                        @Override public void spiStart(String gridName) throws 
IgniteSpiException {
-                            throw new IgniteSpiException("This SPI will never 
start.");
-                        }
-                    });
-
-                    G.start(cfg);
-
-                    info("Thread finished.");
-
-                    return null;
-                }
-            },
-            IgniteCheckedException.class,
-            null
-        );
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void disabledTestStartSingleInstanceSpi() throws Exception {
-        IgniteConfiguration cfg1 = getConfiguration();
-        IgniteConfiguration cfg2 = getConfiguration();
-
-        cfg1.setCollisionSpi(new TestSingleInstancesCollisionSpi());
-        cfg2.setCollisionSpi(new TestSingleInstancesCollisionSpi());
-
-        G.start(cfg1);
-
-        assert G.state(cfg1.getGridName()) == STARTED;
-        assert G.state(getTestGridName() + '1') == STOPPED;
-
-        G.stop(cfg1.getGridName(), false);
-
-        assert G.state(cfg1.getGridName()) == STOPPED;
-        assert G.state(getTestGridName() + '1') == STOPPED;
-
-        cfg2.setGridName(getTestGridName() + '1');
-
-        G.start(cfg2);
-
-        assert G.state(cfg1.getGridName()) == STOPPED;
-        assert G.state(getTestGridName() + '1') == STARTED;
-
-        G.stop(getTestGridName() + '1', false);
-
-        assert G.state(cfg1.getGridName()) == STOPPED;
-        assert G.state(getTestGridName() + '1') == STOPPED;
-
-        cfg2.setGridName(getTestGridName() + '1');
-
-        G.start(cfg2);
-
-        assert G.state(getTestGridName() + '1') == STARTED;
-        assert G.state(getTestGridName()) == STOPPED;
-
-        G.stop(getTestGridName() + '1', false);
-        G.stop(getTestGridName(), false);
-
-        assert G.state(getTestGridName() + '1') == STOPPED;
-        assert G.state(getTestGridName()) == STOPPED;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStartMultipleInstanceSpi() throws Exception {
-        IgniteConfiguration cfg1 = getConfiguration();
-        IgniteConfiguration cfg2 = getConfiguration();
-        IgniteConfiguration cfg3 = getConfiguration();
-
-        cfg1.setCollisionSpi(new TestMultipleInstancesCollisionSpi());
-        cfg2.setCollisionSpi(new TestMultipleInstancesCollisionSpi());
-        cfg3.setCollisionSpi(new TestMultipleInstancesCollisionSpi());
-
-        cfg2.setGridName(getTestGridName() + '1');
-
-        G.start(cfg2);
-
-        G.start(cfg1);
-
-        cfg3.setGridName(getTestGridName() + '2');
-
-        G.start(cfg3);
-
-        assert G.state(cfg1.getGridName()) == STARTED;
-        assert G.state(getTestGridName() + '1') == STARTED;
-        assert G.state(getTestGridName() + '2') == STARTED;
-
-        G.stop(getTestGridName() + '2', false);
-        G.stop(cfg1.getGridName(), false);
-        G.stop(getTestGridName() + '1', false);
-
-        assert G.state(cfg1.getGridName()) == STOPPED;
-        assert G.state(getTestGridName() + '1') == STOPPED;
-        assert G.state(getTestGridName() + '2') == STOPPED;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @Override protected void afterTest() throws Exception {
-        G.stopAll(false);
-    }
-
-    /** */
-    @IgniteSpiMultipleInstancesSupport(true)
-    private static class TestMultipleInstancesCollisionSpi extends 
IgniteSpiAdapter implements CollisionSpi {
-        /** Grid logger. */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** {@inheritDoc} */
-        @Override public void onCollision(CollisionContext ctx) {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStart(String gridName) throws 
IgniteSpiException {
-            // Start SPI start stopwatch.
-            startStopwatch();
-
-            // Ack start.
-            if (log.isInfoEnabled())
-                log.info(startInfo());
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStop() throws IgniteSpiException {
-            // Ack stop.
-            if (log.isInfoEnabled())
-                log.info(stopInfo());
-        }
-
-        /** {@inheritDoc} */
-        @Override public void 
setExternalCollisionListener(CollisionExternalListener lsnr) {
-            // No-op.
-        }
-    }
-
-    /**
-     * DO NOT CHANGE MULTIPLE INSTANCES SUPPORT.
-     * This test might be working on distributed environment.
-     */
-    @IgniteSpiMultipleInstancesSupport(true)
-    private static class TestSingleInstancesCollisionSpi extends 
IgniteSpiAdapter implements CollisionSpi {
-        /** Grid logger. */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** {@inheritDoc} */
-        @Override public void onCollision(CollisionContext ctx) {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStart(String gridName) throws 
IgniteSpiException {
-            // Start SPI start stopwatch.
-            startStopwatch();
-
-            // Ack start.
-            if (log.isInfoEnabled())
-                log.info(startInfo());
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStop() throws IgniteSpiException {
-            // Ack stop.
-            if (log.isInfoEnabled())
-                log.info(stopInfo());
-        }
-
-        /** {@inheritDoc} */
-        @Override public void 
setExternalCollisionListener(CollisionExternalListener lsnr) {
-            // No-op.
-        }
-    }
-
-    /**
-     * Lifecycle bean for testing.
-     */
-    private static class TestLifecycleBean implements LifecycleBean {
-        /** Grid logger. */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** */
-        @IgniteSpringApplicationContextResource
-        private ApplicationContext appCtx;
-
-        /** */
-        @IgniteInstanceResource
-        private Ignite ignite;
-
-        /** Lifecycle events. */
-        private final List<LifecycleEventType> evts = new ArrayList<>();
-
-        /** Grid names. */
-        private final List<String> gridNames = new ArrayList<>();
-
-        /** */
-        private final AtomicReference<Throwable> err = new AtomicReference<>();
-
-        /** {@inheritDoc} */
-        @Override public void onLifecycleEvent(LifecycleEventType evt) {
-            evts.add(evt);
-
-            gridNames.add(ignite.name());
-
-            try {
-                checkState(ignite.name(),
-                    evt == LifecycleEventType.AFTER_GRID_START || evt == 
LifecycleEventType.BEFORE_GRID_STOP);
-            }
-            catch (Throwable e) {
-                log.error("Lifecycle bean failed state check: " + this, e);
-
-                err.compareAndSet(null, e);
-            }
-        }
-
-        /**
-         * Checks state of the bean.
-         *
-         * @param gridName Grid name.
-         * @param exec Try to execute something on the grid.
-         */
-        void checkState(String gridName, boolean exec) {
-            assert log != null;
-            assert appCtx != null;
-
-            assert F.eq(gridName, ignite.name());
-
-            if (exec)
-                // Execute any grid method.
-                
G.ignite(gridName).events().localQuery(F.<IgniteEvent>alwaysTrue());
-        }
-
-        /**
-         * Gets ordered list of lifecycle events.
-         *
-         * @return Ordered list of lifecycle events.
-         */
-        List<LifecycleEventType> getLifecycleEvents() {
-            return evts;
-        }
-
-        /**
-         * Gets ordered list of grid names.
-         *
-         * @return Ordered list of grid names.
-         */
-        List<String> getGridNames() {
-            return gridNames;
-        }
-
-        /**
-         *
-         */
-        void checkErrors() {
-            if (err.get() != null)
-                fail("Exception has been caught by listener: " + 
err.get().getMessage());
-        }
-    }
-
-    /**
-     * Gets Spring application context by given path.
-     *
-     * @param path Spring application context configuration path.
-     * @return Spring application context.
-     * @throws IgniteCheckedException If given path or xml-configuration at 
this path is invalid.
-     */
-    private GenericApplicationContext getSpringContext(String path) throws 
IgniteCheckedException {
-        try {
-            GenericApplicationContext ctx = new GenericApplicationContext();
-
-            new XmlBeanDefinitionReader(ctx).loadBeanDefinitions(new 
UrlResource(U.resolveGridGainUrl(path)));
-
-            ctx.refresh();
-
-            return ctx;
-        }
-        catch (BeansException e) {
-            throw new IgniteCheckedException("Failed to instantiate Spring XML 
application context: " + e.getMessage(), e);
-        }
-    }
-
-    /**
-     * Gets test Spring application context with single {@link StringBuilder} 
bean
-     * with name "myBean" and value "Test string".
-     *
-     * @return Spring application context.
-     */
-    private ApplicationContext getTestApplicationContext() {
-        AbstractBeanDefinition def = new GenericBeanDefinition();
-
-        def.setBeanClass(StringBuilder.class);
-
-        ConstructorArgumentValues args = new ConstructorArgumentValues();
-        args.addGenericArgumentValue("Test string");
-
-        def.setConstructorArgumentValues(args);
-
-        GenericApplicationContext ctx = new GenericApplicationContext();
-
-        ctx.registerBeanDefinition("myBean", def);
-
-        return ctx;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStopCancel() throws Exception {
-        IgniteConfiguration cfg = new IgniteConfiguration();
-
-        cfg.setRestEnabled(false);
-
-        Ignite ignite = G.start(cfg);
-
-        ignite.compute().execute(TestTask.class, null);
-
-        G.stop(true);
-    }
-
-    /**
-     * Test task.
-     */
-    private static class TestTask extends ComputeTaskSplitAdapter<Void, Void> {
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int 
gridSize, Void arg) throws IgniteCheckedException {
-            return F.asSet(new TestJob());
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Void reduce(List<ComputeJobResult> results) 
throws IgniteCheckedException {
-            return null;
-        }
-    }
-
-    /**
-     * Test job.
-     */
-    private static class TestJob extends ComputeJobAdapter {
-        /** {@inheritDoc} */
-        @SuppressWarnings("StatementWithEmptyBody")
-        @Override public Object execute() throws IgniteCheckedException {
-            long start = System.currentTimeMillis();
-
-            while (System.currentTimeMillis() - start < 3000);
-
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0e6cace/modules/spring/src/test/java/org/gridgain/grid/kernal/GridSpringBeanSerializationSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/spring/src/test/java/org/gridgain/grid/kernal/GridSpringBeanSerializationSelfTest.java
 
b/modules/spring/src/test/java/org/gridgain/grid/kernal/GridSpringBeanSerializationSelfTest.java
deleted file mode 100644
index 4032592..0000000
--- 
a/modules/spring/src/test/java/org/gridgain/grid/kernal/GridSpringBeanSerializationSelfTest.java
+++ /dev/null
@@ -1,92 +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.gridgain.grid.kernal;
-
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.marshaller.*;
-import org.apache.ignite.marshaller.optimized.*;
-import org.gridgain.grid.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-/**
- * Test for {@link GridSpringBean} serialization.
- */
-public class GridSpringBeanSerializationSelfTest extends 
GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
-
-    /** Marshaller. */
-    private static final IgniteMarshaller MARSHALLER = new 
IgniteOptimizedMarshaller();
-
-    /** Attribute key. */
-    private static final String ATTR_KEY = "checkAttr";
-
-    /** Bean. */
-    private GridSpringBean bean;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        bean = new GridSpringBean();
-
-        bean.setConfiguration(config());
-
-        bean.afterPropertiesSet();
-    }
-
-    /**
-     * @return Grid configuration.
-     */
-    private IgniteConfiguration config() {
-        IgniteConfiguration cfg = new IgniteConfiguration();
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        cfg.setUserAttributes(F.asMap(ATTR_KEY, true));
-
-        cfg.setRestEnabled(false);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        bean.destroy();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSerialization() throws Exception {
-        assert bean != null;
-
-        GridSpringBean bean0 = MARSHALLER.unmarshal(MARSHALLER.marshal(bean), 
null);
-
-        assert bean0 != null;
-        assert bean0.log() != null;
-        assert bean0.cluster().localNode() != null;
-        assert bean0.cluster().localNode().<Boolean>attribute(ATTR_KEY);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d0e6cace/modules/spring/src/test/java/org/gridgain/grid/p2p/GridP2PUserVersionChangeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/spring/src/test/java/org/gridgain/grid/p2p/GridP2PUserVersionChangeSelfTest.java
 
b/modules/spring/src/test/java/org/gridgain/grid/p2p/GridP2PUserVersionChangeSelfTest.java
deleted file mode 100644
index cbdff68..0000000
--- 
a/modules/spring/src/test/java/org/gridgain/grid/p2p/GridP2PUserVersionChangeSelfTest.java
+++ /dev/null
@@ -1,357 +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.gridgain.grid.p2p;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.config.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.net.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import static java.util.concurrent.TimeUnit.*;
-import static org.apache.ignite.events.IgniteEventType.*;
-
-/**
- * The test does the following:
- *
- * 1. The test should execute a task in SHARED_DEPLOY mode, restart a node 
with new version and make sure that a
- *      new class loader is created on remote node.
- * 2. The test should execute a task in SHARED_DEPLOY mode, restart a node 
with same version and make sure
- *      that the same class loader is created on remote node.
- * 3. The test should execute a task in SHARED_UNDEPLOY mode, restart a node 
with same version and
- *      make sure that a new class loader is created on remote node.
- */
-@SuppressWarnings({"ProhibitedExceptionDeclared", "ObjectEquality", 
"unchecked"})
-public class GridP2PUserVersionChangeSelfTest extends GridCommonAbstractTest {
-    /** Current deployment mode. */
-    private IgniteDeploymentMode depMode;
-
-    /** Test task class name. */
-    private static final String TEST_TASK_NAME = 
"org.gridgain.grid.tests.p2p.GridP2PTestTaskExternalPath1";
-
-    /** Test resource class name. */
-    private static final String TEST_RCRS_NAME = 
"org.gridgain.grid.tests.p2p.GridTestUserResource";
-
-    /** IP finder. */
-    private final TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    public GridP2PUserVersionChangeSelfTest() {
-        super(/*start grid*/false);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected long getTestTimeout() {
-        return 30 * 1000;
-    }
-
-    /**
-     * @return Timeout for condition waits.
-     */
-    private long getConditionTimeout() {
-        return getTestTimeout() > 10000 ? getTestTimeout() - 10000 : 
getTestTimeout();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setDeploymentMode(depMode);
-        cfg.setNetworkTimeout(10000);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(ipFinder);
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        if (gridName.contains("testCacheRedeployVersionChangeContinuousMode")) 
{
-            CacheConfiguration cacheCfg = new CacheConfiguration();
-
-            cacheCfg.setCacheMode(GridCacheMode.REPLICATED);
-
-            cfg.setCacheConfiguration(cacheCfg);
-        }
-        else
-            cfg.setCacheConfiguration();
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testRedeployVersionChangeContinuousMode() throws Exception {
-        depMode = IgniteDeploymentMode.CONTINUOUS;
-
-        checkRedeployVersionChange();
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testRedeployVersionChangeSharedMode() throws Exception {
-        depMode = IgniteDeploymentMode.SHARED;
-
-        checkRedeployVersionChange();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    private void checkRedeployVersionChange() throws Exception {
-        try {
-            Ignite ignite1 = startGrid(1);
-            Ignite ignite2 = startGrid(2);
-
-            GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(
-                new URL[] { new 
URL(GridTestProperties.getProperty("p2p.uri.cls")) },
-                Collections.singletonMap("META-INF/gridgain.xml", 
makeUserVersion("1").getBytes()));
-
-            Class task1 = ldr.loadClass(TEST_TASK_NAME);
-
-            final CountDownLatch undeployed = new CountDownLatch(1);
-
-            ignite2.events().localListen(new IgnitePredicate<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent evt) {
-                    if (evt.type() == EVT_TASK_UNDEPLOYED &&
-                        ((IgniteDeploymentEvent) 
evt).alias().equals(TEST_TASK_NAME))
-                        undeployed.countDown();
-
-                    return true;
-                }
-            }, EVT_TASK_UNDEPLOYED);
-
-            Integer res1 = (Integer)ignite1.compute().execute(task1, 
ignite2.cluster().localNode().id());
-
-            stopGrid(1);
-
-            
ldr.setResourceMap(Collections.singletonMap("META-INF/gridgain.xml", 
makeUserVersion("2").getBytes()));
-
-            ignite1 = startGrid(1);
-
-            Integer res2 = (Integer)ignite1.compute().execute(task1, 
ignite2.cluster().localNode().id());
-
-            assert !res1.equals(res2);
-
-            // Allow P2P timeout to expire.
-            assert undeployed.await(30000, MILLISECONDS);
-        }
-        finally {
-            stopGrid(1);
-            stopGrid(2);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRedeployOnNodeRestartContinuousMode() throws Exception {
-        depMode = IgniteDeploymentMode.CONTINUOUS;
-
-        try {
-            Ignite ignite1 = startGrid(1);
-            Ignite ignite2 = startGrid(2);
-
-            GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(
-                new URL[] { new 
URL(GridTestProperties.getProperty("p2p.uri.cls")) });
-
-            Class task1 = ldr.loadClass(TEST_TASK_NAME);
-
-            final CountDownLatch undeployed = new CountDownLatch(1);
-
-            ignite2.events().localListen(new IgnitePredicate<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent evt) {
-                    if (evt.type() == EVT_TASK_UNDEPLOYED &&
-                        ((IgniteDeploymentEvent) 
evt).alias().equals(TEST_TASK_NAME))
-                        undeployed.countDown();
-
-                    return true;
-                }
-            }, EVT_TASK_UNDEPLOYED);
-
-            Integer res1 = (Integer)ignite1.compute().execute(task1, 
ignite2.cluster().localNode().id());
-
-            stopGrid(1);
-
-            ignite1 = startGrid(1);
-
-            Integer res2 = (Integer)ignite1.compute().execute(task1, 
ignite2.cluster().localNode().id());
-
-            assert !undeployed.await(3000, MILLISECONDS);
-
-            assert res1.equals(res2);
-        }
-        finally {
-            stopGrid(1);
-            stopGrid(2);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRedeployOnNodeRestartSharedMode() throws Exception {
-        depMode = IgniteDeploymentMode.SHARED;
-
-        try {
-            Ignite ignite1 = startGrid(1);
-            Ignite ignite2 = startGrid(2);
-
-            GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(
-                new URL[] { new 
URL(GridTestProperties.getProperty("p2p.uri.cls")) });
-
-            Class task1 = ldr.loadClass(TEST_TASK_NAME);
-
-            final CountDownLatch undeployed = new CountDownLatch(1);
-
-            ignite2.events().localListen(new IgnitePredicate<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent evt) {
-                    if (evt.type() == EVT_TASK_UNDEPLOYED &&
-                        ((IgniteDeploymentEvent) 
evt).alias().equals(TEST_TASK_NAME))
-                        undeployed.countDown();
-
-                    return true;
-                }
-            }, EVT_TASK_UNDEPLOYED);
-
-            final CountDownLatch discoLatch = new CountDownLatch(1);
-
-            ignite2.events().localListen(new IgnitePredicate<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent evt) {
-                    if (evt.type() == EVT_NODE_LEFT)
-                        discoLatch.countDown();
-
-                    return true;
-                }
-            }, EVT_NODE_LEFT);
-
-            Integer res1 = (Integer)ignite1.compute().execute(task1, 
ignite2.cluster().localNode().id());
-
-            stopGrid(1);
-
-            assert discoLatch.await(1000, MILLISECONDS);
-
-            assert undeployed.await(1000, MILLISECONDS);
-
-            ignite1 = startGrid(1);
-
-            Integer res2 = (Integer)ignite1.compute().execute(task1, 
ignite2.cluster().localNode().id());
-
-            assert !res1.equals(res2);
-        }
-        finally {
-            stopGrid(1);
-            stopGrid(2);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    // TODO: GG-5678 Uncomment when fix
-    public void _testCacheRedeployVersionChangeContinuousMode() throws 
Exception {
-        depMode = IgniteDeploymentMode.CONTINUOUS;
-
-        try {
-            Ignite ignite1 = 
startGrid("testCacheRedeployVersionChangeContinuousMode1");
-            Ignite ignite2 = 
startGrid("testCacheRedeployVersionChangeContinuousMode2");
-
-            GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(
-                new URL[] { new 
URL(GridTestProperties.getProperty("p2p.uri.cls")) },
-                Collections.singletonMap("META-INF/gridgain.xml", 
makeUserVersion("1").getBytes()));
-
-            Class rcrsCls = ldr.loadClass(TEST_RCRS_NAME);
-
-            GridCache<Long, Object> cache1 = ignite1.cache(null);
-
-            assertNotNull(cache1);
-
-            cache1.put(1L, rcrsCls.newInstance());
-
-            final GridCache<Long, Object> cache2 = ignite2.cache(null);
-
-            assertNotNull(cache2);
-
-            // The entry should propagate to grid2, because the
-            // cache is REPLICATED. This happens asynchronously, we
-            // need to use condition wait.
-            assert GridTestUtils.waitForCondition(new PAX() {
-                @Override public boolean applyx() throws 
IgniteCheckedException {
-                    return cache2.get(1L) != null;
-                }
-            }, getConditionTimeout());
-
-            stopGrid("testCacheRedeployVersionChangeContinuousMode1");
-
-            // Increase the user version of the test class.
-            
ldr.setResourceMap(Collections.singletonMap("META-INF/gridgain.xml", 
makeUserVersion("2").getBytes()));
-
-            ignite1 = 
startGrid("testCacheRedeployVersionChangeContinuousMode1");
-
-            cache1 = ignite1.cache(null);
-
-            assertNotNull(cache1);
-
-            // Put an entry with a new user version.
-            cache1.put(2L, rcrsCls.newInstance());
-
-            // At this point, old version of test resource should be undeployed
-            // and removed from cache asynchronously.
-            assert GridTestUtils.waitForCondition(new PAX() {
-                @Override public boolean applyx() throws 
IgniteCheckedException {
-                    return cache2.get(1L) == null;
-                }
-            }, getConditionTimeout()) : "2nd condition failed [entries1=" + 
cache1.entrySet() +
-                ", entries2=" + cache2.entrySet() + ']';
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * Creates content of META-INF/gridgain.xml for specified user version.
-     *
-     * @param userVer Version to create.
-     * @return content of META-INF/gridgain.xml.
-     */
-    private String makeUserVersion(String userVer) {
-        return "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " +
-            "<beans xmlns=\"http://www.springframework.org/schema/beans\"; " +
-            "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; " +
-            "xmlns:util=\"http://www.springframework.org/schema/util\"; " +
-            "xsi:schemaLocation=\"http://www.springframework.org/schema/beans 
" +
-            "http://www.springframework.org/schema/beans/spring-beans.xsd " +
-            "http://www.springframework.org/schema/util " +
-            "http://www.springframework.org/schema/util/spring-util.xsd\";> " +
-            "<bean id=\"userVersion\" 
class=\"java.lang.String\"><constructor-arg value=\"" + userVer + "\"/></bean> 
" +
-            "</beans>";
-    }
-}

Reply via email to