Repository: ignite
Updated Branches:
  refs/heads/ignite-6149 7815a977e -> 62dbb11d5


ignite-6289 Remove "allOrNone" flag from IgniteServices#deployAll method


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

Branch: refs/heads/ignite-6149
Commit: 91cf66e7083e4e73b2bcd08e81fdb29cf06ddc59
Parents: 50c7002
Author: Denis Mekhanikov <[email protected]>
Authored: Fri Sep 15 11:19:18 2017 +0300
Committer: sboikov <[email protected]>
Committed: Fri Sep 15 11:19:18 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteServices.java  |  44 +++---
 .../ignite/internal/IgniteServicesImpl.java     |  13 +-
 .../GridServiceDeploymentCompoundFuture.java    | 129 ++---------------
 .../service/GridServiceProcessor.java           |  64 +++------
 .../service/PreparedConfigurations.java         |   8 +-
 ...ServiceDeploymentCompoundFutureSelfTest.java | 121 +---------------
 ...GridServiceProcessorBatchDeploySelfTest.java | 137 +++++--------------
 7 files changed, 95 insertions(+), 421 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/91cf66e7/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteServices.java 
b/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
index e161b11..2222db0 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteServices.java
@@ -435,46 +435,40 @@ public interface IgniteServices extends 
IgniteAsyncSupport {
 
     /**
      * Deploys multiple services described by provided configurations. 
Depending on specified parameters, multiple
-     * instances of the same service may be deployed (see {@link 
ServiceConfiguration}).
-     * Whenever topology changes, Ignite will automatically rebalance
-     * the deployed services within cluster to make sure that each node will 
end up with
-     * about equal number of deployed instances whenever possible.
+     * instances of the same service may be deployed (see {@link 
ServiceConfiguration}). Whenever topology changes,
+     * Ignite will automatically rebalance the deployed services within 
cluster to make sure that each node will end up
+     * with about equal number of deployed instances whenever possible.
      *
-     * If deployment fails, then {@link ServiceDeploymentException} containing 
a list of failed services will be
-     * thrown. It is guaranteed that all services that were provided to this 
method and are not present in the list of
-     * failed services are successfully deployed by the moment of the 
exception being thrown.
+     * If deployment of some of the provided services fails, then {@link 
ServiceDeploymentException} containing a list
+     * of failed services will be thrown. It is guaranteed that all services 
that were provided to this method and are
+     * not present in the list of failed services are successfully deployed by 
the moment of the exception being thrown.
+     * Note that if exception is thrown, then partial deployment may have 
occurred.
      *
      * @param cfgs {@link Collection} of service configurations to be deployed.
-     * @param allOrNone Specifies behavior in case when errors during 
deployment occur. If {@code true}, then two
-     * outcomes are possible: either all services will be deployed, or none of 
them. If {@code false}, then partial
-     * deployments are permitted.
      * @throws ServiceDeploymentException If failed to deploy services.
      * @see IgniteServices#deploy(ServiceConfiguration)
-     * @see IgniteServices#deployAllAsync(Collection, boolean)
+     * @see IgniteServices#deployAllAsync(Collection)
      */
-    public void deployAll(Collection<ServiceConfiguration> cfgs, boolean 
allOrNone) throws ServiceDeploymentException;
+    public void deployAll(Collection<ServiceConfiguration> cfgs) throws 
ServiceDeploymentException;
 
     /**
      * Asynchronously deploys multiple services described by provided 
configurations. Depending on specified parameters,
-     * multiple instances of the same service may be deployed (see {@link 
ServiceConfiguration}).
-     * Whenever topology changes, Ignite will automatically rebalance
-     * the deployed services within cluster to make sure that each node will 
end up with
-     * about equal number of deployed instances whenever possible.
+     * multiple instances of the same service may be deployed (see {@link 
ServiceConfiguration}). Whenever topology
+     * changes, Ignite will automatically rebalance the deployed services 
within cluster to make sure that each node
+     * will end up with about equal number of deployed instances whenever 
possible.
      *
-     * If deployment fails, then {@link ServiceDeploymentException} containing 
a list of failed services will be
-     * thrown from {@link IgniteFuture#get get()} method of the returned 
future. It is guaranteed that all services,
-     * that were provided to this method and are not present in the list of 
failed services, are successfully deployed
-     * by the moment of the exception being thrown.
+     * If deployment of some of the provided services fails, then {@link 
ServiceDeploymentException} containing a list
+     * of failed services will be thrown from {@link IgniteFuture#get get()} 
method of the returned future. It is
+     * guaranteed that all services, that were provided to this method and are 
not present in the list of failed
+     * services, are successfully deployed by the moment of the exception 
being thrown. Note that if exception is
+     * thrown, then partial deployment may have occurred.
      *
      * @param cfgs {@link Collection} of service configurations to be deployed.
-     * @param allOrNone Specifies behavior in case when errors during 
deployment occur. If {@code true}, then two
-     * outcomes are possible: either all services will be deployed, or none of 
them. If {@code false}, then partial
-     * deployments are permitted.
      * @return a Future representing pending completion of the operation.
      * @see IgniteServices#deploy(ServiceConfiguration)
-     * @see IgniteServices#deployAll(Collection,boolean)
+     * @see IgniteServices#deployAll(Collection)
      */
-    public IgniteFuture<Void> deployAllAsync(Collection<ServiceConfiguration> 
cfgs, boolean allOrNone);
+    public IgniteFuture<Void> deployAllAsync(Collection<ServiceConfiguration> 
cfgs);
 
     /**
      * Cancels service deployment. If a service with specified name was 
deployed on the grid,

http://git-wip-us.apache.org/repos/asf/ignite/blob/91cf66e7/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java
index ad455d8..00d6078 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteServicesImpl.java
@@ -218,24 +218,24 @@ public class IgniteServicesImpl extends 
AsyncSupportAdapter implements IgniteSer
     @Override public void deploy(ServiceConfiguration cfg) {
         A.notNull(cfg, "cfg");
 
-        deployAll(Collections.singleton(cfg), false);
+        deployAll(Collections.singleton(cfg));
     }
 
     /** {@inheritDoc} */
     @Override public IgniteFuture<Void> deployAsync(ServiceConfiguration cfg) {
         A.notNull(cfg, "cfg");
 
-        return deployAllAsync(Collections.singleton(cfg), false);
+        return deployAllAsync(Collections.singleton(cfg));
     }
 
     /** {@inheritDoc} */
-    @Override public void deployAll(Collection<ServiceConfiguration> cfgs, 
boolean allOrNone) {
+    @Override public void deployAll(Collection<ServiceConfiguration> cfgs) {
         A.notNull(cfgs, "cfgs");
 
         guard();
 
         try {
-            saveOrGet(ctx.service().deployAll(cfgs, allOrNone));
+            saveOrGet(ctx.service().deployAll(cfgs));
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -246,14 +246,13 @@ public class IgniteServicesImpl extends 
AsyncSupportAdapter implements IgniteSer
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteFuture<Void> 
deployAllAsync(Collection<ServiceConfiguration> cfgs,
-        boolean allOrNone) {
+    @Override public IgniteFuture<Void> 
deployAllAsync(Collection<ServiceConfiguration> cfgs) {
         A.notNull(cfgs, "cfgs");
 
         guard();
 
         try {
-            return (IgniteFuture<Void>)new 
IgniteFutureImpl<>(ctx.service().deployAll(cfgs, allOrNone));
+            return (IgniteFuture<Void>)new 
IgniteFutureImpl<>(ctx.service().deployAll(cfgs));
         }
         finally {
             unguard();

http://git-wip-us.apache.org/repos/asf/ignite/blob/91cf66e7/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java
index bbf0370..45ccc24 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFuture.java
@@ -20,140 +20,51 @@ package org.apache.ignite.internal.processors.service;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.List;
 import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.services.ServiceConfiguration;
 import org.apache.ignite.services.ServiceDeploymentException;
 import org.jetbrains.annotations.Nullable;
 
 /**
- * Service deployment compound future, {@code allOrNone} parameter specifies 
failing policy.
- * <p>
- * If {@code allOrNone} parameter is set to {@code false}, then this future 
waits for completion of all child futures.
- * If any exceptions are thrown during deployment, then {@link 
IgniteCheckedException} with {@link
- * ServiceDeploymentException} as a cause will be thrown from {@link 
IgniteInternalFuture#get get()} method after all
- * futures complete or fail. Inner exception will contain configurations of 
failed services.
+ * Service deployment compound future. If any exceptions are thrown during 
deployment, then {@link
+ * IgniteCheckedException} with {@link ServiceDeploymentException} as a cause 
will be thrown from {@link
+ * IgniteInternalFuture#get get()} method after all futures complete or fail. 
Inner exception will contain
+ * configurations of failed services.
  */
 public class GridServiceDeploymentCompoundFuture extends 
GridCompoundFuture<Object, Object> {
-    /** */
-    private final boolean allOrNone;
-
-    /** Kernal context. */
-    private final GridKernalContext ctx;
-
-    /** Logger. */
-    private final IgniteLogger log;
-
     /** Names of services written to cache during current deployment. */
     private Collection<String> svcsToRollback;
 
     /** */
     private volatile ServiceDeploymentException err;
 
-    /**
-     * @param allOrNone Failing policy.
-     * @param ctx Kernal context.
-     */
-    GridServiceDeploymentCompoundFuture(boolean allOrNone, GridKernalContext 
ctx) {
-        this.allOrNone = allOrNone;
-        this.ctx = ctx;
-        this.log = ctx.log(getClass());
-    }
-
     /** {@inheritDoc} */
     @Override protected boolean processFailure(Throwable err, 
IgniteInternalFuture<Object> fut) {
         assert fut instanceof GridServiceDeploymentFuture : fut;
 
         GridServiceDeploymentFuture depFut = (GridServiceDeploymentFuture)fut;
 
-        if (allOrNone) {
-            if (initialized()) {
-                onDone(new IgniteCheckedException(
-                    new ServiceDeploymentException("Failed to deploy provided 
services.", err, getConfigurations())));
-            }
-            else {
-                synchronized (this) {
-                    if (this.err == null) {
-                        this.err = new ServiceDeploymentException("Failed to 
deploy provided services.", err,
-                            new ArrayList<ServiceConfiguration>());
-                    }
-                    else
-                        this.err.addSuppressed(err);
-                }
+        synchronized (this) {
+            if (this.err == null) {
+                this.err = new ServiceDeploymentException("Failed to deploy 
some services.",
+                    new ArrayList<ServiceConfiguration>());
             }
-        }
-        else {
-            synchronized (this) {
-                if (this.err == null)
-                    this.err = new ServiceDeploymentException("Failed to 
deploy some services.",
-                        new ArrayList<ServiceConfiguration>());
 
-                this.err.getFailedConfigurations().add(depFut.configuration());
-                this.err.addSuppressed(err);
-            }
+            this.err.getFailedConfigurations().add(depFut.configuration());
+            this.err.addSuppressed(err);
         }
 
         return true;
     }
 
-    /**
-     * Marks this future as initialized. Will complete with error if failures 
before initialization occurred and
-     * all-or-none policy is followed.
-     */
-    public void serviceDeploymentMarkInitialized() {
-        if (allOrNone && this.err != null) {
-            this.err.getFailedConfigurations().addAll(getConfigurations());
-
-            onDone(new IgniteCheckedException(this.err));
-        }
-        else
-            super.markInitialized();
-    }
-
     /** {@inheritDoc} */
-    @Override protected boolean onDone(@Nullable final Object res, @Nullable 
Throwable err, final boolean cancel) {
-        final Throwable resErr;
-
+    @Override protected boolean onDone(@Nullable Object res, @Nullable 
Throwable err, boolean cancel) {
         if (err == null && this.err != null)
-            resErr = new IgniteCheckedException(this.err);
-        else
-            resErr = err;
-
-        if (allOrNone && this.err != null && svcsToRollback != null) {
-            U.warn(log, "Failed to deploy provided services. The following 
services will be cancelled:" + svcsToRollback);
-
-            IgniteInternalFuture<?> fut = 
ctx.service().cancelAll(svcsToRollback);
-
-            /*
-            Can not call fut.get() since it is possible we are in system pool 
now and
-            fut also should be completed from system pool.
-             */
-            fut.listen(new IgniteInClosure<IgniteInternalFuture>() {
-                @Override public void apply(IgniteInternalFuture fut) {
-                    try {
-                        fut.get();
-                    }
-                    catch (IgniteCheckedException e) {
-                        U.error(log, "Failed to cancel deployed services.", e);
-                    }
-                    finally {
-                        svcsToRollback = null;
-                    }
-
-                    GridServiceDeploymentCompoundFuture.super.onDone(res, 
resErr, cancel);
-                }
-            });
-
-            return false;
-        }
+            err = new IgniteCheckedException(this.err);
 
-        return super.onDone(res, resErr, cancel);
+        return super.onDone(res, err, cancel);
     }
 
     /**
@@ -180,18 +91,4 @@ public class GridServiceDeploymentCompoundFuture extends 
GridCompoundFuture<Obje
         else
             return Collections.emptyList();
     }
-
-    /**
-     * @return Collection of configurations, stored in child futures.
-     */
-    private Collection<ServiceConfiguration> getConfigurations() {
-        Collection<IgniteInternalFuture<Object>> futs = futures();
-
-        List<ServiceConfiguration> cfgs = new ArrayList<>(futs.size());
-
-        for (IgniteInternalFuture<Object> fut : futs)
-            cfgs.add(((GridServiceDeploymentFuture)fut).configuration());
-
-        return cfgs;
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/91cf66e7/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index f750053..9272760 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -270,7 +270,7 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
                     
c.setNodeFilter(ctx.cluster().get().forServers().predicate());
             }
 
-            deployAll(Arrays.asList(cfgs), true).get();
+            deployAll(Arrays.asList(cfgs)).get();
         }
 
         if (log.isDebugEnabled())
@@ -495,10 +495,9 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
 
     /**
      * @param cfgs Service configurations.
-     * @param allOrNone Failure processing policy.
      * @return Configurations to deploy.
      */
-    private PreparedConfigurations 
prepareServiceConfigurations(Collection<ServiceConfiguration> cfgs, boolean 
allOrNone) {
+    private PreparedConfigurations 
prepareServiceConfigurations(Collection<ServiceConfiguration> cfgs) {
         List<ServiceConfiguration> cfgsCp = new ArrayList<>(cfgs.size());
 
         Marshaller marsh = ctx.config().getMarshaller();
@@ -545,40 +544,28 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
             }
 
             if (err != null) {
-                if (allOrNone) {
-                    return new PreparedConfigurations(null,
-                        null,
-                        new IgniteCheckedException(
-                            new ServiceDeploymentException("None of the 
provided services were deplyed.", err, cfgs)));
-                }
-                else {
-                    if (failedFuts == null)
-                        failedFuts = new ArrayList<>();
+                if (failedFuts == null)
+                    failedFuts = new ArrayList<>();
 
-                    GridServiceDeploymentFuture fut = new 
GridServiceDeploymentFuture(cfg);
+                GridServiceDeploymentFuture fut = new 
GridServiceDeploymentFuture(cfg);
 
-                    fut.onDone(err);
+                fut.onDone(err);
 
-                    failedFuts.add(fut);
-                }
+                failedFuts.add(fut);
             }
         }
 
-        return new PreparedConfigurations(cfgsCp, failedFuts, null);
+        return new PreparedConfigurations(cfgsCp, failedFuts);
     }
 
     /**
      * @param cfgs Service configurations.
-     * @param allOrNone Failure processing policy.
      * @return Future for deployment.
      */
-    public IgniteInternalFuture<?> deployAll(Collection<ServiceConfiguration> 
cfgs, boolean allOrNone) {
+    public IgniteInternalFuture<?> deployAll(Collection<ServiceConfiguration> 
cfgs) {
         assert cfgs != null;
 
-        PreparedConfigurations srvCfg = prepareServiceConfigurations(cfgs, 
allOrNone);
-
-        if (srvCfg.err != null)
-            return new GridFinishedFuture<>(srvCfg.err);
+        PreparedConfigurations srvCfg = prepareServiceConfigurations(cfgs);
 
         List<ServiceConfiguration> cfgsCp = srvCfg.cfgs;
 
@@ -593,7 +580,7 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
         GridServiceDeploymentCompoundFuture res;
 
         while (true) {
-            res = new GridServiceDeploymentCompoundFuture(allOrNone, ctx);
+            res = new GridServiceDeploymentCompoundFuture();
 
             if (ctx.deploy().enabled())
                 ctx.cache().context().deploy().ignoreOwnership(true);
@@ -610,16 +597,8 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
                             catch (IgniteCheckedException e) {
                                 if (X.hasCause(e, 
ClusterTopologyCheckedException.class))
                                     throw e; // Retry.
-
-                                if (allOrNone) {
-                                    for (String name : 
res.servicesToRollback())
-                                        depFuts.remove(name).onDone(e);
-
-                                    res.onDone(new IgniteCheckedException(new 
ServiceDeploymentException(
-                                        "Failed to deploy provided services.", 
e, cfgs)));
-
-                                    return res;
-                                }
+                                else
+                                    U.error(log, e.getMessage());
                             }
                         }
 
@@ -653,7 +632,7 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
         if (ctx.clientDisconnected()) {
             IgniteClientDisconnectedCheckedException err =
                 new 
IgniteClientDisconnectedCheckedException(ctx.cluster().clientReconnectFuture(),
-                "Failed to deploy services, client node disconnected: " + 
cfgs);
+                    "Failed to deploy services, client node disconnected: " + 
cfgs);
 
             for (String name : res.servicesToRollback()) {
                 GridServiceDeploymentFuture fut = depFuts.remove(name);
@@ -670,7 +649,7 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
                 res.add(fut, false);
         }
 
-        res.serviceDeploymentMarkInitialized();
+        res.markInitialized();
 
         return res;
     }
@@ -707,12 +686,8 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
 
             if (dep != null) {
                 if (!dep.configuration().equalsIgnoreNodeFilter(cfg)) {
-                    String err = "Failed to deploy service (service already 
exists with different " +
-                        "configuration) [deployed=" + dep.configuration() + ", 
new=" + cfg + ']';
-
-                    U.error(log, err);
-
-                    throw new IgniteCheckedException(err);
+                    throw new IgniteCheckedException("Failed to deploy service 
(service already exists with " +
+                        "different configuration) [deployed=" + 
dep.configuration() + ", new=" + cfg + ']');
                 }
                 else {
                     res.add(fut, false);
@@ -755,7 +730,7 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
     public IgniteInternalFuture<?> deploy(ServiceConfiguration cfg) {
         A.notNull(cfg, "cfg");
 
-        return deployAll(Collections.singleton(cfg), false);
+        return deployAll(Collections.singleton(cfg));
     }
 
     /**
@@ -771,7 +746,8 @@ public class GridServiceProcessor extends 
GridProcessorAdapter implements Ignite
                 if (X.hasCause(e, ClusterTopologyCheckedException.class)) {
                     if (log.isDebugEnabled())
                         log.debug("Topology changed while cancelling service 
(will retry): " + e.getMessage());
-                } else {
+                }
+                else {
                     U.error(log, "Failed to undeploy service: " + name, e);
 
                     return new GridFinishedFuture<>(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/91cf66e7/modules/core/src/main/java/org/apache/ignite/internal/processors/service/PreparedConfigurations.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/PreparedConfigurations.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/PreparedConfigurations.java
index a581e15..dc41c22 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/PreparedConfigurations.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/PreparedConfigurations.java
@@ -31,19 +31,13 @@ class PreparedConfigurations {
     /** */
     final List<GridServiceDeploymentFuture> failedFuts;
 
-    /** */
-    final Exception err;
-
     /**
      * @param cfgs Configurations to deploy.
      * @param failedFuts Finished futures for failed configurations.
-     * @param err Error if need to stop deploy.
      */
-    PreparedConfigurations(List<ServiceConfiguration> cfgs, 
List<GridServiceDeploymentFuture> failedFuts,
-        Exception err) {
+    PreparedConfigurations(List<ServiceConfiguration> cfgs, 
List<GridServiceDeploymentFuture> failedFuts) {
         this.cfgs = cfgs;
         this.failedFuts = failedFuts;
-        this.err = err;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/91cf66e7/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java
index ca95198..bcc0504 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceDeploymentCompoundFutureSelfTest.java
@@ -22,9 +22,7 @@ import java.util.Collection;
 import java.util.List;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
-import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.services.ServiceConfiguration;
@@ -33,16 +31,6 @@ import 
org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 /** */
 public class GridServiceDeploymentCompoundFutureSelfTest extends 
GridCommonAbstractTest {
-    /** */
-    private static GridKernalContext ctx;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        IgniteKernal kernal = (IgniteKernal)startGrid(0);
-
-        ctx = kernal.context();
-    }
-
     /** {@inheritDoc} */
     @Override protected void afterTestsStopped() throws Exception {
         stopAllGrids();
@@ -51,8 +39,8 @@ public class GridServiceDeploymentCompoundFutureSelfTest 
extends GridCommonAbstr
     /**
      * @throws Exception If failed.
      */
-    public void testWaitForCompletionOnFailingFuturePartial() throws Exception 
{
-        GridServiceDeploymentCompoundFuture compFut = new 
GridServiceDeploymentCompoundFuture(false, ctx);
+    public void testWaitForCompletionOnFailingFuture() throws Exception {
+        GridServiceDeploymentCompoundFuture compFut = new 
GridServiceDeploymentCompoundFuture();
 
         int failingFutsNum = 2;
 
@@ -80,7 +68,7 @@ public class GridServiceDeploymentCompoundFutureSelfTest 
extends GridCommonAbstr
             compFut.add(fut);
         }
 
-        compFut.serviceDeploymentMarkInitialized();
+        compFut.markInitialized();
 
         List<Exception> causes = new ArrayList<>();
 
@@ -126,109 +114,6 @@ public class GridServiceDeploymentCompoundFutureSelfTest 
extends GridCommonAbstr
     }
 
     /**
-     * @throws Exception if failed.
-     */
-    public void testFailAllAfterInitialized() throws Exception {
-        GridServiceDeploymentCompoundFuture compFut = new 
GridServiceDeploymentCompoundFuture(true, ctx);
-
-        ServiceConfiguration failingCfg = config("Failed");
-
-        GridServiceDeploymentFuture failingFut = new 
GridServiceDeploymentFuture(failingCfg);
-
-        compFut.add(failingFut);
-
-        int futsNum = 5;
-
-        List<ServiceConfiguration> cfgs = new ArrayList<>(futsNum + 1);
-
-        cfgs.add(failingCfg);
-
-        for (int i = 0; i < futsNum; i++) {
-            ServiceConfiguration cfg = config(String.valueOf(i));
-
-            cfgs.add(cfg);
-
-            compFut.add(new GridServiceDeploymentFuture(cfg));
-        }
-
-        compFut.serviceDeploymentMarkInitialized();
-
-        Exception expCause = new Exception("Test error");
-
-        failingFut.onDone(expCause);
-
-        assertFailAll(compFut, cfgs, expCause);
-    }
-
-    /**
-     * @throws Exception if failed.
-     */
-    public void testFailAllBeforeInitialized() throws Exception {
-        GridServiceDeploymentCompoundFuture compFut = new 
GridServiceDeploymentCompoundFuture(true, ctx);
-
-        ServiceConfiguration failingCfg = config("Failed");
-
-        GridServiceDeploymentFuture failingFut = new 
GridServiceDeploymentFuture(failingCfg);
-
-        Exception expCause = new Exception("Test error");
-
-        failingFut.onDone(expCause);
-
-        compFut.add(failingFut);
-
-        assertFalse(compFut.isDone());
-
-        int futsNum = 5;
-
-        List<ServiceConfiguration> cfgs = new ArrayList<>(futsNum + 1);
-
-        cfgs.add(failingCfg);
-
-        for (int i = 0; i < futsNum; i++) {
-            ServiceConfiguration cfg = config(String.valueOf(i));
-
-            cfgs.add(cfg);
-
-            compFut.add(new GridServiceDeploymentFuture(cfg));
-        }
-
-        compFut.serviceDeploymentMarkInitialized();
-
-        assertFailAll(compFut, cfgs, expCause);
-    }
-
-    /**
-     * Try waiting for the future completion and check that a proper exception 
is thrown.
-     *
-     * @param fut Future.
-     * @param expCfgs Expected cfgs.
-     * @param expCause Expected cause.
-     */
-    private void assertFailAll(GridServiceDeploymentCompoundFuture fut, 
Collection<ServiceConfiguration> expCfgs,
-        Exception expCause) {
-        try {
-            fut.get();
-
-            fail("Should never reach here.");
-        }
-        catch (IgniteCheckedException ce) {
-            log.info("Expected exception: " + ce.getMessage());
-
-            IgniteException e = U.convertException(ce);
-
-            assertTrue(e instanceof ServiceDeploymentException);
-
-            assertEqualsCollections(expCfgs, 
((ServiceDeploymentException)e).getFailedConfigurations());
-
-            Throwable actCause = e.getCause();
-
-            assertTrue(actCause instanceof IgniteCheckedException);
-
-            assertEquals(expCause, actCause.getCause());
-        }
-    }
-
-    /**
      * @param name Name.
      * @return Dummy configuration with a specified name.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/91cf66e7/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
index dc19f33..f0e2e71 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorBatchDeploySelfTest.java
@@ -100,7 +100,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         subscribeExeLatch(cfgs, latch);
 
-        client.services().deployAll(cfgs, false);
+        client.services().deployAll(cfgs);
 
         assertTrue("Waiting for services deployment timed out.", 
latch.await(30, TimeUnit.SECONDS));
 
@@ -119,7 +119,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         subscribeExeLatch(cfgs, latch);
 
-        IgniteFuture<Void> fut = client.services().deployAllAsync(cfgs, false);
+        IgniteFuture<Void> fut = client.services().deployAllAsync(cfgs);
 
         fut.get();
 
@@ -129,7 +129,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
     }
 
     /**
-     * TODO: enable when IGNITE-6259 is fixed
+     * TODO: enable when IGNITE-6259 is fixed.
      *
      * @throws Exception If failed.
      */
@@ -166,7 +166,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
             while (from < numServices) {
                 int to = Math.min(numServices, from + batchSize);
 
-                client.services().deployAllAsync(cfgs.subList(from, to), 
false).get(5000);
+                client.services().deployAllAsync(cfgs.subList(from, 
to)).get(5000);
 
                 from = to;
             }
@@ -183,7 +183,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
     }
 
     /**
-     * TODO: enable when IGNITE-6259 is fixed
+     * TODO: enable when IGNITE-6259 is fixed.
      *
      * @throws Exception If failed.
      */
@@ -231,7 +231,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
                 failingCfgs.add(failingCfg);
 
                 try {
-                    client.services().deployAllAsync(cfgsBatch, 
false).get(5000);
+                    client.services().deployAllAsync(cfgsBatch).get(5000);
 
                     fail("Should never reach here.");
                 }
@@ -264,37 +264,22 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
     /**
      * @throws Exception If failed.
      */
-    public void testDeployAllFailAll() throws Exception {
-        deployAllFail(false, true);
+    public void testDeployAllFail() throws Exception {
+        deployAllFail(false);
     }
 
     /**
      * @throws Exception If failed.
      */
-    public void testDeployAllPartial() throws Exception {
-        deployAllFail(false, false);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDeployAllAsyncFailAll() throws Exception {
-        deployAllFail(true, true);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDeployAllAsyncFailPartial() throws Exception {
-        deployAllFail(true, false);
+    public void testDeployAllAsyncFail() throws Exception {
+        deployAllFail(true);
     }
 
     /**
      * @param async If {@code true}, then asynchronous method of deployment 
will be performed.
-     * @param allOrNone Failing strategy.
      * @throws Exception If failed.
      */
-    private void deployAllFail(boolean async, boolean allOrNone) throws 
Exception {
+    private void deployAllFail(boolean async) throws Exception {
         Ignite client = grid(CLIENT_NODE_NAME);
 
         CountDownLatch latch = new CountDownLatch(NUM_SERVICES - 1);
@@ -307,20 +292,11 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         failingCfg.setName(null);
 
-        assertFailingDeploy(client, async, allOrNone, cfgs, failingCfg);
+        assertFailingDeploy(client, async, cfgs, failingCfg);
 
-        if (allOrNone) {
-            assertFalse("Some of the services were deployed.", latch.await(2, 
TimeUnit.SECONDS));
-
-            assertEquals(NUM_SERVICES - 1, latch.getCount());
-
-            assertTrue(client.services().serviceDescriptors().isEmpty());
-        }
-        else {
-            assertTrue("Waiting for services deployment timed out.", 
latch.await(30, TimeUnit.SECONDS));
+        assertTrue("Waiting for services deployment timed out.", 
latch.await(30, TimeUnit.SECONDS));
 
-            assertDeployedServices(client, cfgs.subList(0, cfgs.size() - 1));
-        }
+        assertDeployedServices(client, cfgs.subList(0, cfgs.size() - 1));
     }
 
     /**
@@ -338,8 +314,8 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
         List<ServiceConfiguration> fstBatch = cfgs.subList(0, NUM_SERVICES / 
2);
         List<ServiceConfiguration> sndBatch = cfgs.subList(NUM_SERVICES / 4, 
NUM_SERVICES);
 
-        IgniteFuture<Void> fstFut = client.services().deployAllAsync(fstBatch, 
false);
-        IgniteFuture<Void> sndFut = client.services().deployAllAsync(sndBatch, 
false);
+        IgniteFuture<Void> fstFut = client.services().deployAllAsync(fstBatch);
+        IgniteFuture<Void> sndFut = client.services().deployAllAsync(sndBatch);
 
         fstFut.get();
         sndFut.get();
@@ -352,32 +328,12 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
     /**
      * @throws Exception If failed.
      */
-    public void testClashingNamesFailAll() throws Exception {
-        clashingNamesFail(true);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClashingNamesPartial() throws Exception {
-        clashingNamesFail(false);
-    }
-
-    /**
-     * @param allOrNone Failing strategy.
-     * @throws Exception If failed.
-     */
-    private void clashingNamesFail(boolean allOrNone) throws Exception {
+    public void testClashingNamesFail() throws Exception {
         Ignite client = grid(CLIENT_NODE_NAME);
 
         List<ServiceConfiguration> cfgs = 
getConfigs(client.cluster().forServers().predicate(), NUM_SERVICES);
 
-        int numDepSvcs;
-
-        if (allOrNone)
-            numDepSvcs = NUM_SERVICES / 2;
-        else
-            numDepSvcs = NUM_SERVICES - 1;
+        int numDepSvcs = NUM_SERVICES - 1;
 
         CountDownLatch latch = new CountDownLatch(numDepSvcs);
 
@@ -386,13 +342,13 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         subscribeExeLatch(cfgs, latch);
 
-        IgniteFuture<Void> fut = client.services().deployAllAsync(fstBatch, 
false);
+        IgniteFuture<Void> fut = client.services().deployAllAsync(fstBatch);
 
         ServiceConfiguration failingCfg = cfgs.get(NUM_SERVICES - 1);
 
         failingCfg.setName(null);
 
-        assertFailingDeploy(client, false, allOrNone, sndBatch, failingCfg);
+        assertFailingDeploy(client, false, sndBatch, failingCfg);
 
         fut.get();
 
@@ -404,33 +360,12 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
     /**
      * @throws Exception If failed.
      */
-    public void testClashingNameDifferentConfigFailAll() throws Exception {
-        testClashingNameDifferentConfig(true);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClashingNameDifferentConfigPartial() throws Exception {
-        testClashingNameDifferentConfig(false);
-    }
-
-    /**
-     * @param allOrNone Failing strategy.
-     * @throws Exception If failed.
-     */
-    private void testClashingNameDifferentConfig(boolean allOrNone) throws 
Exception {
+    public void testClashingNameDifferentConfig() throws Exception {
         Ignite client = grid(CLIENT_NODE_NAME);
 
         List<ServiceConfiguration> cfgs = 
getConfigs(client.cluster().forServers().predicate(), NUM_SERVICES);
 
-        int numDepSvcs;
-
-        if (allOrNone)
-            numDepSvcs = NUM_SERVICES / 2;
-        else
-            numDepSvcs = NUM_SERVICES - 1;
-
+        int numDepSvcs = NUM_SERVICES - 1;
 
         CountDownLatch latch = new CountDownLatch(numDepSvcs);
 
@@ -439,7 +374,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         subscribeExeLatch(cfgs, latch);
 
-        client.services().deployAll(fstBatch, false);
+        client.services().deployAll(fstBatch);
 
         ServiceConfiguration failingCfg = copyService(cfgs.get(NUM_SERVICES - 
1));
 
@@ -449,7 +384,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         sndBatch.add(failingCfg);
 
-        assertFailingDeploy(client, false, allOrNone, sndBatch, failingCfg);
+        assertFailingDeploy(client, false, sndBatch, failingCfg);
 
         assertTrue("Waiting for services deployment timed out.", 
latch.await(30, TimeUnit.SECONDS));
 
@@ -468,7 +403,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         subscribeExeLatch(cfgs, latch);
 
-        client.services().deployAll(cfgs, true);
+        client.services().deployAll(cfgs);
 
         latch.await(30, TimeUnit.SECONDS);
 
@@ -489,7 +424,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         subscribeExeLatch(cfgs, latch);
 
-        client.services().deployAll(cfgs, true);
+        client.services().deployAll(cfgs);
 
         latch.await(30, TimeUnit.SECONDS);
 
@@ -501,7 +436,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
     }
 
     /**
-     * TODO: enable when IGNITE-6259 is fixed
+     * TODO: enable when IGNITE-6259 is fixed.
      *
      * @throws Exception If failed.
      */
@@ -516,7 +451,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         subscribeExeLatch(cfgs, latch);
 
-        client.services().deployAll(cfgs, true);
+        client.services().deployAll(cfgs);
 
         latch.await(30, TimeUnit.SECONDS);
 
@@ -564,7 +499,7 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
 
         subscribeExeLatch(cfgs, latch);
 
-        client.services().deployAll(cfgs, true);
+        client.services().deployAll(cfgs);
 
         latch.await(30, TimeUnit.SECONDS);
 
@@ -595,35 +530,29 @@ public class GridServiceProcessorBatchDeploySelfTest 
extends GridCommonAbstractT
      * @param client Client.
      * @param async If {@code true}, then async version of deploy method will 
be used.
      * @param cfgs Service configurations.
-     * @param allOrNone Failing policy.
      * @param failingCfg Configuration of the failing service.
      * @throws Exception If failed.
      */
-    private void assertFailingDeploy(Ignite client, boolean async, boolean 
allOrNone, List<ServiceConfiguration> cfgs,
+    private void assertFailingDeploy(Ignite client, boolean async, 
List<ServiceConfiguration> cfgs,
         ServiceConfiguration failingCfg) throws Exception {
 
         IgniteFuture<Void> fut = null;
 
         if (async)
-            fut = client.services().deployAllAsync(cfgs, allOrNone);
+            fut = client.services().deployAllAsync(cfgs);
 
         try {
             if (async)
                 fut.get();
             else
-                client.services().deployAll(cfgs, allOrNone);
+                client.services().deployAll(cfgs);
 
             fail("Should never reach here.");
         }
         catch (ServiceDeploymentException e) {
             info("Expected exception: " + e.getMessage());
 
-            Collection<ServiceConfiguration> expFails;
-
-            if (allOrNone)
-                expFails = cfgs;
-            else
-                expFails = Collections.singleton(failingCfg);
+            Collection<ServiceConfiguration> expFails = 
Collections.singleton(failingCfg);
 
             Collection<ServiceConfiguration> actFails = 
e.getFailedConfigurations();
 

Reply via email to