Search in sources :

Example 16 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class BackendExternalProviderCertificatesResource method list.

@Override
public Certificates list() {
    Provider provider = BackendExternalProviderHelper.getProvider(this, providerId);
    ProviderQueryParameters parameters = new ProviderQueryParameters();
    parameters.setProvider(provider);
    return mapCollection(getBackendCollection(QueryType.GetProviderCertificateChain, parameters));
}
Also used : ProviderQueryParameters(org.ovirt.engine.core.common.queries.ProviderQueryParameters) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 17 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class ExternalHostProviderMapper method map.

@Mapping(from = ExternalHostProvider.class, to = Provider.class)
public static Provider map(ExternalHostProvider model, Provider template) {
    Provider entity = template != null ? template : new Provider();
    entity.setType(ProviderType.FOREMAN);
    if (model.isSetId()) {
        entity.setId(GuidUtils.asGuid(model.getId()));
    }
    if (model.isSetName()) {
        entity.setName(model.getName());
    }
    if (model.isSetDescription()) {
        entity.setDescription(model.getDescription());
    }
    if (model.isSetUrl()) {
        entity.setUrl(model.getUrl());
    }
    if (model.isSetRequiresAuthentication()) {
        entity.setRequiringAuthentication(model.isRequiresAuthentication());
    }
    if (model.isSetUsername()) {
        entity.setUsername(model.getUsername());
    }
    if (model.isSetPassword()) {
        entity.setPassword(model.getPassword());
    }
    return entity;
}
Also used : ExternalHostProvider(org.ovirt.engine.api.model.ExternalHostProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider) Mapping(org.ovirt.engine.api.restapi.types.Mapping)

Example 18 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class GetAllExternalNetworksOnProviderQueryTest method testExecuteQueryCommand.

@Test
@SuppressWarnings("unchecked")
public void testExecuteQueryCommand() {
    when(params.getId()).thenReturn(mock(Guid.class));
    when((Provider<AdditionalProperties>) providerDao.get(any())).thenReturn(networkProvider);
    when(providerProxyFactory.create(networkProvider)).thenReturn(client);
    Network network = mock(Network.class);
    ProviderNetwork providerNetwork = mock(ProviderNetwork.class);
    when(client.getAll()).thenReturn(Collections.singletonList(network));
    when(network.getProvidedBy()).thenReturn(providerNetwork);
    when(providerNetwork.getExternalId()).thenReturn("");
    Guid id = mock(Guid.class);
    when(dcDao.getDcIdByExternalNetworkId(any())).thenReturn(Collections.singletonList(id));
    Map<Network, Set<Guid>> expected = new HashMap<>();
    expected.put(network, Collections.singleton(id));
    query = getQuery();
    query.executeQueryCommand();
    assertEquals("Wrong result returned", expected, getQuery().getQueryReturnValue().getReturnValue());
}
Also used : Set(java.util.Set) HashMap(java.util.HashMap) ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork) Network(org.ovirt.engine.core.common.businessentities.network.Network) ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork) Guid(org.ovirt.engine.core.compat.Guid) Provider(org.ovirt.engine.core.common.businessentities.Provider) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Example 19 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class GetHostGroupsFromExternalProviderQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    Provider hostProvider = getParameters().getProvider();
    List<ExternalHostGroup> providerHostGroups = getProviderHostGroups(hostProvider);
    getQueryReturnValue().setReturnValue(providerHostGroups);
}
Also used : ExternalHostGroup(org.ovirt.engine.core.common.businessentities.ExternalHostGroup) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Example 20 with Provider

use of org.ovirt.engine.core.common.businessentities.Provider in project ovirt-engine by oVirt.

the class ProviderDaoTest method generateNewEntity.

@Override
protected Provider<?> generateNewEntity() {
    Provider<AdditionalProperties> provider = new Provider<>();
    provider.setId(generateNonExistingId());
    provider.setName("brovider");
    provider.setUrl("http://brovider.com/");
    provider.setType(ProviderType.OPENSTACK_NETWORK);
    OpenstackNetworkProviderProperties additionalProperties = new OpenstackNetworkProviderProperties();
    additionalProperties.setReadOnly(Boolean.FALSE);
    additionalProperties.setTenantName("10ant");
    additionalProperties.setPluginType(OpenstackNetworkPluginType.OPEN_VSWITCH.name());
    provider.setAdditionalProperties(additionalProperties);
    provider.setAuthUrl("http://keystone-server:35357/v2.0/");
    return provider;
}
Also used : AdditionalProperties(org.ovirt.engine.core.common.businessentities.Provider.AdditionalProperties) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Aggregations

Provider (org.ovirt.engine.core.common.businessentities.Provider)63 ExternalHostProvider (org.ovirt.engine.api.model.ExternalHostProvider)10 ArrayList (java.util.ArrayList)7 ProviderQueryParameters (org.ovirt.engine.core.common.queries.ProviderQueryParameters)7 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)7 ProviderParameters (org.ovirt.engine.core.common.action.ProviderParameters)6 Test (org.junit.Test)5 VDS (org.ovirt.engine.core.common.businessentities.VDS)5 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)5 Guid (org.ovirt.engine.core.compat.Guid)5 List (java.util.List)4 OpenStackNetworkProvider (org.ovirt.engine.api.model.OpenStackNetworkProvider)4 OpenStackVolumeProvider (org.ovirt.engine.api.model.OpenStackVolumeProvider)4 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)4 ExternalDiscoveredHost (org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost)4 ExternalHostGroup (org.ovirt.engine.core.common.businessentities.ExternalHostGroup)4 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)4 ExternalProvider (org.ovirt.engine.api.model.ExternalProvider)3 OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)3 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)3