Repository: ambari
Updated Branches:
  refs/heads/trunk a84a65320 -> ce4020028


http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/api/resources/ClusterResourceDefinitionTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/api/resources/ClusterResourceDefinitionTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/api/resources/ClusterResourceDefinitionTest.java
index 6a48134..c5721a5 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/api/resources/ClusterResourceDefinitionTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/api/resources/ClusterResourceDefinitionTest.java
@@ -50,7 +50,7 @@ public class ClusterResourceDefinitionTest {
     ResourceDefinition resource = new ClusterResourceDefinition();
     Set<SubResourceDefinition> subResources = 
resource.getSubResourceDefinitions();
 
-    assertEquals(7, subResources.size());
+    assertEquals(8, subResources.size());
     assertTrue(includesType(subResources, Resource.Type.Service));
     assertTrue(includesType(subResources, Resource.Type.Host));
     assertTrue(includesType(subResources, Resource.Type.Configuration));
@@ -58,6 +58,7 @@ public class ClusterResourceDefinitionTest {
     assertTrue(includesType(subResources, Resource.Type.Workflow));
     assertTrue(includesType(subResources, Resource.Type.ConfigGroup));
     assertTrue(includesType(subResources, Resource.Type.AlertDefinition));
+    assertTrue(includesType(subResources, Resource.Type.ServiceConfigVersion));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/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 a332656..8c92ba3 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
@@ -1583,7 +1583,7 @@ public class AmbariManagementControllerTest {
     Map<String, Map<String, String>> propertiesAttributes = new 
HashMap<String, Map<String,String>>();
 
     Config c1 = new ConfigImpl(cluster, "hdfs-site", properties, 
propertiesAttributes, injector);
-    c1.setVersionTag("v1");
+    c1.setTag("v1");
     cluster.addConfig(c1);
     c1.persist();
     configs.put(c1.getType(), c1);
@@ -1631,9 +1631,9 @@ public class AmbariManagementControllerTest {
     Map<String, String> mapRequestProps = new HashMap<String, String>();
     mapRequestProps.put("context", "Called from a test");
 
-    c1.setVersionTag("v1");
-    c2.setVersionTag("v1");
-    c3.setVersionTag("v1");
+    c1.setTag("v1");
+    c2.setTag("v1");
+    c3.setTag("v1");
 
     cluster.addConfig(c1);
     cluster.addConfig(c2);
@@ -3871,13 +3871,13 @@ public class AmbariManagementControllerTest {
         new HashMap<String, String>() {{
           put("key1", "value1");
         }}, new HashMap<String, Map<String,String>>());
-    config1.setVersionTag("version1");
+    config1.setTag("version1");
 
     Config config2 = cf.createNew(cluster, "core-site",
         new HashMap<String, String>() {{
           put("key1", "value1");
         }}, new HashMap<String, Map<String,String>>());
-    config2.setVersionTag("version1");
+    config2.setTag("version1");
 
     cluster.addConfig(config1);
     cluster.addConfig(config2);
@@ -4002,13 +4002,13 @@ public class AmbariManagementControllerTest {
       new HashMap<String, String>() {{
         put("key1", "value1");
       }}, new HashMap<String, Map<String,String>>());
-    config1.setVersionTag("version1");
+    config1.setTag("version1");
 
     Config config2 = cf.createNew(cluster, "core-site",
       new HashMap<String, String>() {{
         put("key1", "value1");
       }}, new HashMap<String, Map<String,String>>());
-    config2.setVersionTag("version1");
+    config2.setTag("version1");
 
     cluster.addConfig(config1);
     cluster.addConfig(config2);
@@ -4203,13 +4203,15 @@ public class AmbariManagementControllerTest {
         new HashMap<String, String>() {{
           put("key1", "value1");
         }}, new HashMap<String, Map<String,String>>());
-    config1.setVersionTag("version1");
+    config1.setTag("version1");
 
     Config config2 = cf.createNew(cluster, "core-site",
         new HashMap<String, String>() {{
           put("key1", "value1");
         }}, new HashMap<String, Map<String,String>>());
-    config2.setVersionTag("version1");
+    config2.setTag("version1");
+    config1.persist();
+    config2.persist();
 
     cluster.addConfig(config1);
     cluster.addConfig(config2);
@@ -4465,12 +4467,12 @@ public class AmbariManagementControllerTest {
     ConfigFactory cf = injector.getInstance(ConfigFactory.class);
     Config config1 = cf.createNew(cluster, "global",
         new HashMap<String, String>(){{ put("key1", "value1"); }}, new 
HashMap<String, Map<String,String>>());
-    config1.setVersionTag("version1");
+    config1.setTag("version1");
     config1.setPropertiesAttributes(new HashMap<String, Map<String, 
String>>(){{ put("attr1", new HashMap<String, String>()); }});
 
     Config config2 = cf.createNew(cluster, "core-site",
         new HashMap<String, String>(){{ put("key1", "value1"); }}, new 
HashMap<String, Map<String,String>>());
-    config2.setVersionTag("version1");
+    config2.setTag("version1");
     config2.setPropertiesAttributes(new HashMap<String, Map<String, 
String>>(){{ put("attr2", new HashMap<String, String>()); }});
 
     cluster.addConfig(config1);
@@ -6259,13 +6261,13 @@ public class AmbariManagementControllerTest {
       new HashMap<String, String>() {{
         put("key1", "value1");
       }}, new HashMap<String, Map<String,String>>());
-    config1.setVersionTag("version1");
+    config1.setTag("version1");
 
     Config config2 = cf.createNew(cluster, "core-site",
       new HashMap<String, String>() {{
         put("key1", "value1");
       }}, new HashMap<String, Map<String,String>>());
-    config2.setVersionTag("version1");
+    config2.setTag("version1");
 
     cluster.addConfig(config1);
     cluster.addConfig(config2);
@@ -6355,13 +6357,13 @@ public class AmbariManagementControllerTest {
       new HashMap<String, String>() {{
         put("key1", "value1");
       }}, new HashMap<String, Map<String,String>>());
-    config1.setVersionTag("version1");
+    config1.setTag("version1");
 
     Config config2 = cf.createNew(cluster, "core-site",
       new HashMap<String, String>() {{
         put("key1", "value1");
       }}, new HashMap<String, Map<String,String>>());
-    config2.setVersionTag("version1");
+    config2.setTag("version1");
 
     cluster.addConfig(config1);
     cluster.addConfig(config2);
@@ -6723,7 +6725,7 @@ public class AmbariManagementControllerTest {
     Cluster cluster = clusters.getCluster(clusterName);
     final Config config = new ConfigImpl("core-site");
     config.setProperties(configs);
-    config.setVersionTag("version122");
+    config.setTag("version122");
     Long groupId = createConfigGroup(cluster, "g1", "t1",
       new ArrayList<String>() {{ add("h1"); }},
       new ArrayList<Config>() {{ add(config); }});
@@ -6736,7 +6738,7 @@ public class AmbariManagementControllerTest {
 
     final Config config2 = new ConfigImpl("mapred-site");
     config2.setProperties(configs);
-    config2.setVersionTag("version122");
+    config2.setTag("version122");
     groupId = createConfigGroup(cluster, "g2", "t2",
       new ArrayList<String>() {{ add("h1"); }},
       new ArrayList<Config>() {{ add(config2); }});
@@ -6878,7 +6880,7 @@ public class AmbariManagementControllerTest {
 
     final Config config = new ConfigImpl("hdfs-site");
     config.setProperties(configs);
-    config.setVersionTag("version122");
+    config.setTag("version122");
     Long groupId = createConfigGroup(clusters.getCluster(clusterName), "g1", 
"t1",
         new ArrayList<String>() {{
           add("h1");
@@ -6984,7 +6986,7 @@ public class AmbariManagementControllerTest {
 
     final Config config = new ConfigImpl("hdfs-site");
     config.setProperties(configs);
-    config.setVersionTag("version122");
+    config.setTag("version122");
     Long groupId = createConfigGroup(clusters.getCluster(clusterName), "g1", 
"t1",
       new ArrayList<String>() {{ add("h1"); add("h2"); }},
       new ArrayList<Config>() {{ add(config); }});
@@ -7589,7 +7591,7 @@ public class AmbariManagementControllerTest {
     }
   }
 
-  private void resetCluster(Cluster cluster, StackId currentStackId) {
+  private void resetCluster(Cluster cluster, StackId currentStackId) throws 
AmbariException{
     cluster.setDesiredStackVersion(currentStackId);
     for (Service service : cluster.getServices().values()) {
       service.setDesiredStackVersion(currentStackId);
@@ -10053,7 +10055,7 @@ public class AmbariManagementControllerTest {
         new ConfigurationRequest(clusterName, "typeA", "v2", new 
HashMap<String, String>(), new HashMap<String, Map<String,String>>()));
     controller.updateClusters(Collections.singleton(cr), new HashMap<String, 
String>());
     config = cluster.getDesiredConfigByType("typeA");
-    Assert.assertEquals("v2", config.getVersionTag());
+    Assert.assertEquals("v2", config.getTag());
     Assert.assertNotNull(config);
     Assert.assertEquals(Integer.valueOf(0), 
Integer.valueOf(config.getProperties().size()));
     

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
index a1cb64e..d8f7fbc 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.controller.internal;
 
+import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.capture;
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.createMockBuilder;
@@ -2576,6 +2577,8 @@ public class ClusterResourceProviderTest {
         AbstractResourceProviderTest.Matcher.getClusterRequestSet(103L, null, 
null, "HDP-0.1", null), eq(mapRequestProps))).
         andReturn(response).once();
 
+    
expect(managementController.getClusterUpdateResults(anyObject(ClusterRequest.class))).andReturn(null).anyTimes();
+
     // replay
     replay(managementController, response);
 
@@ -2632,6 +2635,8 @@ public class ClusterResourceProviderTest {
     
expect(managementController.getClusters(EasyMock.<Set<ClusterRequest>>anyObject())).andReturn(nameResponse).times(2);
     
expect(managementController.updateClusters(Collections.singleton(EasyMock.anyObject(ClusterRequest.class)),
         eq(mapRequestProps))).andReturn(response).times(1);
+    
expect(managementController.getClusterUpdateResults(anyObject(ClusterRequest.class))).andReturn(null).anyTimes();
+
 
     // replay
     replay(managementController, response);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
index c8c905a..4194979 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
@@ -17,9 +17,6 @@
  */
 package org.apache.ambari.server.controller.internal;
 
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.ConfigGroupNotFoundException;
-import org.apache.ambari.server.ObjectNotFoundException;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.ConfigGroupRequest;
 import org.apache.ambari.server.controller.ConfigGroupResponse;
@@ -60,7 +57,6 @@ import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expectLastCall;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
-import static org.hamcrest.CoreMatchers.instanceOf;
 
 public class ConfigGroupResourceProviderTest {
 
@@ -153,7 +149,7 @@ public class ConfigGroupResourceProviderTest {
       configGroup, response);
 
     assertEquals("version100", captureConfigs.getValue().get("core-site")
-      .getVersionTag());
+      .getTag());
     assertTrue(captureHosts.getValue().containsKey("h1"));
     assertTrue(captureHosts.getValue().containsKey("h2"));
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
index e272e64..4cdf9cb 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
@@ -51,6 +51,7 @@ public class ConfigurationResourceProviderTest {
 
     
managementController.createConfiguration(AbstractResourceProviderTest.Matcher.getConfigurationRequest(
         "Cluster100", "type", "tag", new HashMap<String, String>(), null));
+    expectLastCall().andReturn(null);
 
     // replay
     replay(managementController, response);
@@ -99,6 +100,7 @@ public class ConfigurationResourceProviderTest {
             });
           }
         }));
+    expectLastCall().andReturn(null);
 
     // replay
     replay(managementController, response);
@@ -136,13 +138,13 @@ public class ConfigurationResourceProviderTest {
     AmbariManagementController managementController = 
createMock(AmbariManagementController.class);
 
     Set<ConfigurationResponse> allResponse = new 
HashSet<ConfigurationResponse>();
-    allResponse.add(new ConfigurationResponse("Cluster100", "type", "tag1", 
null, null));
-    allResponse.add(new ConfigurationResponse("Cluster100", "type", "tag2", 
null, null));
-    allResponse.add(new ConfigurationResponse("Cluster100", "type", "tag3", 
null, null));
+    allResponse.add(new ConfigurationResponse("Cluster100", "type", "tag1", 
1L, null, null));
+    allResponse.add(new ConfigurationResponse("Cluster100", "type", "tag2", 
2L, null, null));
+    allResponse.add(new ConfigurationResponse("Cluster100", "type", "tag3", 
3L, null, null));
 
     Set<ConfigurationResponse> orResponse = new 
HashSet<ConfigurationResponse>();
-    orResponse.add(new ConfigurationResponse("Cluster100", "type", "tag1", 
null, null));
-    orResponse.add(new ConfigurationResponse("Cluster100", "type", "tag2", 
null, null));
+    orResponse.add(new ConfigurationResponse("Cluster100", "type", "tag1", 1L, 
null, null));
+    orResponse.add(new ConfigurationResponse("Cluster100", "type", "tag2", 2L, 
null, null));
 
     Capture<Set<ConfigurationRequest>> configRequestCapture1 = new 
Capture<Set<ConfigurationRequest>>();
     Capture<Set<ConfigurationRequest>> configRequestCapture2 = new 
Capture<Set<ConfigurationRequest>>();

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
index 5f4b55c..a66233d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
@@ -273,7 +273,7 @@ public class JMXHostProviderTest {
     controller.updateClusters(Collections.singleton(crReq), null);
     Cluster cluster = clusters.getCluster(clusterName);
     Assert.assertEquals("versionN", cluster.getDesiredConfigByType("hdfs-site")
-      .getVersionTag());
+      .getTag());
 
     ConfigurationRequest cr2 = new ConfigurationRequest(clusterName,
       "yarn-site", "versionN", yarnConfigs, null);
@@ -281,7 +281,7 @@ public class JMXHostProviderTest {
     controller.updateClusters(Collections.singleton(crReq), null);
 
     Assert.assertEquals("versionN", cluster.getDesiredConfigByType("yarn-site")
-      .getVersionTag());
+      .getTag());
     Assert.assertEquals("localhost:${ambari.dfs.datanode.http.port}", 
cluster.getDesiredConfigByType
       ("hdfs-site").getProperties().get(NAMENODE_PORT_V1));
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
index 4327e6e..894126d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
@@ -17,8 +17,6 @@
  */
 package org.apache.ambari.server.state;
 
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.persist.PersistService;
@@ -40,14 +38,10 @@ import 
org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 public class ConfigGroupTest {
@@ -106,7 +100,7 @@ public class ConfigGroupTest {
     attributes.put("a", "true");
     propertiesAttributes.put("final", attributes);
     Config config = configFactory.createNew(cluster, "hdfs-site", properties, 
propertiesAttributes);
-    config.setVersionTag("testversion");
+    config.setTag("testversion");
 
     Host host = clusters.getHost("h1");
 
@@ -172,7 +166,7 @@ public class ConfigGroupTest {
     Config config = new ConfigImpl("test-site");
     config.setProperties(properties);
     config.setPropertiesAttributes(propertiesAttributes);
-    config.setVersionTag("version100");
+    config.setTag("version100");
 
     configGroup.addConfiguration(config);
     Assert.assertEquals(2, configGroup.getConfigurations().values().size());

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
index c0bc8e6..2abc446 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
@@ -31,7 +31,6 @@ import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
-import org.apache.ambari.server.state.host.HostImpl;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -157,7 +156,7 @@ public class ConfigHelperTest {
   @Test
   public void testEffectiveTagsForHost() throws Exception {
     final Config config = new ConfigImpl("core-site");
-    config.setVersionTag("version122");
+    config.setTag("version122");
 
     Map<String, String> properties = new HashMap<String, String>();
     properties.put("a", "b");
@@ -184,7 +183,7 @@ public class ConfigHelperTest {
   @Test
   public void testEffectivePropertiesWithOverrides() throws Exception {
     final Config config1 = new ConfigImpl("core-site");
-    config1.setVersionTag("version122");
+    config1.setTag("version122");
 
     Map<String, String> properties = new HashMap<String, String>();
     properties.put("a", "b");
@@ -192,7 +191,7 @@ public class ConfigHelperTest {
     config1.setProperties(properties);
 
     final Config config2 = new ConfigImpl("global");
-    config2.setVersionTag("version122");
+    config2.setTag("version122");
     Map<String, String> properties2 = new HashMap<String, String>();
     properties2.put("namenode_heapsize", "1111");
     config2.setProperties(properties2);
@@ -222,7 +221,7 @@ public class ConfigHelperTest {
   @Test
   public void testEffectivePropertiesAttributesWithOverrides() throws 
Exception {
     final Config config1 = new ConfigImpl("core-site");
-    config1.setVersionTag("version122");
+    config1.setTag("version122");
 
     Map<String, String> attributes = new HashMap<String, String>();
     attributes.put("fs.trash.interval", "11");
@@ -232,7 +231,7 @@ public class ConfigHelperTest {
     config1.setPropertiesAttributes(config1Attributes);
 
     final Config config2 = new ConfigImpl("global");
-    config2.setVersionTag("version122");
+    config2.setTag("version122");
     attributes = new HashMap<String, String>();
     attributes.put("namenode_heapsize", "z");
     attributes.put("c", "q");

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/state/DesiredConfigTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/DesiredConfigTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/DesiredConfigTest.java
index 59497f7..93e3f07 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/DesiredConfigTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/DesiredConfigTest.java
@@ -32,11 +32,11 @@ public class DesiredConfigTest {
   public void testDesiredConfig() throws Exception {
     DesiredConfig dc = new DesiredConfig();
     dc.setServiceName("service");
-    dc.setVersion("global");
+    dc.setTag("global");
     dc.setUser("_test");
 
     Assert.assertEquals("Expected service 'service'", "service", 
dc.getServiceName());
-    Assert.assertEquals("Expected version 'global'", "global", 
dc.getVersion());
+    Assert.assertEquals("Expected version 'global'", "global", dc.getTag());
     Assert.assertEquals("Expected no host overrides", 0, 
dc.getHostOverrides().size());
     Assert.assertEquals("Expected user '_test'", "_test", dc.getUser());
     

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
index f83d58d..85a6993 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
@@ -314,15 +314,15 @@ public class ClusterTest {
     c2PropAttributes.get("final").put("x", "true");
     Config config1 = configFactory.createNew(c1, "global",
         new HashMap<String, String>() {{ put("a", "b"); }}, c1PropAttributes);
-    config1.setVersionTag("version1");
+    config1.setTag("version1");
     
     Config config2 = configFactory.createNew(c1, "global",
         new HashMap<String, String>() {{ put("x", "y"); }}, c2PropAttributes);
-    config2.setVersionTag("version2");
+    config2.setTag("version2");
     
     Config config3 = configFactory.createNew(c1, "core-site",
         new HashMap<String, String>() {{ put("x", "y"); }}, new 
HashMap<String, Map<String,String>>());
-    config3.setVersionTag("version2");
+    config3.setTag("version2");
     
     c1.addConfig(config1);
     c1.addConfig(config2);
@@ -338,7 +338,7 @@ public class ClusterTest {
     
     c1.addDesiredConfig("_test", config2);
     res = c1.getDesiredConfigByType("global");
-    Assert.assertEquals("Expected version tag to be 'version2'", "version2", 
res.getVersionTag());
+    Assert.assertEquals("Expected version tag to be 'version2'", "version2", 
res.getTag());
     Assert.assertEquals("true", 
res.getPropertiesAttributes().get("final").get("x"));
   }
   
@@ -346,15 +346,15 @@ public class ClusterTest {
   public void testDesiredConfigs() throws Exception {
     Config config1 = configFactory.createNew(c1, "global",
         new HashMap<String, String>() {{ put("a", "b"); }}, new 
HashMap<String, Map<String,String>>());
-    config1.setVersionTag("version1");
+    config1.setTag("version1");
     
     Config config2 = configFactory.createNew(c1, "global",
         new HashMap<String, String>() {{ put("x", "y"); }}, new 
HashMap<String, Map<String,String>>());
-    config2.setVersionTag("version2");
+    config2.setTag("version2");
     
     Config config3 = configFactory.createNew(c1, "core-site",
         new HashMap<String, String>() {{ put("x", "y"); }}, new 
HashMap<String, Map<String,String>>());
-    config3.setVersionTag("version2");
+    config3.setTag("version2");
     
     c1.addConfig(config1);
     c1.addConfig(config2);
@@ -375,8 +375,8 @@ public class ClusterTest {
     Assert.assertFalse("Expect desired config not contain 'mapred-site'", 
desiredConfigs.containsKey("mapred-site"));
     Assert.assertTrue("Expect desired config contain " + config1.getType(), 
desiredConfigs.containsKey("global"));
     Assert.assertTrue("Expect desired config contain " + config3.getType(), 
desiredConfigs.containsKey("core-site"));
-    Assert.assertEquals("Expect desired config for global should be " + 
config1.getVersionTag(),
-        config1.getVersionTag(), 
desiredConfigs.get(config1.getType()).getVersion());
+    Assert.assertEquals("Expect desired config for global should be " + 
config1.getTag(),
+        config1.getTag(), desiredConfigs.get(config1.getType()).getTag());
     Assert.assertEquals("_test1", 
desiredConfigs.get(config1.getType()).getUser());
     Assert.assertEquals("_test3", 
desiredConfigs.get(config3.getType()).getUser());
     DesiredConfig dc = desiredConfigs.get(config1.getType());
@@ -401,6 +401,7 @@ public class ClusterTest {
   
   public ClusterEntity createDummyData() {
     ClusterEntity clusterEntity = new ClusterEntity();
+    clusterEntity.setClusterId(1L);
     clusterEntity.setClusterName("test_cluster1");
     clusterEntity.setClusterInfo("test_cluster_info1");
 
@@ -545,7 +546,7 @@ public class ClusterTest {
     Config config = configFactory.createNew(c1, "hdfs-site", new 
HashMap<String, String>(){{
       put("test", "test");
     }}, propAttributes);
-    config.setVersionTag("1");
+    config.setTag("1");
 
     host1.addDesiredConfig(c1.getClusterId(), true, "test", config);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
index 8356b0e..e794e01 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
@@ -319,14 +319,14 @@ public class ClustersTest {
         new HashMap<String, String>() {{
           put("prop1", "val1");
         }}, new HashMap<String, Map<String,String>>());
-    config1.setVersionTag("1");
+    config1.setTag("1");
     config1.persist();
     
     Config config2 = 
injector.getInstance(ConfigFactory.class).createNew(cluster, "t1",
         new HashMap<String, String>() {{
           put("prop2", "val2");
         }}, new HashMap<String, Map<String,String>>());
-    config2.setVersionTag("2");
+    config2.setTag("2");
     config2.persist();
     
     // cluster desired config

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java 
b/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
index b1fb149..e74239b 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java
@@ -395,7 +395,7 @@ public class HostTest {
     }
     
     
-    config.setVersionTag("v1");
+    config.setTag("v1");
     host.addDesiredConfig(c1.getClusterId(), true, "_test", config);
     
     Map<String, DesiredConfig> map = host.getDesiredConfigs(c1.getClusterId());
@@ -404,12 +404,12 @@ public class HostTest {
     
     config = configFactory.createNew(c1, "global",
         new HashMap<String,String>() {{ put("c", "d"); }}, new HashMap<String, 
Map<String,String>>());
-    config.setVersionTag("v2");
+    config.setTag("v2");
     host.addDesiredConfig(c1.getClusterId(), true, "_test1", config);
     
     map = host.getDesiredConfigs(c1.getClusterId());
     Assert.assertTrue("Expect desired config to contain global", 
map.containsKey("global"));
-    Assert.assertEquals("Expect version to be 'v2'", "v2", 
map.get("global").getVersion());
+    Assert.assertEquals("Expect version to be 'v2'", "v2", 
map.get("global").getTag());
     Assert.assertEquals("Expect user to be '_test1'", "_test1", 
map.get("global").getUser());
     
     host.addDesiredConfig(c1.getClusterId(), false, "_test2", config);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
index 0101352..c0bdaa2 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
@@ -187,7 +187,7 @@ public class ServiceComponentHostTest {
     if (c.getConfig("time", String.valueOf(timestamp)) == null) {
       Config config = configFactory.createNew (c, "time",
           new HashMap<String, String>(), new HashMap<String, 
Map<String,String>>());
-      config.setVersionTag(String.valueOf(timestamp));
+      config.setTag(String.valueOf(timestamp));
       c.addConfig(config);
       config.persist();
     }
@@ -802,7 +802,7 @@ public class ServiceComponentHostTest {
     final Config c = configFactory.createNew(cluster, "hdfs-site",
         new HashMap<String, String>() {{ put("dfs.journalnode.http-address", 
"http://goo";); }}, 
         new HashMap<String, Map<String,String>>());
-    c.setVersionTag("version3");
+    c.setTag("version3");
     c.persist();
     cluster.addConfig(c);
     //host.addDesiredConfig(cluster.getClusterId(), true, "user", c);
@@ -869,7 +869,7 @@ public class ServiceComponentHostTest {
     final Config c1 = configFactory.createNew(cluster, "core-site",
       new HashMap<String, String>() {{ put("fs.trash.interval", "400"); }}, 
       new HashMap<String, Map<String,String>>());
-    c1.setVersionTag("version2");
+    c1.setTag("version2");
     c1.persist();
     cluster.addConfig(c1);
     configGroup = configGroupFactory.createNew(cluster, "g2",
@@ -1038,7 +1038,7 @@ public class ServiceComponentHostTest {
    */
   private void makeConfig(Cluster cluster, String type, String tag, 
Map<String, String> values, Map<String, Map<String, String>> attributes) {
     Config config = configFactory.createNew(cluster, type, values, attributes);
-    config.setVersionTag(tag);
+    config.setTag(tag);
     config.persist();
     cluster.addConfig(config);
     cluster.addDesiredConfig("user", config);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
index 92e580b..a52c909 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
@@ -32,7 +32,6 @@ import 
org.apache.ambari.server.orm.dao.HostComponentDesiredStateDAO;
 import org.apache.ambari.server.orm.dao.HostDAO;
 import org.apache.ambari.server.orm.dao.KeyValueDAO;
 import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
-import org.apache.ambari.server.orm.entities.ClusterConfigEntityPK;
 import org.apache.ambari.server.orm.entities.ClusterConfigMappingEntity;
 import org.apache.ambari.server.orm.entities.ClusterEntity;
 import org.apache.ambari.server.orm.entities.ClusterServiceEntity;
@@ -263,11 +262,7 @@ public class UpgradeCatalog150Test {
 
     Long clusterId = clusterEntity.getClusterId();
 
-    ClusterConfigEntityPK configEntityPK = new ClusterConfigEntityPK();
-    configEntityPK.setClusterId(clusterId);
-    configEntityPK.setType("hdfs-log4j");
-    configEntityPK.setTag("version1");
-    ClusterConfigEntity configEntity = clusterDAO.findConfig(configEntityPK);
+    ClusterConfigEntity configEntity = clusterDAO.findConfig(clusterId, 
"hdfs-log4j", "version1");
     Assert.assertNull(configEntity);
 
     for (ClusterConfigMappingEntity ccme : 
clusterEntity.getConfigMappingEntities()) {
@@ -279,7 +274,7 @@ public class UpgradeCatalog150Test {
     UpgradeCatalog150 upgradeCatalog150 = 
injector.getInstance(UpgradeCatalog150.class);
     upgradeCatalog150.addMissingLog4jConfigs();
 
-    configEntity = clusterDAO.findConfig(configEntityPK);
+    configEntity = clusterDAO.findConfig(clusterId, "hdfs-log4j", "version1");
     Assert.assertNotNull(configEntity);
 
     //Get updated cluster

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce402002/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogTest.java
index b7dac7b..f8d16c8 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogTest.java
@@ -161,7 +161,7 @@ public class UpgradeCatalogTest {
     testCatalog.updateConfigurationProperties("global",
       Collections.singletonMap("x", "y"), false, false);
     config = cluster.getDesiredConfigByType("global");
-    String version = config.getVersionTag();
+    String version = config.getTag();
     Assert.assertNotNull(config);
     Assert.assertNotSame("version1", version);
     Assert.assertTrue(config.getProperties().containsKey("x"));
@@ -172,17 +172,17 @@ public class UpgradeCatalogTest {
       Collections.singletonMap("x", "z"), true, false);
     config = cluster.getDesiredConfigByType("global");
     Assert.assertNotNull(config);
-    Assert.assertNotSame(version, config.getVersionTag());
+    Assert.assertNotSame(version, config.getTag());
     Assert.assertTrue(config.getProperties().containsKey("x"));
     Assert.assertEquals("z", config.getProperties().get("x"));
-    version = config.getVersionTag();
+    version = config.getTag();
 
     // Retain original
     testCatalog.updateConfigurationProperties("global",
       Collections.singletonMap("x", "y"), false, false);
     config = cluster.getDesiredConfigByType("global");
     Assert.assertNotNull(config);
-    Assert.assertSame(version, config.getVersionTag());
+    Assert.assertSame(version, config.getTag());
     Assert.assertTrue(config.getProperties().containsKey("x"));
     Assert.assertEquals("z", config.getProperties().get("x"));
   }

Reply via email to