use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class UpdateHostValidatorTest method hostProviderTypeMatches.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void hostProviderTypeMatches() {
when(host.getHostProviderId()).thenReturn(Guid.newGuid());
Provider provider = mock(Provider.class);
when(provider.getType()).thenReturn(ProviderType.FOREMAN);
when(providerDao.get(any())).thenReturn(provider);
assertThat(validator.hostProviderTypeMatches(), isValid());
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class BackendExternalDiscoveredHostResource method get.
@Override
public ExternalDiscoveredHost get() {
// Convert the resource identifier to the host group name:
String name = hex2string(id);
// The backend doesn't have a way to retrieve a host by ide, so we have to iterate them:
Provider provider = BackendExternalProviderHelper.getProvider(this, providerId);
ProviderQueryParameters parameters = new ProviderQueryParameters();
parameters.setProvider(provider);
QueryReturnValue result = runQuery(QueryType.GetDiscoveredHostListFromExternalProvider, parameters);
List<org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost> entities = result.getReturnValue();
if (entities != null) {
for (org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost entity : entities) {
if (name.equals(entity.getName())) {
return addLinks(populate(map(entity), entity));
}
}
}
// No luck:
return notFound();
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class BackendExternalHostProviderResource method remove.
@Override
public Response remove() {
Provider provider = BackendExternalProviderHelper.getProvider(this, id);
ProviderParameters parameters = new ProviderParameters(provider);
return performAction(ActionType.RemoveProvider, parameters);
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class ProviderGeneralModel method updateProperties.
private void updateProperties() {
Provider provider = getEntity();
setName(provider.getName());
setType(provider.getType());
setDescription(provider.getDescription());
setUrl(provider.getUrl());
}
use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.
the class ProviderListModel method updateActionAvailability.
private void updateActionAvailability() {
Collection<Provider> tempVar = getSelectedItems();
Collection<Provider> selectedItems = (tempVar != null) ? tempVar : new ArrayList();
getEditCommand().setIsExecutionAllowed(selectedItems.size() == 1);
getRemoveCommand().setIsExecutionAllowed(selectedItems.size() > 0);
getForceRemoveCommand().setIsExecutionAllowed(selectedItems.size() > 0);
getAddCommand().setIsAvailable(true);
getRemoveCommand().setIsAvailable(true);
getForceRemoveCommand().setIsAvailable(isSelectedProviderOfType(ProviderType.OPENSTACK_VOLUME));
}
Aggregations