ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject ambari git commit: AMBARI-14259. Save on Repositories dialog box not working (ncole)
Date Fri, 11 Dec 2015 13:30:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 d4560f5a9 -> 45dd43758


AMBARI-14259. Save on Repositories dialog box not working (ncole)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/45dd4375
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/45dd4375
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/45dd4375

Branch: refs/heads/branch-2.2
Commit: 45dd43758ae4bea4c87f2595539d63b2eb213f50
Parents: d4560f5
Author: Nate Cole <ncole@hortonworks.com>
Authored: Fri Dec 11 08:07:28 2015 -0500
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Fri Dec 11 08:29:23 2015 -0500

----------------------------------------------------------------------
 .../RepositoryVersionResourceProvider.java         | 17 +++--------------
 .../RepositoryVersionResourceProviderTest.java     | 10 +++++++---
 2 files changed, 10 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/45dd4375/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
index 145ad7d..de5d94c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
@@ -26,7 +26,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import com.google.inject.Provider;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ObjectNotFoundException;
 import org.apache.ambari.server.api.resources.OperatingSystemResourceDefinition;
@@ -65,6 +64,8 @@ import org.apache.commons.lang.StringUtils;
 import com.google.common.collect.Lists;
 import com.google.gson.Gson;
 import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.persist.Transactional;
 
 /**
  * Resource provider for repository versions resources.
@@ -248,19 +249,7 @@ public class RepositoryVersionResourceProvider extends AbstractResourceProvider
             throw new ObjectNotFoundException("There is no repository version with id " +
id);
           }
 
-          // Prevent changing repo version if there's already a cluster version that has
performed some meaningful action on it.
-          StackEntity stackEntity = entity.getStack();
-          String stackName = stackEntity.getStackName();
-          String stackVersion = stackEntity.getStackVersion();
-
-          final List<ClusterVersionEntity> clusterVersionEntities = clusterVersionDAO.findByStackAndVersion(
-              stackName, stackVersion, entity.getVersion());
-
-          if (!clusterVersionEntities.isEmpty()) {
-            final ClusterVersionEntity firstClusterVersion = clusterVersionEntities.get(0);
-            throw new AmbariException("Upgrade pack can't be changed for repository version
which has a state of " +
-              firstClusterVersion.getState().name() + " on cluster " + firstClusterVersion.getClusterEntity().getClusterName());
-          }
+          List<OperatingSystemEntity> operatingSystemEntities = null;
 
           if (StringUtils.isNotBlank(ObjectUtils.toString(propertyMap.get(SUBRESOURCE_OPERATING_SYSTEMS_PROPERTY_ID))))
{
             final Object operatingSystems = propertyMap.get(SUBRESOURCE_OPERATING_SYSTEMS_PROPERTY_ID);

http://git-wip-us.apache.org/repos/asf/ambari/blob/45dd4375/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java
index 493cfbb..5b49a16 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java
@@ -27,8 +27,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import junit.framework.Assert;
-
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.ResourceProviderFactory;
 import org.apache.ambari.server.controller.predicate.AndPredicate;
@@ -44,6 +42,8 @@ import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
 import org.apache.ambari.server.orm.dao.StackDAO;
 import org.apache.ambari.server.orm.entities.ClusterEntity;
 import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
+import org.apache.ambari.server.orm.entities.OperatingSystemEntity;
+import org.apache.ambari.server.orm.entities.RepositoryEntity;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.Clusters;
@@ -58,6 +58,8 @@ import org.junit.Test;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
 
 import com.google.common.collect.Sets;
 import com.google.gson.Gson;
@@ -65,6 +67,8 @@ import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.persist.PersistService;
 
+import junit.framework.Assert;
+
 /**
  * RepositoryVersionResourceProvider tests.
  */
@@ -428,8 +432,8 @@ public class RepositoryVersionResourceProviderTest {
 
     try {
       provider.updateResources(updateRequest, new AndPredicate(predicateStackName, predicateStackVersion));
-      Assert.fail("Update of upgrade pack should not be allowed when repo version is installed
on any cluster");
     } catch (Exception ex) {
+      Assert.fail("Update of repository should be allowed when repo version is installed
on any cluster");
     }
   }
 


Mime
View raw message