Examples of HostComponentDesiredStateEntityPK


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

    this.service = service;
    this.desiredStateEntity = serviceComponentDesiredStateEntity;

    this.hostComponents = new HashMap<String, ServiceComponentHost>();
    for (HostComponentStateEntity hostComponentStateEntity : desiredStateEntity.getHostComponentStateEntities()) {
      HostComponentDesiredStateEntityPK pk = new HostComponentDesiredStateEntityPK();
      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,
View Full Code Here

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

                String decommissionedNodes = properties.get("datanodes");
                if (decommissionedNodes != null) {
                  String[] nodes = decommissionedNodes.split(",");
                  if (nodes.length > 0) {
                    for (String node : nodes) {
                      HostComponentDesiredStateEntityPK entityPK =
                        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.HostComponentDesiredStateEntityPK

   
    ServiceComponentHost sch1 = createNewServiceComponentHost(cluster, "HDFS", "NAMENODE", hostName);
    ServiceComponentHost sch2 = createNewServiceComponentHost(cluster, "HDFS", "DATANODE", hostName);
    ServiceComponentHost sch3 = createNewServiceComponentHost(cluster, "MAPREDUCE2", "HISTORYSERVER", hostName);

    HostComponentDesiredStateEntityPK pk = new HostComponentDesiredStateEntityPK();
    pk.setClusterId(Long.valueOf(cluster.getClusterId()));
    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());
View Full Code Here

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

    ServiceComponentHost serviceCheckNodeHost = serviceCheckNode.addServiceComponentHost(h2);
    serviceCheckNodeHost.persist();
    serviceCheckNodeHost.setState(State.UNKNOWN);

    HostComponentStateEntityPK hkspk = new HostComponentStateEntityPK();
    HostComponentDesiredStateEntityPK hkdspk = new HostComponentDesiredStateEntityPK();

    hkspk.setClusterId(nameNodeHost.getClusterId());
    hkspk.setHostName(nameNodeHost.getHostName());
    hkspk.setServiceName(nameNodeHost.getServiceName());
    hkspk.setComponentName(nameNodeHost.getServiceComponentName());

    hkdspk.setClusterId(nameNodeHost.getClusterId());
    hkdspk.setHostName(nameNodeHost.getHostName());
    hkdspk.setServiceName(nameNodeHost.getServiceName());
    hkdspk.setComponentName(nameNodeHost.getServiceComponentName());

    Assert.assertNotNull(injector.getInstance(HostComponentStateDAO.class).findByPK(hkspk));
    Assert.assertNotNull(injector.getInstance(HostComponentDesiredStateDAO.class).findByPK(hkdspk));
    Assert.assertEquals(2, injector.getProvider(EntityManager.class).get().createQuery("SELECT config FROM ClusterConfigEntity config").getResultList().size());
    Assert.assertEquals(1, injector.getProvider(EntityManager.class).get().createQuery("SELECT state FROM ClusterStateEntity state").getResultList().size());
View Full Code Here

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

  @Override
  @Transactional
  public synchronized void refresh() {
    if (isPersisted()) {
      HostComponentStateEntityPK pk = new HostComponentStateEntityPK();
      HostComponentDesiredStateEntityPK dpk = new HostComponentDesiredStateEntityPK();
      pk.setClusterId(getClusterId());
      pk.setComponentName(getServiceComponentName());
      pk.setServiceName(getServiceName());
      pk.setHostName(getHostName());
      dpk.setClusterId(getClusterId());
      dpk.setComponentName(getServiceComponentName());
      dpk.setServiceName(getServiceName());
      dpk.setHostName(getHostName());
      stateEntity = hostComponentStateDAO.findByPK(pk);
      desiredStateEntity = hostComponentDesiredStateDAO.findByPK(dpk);
      hostComponentStateDAO.refresh(stateEntity);
      hostComponentDesiredStateDAO.refresh(desiredStateEntity);
    }
View Full Code Here

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

    pk.setServiceName(stateEntity.getServiceName());
    pk.setHostName(stateEntity.getHostName());

    hostComponentStateDAO.removeByPK(pk);

    HostComponentDesiredStateEntityPK desiredPK = new HostComponentDesiredStateEntityPK();
    desiredPK.setClusterId(desiredStateEntity.getClusterId());
    desiredPK.setComponentName(desiredStateEntity.getComponentName());
    desiredPK.setServiceName(desiredStateEntity.getServiceName());
    desiredPK.setHostName(desiredStateEntity.getHostName());

    hostComponentDesiredStateDAO.removeByPK(desiredPK);
  }
View Full Code Here

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

  @Override
  @Transactional
  public synchronized void refresh() {
    if (isPersisted()) {
      HostComponentStateEntityPK pk = new HostComponentStateEntityPK();
      HostComponentDesiredStateEntityPK dpk = new HostComponentDesiredStateEntityPK();
      pk.setClusterId(getClusterId());
      pk.setComponentName(getServiceComponentName());
      pk.setServiceName(getServiceName());
      pk.setHostName(getHostName());
      dpk.setClusterId(getClusterId());
      dpk.setComponentName(getServiceComponentName());
      dpk.setServiceName(getServiceName());
      dpk.setHostName(getHostName());
      stateEntity = hostComponentStateDAO.findByPK(pk);
      desiredStateEntity = hostComponentDesiredStateDAO.findByPK(dpk);
      hostComponentStateDAO.refresh(stateEntity);
      hostComponentDesiredStateDAO.refresh(desiredStateEntity);
    }
View Full Code Here

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

    pk.setServiceName(stateEntity.getServiceName());
    pk.setHostName(stateEntity.getHostName());

    hostComponentStateDAO.removeByPK(pk);

    HostComponentDesiredStateEntityPK desiredPK = new HostComponentDesiredStateEntityPK();
    desiredPK.setClusterId(desiredStateEntity.getClusterId());
    desiredPK.setComponentName(desiredStateEntity.getComponentName());
    desiredPK.setServiceName(desiredStateEntity.getServiceName());
    desiredPK.setHostName(desiredStateEntity.getHostName());

    hostComponentDesiredStateDAO.removeByPK(desiredPK);
  }
View Full Code Here

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

    HostComponentDesiredStateDAO desiredStateDAO = injector.getInstance(
        HostComponentDesiredStateDAO.class);
    HostComponentStateDAO liveStateDAO = injector.getInstance(
        HostComponentStateDAO.class);

    HostComponentDesiredStateEntityPK dPK =
        new HostComponentDesiredStateEntityPK();
    HostComponentStateEntityPK lPK =
        new HostComponentStateEntityPK();

    dPK.setClusterId(cluster.getClusterId());
    dPK.setComponentName(componentName);
    dPK.setHostName("h1");
    dPK.setServiceName(serviceName);
    lPK.setClusterId(cluster.getClusterId());
    lPK.setComponentName(componentName);
    lPK.setHostName("h1");
    lPK.setServiceName(serviceName);
View Full Code Here

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

   
    ServiceComponentHost sch1 = createNewServiceComponentHost(cluster, "HDFS", "NAMENODE", hostName);
    ServiceComponentHost sch2 = createNewServiceComponentHost(cluster, "HDFS", "DATANODE", hostName);
    ServiceComponentHost sch3 = createNewServiceComponentHost(cluster, "MAPREDUCE2", "HISTORYSERVER", hostName);

    HostComponentDesiredStateEntityPK pk = new HostComponentDesiredStateEntityPK();
    pk.setClusterId(Long.valueOf(cluster.getClusterId()));
    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());
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.