ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject ambari git commit: Revert "AMBARI-13629. Oozie service have required, empty configs:oozie.authentication.kerberos.name.rules (after upgrade from 2.1.1 to 2.1.2.1). Compilation failure. (dsen)"
Date Fri, 30 Oct 2015 03:35:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1.2 e8594069a -> 38f6b0438


Revert "AMBARI-13629. Oozie service have required, empty configs:oozie.authentication.kerberos.name.rules
(after upgrade from 2.1.1 to 2.1.2.1). Compilation failure. (dsen)"

This reverts commit ffff5538efeab6bd40d885f6e9c54dffab402a84.


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

Branch: refs/heads/branch-2.1.2
Commit: 38f6b04383c531c37ef2dfda01f2924e4b279840
Parents: e859406
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Thu Oct 29 20:34:37 2015 -0700
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Thu Oct 29 20:34:37 2015 -0700

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog2121.java      | 25 -------
 .../server/upgrade/UpgradeCatalog2121Test.java  | 70 ++++----------------
 2 files changed, 13 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/38f6b043/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121.java
index be88597..ac06bb1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121.java
@@ -27,17 +27,13 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
 import org.apache.ambari.server.state.StackId;
-import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.sql.SQLException;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * Upgrade catalog for version 2.1.2.1
@@ -52,9 +48,6 @@ public class UpgradeCatalog2121 extends AbstractUpgradeCatalog {
   @Inject
   DaoUtils daoUtils;
 
-  private static final String OOZIE_SITE_CONFIG = "oozie-site";
-  private static final String OOZIE_AUTHENTICATION_KERBEROS_NAME_RULES = "oozie.authentication.kerberos.name.rules";
-
   // ----- Constructors ------------------------------------------------------
 
   /**
@@ -111,7 +104,6 @@ public class UpgradeCatalog2121 extends AbstractUpgradeCatalog {
   @Override
   protected void executeDMLUpdates() throws AmbariException, SQLException {
     updatePHDConfigs();
-    updateOozieConfigs();
   }
 
   /**
@@ -173,22 +165,5 @@ public class UpgradeCatalog2121 extends AbstractUpgradeCatalog {
       }
     }
   }
-
-  protected void updateOozieConfigs() throws AmbariException {
-    AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
-    for (final Cluster cluster : getCheckedClusterMap(ambariManagementController.getClusters()).values())
{
-      Config oozieSiteProps = cluster.getDesiredConfigByType(OOZIE_SITE_CONFIG);
-      if (oozieSiteProps != null) {
-        // Remove oozie.authentication.kerberos.name.rules if empty
-        String oozieAuthKerbRules = oozieSiteProps.getProperties().get(OOZIE_AUTHENTICATION_KERBEROS_NAME_RULES);
-        if (StringUtils.isBlank(oozieAuthKerbRules)) {
-          Set<String> removeProperties = new HashSet<String>();
-          removeProperties.add(OOZIE_AUTHENTICATION_KERBEROS_NAME_RULES);
-          updateConfigurationPropertiesForCluster(cluster, OOZIE_SITE_CONFIG, null, removeProperties,
true, false);
-        }
-      }
-    }
-
-  }
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/38f6b043/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121Test.java
index 3bef3a3..f6b1c78 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog2121Test.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.upgrade;
 
 import static junit.framework.Assert.assertEquals;
 import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.capture;
 import static org.easymock.EasyMock.createMockBuilder;
 import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.createStrictMock;
@@ -30,38 +31,44 @@ import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.reset;
 import static org.easymock.EasyMock.verify;
 
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.Collections;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Set;
 
 import javax.persistence.EntityManager;
 
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.orm.DBAccessor;
+import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
-import org.apache.ambari.server.orm.dao.DaoUtils;
 import org.apache.ambari.server.orm.dao.StackDAO;
 import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.*;
 import org.apache.ambari.server.state.stack.OsFamily;
+import org.easymock.Capture;
 import org.easymock.EasyMockSupport;
-import org.easymock.internal.MockBuilder;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
 import com.google.inject.AbstractModule;
+import com.google.inject.Binder;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
+import com.google.inject.Module;
 import com.google.inject.Provider;
 import com.google.inject.persist.PersistService;
-import org.powermock.core.classloader.annotations.PrepareForTest;
 
-@PrepareForTest(UpgradeCatalog2121.class)
+
 public class UpgradeCatalog2121Test {
   private Injector injector;
   private Provider<EntityManager> entityManagerProvider = createStrictMock(Provider.class);
@@ -93,17 +100,13 @@ public class UpgradeCatalog2121Test {
   @Test
   public void testExecuteDMLUpdates() throws Exception {
     Method updatePHDConfigs = UpgradeCatalog2121.class.getDeclaredMethod("updatePHDConfigs");
-    Method updateOozieConfigs = UpgradeCatalog2121.class.getDeclaredMethod("updateOozieConfigs");
 
     UpgradeCatalog2121 upgradeCatalog2121 = createMockBuilder(UpgradeCatalog2121.class)
         .addMockedMethod(updatePHDConfigs)
-        .addMockedMethod(updateOozieConfigs)
         .createMock();
 
     upgradeCatalog2121.updatePHDConfigs();
     expectLastCall().once();
-    upgradeCatalog2121.updateOozieConfigs();
-    expectLastCall().once();
 
     replay(upgradeCatalog2121);
 
@@ -111,52 +114,5 @@ public class UpgradeCatalog2121Test {
 
     verify(upgradeCatalog2121);
   }
-
-  @Test
-  public void testUpdateOozieConfigs() throws Exception {
-    EasyMockSupport easyMockSupport = new EasyMockSupport();
-    final AmbariManagementController mockAmbariManagementController = easyMockSupport.createNiceMock(AmbariManagementController.class);
-    final Clusters mockClusters = easyMockSupport.createStrictMock(Clusters.class);
-    final Cluster mockClusterExpected = easyMockSupport.createNiceMock(Cluster.class);
-    final Map<String, String> propertiesOozieSite = new HashMap<String, String>()
{{
-      put("oozie.authentication.kerberos.name.rules", " ");
-    }};
-    final Config oozieSiteConf = easyMockSupport.createNiceMock(Config.class);
-    final Injector mockInjector = Guice.createInjector(new AbstractModule() {
-      @Override
-      protected void configure() {
-        bind(AmbariManagementController.class).toInstance(mockAmbariManagementController);
-        bind(Clusters.class).toInstance(mockClusters);
-        bind(EntityManager.class).toInstance(entityManager);
-
-        bind(DBAccessor.class).toInstance(createNiceMock(DBAccessor.class));
-        bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
-      }
-    });
-    expect(mockAmbariManagementController.getClusters()).andReturn(mockClusters).once();
-    expect(mockClusters.getClusters()).andReturn(new HashMap<String, Cluster>() {{
-      put("normal", mockClusterExpected);
-    }}).atLeastOnce();
-    expect(mockClusterExpected.getDesiredConfigByType("oozie-site")).andReturn(oozieSiteConf).atLeastOnce();
-
-    expect(oozieSiteConf.getProperties()).andReturn(propertiesOozieSite).once();
-
-    UpgradeCatalog2121 upgradeCatalog2121 = createMockBuilder(UpgradeCatalog2121.class)
-            .withConstructor(Injector.class)
-            .withArgs(mockInjector)
-            .addMockedMethod("updateConfigurationPropertiesForCluster", Cluster.class, String.class,
-                    Map.class, Set.class, boolean.class, boolean.class)
-            .createMock();
-    upgradeCatalog2121.updateConfigurationPropertiesForCluster(mockClusterExpected,
-            "oozie-site", null, Collections.singleton("oozie.authentication.kerberos.name.rules"),
-            true, false);
-    expectLastCall().once();
-
-    easyMockSupport.replayAll();
-    replay(upgradeCatalog2121);
-    upgradeCatalog2121.updateOozieConfigs();
-    easyMockSupport.verifyAll();
-
-  }
 }
 


Mime
View raw message