Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-18456 aa29f56cb -> 2c6008293
http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/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 7b3f671..c06debb 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 @@ -2523,8 +2523,6 @@ public class AmbariManagementControllerTest { sch1.setDesiredStackVersion(new StackId("HDP-1.2.0")); sch1.setStackVersion(new StackId("HDP-0.1")); - sch1.persist(); - sch1.updateActualConfigs(new HashMap<String, Map<String,String>>() {{ put("global", new HashMap<String,String>() {{ put("tag", "version1"); }}); }}); @@ -2958,13 +2956,6 @@ public class AmbariManagementControllerTest { sch4.setDesiredState(State.INSTALLED); sch5.setDesiredState(State.UNINSTALLED); - sch1.persist(); - sch2.persist(); - sch3.persist(); - sch4.persist(); - sch5.persist(); - sch6.persist(); - ServiceComponentHostRequest r = new ServiceComponentHostRequest(null, null, null, null, null); @@ -3959,9 +3950,7 @@ public class AmbariManagementControllerTest { Assert.assertEquals("testServiceComponentHostUpdateStackId", stages.get(0).getRequestContext()); Assert.assertEquals(State.UPGRADING, sch1.getState()); Assert.assertEquals(State.UPGRADING, sch2.getState()); - sch1.refresh(); Assert.assertTrue(sch1.getDesiredStackVersion().compareTo(newStack) == 0); - sch2.refresh(); Assert.assertTrue(sch2.getDesiredStackVersion().compareTo(newStack) == 0); for (HostRoleCommand command : stages.get(0).getOrderedHostRoleCommands()) { ExecutionCommand execCommand = command.getExecutionCommandWrapper().getExecutionCommand(); @@ -4005,11 +3994,8 @@ public class AmbariManagementControllerTest { Assert.assertEquals(State.UPGRADING, sch1.getState()); Assert.assertEquals(State.UPGRADING, sch2.getState()); Assert.assertEquals(State.UPGRADING, sch3.getState()); - sch1.refresh(); Assert.assertTrue(sch1.getDesiredStackVersion().compareTo(newStack) == 0); - sch2.refresh(); Assert.assertTrue(sch2.getDesiredStackVersion().compareTo(newStack) == 0); - sch3.refresh(); Assert.assertTrue(sch3.getDesiredStackVersion().compareTo(newStack) == 0); for (Stage stage : stages) { for (HostRoleCommand command : stage.getOrderedHostRoleCommands()) { @@ -4248,10 +4234,10 @@ public class AmbariManagementControllerTest { mapred.addServiceComponent(Role.RESOURCEMANAGER.name()); - hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host2).persist(); + hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host2); String actionDef1 = getUniqueName(); String actionDef2 = getUniqueName(); @@ -4411,9 +4397,9 @@ public class AmbariManagementControllerTest { hdfs.addServiceComponent(Role.NAMENODE.name()); hdfs.addServiceComponent(Role.DATANODE.name()); - hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1).persist(); + hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1); installService(cluster1, "HDFS", false, false); @@ -4523,9 +4509,9 @@ public class AmbariManagementControllerTest { hive.addServiceComponent(Role.HIVE_SERVER.name()); - hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1).persist(); + hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1); Map<String, String> params = new HashMap<String, String>() {{ put("test", "test"); @@ -4804,8 +4790,8 @@ public class AmbariManagementControllerTest { hdfs.addServiceComponent(Role.HDFS_CLIENT.name()); mapReduce.addServiceComponent(Role.MAPREDUCE_CLIENT.name()); - hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1).persist(); - mapReduce.getServiceComponent(Role.MAPREDUCE_CLIENT.name()).addServiceComponentHost(host2).persist(); + hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1); + mapReduce.getServiceComponent(Role.MAPREDUCE_CLIENT.name()).addServiceComponentHost(host2); Map<String, String> params = new HashMap<String, String>() {{ put("test", "test"); @@ -6486,10 +6472,10 @@ public class AmbariManagementControllerTest { mapred.addServiceComponent(Role.RESOURCEMANAGER.name()); - hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host2).persist(); + hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host2); String action1 = getUniqueName(); @@ -6592,12 +6578,12 @@ public class AmbariManagementControllerTest { mapred.addServiceComponent(Role.RESOURCEMANAGER.name()); - hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1).persist(); - hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host2).persist(); + hdfs.getServiceComponent(Role.HDFS_CLIENT.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.NAMENODE.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host1); + hdfs.getServiceComponent(Role.DATANODE.name()).addServiceComponentHost(host2); - mapred.getServiceComponent(Role.RESOURCEMANAGER.name()).addServiceComponentHost(host2).persist(); + mapred.getServiceComponent(Role.RESOURCEMANAGER.name()).addServiceComponentHost(host2); Map<String, String> params = new HashMap<String, String>() {{ put("test", "test"); http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java index 43de27f..79d5569 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java @@ -395,7 +395,5 @@ public class EventsTest { sch.setState(State.INSTALLED); sch.setDesiredStackVersion(new StackId("HDP-2.0.6")); sch.setStackVersion(new StackId("HDP-2.0.6")); - - sch.persist(); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java index fffda6c..15e81c5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java @@ -419,7 +419,6 @@ public class OrmTestHelper { ServiceComponent serviceComponent = service.getServiceComponent(componentName); ServiceComponentHost serviceComponentHost = serviceComponent.addServiceComponentHost(hostName); serviceComponentHost.setDesiredState(State.INSTALLED); - serviceComponentHost.persist(); } /** @@ -447,8 +446,6 @@ public class OrmTestHelper { sch.setDesiredStackVersion(new StackId("HDP-2.0.6")); sch.setStackVersion(new StackId("HDP-2.0.6")); - sch.persist(); - ServiceComponent namenode = componentFactory.createNew(service, "NAMENODE"); service.addServiceComponent(namenode); @@ -460,8 +457,6 @@ public class OrmTestHelper { sch.setState(State.INSTALLED); sch.setDesiredStackVersion(new StackId("HDP-2.0.6")); sch.setStackVersion(new StackId("HDP-2.0.6")); - - sch.persist(); } /** @@ -489,8 +484,6 @@ public class OrmTestHelper { sch.setState(State.INSTALLED); sch.setDesiredStackVersion(new StackId("HDP-2.0.6")); sch.setStackVersion(new StackId("HDP-2.0.6")); - - sch.persist(); } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java index 6d19113..0163024 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java @@ -363,7 +363,6 @@ public class ComponentVersionCheckActionTest { sch.setDesiredStackVersion(cluster.getDesiredStackVersion()); sch.setStackVersion(cluster.getCurrentStackVersion()); - sch.persist(); return sch; } http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java index 60027c2..8f9d4f4 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java @@ -1007,8 +1007,6 @@ public class UpgradeActionTest { sch.setState(State.INSTALLED); sch.setDesiredStackVersion(cluster.getDesiredStackVersion()); sch.setStackVersion(cluster.getCurrentStackVersion()); - - sch.persist(); return sch; } http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java index 59bb393..0cf7f09 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java @@ -216,43 +216,23 @@ public class ServiceComponentTest { HostEntity hostEntity1 = hostDAO.findByName("h1"); assertNotNull(hostEntity1); - ServiceComponentHost sch1 = - serviceComponentHostFactory.createNew(sc, "h1"); - ServiceComponentHost sch2 = - serviceComponentHostFactory.createNew(sc, "h2"); - ServiceComponentHost failSch = - serviceComponentHostFactory.createNew(sc, "h2"); - - Map<String, ServiceComponentHost> compHosts = - new HashMap<String, ServiceComponentHost>(); - compHosts.put("h1", sch1); - compHosts.put("h2", sch2); - compHosts.put("h3", failSch); + ServiceComponentHost sch1 = sc.addServiceComponentHost("h1"); + ServiceComponentHost sch2 = sc.addServiceComponentHost("h2"); try { - sc.addServiceComponentHosts(compHosts); + sc.addServiceComponentHost("h2"); fail("Expected error for dups"); } catch (Exception e) { // Expected } - Assert.assertTrue(sc.getServiceComponentHosts().isEmpty()); - - compHosts.remove("h3"); - sc.addServiceComponentHosts(compHosts); Assert.assertEquals(2, sc.getServiceComponentHosts().size()); - sch1.persist(); - sch2.persist(); - ServiceComponentHost schCheck = sc.getServiceComponentHost("h2"); Assert.assertNotNull(schCheck); Assert.assertEquals("h2", schCheck.getHostName()); - ServiceComponentHost sch3 = - serviceComponentHostFactory.createNew(sc, "h3"); - sc.addServiceComponentHost(sch3); - sch3.persist(); + sc.addServiceComponentHost("h3"); Assert.assertNotNull(sc.getServiceComponentHost("h3")); sch1.setDesiredStackVersion(new StackId("HDP-1.2.0")); @@ -307,7 +287,6 @@ public class ServiceComponentTest { compHosts.put("h1", sch); component.addServiceComponentHosts(compHosts); Assert.assertEquals(1, component.getServiceComponentHosts().size()); - sch.persist(); ServiceComponent sc = service.getServiceComponent(componentName); Assert.assertNotNull(sc); http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java index fa5491e..4fdcc22 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java @@ -582,7 +582,6 @@ public class ClusterDeadlockTest { sch.setDesiredStackVersion(stackId); sch.setStackVersion(stackId); - sch.persist(); return sch; } http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java index ca12826..aad074e 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java @@ -63,7 +63,7 @@ public class ClusterImplTest { injector.getInstance(GuiceJpaInitializer.class); clusters = injector.getInstance(Clusters.class); } - + @Test public void testAddSessionAttributes() throws Exception { Map<String, Object> attributes = new HashMap<String, Object>(); @@ -216,23 +216,21 @@ public class ClusterImplTest { Service hdfs = cluster.addService("HDFS"); ServiceComponent nameNode = hdfs.addServiceComponent("NAMENODE"); - nameNode.addServiceComponentHost(hostName1).persist(); + nameNode.addServiceComponentHost(hostName1); ServiceComponent dataNode = hdfs.addServiceComponent("DATANODE"); - dataNode.addServiceComponentHost(hostName1).persist(); - dataNode.addServiceComponentHost(hostName2).persist(); + dataNode.addServiceComponentHost(hostName1); + dataNode.addServiceComponentHost(hostName2); ServiceComponent hdfsClient = hdfs.addServiceComponent("HDFS_CLIENT"); - hdfsClient.addServiceComponentHost(hostName1).persist(); - hdfsClient.addServiceComponentHost(hostName2).persist(); + hdfsClient.addServiceComponentHost(hostName1); + hdfsClient.addServiceComponentHost(hostName2); Service tez = cluster.addService(serviceToDelete); ServiceComponent tezClient = tez.addServiceComponent("TEZ_CLIENT"); ServiceComponentHost tezClientHost1 = tezClient.addServiceComponentHost(hostName1); - tezClientHost1.persist(); ServiceComponentHost tezClientHost2 = tezClient.addServiceComponentHost(hostName2); - tezClientHost2.persist(); // When cluster.deleteService(serviceToDelete); http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/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 64d8184..dcbc435 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 @@ -419,26 +419,16 @@ public class ClusterTest { sc2CompB.addServiceComponentHost(schHost1Serv2CompB); sc3CompA.addServiceComponentHost(schHost1Serv3CompA); sc3CompB.addServiceComponentHost(schHost1Serv3CompB); - schHost1Serv1CompA.persist(); - schHost1Serv1CompB.persist(); - schHost1Serv1CompC.persist(); - schHost1Serv2CompA.persist(); - schHost1Serv2CompB.persist(); - schHost1Serv3CompA.persist(); - schHost1Serv3CompB.persist(); // Host 2 will have ZK_CLIENT and GANGLIA_MONITOR ServiceComponentHost schHost2Serv2CompB = serviceComponentHostFactory.createNew(sc2CompB, "h-2"); ServiceComponentHost schHost2Serv3CompB = serviceComponentHostFactory.createNew(sc3CompB, "h-2"); sc2CompB.addServiceComponentHost(schHost2Serv2CompB); sc3CompB.addServiceComponentHost(schHost2Serv3CompB); - schHost2Serv2CompB.persist(); - schHost2Serv3CompB.persist(); // Host 3 will have GANGLIA_MONITOR ServiceComponentHost schHost3Serv3CompB = serviceComponentHostFactory.createNew(sc3CompB, "h-3"); sc3CompB.addServiceComponentHost(schHost3Serv3CompB); - schHost3Serv3CompB.persist(); // Verify count of components List<ServiceComponentHost> scHost1 = cluster.getServiceComponentHosts("h-1"); @@ -689,7 +679,6 @@ public class ClusterTest { ServiceComponentHost sch = serviceComponentHostFactory.createNew(sc, "h1"); sc.addServiceComponentHost(sch); - sch.persist(); List<ServiceComponentHost> scHosts = c1.getServiceComponentHosts("h1"); Assert.assertEquals(1, scHosts.size()); @@ -706,7 +695,6 @@ public class ClusterTest { s1.addServiceComponent(sc1); ServiceComponentHost sch1 = serviceComponentHostFactory.createNew(sc1, "h1"); sc1.addServiceComponentHost(sch1); - sch1.persist(); } } catch (ConcurrentModificationException e ) { Assert.assertTrue("Failed to work concurrently with sch", false); @@ -727,16 +715,13 @@ public class ClusterTest { s.addServiceComponent(scNN); ServiceComponentHost schNNH1 = serviceComponentHostFactory.createNew(scNN, "h1"); scNN.addServiceComponentHost(schNNH1); - schNNH1.persist(); ServiceComponent scDN = serviceComponentFactory.createNew(s, "DATANODE"); s.addServiceComponent(scDN); ServiceComponentHost scDNH1 = serviceComponentHostFactory.createNew(scDN, "h1"); scDN.addServiceComponentHost(scDNH1); - scDNH1.persist(); ServiceComponentHost scDNH2 = serviceComponentHostFactory.createNew(scDN, "h2"); scDN.addServiceComponentHost(scDNH2); - scDNH2.persist(); List<ServiceComponentHost> scHosts; @@ -758,16 +743,13 @@ public class ClusterTest { s.addServiceComponent(scNN); ServiceComponentHost schNNH1 = serviceComponentHostFactory.createNew(scNN, "h1"); scNN.addServiceComponentHost(schNNH1); - schNNH1.persist(); ServiceComponent scDN = serviceComponentFactory.createNew(s, "DATANODE"); s.addServiceComponent(scDN); ServiceComponentHost scDNH1 = serviceComponentHostFactory.createNew(scDN, "h1"); scDN.addServiceComponentHost(scDNH1); - scDNH1.persist(); ServiceComponentHost scDNH2 = serviceComponentHostFactory.createNew(scDN, "h2"); scDN.addServiceComponentHost(scDNH2); - scDNH2.persist(); List<ServiceComponentHost> scHosts; @@ -795,16 +777,13 @@ public class ClusterTest { s.addServiceComponent(scNN); ServiceComponentHost schNNH1 = serviceComponentHostFactory.createNew(scNN, "h1"); scNN.addServiceComponentHost(schNNH1); - schNNH1.persist(); ServiceComponent scDN = serviceComponentFactory.createNew(s, "DATANODE"); s.addServiceComponent(scDN); ServiceComponentHost scDNH1 = serviceComponentHostFactory.createNew(scDN, "h1"); scDN.addServiceComponentHost(scDNH1); - scDNH1.persist(); ServiceComponentHost scDNH2 = serviceComponentHostFactory.createNew(scDN, "h2"); scDN.addServiceComponentHost(scDNH2); - scDNH2.persist(); Map<String, Set<String>> componentHostMap; @@ -833,22 +812,18 @@ public class ClusterTest { sfHDFS.addServiceComponent(scNN); ServiceComponentHost schNNH1 = serviceComponentHostFactory.createNew(scNN, "h1"); scNN.addServiceComponentHost(schNNH1); - schNNH1.persist(); ServiceComponent scDN = serviceComponentFactory.createNew(sfHDFS, "DATANODE"); sfHDFS.addServiceComponent(scDN); ServiceComponentHost scDNH1 = serviceComponentHostFactory.createNew(scDN, "h1"); scDN.addServiceComponentHost(scDNH1); - scDNH1.persist(); ServiceComponentHost scDNH2 = serviceComponentHostFactory.createNew(scDN, "h2"); scDN.addServiceComponentHost(scDNH2); - scDNH2.persist(); ServiceComponent scJT = serviceComponentFactory.createNew(sfMR, "JOBTRACKER"); sfMR.addServiceComponent(scJT); ServiceComponentHost schJTH1 = serviceComponentHostFactory.createNew(scJT, "h1"); scJT.addServiceComponentHost(schJTH1); - schJTH1.persist(); Map<String, Set<String>> componentHostMap; @@ -893,22 +868,18 @@ public class ClusterTest { sfHDFS.addServiceComponent(scNN); ServiceComponentHost schNNH1 = serviceComponentHostFactory.createNew(scNN, "h1"); scNN.addServiceComponentHost(schNNH1); - schNNH1.persist(); ServiceComponent scDN = serviceComponentFactory.createNew(sfHDFS, "DATANODE"); sfHDFS.addServiceComponent(scDN); ServiceComponentHost scDNH1 = serviceComponentHostFactory.createNew(scDN, "h1"); scDN.addServiceComponentHost(scDNH1); - scDNH1.persist(); ServiceComponentHost scDNH2 = serviceComponentHostFactory.createNew(scDN, "h2"); scDN.addServiceComponentHost(scDNH2); - scDNH2.persist(); ServiceComponent scJT = serviceComponentFactory.createNew(sfMR, "JOBTRACKER"); sfMR.addServiceComponent(scJT); ServiceComponentHost schJTH1 = serviceComponentHostFactory.createNew(scJT, "h1"); scJT.addServiceComponentHost(schJTH1); - schJTH1.persist(); Map<String, Set<String>> componentHostMap; @@ -954,22 +925,18 @@ public class ClusterTest { sfHDFS.addServiceComponent(scNN); ServiceComponentHost schNNH1 = serviceComponentHostFactory.createNew(scNN, "h1"); scNN.addServiceComponentHost(schNNH1); - schNNH1.persist(); ServiceComponent scDN = serviceComponentFactory.createNew(sfHDFS, "DATANODE"); sfHDFS.addServiceComponent(scDN); ServiceComponentHost scDNH1 = serviceComponentHostFactory.createNew(scDN, "h1"); scDN.addServiceComponentHost(scDNH1); - scDNH1.persist(); ServiceComponentHost scDNH2 = serviceComponentHostFactory.createNew(scDN, "h2"); scDN.addServiceComponentHost(scDNH2); - scDNH2.persist(); ServiceComponent scJT = serviceComponentFactory.createNew(sfMR, "JOBTRACKER"); sfMR.addServiceComponent(scJT); ServiceComponentHost schJTH1 = serviceComponentHostFactory.createNew(scJT, "h1"); scJT.addServiceComponentHost(schJTH1); - schJTH1.persist(); Map<String, Set<String>> componentHostMap; @@ -2094,9 +2061,6 @@ public class ClusterTest { sc2CompA.addServiceComponentHost(schHost4Serv2CompA); sc2CompB.addServiceComponentHost(schHost4Serv2CompB); sc3CompB.addServiceComponentHost(schHost4Serv3CompB); - schHost4Serv2CompA.persist(); - schHost4Serv2CompB.persist(); - schHost4Serv3CompB.persist(); simulateStackVersionListener(stackId, v1, cluster, hostComponentStateDAO.findByHost("h-4")); @@ -2128,7 +2092,6 @@ public class ClusterTest { clusters.mapHostToCluster("h-5", clusterName); ServiceComponentHost schHost5Serv3CompB = serviceComponentHostFactory.createNew(sc3CompB, "h-5"); sc3CompB.addServiceComponentHost(schHost5Serv3CompB); - schHost5Serv3CompB.persist(); // Host 5 will be in OUT_OF_SYNC, so redistribute bits to it so that it reaches a state of INSTALLED HostVersionEntity h5Version2 = hostVersionDAO.findByClusterStackVersionAndHost(clusterName, stackId, v2, "h-5"); http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java index 3e526d9..27e6e13 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java @@ -420,7 +420,6 @@ public class ClustersDeadlockTest { sch.setDesiredStackVersion(stackId); sch.setStackVersion(stackId); - sch.persist(); return sch; } http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/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 9e285c6..5886234 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 @@ -449,15 +449,12 @@ public class ClustersTest { ServiceComponent serviceCheckNode = hdfs.addServiceComponent("HDFS_CLIENT"); ServiceComponentHost nameNodeHost = nameNode.addServiceComponentHost(h1); - nameNodeHost.persist(); HostEntity nameNodeHostEntity = hostDAO.findByName(nameNodeHost.getHostName()); Assert.assertNotNull(nameNodeHostEntity); ServiceComponentHost dataNodeHost = dataNode.addServiceComponentHost(h2); - dataNodeHost.persist(); ServiceComponentHost serviceCheckNodeHost = serviceCheckNode.addServiceComponentHost(h2); - serviceCheckNodeHost.persist(); serviceCheckNodeHost.setState(State.UNKNOWN); HostComponentDesiredStateEntityPK hkdspk = new HostComponentDesiredStateEntityPK(); http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java index fbed6e2..2500a16 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java @@ -212,7 +212,6 @@ public class ConcurrentServiceConfigVersionTest { sch.setDesiredStackVersion(stackId); sch.setStackVersion(stackId); - sch.persist(); return sch; } http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java index bb55597..1f09002 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java @@ -241,7 +241,6 @@ public class ServiceComponentHostConcurrentWriteDeadlockTest { sch.setDesiredStackVersion(stackId); sch.setStackVersion(stackId); - sch.persist(); return sch; } http://git-wip-us.apache.org/repos/asf/ambari/blob/2c600829/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 48279af..14a8de6 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 @@ -195,8 +195,6 @@ public class ServiceComponentHostTest { ServiceComponentHost impl = serviceComponentHostFactory.createNew( sc, hostName); - impl.persist(); - Assert.assertEquals(State.INIT, impl.getState()); Assert.assertEquals(State.INIT, impl.getDesiredState()); Assert.assertEquals(SecurityState.UNSECURED, impl.getSecurityState());