sch1.setStackVersion(new StackId("HDP-1.0.0"));
sch1.setDesiredState(State.STARTED);
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);
HostComponentDesiredStateEntity desiredStateEntity =
desiredStateDAO.findByPK(dPK);
HostComponentStateEntity stateEntity =
liveStateDAO.findByPK(lPK);
ServiceComponentHost sch = serviceComponentHostFactory.createExisting(sc,
stateEntity, desiredStateEntity);
Assert.assertNotNull(sch);
Assert.assertEquals(State.STARTING, sch.getState());