Package org.apache.ambari.server.orm.entities

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


  }

  @Test
  public void testProcessDecommissionedDatanodes() throws Exception {
    ClusterEntity clusterEntity = createCluster();
    ClusterServiceEntity clusterServiceEntity = createService(clusterEntity);
    HostEntity hostEntity = createHost(clusterEntity);

    ServiceComponentDesiredStateEntity componentDesiredStateEntity =
      new ServiceComponentDesiredStateEntity();
    componentDesiredStateEntity.setClusterId(clusterEntity.getClusterId());
    componentDesiredStateEntity.setServiceName(clusterServiceEntity.getServiceName());
    componentDesiredStateEntity.setClusterServiceEntity(clusterServiceEntity);
    componentDesiredStateEntity.setComponentName("DATANODE");

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


  @Test
  public void testAddMissingLog4jConfigs() throws Exception {
    ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);

    ClusterEntity clusterEntity = createCluster();
    ClusterServiceEntity clusterServiceEntityMR = addService(clusterEntity, "HDFS");

    Long clusterId = clusterEntity.getClusterId();

    ClusterConfigEntityPK configEntityPK = new ClusterConfigEntityPK();
    configEntityPK.setClusterId(clusterId);
View Full Code Here

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

    hostStateEntity2.setCurrentState(HostState.HEALTHY);
    hostStateEntity2.setHostEntity(host2);
    host1.setHostStateEntity(hostStateEntity1);
    host2.setHostStateEntity(hostStateEntity2);

    ClusterServiceEntity clusterServiceEntity = new ClusterServiceEntity();
    clusterServiceEntity.setServiceName("HDFS");
    clusterServiceEntity.setClusterEntity(clusterEntity);
    clusterServiceEntity.setServiceComponentDesiredStateEntities(
        Collections.EMPTY_LIST);
    clusterServiceEntity.setServiceConfigMappings(Collections.EMPTY_LIST);
    ServiceDesiredStateEntity stateEntity = mock(ServiceDesiredStateEntity.class);
    Gson gson = new Gson();
    when(stateEntity.getDesiredStackVersion()).thenReturn(gson.toJson(new StackId("HDP-0.1"),
        StackId.class));
    clusterServiceEntity.setServiceDesiredStateEntity(stateEntity);
    List<ClusterServiceEntity> clusterServiceEntities = new ArrayList<ClusterServiceEntity>();
    clusterServiceEntities.add(clusterServiceEntity);
    clusterEntity.setClusterServiceEntities(clusterServiceEntities);
    return clusterEntity;
  }
View Full Code Here

    hostStateEntity2.setCurrentState(HostState.HEALTHY);
    hostStateEntity2.setHostEntity(host2);
    host1.setHostStateEntity(hostStateEntity1);
    host2.setHostStateEntity(hostStateEntity2);

    ClusterServiceEntity clusterServiceEntity = new ClusterServiceEntity();
    clusterServiceEntity.setServiceName("HDFS");
    clusterServiceEntity.setClusterEntity(clusterEntity);
    clusterServiceEntity.setServiceComponentDesiredStateEntities(
        Collections.EMPTY_LIST);
    clusterServiceEntity.setServiceConfigMappings(Collections.EMPTY_LIST);
    ServiceDesiredStateEntity stateEntity = mock(ServiceDesiredStateEntity.class);
    Gson gson = new Gson();
    when(stateEntity.getDesiredStackVersion()).thenReturn(gson.toJson(new StackId("HDP-0.1"),
        StackId.class));
    clusterServiceEntity.setServiceDesiredStateEntity(stateEntity);
    List<ClusterServiceEntity> clusterServiceEntities = new ArrayList<ClusterServiceEntity>();
    clusterServiceEntities.add(clusterServiceEntity);
    clusterEntity.setClusterServiceEntities(clusterServiceEntities);
    return clusterEntity;
  }
View Full Code Here

    return clusterEntity;
  }

  private ClusterServiceEntity createService(ClusterEntity clusterEntity) {
    ClusterServiceDAO clusterServiceDAO = injector.getInstance(ClusterServiceDAO.class);
    ClusterServiceEntity clusterServiceEntity = new ClusterServiceEntity();
    clusterServiceEntity.setClusterId(1L);
    clusterServiceEntity.setClusterEntity(clusterEntity);
    clusterServiceEntity.setServiceName(SERVICE_NAME);
    clusterServiceDAO.create(clusterServiceEntity);
    return clusterServiceEntity;
  }
View Full Code Here

  }
 
  private ClusterServiceEntity addService(ClusterEntity clusterEntity, String serviceName) {
    ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);
   
    ClusterServiceEntity clusterServiceEntity = new ClusterServiceEntity();
    clusterServiceEntity.setClusterEntity(clusterEntity);
    clusterServiceEntity.setServiceName(serviceName);
   
    ServiceDesiredStateEntity serviceDesiredStateEntity = new ServiceDesiredStateEntity();
    serviceDesiredStateEntity.setDesiredStackVersion(DESIRED_STACK_VERSION);
    serviceDesiredStateEntity.setClusterServiceEntity(clusterServiceEntity);
   
    clusterServiceEntity.setServiceDesiredStateEntity(serviceDesiredStateEntity);
    clusterEntity.getClusterServiceEntities().add(clusterServiceEntity);
   
    clusterDAO.merge(clusterEntity);
   
    return clusterServiceEntity;
View Full Code Here

  }

  @Test
  public void testAddHistoryServer() throws AmbariException {
    final ClusterEntity clusterEntity = createCluster();
    final ClusterServiceEntity clusterServiceEntityMR = addService(clusterEntity, "MAPREDUCE");
    final HostEntity hostEntity = createHost(clusterEntity);
   
    executeInTransaction(new Runnable() {
      @Override
      public void run() {
View Full Code Here

  }

  @Test
  public void testProcessDecommissionedDatanodes() throws Exception {
    ClusterEntity clusterEntity = createCluster();
    ClusterServiceEntity clusterServiceEntity = createService(clusterEntity);
    HostEntity hostEntity = createHost(clusterEntity);

    ServiceComponentDesiredStateEntity componentDesiredStateEntity =
      new ServiceComponentDesiredStateEntity();
    componentDesiredStateEntity.setClusterId(clusterEntity.getClusterId());
    componentDesiredStateEntity.setServiceName(clusterServiceEntity.getServiceName());
    componentDesiredStateEntity.setClusterServiceEntity(clusterServiceEntity);
    componentDesiredStateEntity.setComponentName("DATANODE");

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

  @Test
  public void testAddMissingLog4jConfigs() throws Exception {
    ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);

    ClusterEntity clusterEntity = createCluster();
    ClusterServiceEntity clusterServiceEntityMR = addService(clusterEntity, "HDFS");

    Long clusterId = clusterEntity.getClusterId();

    ClusterConfigEntityPK configEntityPK = new ClusterConfigEntityPK();
    configEntityPK.setClusterId(clusterId);
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.orm.entities.ClusterServiceEntity

Copyright © 2018 www.massapicom. 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.