|
@@ -40,8 +40,22 @@ import org.apache.ambari.server.controller.MaintenanceStateHelper;
|
|
|
import org.apache.ambari.server.orm.DBAccessor;
|
|
|
import org.apache.ambari.server.orm.GuiceJpaInitializer;
|
|
|
import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
|
|
|
-import org.apache.ambari.server.orm.dao.*;
|
|
|
-import org.apache.ambari.server.orm.entities.*;
|
|
|
+import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
|
|
|
+import org.apache.ambari.server.orm.dao.ArtifactDAO;
|
|
|
+import org.apache.ambari.server.orm.dao.ClusterDAO;
|
|
|
+import org.apache.ambari.server.orm.dao.ClusterVersionDAO;
|
|
|
+import org.apache.ambari.server.orm.dao.DaoUtils;
|
|
|
+import org.apache.ambari.server.orm.dao.HostVersionDAO;
|
|
|
+import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
|
|
|
+import org.apache.ambari.server.orm.dao.StackDAO;
|
|
|
+import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
|
|
|
+import org.apache.ambari.server.orm.entities.ArtifactEntity;
|
|
|
+import org.apache.ambari.server.orm.entities.ClusterEntity;
|
|
|
+import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
|
|
|
+import org.apache.ambari.server.orm.entities.HostEntity;
|
|
|
+import org.apache.ambari.server.orm.entities.HostVersionEntity;
|
|
|
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
|
|
|
+import org.apache.ambari.server.orm.entities.StackEntity;
|
|
|
import org.apache.ambari.server.stack.StackManagerFactory;
|
|
|
import org.apache.ambari.server.state.Cluster;
|
|
|
import org.apache.ambari.server.state.Clusters;
|
|
@@ -52,7 +66,10 @@ import org.apache.ambari.server.state.SecurityType;
|
|
|
import org.apache.ambari.server.state.Service;
|
|
|
import org.apache.ambari.server.state.StackId;
|
|
|
import org.apache.ambari.server.state.StackInfo;
|
|
|
-import org.apache.ambari.server.state.kerberos.*;
|
|
|
+import org.apache.ambari.server.state.kerberos.KerberosComponentDescriptor;
|
|
|
+import org.apache.ambari.server.state.kerberos.KerberosDescriptor;
|
|
|
+import org.apache.ambari.server.state.kerberos.KerberosDescriptorFactory;
|
|
|
+import org.apache.ambari.server.state.kerberos.KerberosServiceDescriptor;
|
|
|
import org.apache.ambari.server.state.stack.OsFamily;
|
|
|
import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper;
|
|
|
import org.easymock.Capture;
|
|
@@ -77,6 +94,8 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import static junit.framework.Assert.assertNotNull;
|
|
|
+import static junit.framework.Assert.assertNull;
|
|
|
import static org.easymock.EasyMock.anyLong;
|
|
|
import static org.easymock.EasyMock.anyObject;
|
|
|
import static org.easymock.EasyMock.capture;
|
|
@@ -90,9 +109,6 @@ import static org.easymock.EasyMock.replay;
|
|
|
import static org.easymock.EasyMock.reset;
|
|
|
import static org.easymock.EasyMock.verify;
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
-
|
|
|
-import static junit.framework.Assert.assertNotNull;
|
|
|
-import static junit.framework.Assert.assertNull;
|
|
|
/**
|
|
|
* {@link org.apache.ambari.server.upgrade.UpgradeCatalog213} unit tests.
|
|
|
*/
|
|
@@ -589,6 +605,26 @@ public class UpgradeCatalog213Test {
|
|
|
easyMockSupport.verifyAll();
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testUpdateAmsHbaseEnvContent() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
|
|
+ Method updateAmsHbaseEnvContent = UpgradeCatalog213.class.getDeclaredMethod("updateAmsHbaseEnvContent", String.class);
|
|
|
+ UpgradeCatalog213 upgradeCatalog213 = new UpgradeCatalog213(injector);
|
|
|
+ String oldContent = "export HBASE_CLASSPATH=${HBASE_CLASSPATH}\n" +
|
|
|
+ "\n" +
|
|
|
+ "# The maximum amount of heap to use, in MB. Default is 1000.\n" +
|
|
|
+ "export HBASE_HEAPSIZE={{hbase_heapsize}}\n";
|
|
|
+
|
|
|
+ String expectedContent = "export HBASE_CLASSPATH=${HBASE_CLASSPATH}\n" +
|
|
|
+ "\n" +
|
|
|
+ "# The maximum amount of heap to use, in MB. Default is 1000.\n" +
|
|
|
+ "#export HBASE_HEAPSIZE={{hbase_heapsize}}\n" +
|
|
|
+ "\n" +
|
|
|
+ "# The maximum amount of heap to use for hbase shell.\n" +
|
|
|
+ "export HBASE_SHELL_OPTS=\"-Xmx256m\"\n";
|
|
|
+ String result = (String) updateAmsHbaseEnvContent.invoke(upgradeCatalog213, oldContent);
|
|
|
+ Assert.assertEquals(expectedContent, result);
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void testAmsSiteUpdateConfigs() throws Exception{
|
|
|
|