You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/10/28 17:20:14 UTC
git commit: SLIDER-562: regression: mock tests failing
Repository: incubator-slider
Updated Branches:
refs/heads/develop a11efd9bb -> fa626f3d7
SLIDER-562: regression: mock tests failing
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/fa626f3d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/fa626f3d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/fa626f3d
Branch: refs/heads/develop
Commit: fa626f3d7c89400a2abfd7b674134eddc04b3ff1
Parents: a11efd9
Author: Steve Loughran <st...@apache.org>
Authored: Tue Oct 28 16:19:57 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Oct 28 16:19:57 2014 +0000
----------------------------------------------------------------------
.../apache/slider/core/conf/MapOperations.java | 6 ++++-
.../slider/server/appmaster/state/AppState.java | 28 +++++++++-----------
.../model/mock/BaseMockAppStateTest.groovy | 1 -
.../appmaster/model/mock/MockFactory.groovy | 2 +-
4 files changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa626f3d/slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java b/slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
index bba3ee2..6503c9b 100644
--- a/slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
+++ b/slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
@@ -112,7 +112,11 @@ public class MapOperations implements Map<String, String> {
log.debug("Missing key {} from config containing {}",
key, this);
}
- throw new BadConfigException("Missing option " + key);
+ String text = "Missing option " + key;
+ if (SliderUtils.isSet(name)) {
+ text += " from set " + name;
+ }
+ throw new BadConfigException(text);
}
return val;
}
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa626f3d/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
index 24245bb..31658bc 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
@@ -477,19 +477,16 @@ public class AppState {
Set<String> confKeys = ConfigHelper.sortedConfigKeys(publishedProviderConf);
-// Add the -site configuration properties
+ // Add the -site configuration properties
for (String key : confKeys) {
String val = publishedProviderConf.get(key);
clientProperties.put(key, val);
}
-
// set the cluster specification (once its dependency the client properties
// is out the way
-
updateInstanceDefinition(instanceDefinition);
-
//build the initial role list
for (ProviderRole providerRole : providerRoles) {
buildRole(providerRole);
@@ -502,7 +499,7 @@ public class AppState {
for (String name : roleNames) {
if (!roles.containsKey(name)) {
// this is a new value
- log.info("Adding new role {}", name);
+ log.info("Adding role {}", name);
MapOperations resComponent = resources.getComponent(name);
ProviderRole dynamicRole =
createDynamicProviderRole(name, resComponent);
@@ -582,16 +579,14 @@ public class AppState {
BadConfigException {
String priOpt = component.getMandatoryOption(ResourceKeys.COMPONENT_PRIORITY);
int pri = SliderUtils.parseAndValidate("value of " + name + " " +
- ResourceKeys.COMPONENT_PRIORITY,
- priOpt, 0, 1, -1
- );
+ ResourceKeys.COMPONENT_PRIORITY,
+ priOpt, 0, 1, -1);
log.info("Role {} assigned priority {}", name, pri);
String placementOpt = component.getOption(
ResourceKeys.COMPONENT_PLACEMENT_POLICY, "0");
int placement = SliderUtils.parseAndValidate("value of " + name + " " +
- ResourceKeys.COMPONENT_PLACEMENT_POLICY,
- placementOpt, 0, 0, -1
- );
+ ResourceKeys.COMPONENT_PLACEMENT_POLICY,
+ placementOpt, 0, 0, -1);
return new ProviderRole(name, pri, placement);
}
@@ -608,10 +603,13 @@ public class AppState {
instanceDefinition.resolve();
// force in the AM desired state values
- instanceDefinition.getResourceOperations().setComponentOpt(
- SliderKeys.COMPONENT_AM, ResourceKeys.COMPONENT_INSTANCES, "1"
- );
-
+ ConfTreeOperations resources =
+ instanceDefinition.getResourceOperations();
+ if (resources.getComponent(SliderKeys.COMPONENT_AM) != null) {
+ resources.setComponentOpt(
+ SliderKeys.COMPONENT_AM, ResourceKeys.COMPONENT_INSTANCES, "1");
+ }
+
//note the time
snapshotTime = now();
//snapshot all three sectons
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa626f3d/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy
index 1b5ac4b..6c0f571 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/BaseMockAppStateTest.groovy
@@ -33,7 +33,6 @@ import org.apache.slider.common.tools.SliderUtils
import org.apache.slider.core.conf.AggregateConf
import org.apache.slider.core.main.LauncherExitCodes
import org.apache.slider.server.appmaster.operations.AbstractRMOperation
-import org.apache.slider.server.appmaster.operations.ContainerRequestOperation
import org.apache.slider.server.appmaster.state.*
import org.apache.slider.test.SliderTestBase
import org.junit.Before
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa626f3d/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockFactory.groovy
----------------------------------------------------------------------
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockFactory.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockFactory.groovy
index 1396795..311c049 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockFactory.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/model/mock/MockFactory.groovy
@@ -35,7 +35,7 @@ import org.apache.slider.providers.ProviderRole
*/
//@CompileStatic
@Slf4j
-class MockFactory implements MockRoles {
+class MockFactory implements MockRoles {
public static final ProviderRole PROVIDER_ROLE0 = new ProviderRole(
MockRoles.ROLE0,