//componentDesiredStateDAO.create(componentDesiredStateEntity);
HostComponentDesiredStateDAO hostComponentDesiredStateDAO =
injector.getInstance(HostComponentDesiredStateDAO.class);
HostComponentDesiredStateEntity hostComponentDesiredStateEntity =
new HostComponentDesiredStateEntity();
hostComponentDesiredStateEntity.setClusterId(clusterEntity.getClusterId());
hostComponentDesiredStateEntity.setComponentName("DATANODE");
hostComponentDesiredStateEntity.setAdminState(HostComponentAdminState.INSERVICE);
hostComponentDesiredStateEntity.setServiceName(clusterServiceEntity.getServiceName());
hostComponentDesiredStateEntity.setServiceComponentDesiredStateEntity(componentDesiredStateEntity);
hostComponentDesiredStateEntity.setHostEntity(hostEntity);
hostComponentDesiredStateEntity.setHostName(hostEntity.getHostName());
hostComponentDesiredStateDAO.create(hostComponentDesiredStateEntity);
HostComponentDesiredStateEntity entity = hostComponentDesiredStateDAO.findAll().get(0);
Assert.assertEquals(HostComponentAdminState.INSERVICE.name(), entity.getAdminState().name());
KeyValueDAO keyValueDAO = injector.getInstance(KeyValueDAO.class);
KeyValueEntity keyValueEntity = new KeyValueEntity();
keyValueEntity.setKey("decommissionDataNodesTag");
keyValueEntity.setValue("1394147791230");
keyValueDAO.create(keyValueEntity);
ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);
ClusterConfigEntity configEntity = new ClusterConfigEntity();
configEntity.setClusterEntity(clusterEntity);
configEntity.setClusterId(clusterEntity.getClusterId());
configEntity.setType("hdfs-exclude-file");
configEntity.setTag("1394147791230");
configEntity.setData("{\"datanodes\":\"" + HOST_NAME + "\"}");
configEntity.setTimestamp(System.currentTimeMillis());
clusterDAO.createConfig(configEntity);
UpgradeCatalog150 upgradeCatalog150 = injector.getInstance(UpgradeCatalog150.class);
upgradeCatalog150.processDecommissionedDatanodes();
entity = hostComponentDesiredStateDAO.findAll().get(0);
Assert.assertEquals(HostComponentAdminState.DECOMMISSIONED.name(), entity.getAdminState().name());
keyValueEntity = keyValueDAO.findByKey("decommissionDataNodesTag");
Assert.assertNull(keyValueEntity);
keyValueEntity = keyValueDAO.findByKey("decommissionDataNodesTag-Moved");
Assert.assertNotNull(keyValueEntity);