You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2016/02/19 21:30:55 UTC
ambari git commit: AMBARI-15118. Fix and enable UTs testMetricsLoaded
and testServicesWithRangerPluginRoleCommandOrder (smohanty)
Repository: ambari
Updated Branches:
refs/heads/trunk 82d944017 -> dccacb952
AMBARI-15118. Fix and enable UTs testMetricsLoaded and testServicesWithRangerPluginRoleCommandOrder (smohanty)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dccacb95
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dccacb95
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dccacb95
Branch: refs/heads/trunk
Commit: dccacb9528f81c06d8e9bef85f4a0dbce6b0e507
Parents: 82d9440
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Fri Feb 19 12:28:11 2016 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Fri Feb 19 12:28:11 2016 -0800
----------------------------------------------------------------------
.../ambari/server/stack/StackManagerTest.java | 35 ++++++++++----------
1 file changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/dccacb95/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
index 455652b..d7a15e2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
@@ -31,6 +31,7 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileReader;
import java.lang.reflect.Type;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -62,6 +63,7 @@ import org.apache.commons.lang.StringUtils;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.util.Assert;
/**
* StackManager unit tests.
@@ -641,12 +643,16 @@ public class StackManagerTest {
stack.getKerberosDescriptorFileLocation());
}
- @Ignore
@Test
public void testMetricsLoaded() throws Exception {
- String stackRoot = ClassLoader.getSystemClassLoader().getResource("stacks").getPath().replace("test-classes","classes");
- String commonServices = ClassLoader.getSystemClassLoader().getResource("common-services").getPath().replace("test-classes","classes");
+ URL rootDirectoryURL = StackManagerTest.class.getResource("/");
+ Assert.notNull(rootDirectoryURL);
+
+ File resourcesDirectory = new File(new File(rootDirectoryURL.getFile()).getParentFile().getParentFile(), "src/main/resources");
+
+ File stackRoot = new File(resourcesDirectory, "stacks");
+ File commonServices = new File(resourcesDirectory, "common-services");
MetainfoDAO metaInfoDao = createNiceMock(MetainfoDAO.class);
StackDAO stackDao = createNiceMock(StackDAO.class);
@@ -660,7 +666,7 @@ public class StackManagerTest {
OsFamily osFamily = new OsFamily(config);
- StackManager stackManager = new StackManager(new File(stackRoot), new File(commonServices),
+ StackManager stackManager = new StackManager(stackRoot, commonServices,
osFamily, metaInfoDao, actionMetadata, stackDao);
for (StackInfo stackInfo : stackManager.getStacks()) {
@@ -682,12 +688,15 @@ public class StackManagerTest {
}
}
- @Ignore
@Test
public void testServicesWithRangerPluginRoleCommandOrder() throws AmbariException {
- // Given
- String stackRoot = ClassLoader.getSystemClassLoader().getResource("stacks").getPath().replace("test-classes","classes");
- String commonServices = ClassLoader.getSystemClassLoader().getResource("common-services").getPath().replace("test-classes","classes");
+ URL rootDirectoryURL = StackManagerTest.class.getResource("/");
+ Assert.notNull(rootDirectoryURL);
+
+ File resourcesDirectory = new File(new File(rootDirectoryURL.getFile()).getParentFile().getParentFile(), "src/main/resources");
+
+ File stackRoot = new File(resourcesDirectory, "stacks");
+ File commonServices = new File(resourcesDirectory, "common-services");
MetainfoDAO metaInfoDao = createNiceMock(MetainfoDAO.class);
StackDAO stackDao = createNiceMock(StackDAO.class);
@@ -701,7 +710,7 @@ public class StackManagerTest {
OsFamily osFamily = new OsFamily(config);
- StackManager stackManager = new StackManager(new File(stackRoot), new File(commonServices), osFamily, metaInfoDao, actionMetadata, stackDao);
+ StackManager stackManager = new StackManager(stackRoot, commonServices, osFamily, metaInfoDao, actionMetadata, stackDao);
String rangerUserSyncRoleCommand = Role.RANGER_USERSYNC + "-" + RoleCommand.START;
String rangerAdminRoleCommand = Role.RANGER_ADMIN + "-" + RoleCommand.START;
@@ -783,14 +792,6 @@ public class StackManagerTest {
assertTrue(rangerUserSyncRoleCommand + " should be dependent of " + rangerAdminRoleCommand, rangerUserSyncBlockers.contains(rangerAdminRoleCommand));
assertTrue(rangerUserSyncRoleCommand + " should be dependent of " + kmsRoleCommand, rangerUserSyncBlockers.contains(kmsRoleCommand));
-
- // Zookeeper Server
- ArrayList<String> zookeeperBlockers = (ArrayList<String>)generalDeps.get(zookeeperServerRoleCommand);
-
- assertTrue(zookeeperServerRoleCommand + " should be dependent of " + rangerUserSyncRoleCommand, zookeeperBlockers.contains(rangerUserSyncRoleCommand));
-
}
-
-
//todo: component override assertions
}