use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class ManageGlusterServiceCommandTest method mockBackend.
private void mockBackend(boolean succeeded, EngineError errorCode, GlusterServiceStatus status) {
VDSReturnValue vdsReturnValue = new VDSReturnValue();
vdsReturnValue.setSucceeded(succeeded);
if (!succeeded) {
vdsReturnValue.setVdsError(new VDSError(errorCode, ""));
} else {
if (status == GlusterServiceStatus.STOPPED) {
vdsReturnValue.setReturnValue(getGlusterServerServicesByServerIdAndServiceType(Guid.newGuid(), ServiceType.GLUSTER_SWIFT, status));
} else {
// Adding one additional service for the case of stop so that save mechanism can be tested out
Guid serverId = Guid.newGuid();
List<GlusterServerService> serverServiceList = getGlusterServerServicesByServerIdAndServiceType(serverId, ServiceType.GLUSTER_SWIFT, status);
GlusterServerService srvc3 = new GlusterServerService();
srvc3.setMessage("test-msg3");
srvc3.setPid(10000);
srvc3.setPort(20000);
srvc3.setServerId(serverId);
srvc3.setServiceId(Guid.newGuid());
srvc3.setServiceName("srvc3");
srvc3.setServiceType(ServiceType.GLUSTER_SWIFT);
srvc3.setStatus(status);
serverServiceList.add(srvc3);
vdsReturnValue.setReturnValue(serverServiceList);
}
}
when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.ManageGlusterService), any())).thenReturn(vdsReturnValue);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class GlusterSwiftServiceModel method onEntityChanged.
@Override
protected void onEntityChanged() {
super.onEntityChanged();
GlusterServerService service = getEntity();
if (service == null || service.getStatus() == GlusterServiceStatus.NOT_AVAILABLE) {
getStartSwift().setIsChangeable(false);
getStopSwift().setIsChangeable(false);
getRestartSwift().setIsChangeable(false);
} else {
getStartSwift().setIsChangeable(service.getStatus() != GlusterServiceStatus.RUNNING);
getStopSwift().setIsChangeable(service.getStatus() != GlusterServiceStatus.STOPPED);
getRestartSwift().setIsChangeable(true);
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class ClusterGeneralModel method getGroupedGlusterSwiftServices.
private List<GlusterSwiftServiceModel> getGroupedGlusterSwiftServices(List<GlusterServerService> serviceList) {
Map<Guid, GlusterSwiftServiceModel> serverSwiftMap = new HashMap<>();
for (GlusterServerService service : serviceList) {
GlusterSwiftServiceModel serverSwiftModel = serverSwiftMap.get(service.getServerId());
if (serverSwiftModel == null) {
GlusterServerService serverSwift = new GlusterServerService();
serverSwift.setHostName(service.getHostName());
serverSwift.setServerId(service.getServerId());
serverSwift.setServiceType(ServiceType.GLUSTER_SWIFT);
serverSwift.setStatus(service.getStatus());
serverSwiftModel = new GlusterSwiftServiceModel(serverSwift);
serverSwiftMap.put(service.getServerId(), serverSwiftModel);
}
serverSwiftModel.getInternalServiceList().add(service);
}
return new ArrayList<>(serverSwiftMap.values());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class GlusterServerServiceDaoTest method testUpdateByServerIdAndServiceType.
@Test
public void testUpdateByServerIdAndServiceType() {
GlusterServerService existingService = dao.get(SERVER1_SERVICE_ID);
assertNotNull(existingService);
assertEquals(GlusterServiceStatus.RUNNING, existingService.getStatus());
GlusterServerService serviceToModify = dao.get(SERVER1_SERVICE_ID);
serviceToModify.setStatus(GlusterServiceStatus.STOPPED);
dao.updateByServerIdAndServiceType(serviceToModify);
GlusterServerService modifiedService = dao.get(SERVER1_SERVICE_ID);
assertNotNull(modifiedService);
assertEquals(GlusterServiceStatus.STOPPED, modifiedService.getStatus());
assertEquals(GlusterServiceStatus.RUNNING, existingService.getStatus());
assertFalse(existingService.equals(modifiedService));
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService in project ovirt-engine by oVirt.
the class GlusterServerServiceDaoTest method testUpdate.
@Test
public void testUpdate() {
GlusterServerService existingService = dao.get(SERVER1_SERVICE_ID);
assertNotNull(existingService);
assertEquals(GlusterServiceStatus.RUNNING, existingService.getStatus());
GlusterServerService serviceToModify = dao.get(SERVER1_SERVICE_ID);
serviceToModify.setStatus(GlusterServiceStatus.STOPPED);
dao.update(serviceToModify);
GlusterServerService modifiedService = dao.get(SERVER1_SERVICE_ID);
assertNotNull(modifiedService);
assertEquals(GlusterServiceStatus.STOPPED, modifiedService.getStatus());
assertEquals(GlusterServiceStatus.RUNNING, existingService.getStatus());
assertFalse(existingService.equals(modifiedService));
}
Aggregations