Examples of HostComponentDesiredStateEntity


Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

    lPK.setClusterId(cluster.getClusterId());
    lPK.setComponentName(componentName);
    lPK.setHostName("h1");
    lPK.setServiceName(serviceName);

    HostComponentDesiredStateEntity desiredStateEntity =
        desiredStateDAO.findByPK(dPK);
    HostComponentStateEntity stateEntity =
        liveStateDAO.findByPK(lPK);

    ServiceComponentHost sch = serviceComponentHostFactory.createExisting(sc,
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

    stateEntity.setServiceName(serviceComponent.getServiceName());
    stateEntity.setHostName(hostName);
    stateEntity.setCurrentState(stateMachine.getCurrentState());
    stateEntity.setCurrentStackVersion(gson.toJson(new StackId()));

    desiredStateEntity = new HostComponentDesiredStateEntity();
    desiredStateEntity.setClusterId(serviceComponent.getClusterId());
    desiredStateEntity.setComponentName(serviceComponent.getName());
    desiredStateEntity.setServiceName(serviceComponent.getServiceName());
    desiredStateEntity.setHostName(hostName);
    desiredStateEntity.setDesiredState(State.INIT);
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

    lPK.setClusterId(cluster.getClusterId());
    lPK.setComponentName(componentName);
    lPK.setHostName("h1");
    lPK.setServiceName(serviceName);

    HostComponentDesiredStateEntity desiredStateEntity =
        desiredStateDAO.findByPK(dPK);
    HostComponentStateEntity stateEntity =
        liveStateDAO.findByPK(lPK);

    ServiceComponentHost sch = serviceComponentHostFactory.createExisting(sc,
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

    stateEntity.setServiceName(serviceComponent.getServiceName());
    stateEntity.setHostName(hostName);
    stateEntity.setCurrentState(stateMachine.getCurrentState());
    stateEntity.setCurrentStackVersion(gson.toJson(new StackId()));

    desiredStateEntity = new HostComponentDesiredStateEntity();
    desiredStateEntity.setClusterId(serviceComponent.getClusterId());
    desiredStateEntity.setComponentName(serviceComponent.getName());
    desiredStateEntity.setServiceName(serviceComponent.getServiceName());
    desiredStateEntity.setHostName(hostName);
    desiredStateEntity.setDesiredState(State.INIT);
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

      pk.setClusterId(hostComponentStateEntity.getClusterId());
      pk.setServiceName(hostComponentStateEntity.getServiceName());
      pk.setComponentName(hostComponentStateEntity.getComponentName());
      pk.setHostName(hostComponentStateEntity.getHostName());

      HostComponentDesiredStateEntity hostComponentDesiredStateEntity = hostComponentDesiredStateDAO.findByPK(pk);

      hostComponents.put(hostComponentStateEntity.getHostName(),
          serviceComponentHostFactory.createExisting(this,
              hostComponentStateEntity, hostComponentDesiredStateEntity));
    }
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

    ServiceComponentDesiredStateEntity componentDesiredStateEntity = new ServiceComponentDesiredStateEntity();
    componentDesiredStateEntity.setClusterServiceEntity(clusterServiceEntity);
    componentDesiredStateEntity.setComponentName(componentName);
    componentDesiredStateEntity.setHostComponentStateEntities(new ArrayList<HostComponentStateEntity>());
   
    HostComponentDesiredStateEntity hostComponentDesiredStateEntity = new HostComponentDesiredStateEntity();
    hostComponentDesiredStateEntity.setAdminState(HostComponentAdminState.INSERVICE);
    hostComponentDesiredStateEntity.setServiceComponentDesiredStateEntity(componentDesiredStateEntity);
    hostComponentDesiredStateEntity.setHostEntity(hostEntity);
   
    HostComponentStateEntity hostComponentStateEntity = new HostComponentStateEntity();
    hostComponentStateEntity.setHostEntity(hostEntity);
    hostComponentStateEntity.setHostName(hostEntity.getHostName());
    hostComponentStateEntity.setCurrentStackVersion(clusterEntity.getDesiredStackVersion());
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

    //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);
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

      if(serviceComponentDesiredStateEntityJT == null)
        continue;

     
      HostComponentStateEntity jtHostComponentStateEntity = serviceComponentDesiredStateEntityJT.getHostComponentStateEntities().iterator().next();
      HostComponentDesiredStateEntity jtHostComponentDesiredStateEntity = serviceComponentDesiredStateEntityJT.getHostComponentDesiredStateEntities().iterator().next();
      String jtHostname = jtHostComponentStateEntity.getHostName();
      State jtCurrState = jtHostComponentStateEntity.getCurrentState();
      State jtHostComponentDesiredState = jtHostComponentDesiredStateEntity.getDesiredState();
      State jtServiceComponentDesiredState = serviceComponentDesiredStateEntityJT.getDesiredState();
         
      ClusterServiceEntityPK pk = new ClusterServiceEntityPK();
      pk.setClusterId(clusterEntity.getClusterId());
      pk.setServiceName("MAPREDUCE");
     
      ClusterServiceEntity clusterServiceEntity = clusterServiceDAO.findByPK(pk);
     
     
      final ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntity = new ServiceComponentDesiredStateEntity();
      serviceComponentDesiredStateEntity.setComponentName("HISTORYSERVER");
      serviceComponentDesiredStateEntity.setDesiredStackVersion(clusterEntity.getDesiredStackVersion());
      serviceComponentDesiredStateEntity.setDesiredState(jtServiceComponentDesiredState);
      serviceComponentDesiredStateEntity.setClusterServiceEntity(clusterServiceEntity);
      serviceComponentDesiredStateEntity.setHostComponentDesiredStateEntities(new ArrayList<HostComponentDesiredStateEntity>());

      final HostComponentStateEntity stateEntity = new HostComponentStateEntity();
      stateEntity.setHostName(jtHostname);
      stateEntity.setCurrentState(jtCurrState);
      stateEntity.setCurrentStackVersion(clusterEntity.getDesiredStackVersion());
     
      final HostComponentDesiredStateEntity desiredStateEntity = new HostComponentDesiredStateEntity();
      desiredStateEntity.setDesiredState(jtHostComponentDesiredState);
      desiredStateEntity.setDesiredStackVersion(clusterEntity.getDesiredStackVersion());
     
      persistComponentEntities(stateEntity, desiredStateEntity, serviceComponentDesiredStateEntity);
    }
  }
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

                        new HostComponentDesiredStateEntityPK();
                      entityPK.setClusterId(clusterId);
                      entityPK.setServiceName("HDFS");
                      entityPK.setComponentName("DATANODE");
                      entityPK.setHostName(node.trim());
                      HostComponentDesiredStateEntity desiredStateEntity =
                        desiredStateDAO.findByPK(entityPK);
                      desiredStateEntity.setAdminState(HostComponentAdminState.DECOMMISSIONED);
                      desiredStateDAO.merge(desiredStateEntity);
                    }
                  }
                }
              }
View Full Code Here

Examples of org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity

    pk.setComponentName(sch1.getServiceComponentName());
    pk.setServiceName(sch1.getServiceName());
    pk.setHostName(hostName);
   
    HostComponentDesiredStateDAO dao = injector.getInstance(HostComponentDesiredStateDAO.class);
    HostComponentDesiredStateEntity entity = dao.findByPK(pk);
    Assert.assertEquals(MaintenanceState.OFF, entity.getMaintenanceState());
    Assert.assertEquals(MaintenanceState.OFF, sch1.getMaintenanceState());
   
    sch1.setMaintenanceState(MaintenanceState.ON);
    Assert.assertEquals(MaintenanceState.ON, sch1.getMaintenanceState());
   
    entity = dao.findByPK(pk);
    Assert.assertEquals(MaintenanceState.ON, entity.getMaintenanceState());

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.