Repository: ambari Updated Branches: refs/heads/trunk 8595774b5 -> c879e9373
AMBARI-17626: Blueprint registration step uses wrong format for property-attributes in Configuration (Keta Patel via dili) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c879e937 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c879e937 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c879e937 Branch: refs/heads/trunk Commit: c879e937341c427714a0dff5c4bc73f272d4d30e Parents: 8595774 Author: Di Li <[email protected]> Authored: Fri Jul 22 11:56:10 2016 -0400 Committer: Di Li <[email protected]> Committed: Fri Jul 22 11:56:10 2016 -0400 ---------------------------------------------------------------------- .../server/topology/ConfigurationFactory.java | 2 +- .../internal/ProvisionClusterRequestTest.java | 20 +++++------ .../topology/ConfigurationFactoryTest.java | 35 +++++++++----------- 3 files changed, 27 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c879e937/ambari-server/src/main/java/org/apache/ambari/server/topology/ConfigurationFactory.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ConfigurationFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ConfigurationFactory.java index f4dc879..f6990af 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ConfigurationFactory.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ConfigurationFactory.java @@ -114,7 +114,7 @@ public class ConfigurationFactory { if (BlueprintFactory.PROPERTIES_PROPERTY_ID.equals(propertyNameTokens[1])) { configuration.setProperty(type, propertyNameTokens[2], propertyValue); } else if (BlueprintFactory.PROPERTIES_ATTRIBUTES_PROPERTY_ID.equals(propertyNameTokens[1])) { - configuration.setAttribute(type, propertyNameTokens[2], propertyNameTokens[3], propertyValue); + configuration.setAttribute(type, propertyNameTokens[3], propertyNameTokens[2], propertyValue); } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/c879e937/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequestTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequestTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequestTest.java index 0610d10..a28b9fe 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequestTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequestTest.java @@ -141,9 +141,9 @@ public class ProvisionClusterRequestTest { assertEquals(1, clusterScopedAttributes.size()); Map<String, Map<String, String>> clusterScopedTypeAttributes = clusterScopedAttributes.get("someType"); assertEquals(1, clusterScopedTypeAttributes.size()); - Map<String, String> clusterScopedTypePropertyAttributes = clusterScopedTypeAttributes.get("property1"); + Map<String, String> clusterScopedTypePropertyAttributes = clusterScopedTypeAttributes.get("attribute1"); assertEquals(1, clusterScopedTypePropertyAttributes.size()); - assertEquals("someAttributePropValue", clusterScopedTypePropertyAttributes.get("attribute1")); + assertEquals("someAttributePropValue", clusterScopedTypePropertyAttributes.get("property1")); } @Test @@ -181,9 +181,9 @@ public class ProvisionClusterRequestTest { assertEquals(1, group2Attributes.size()); Map<String, Map<String, String>> group2Type1Attributes = group2Attributes.get("foo-type"); assertEquals(1, group2Type1Attributes.size()); - Map<String, String> group2Type1Prop1Attributes = group2Type1Attributes.get("hostGroup2Prop10"); + Map<String, String> group2Type1Prop1Attributes = group2Type1Attributes.get("attribute1"); assertEquals(1, group2Type1Prop1Attributes.size()); - assertEquals("attribute1Prop10-value", group2Type1Prop1Attributes.get("attribute1")); + assertEquals("attribute1Prop10-value", group2Type1Prop1Attributes.get("hostGroup2Prop10")); // cluster scoped configuration Configuration clusterScopeConfiguration = provisionClusterRequest.getConfiguration(); @@ -197,9 +197,9 @@ public class ProvisionClusterRequestTest { assertEquals(1, clusterScopedAttributes.size()); Map<String, Map<String, String>> clusterScopedTypeAttributes = clusterScopedAttributes.get("someType"); assertEquals(1, clusterScopedTypeAttributes.size()); - Map<String, String> clusterScopedTypePropertyAttributes = clusterScopedTypeAttributes.get("property1"); + Map<String, String> clusterScopedTypePropertyAttributes = clusterScopedTypeAttributes.get("attribute1"); assertEquals(1, clusterScopedTypePropertyAttributes.size()); - assertEquals("someAttributePropValue", clusterScopedTypePropertyAttributes.get("attribute1")); + assertEquals("someAttributePropValue", clusterScopedTypePropertyAttributes.get("property1")); } @Test @@ -251,9 +251,9 @@ public class ProvisionClusterRequestTest { assertEquals(1, group2Attributes.size()); Map<String, Map<String, String>> group2Type1Attributes = group2Attributes.get("foo-type"); assertEquals(1, group2Type1Attributes.size()); - Map<String, String> group2Type1Prop1Attributes = group2Type1Attributes.get("hostGroup2Prop10"); + Map<String, String> group2Type1Prop1Attributes = group2Type1Attributes.get("attribute1"); assertEquals(1, group2Type1Prop1Attributes.size()); - assertEquals("attribute1Prop10-value", group2Type1Prop1Attributes.get("attribute1")); + assertEquals("attribute1Prop10-value", group2Type1Prop1Attributes.get("hostGroup2Prop10")); // cluster scoped configuration Configuration clusterScopeConfiguration = provisionClusterRequest.getConfiguration(); @@ -267,9 +267,9 @@ public class ProvisionClusterRequestTest { assertEquals(1, clusterScopedAttributes.size()); Map<String, Map<String, String>> clusterScopedTypeAttributes = clusterScopedAttributes.get("someType"); assertEquals(1, clusterScopedTypeAttributes.size()); - Map<String, String> clusterScopedTypePropertyAttributes = clusterScopedTypeAttributes.get("property1"); + Map<String, String> clusterScopedTypePropertyAttributes = clusterScopedTypeAttributes.get("attribute1"); assertEquals(1, clusterScopedTypePropertyAttributes.size()); - assertEquals("someAttributePropValue", clusterScopedTypePropertyAttributes.get("attribute1")); + assertEquals("someAttributePropValue", clusterScopedTypePropertyAttributes.get("property1")); } @Test(expected= InvalidTopologyTemplateException.class) http://git-wip-us.apache.org/repos/asf/ambari/blob/c879e937/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java index 1c2b177..80802e8 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java @@ -77,32 +77,29 @@ public class ConfigurationFactoryTest { // config type foo Map<String, Map<String, String>> configType1Attributes = attributes.get("foo-type"); - assertEquals(3, configType1Attributes.size()); - // prop1 attributes - Map<String, String> configType1Prop1Attributes = configType1Attributes.get("prop1"); - assertEquals(2, configType1Prop1Attributes.size()); - assertEquals("attribute1-prop1-value", configType1Prop1Attributes.get("attribute1")); - assertEquals("attribute2-prop1-value", configType1Prop1Attributes.get("attribute2")); - // prop2 attributes - Map<String, String> configType1Prop2Attributes = configType1Attributes.get("prop2"); + assertEquals(2, configType1Attributes.size()); + // properties with attribute1 + Map<String, String> configType1Prop1Attributes = configType1Attributes.get("attribute1"); + assertEquals(3, configType1Prop1Attributes.size()); + assertEquals("attribute1-prop1-value", configType1Prop1Attributes.get("prop1")); + assertEquals("attribute1-prop2-value", configType1Prop1Attributes.get("prop2")); + assertEquals("attribute1-prop3-value", configType1Prop1Attributes.get("prop3")); + // properties with attribute2 + Map<String, String> configType1Prop2Attributes = configType1Attributes.get("attribute2"); assertEquals(1, configType1Prop2Attributes.size()); - assertEquals("attribute1-prop2-value", configType1Prop2Attributes.get("attribute1")); - // prop3 attributes - Map<String, String> configType1Prop3Attributes = configType1Attributes.get("prop3"); - assertEquals(1, configType1Prop3Attributes.size()); - assertEquals("attribute1-prop3-value", configType1Prop3Attributes.get("attribute1")); + assertEquals("attribute2-prop1-value", configType1Prop2Attributes.get("prop1")); // config type foobar Map<String, Map<String, String>> configType2Attributes = attributes.get("foobar-type"); assertEquals(2, configType2Attributes.size()); - // prop10 attributes - Map<String, String> configType2Prop1Attributes = configType2Attributes.get("prop10"); + // properties with attribute1 + Map<String, String> configType2Prop1Attributes = configType2Attributes.get("attribute1"); assertEquals(1, configType2Prop1Attributes.size()); - assertEquals("attribute1-prop10-value", configType2Prop1Attributes.get("attribute1")); - // prop11 attributes - Map<String, String> configType2Prop2Attributes = configType2Attributes.get("prop11"); + assertEquals("attribute1-prop10-value", configType2Prop1Attributes.get("prop10")); + // properties with attribute10 + Map<String, String> configType2Prop2Attributes = configType2Attributes.get("attribute10"); assertEquals(1, configType2Prop2Attributes.size()); - assertEquals("attribute10-prop11-value", configType2Prop2Attributes.get("attribute10")); + assertEquals("attribute10-prop11-value", configType2Prop2Attributes.get("prop11")); } private Collection<Map<String, String>> getNewSyntaxConfigProps() {
