You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/01/26 22:45:21 UTC

[18/50] ambari git commit: AMBARI-14774. Change logging level to INFO for unit tests. Unit tests fix. (mpapirkovskyy)

AMBARI-14774. Change logging level to INFO for unit tests. Unit tests fix. (mpapirkovskyy)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: c4f643ab9c6596da508c61de757fee05e3ff3568
Parents: 3765a39
Author: Myroslav Papirkovskyy <mp...@hortonworks.com>
Authored: Fri Jan 22 21:42:49 2016 +0200
Committer: Myroslav Papirkovskyy <mp...@hortonworks.com>
Committed: Fri Jan 22 21:46:37 2016 +0200

----------------------------------------------------------------------
 .../AmbariManagementControllerImplTest.java       | 18 +++++++++---------
 .../AmbariManagementControllerTest.java           |  5 ++---
 2 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c4f643ab/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
index 42e3b10..5838001 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
@@ -560,10 +560,10 @@ public class AmbariManagementControllerImplTest {
     expect(injector.getInstance(Gson.class)).andReturn(null);
     expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(null);
     expect(injector.getInstance(KerberosHelper.class)).andReturn(kerberosHelper);
-    expect(clusterRequest.getClusterName()).andReturn("clusterNew").times(4);
+    expect(clusterRequest.getClusterName()).andReturn("clusterNew").times(3);
     expect(clusterRequest.getClusterId()).andReturn(1L).times(6);
     expect(clusters.getClusterById(1L)).andReturn(cluster).times(2);
-    expect(cluster.getClusterName()).andReturn("clusterOld").times(2);
+    expect(cluster.getClusterName()).andReturn("clusterOld").times(1);
 
     cluster.addSessionAttributes(anyObject(Map.class));
     expectLastCall().once();
@@ -676,7 +676,7 @@ public class AmbariManagementControllerImplTest {
     expect(injector.getInstance(KerberosHelper.class)).andReturn(kerberosHelper);
     expect(clusterRequest.getClusterId()).andReturn(1L).times(6);
     expect(clusters.getClusterById(1L)).andReturn(cluster).times(2);
-    expect(cluster.getClusterName()).andReturn("cluster").times(2);
+    expect(cluster.getClusterName()).andReturn("cluster").times(1);
 
     cluster.addSessionAttributes(anyObject(Map.class));
     expectLastCall().once();
@@ -719,7 +719,7 @@ public class AmbariManagementControllerImplTest {
     expect(clusterRequest.getClusterId()).andReturn(1L).times(6);
     expect(clusterRequest.getSecurityType()).andReturn(SecurityType.KERBEROS).anyTimes();
     expect(clusters.getClusterById(1L)).andReturn(cluster).times(2);
-    expect(cluster.getClusterName()).andReturn("cluster").times(2);
+    expect(cluster.getClusterName()).andReturn("cluster").times(1);
     expect(cluster.getSecurityType()).andReturn(SecurityType.KERBEROS).anyTimes();
 
     cluster.addSessionAttributes(anyObject(Map.class));
@@ -766,7 +766,7 @@ public class AmbariManagementControllerImplTest {
     expect(clusterRequest.getClusterId()).andReturn(1L).times(6);
     expect(clusterRequest.getSecurityType()).andReturn(SecurityType.KERBEROS).anyTimes();
     expect(clusters.getClusterById(1L)).andReturn(cluster).times(2);
-    expect(cluster.getClusterName()).andReturn("cluster").times(2);
+    expect(cluster.getClusterName()).andReturn("cluster").times(1);
     expect(cluster.getSecurityType()).andReturn(SecurityType.NONE).anyTimes();
 
     cluster.addSessionAttributes(anyObject(Map.class));
@@ -847,7 +847,7 @@ public class AmbariManagementControllerImplTest {
     expect(clusterRequest.getClusterId()).andReturn(1L).times(6);
     expect(clusterRequest.getSecurityType()).andReturn(SecurityType.NONE).anyTimes();
     expect(clusters.getClusterById(1L)).andReturn(cluster).times(2);
-    expect(cluster.getClusterName()).andReturn("cluster").times(2);
+    expect(cluster.getClusterName()).andReturn("cluster").times(1);
     expect(cluster.getSecurityType()).andReturn(SecurityType.KERBEROS).anyTimes();
 
     cluster.addSessionAttributes(anyObject(Map.class));
@@ -902,7 +902,7 @@ public class AmbariManagementControllerImplTest {
     expect(clusterRequest.getSecurityType()).andReturn(SecurityType.NONE).anyTimes();
     expect(clusters.getClusterById(1L)).andReturn(cluster).times(2);
     expect(cluster.getResourceId()).andReturn(1L).times(3);
-    expect(cluster.getClusterName()).andReturn("cluster").times(2);
+    expect(cluster.getClusterName()).andReturn("cluster").times(1);
     expect(cluster.getSecurityType()).andReturn(SecurityType.KERBEROS).anyTimes();
     expect(cluster.getCurrentClusterVersion()).andReturn(null).anyTimes();
     expect(cluster.getCurrentStackVersion()).andReturn(null).anyTimes();
@@ -966,10 +966,10 @@ public class AmbariManagementControllerImplTest {
     expect(injector.getInstance(Gson.class)).andReturn(null);
     expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(null);
     expect(injector.getInstance(KerberosHelper.class)).andReturn(createNiceMock(KerberosHelper.class));
-    expect(clusterRequest.getClusterName()).andReturn("clusterNew").times(4);
+    expect(clusterRequest.getClusterName()).andReturn("clusterNew").times(3);
     expect(clusterRequest.getClusterId()).andReturn(1L).times(6);
     expect(clusters.getClusterById(1L)).andReturn(cluster).times(2);
-    expect(cluster.getClusterName()).andReturn("clusterOld").times(2);
+    expect(cluster.getClusterName()).andReturn("clusterOld").times(1);
     cluster.setClusterName("clusterNew");
     expectLastCall().andThrow(new RollbackException());
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4f643ab/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 461cb48..a0ac966 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -8364,7 +8364,7 @@ public class AmbariManagementControllerTest {
     try {
       controller.updateRepositories(requests);
     } catch (Exception e) {
-      assertTrue(e.getMessage().contains(MalformedURLException.class.getName()));
+      assertTrue(e.getMessage().contains("Could not access base url"));
     }
 
     requests.clear();
@@ -8376,8 +8376,7 @@ public class AmbariManagementControllerTest {
       controller.updateRepositories(requests);
     } catch (Exception e) {
       String exceptionMsg = e.getMessage();
-      assertTrue(exceptionMsg.contains(UnknownHostException.class.getName())
-        || exceptionMsg.contains(ConnectException.class.getName()));
+      assertTrue(exceptionMsg.contains("Could not access base url"));
     }
 
     // reset repo