Search in sources :

Example 6 with OpenStackNetworkProvider

use of org.ovirt.engine.api.model.OpenStackNetworkProvider in project ovirt-engine by oVirt.

the class V3OpenStackNetworkProviderInAdapter method adapt.

@Override
public OpenStackNetworkProvider adapt(V3OpenStackNetworkProvider from) {
    OpenStackNetworkProvider to = new OpenStackNetworkProvider();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAgentConfiguration()) {
        to.setAgentConfiguration(adaptIn(from.getAgentConfiguration()));
    }
    if (from.isSetAuthenticationUrl()) {
        to.setAuthenticationUrl(from.getAuthenticationUrl());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetPassword()) {
        to.setPassword(from.getPassword());
    }
    if (from.isSetPluginType()) {
        to.setPluginType(NetworkPluginType.fromValue(from.getPluginType()));
    }
    if (from.isSetProperties()) {
        to.setProperties(new Properties());
        to.getProperties().getProperties().addAll(adaptIn(from.getProperties().getProperties()));
    }
    if (from.isSetRequiresAuthentication()) {
        to.setRequiresAuthentication(from.isRequiresAuthentication());
    }
    if (from.isSetTenantName()) {
        to.setTenantName(from.getTenantName());
    }
    if (from.isSetUrl()) {
        to.setUrl(from.getUrl());
    }
    if (from.isSetUsername()) {
        to.setUsername(from.getUsername());
    }
    to.setType(OpenStackNetworkProviderType.NEUTRON);
    return to;
}
Also used : OpenStackNetworkProvider(org.ovirt.engine.api.model.OpenStackNetworkProvider) V3OpenStackNetworkProvider(org.ovirt.engine.api.v3.types.V3OpenStackNetworkProvider) Properties(org.ovirt.engine.api.model.Properties)

Example 7 with OpenStackNetworkProvider

use of org.ovirt.engine.api.model.OpenStackNetworkProvider in project ovirt-engine by oVirt.

the class BackendOpenStackNetworkProviderResourceTest method getModel.

private OpenStackNetworkProvider getModel(int index) {
    OpenStackNetworkProvider model = new OpenStackNetworkProvider();
    model.setName(NAMES[index]);
    model.setType(OpenStackNetworkProviderType.NEUTRON);
    model.setDescription(DESCRIPTIONS[index]);
    return model;
}
Also used : OpenStackNetworkProvider(org.ovirt.engine.api.model.OpenStackNetworkProvider)

Example 8 with OpenStackNetworkProvider

use of org.ovirt.engine.api.model.OpenStackNetworkProvider in project ovirt-engine by oVirt.

the class BackendOpenStackNetworkProviderResourceTest method testConflictedUpdate.

@Test
public void testConflictedUpdate() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpGetEntityExpectations(1);
    OpenStackNetworkProvider model = getModel(1);
    model.setId(GUIDS[1].toString());
    try {
        resource.update(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyImmutabilityConstraint(wae);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) OpenStackNetworkProvider(org.ovirt.engine.api.model.OpenStackNetworkProvider) Test(org.junit.Test) AbstractBackendSubResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendSubResourceTest)

Aggregations

OpenStackNetworkProvider (org.ovirt.engine.api.model.OpenStackNetworkProvider)8 OpenStackNetwork (org.ovirt.engine.api.model.OpenStackNetwork)2 Properties (org.ovirt.engine.api.model.Properties)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 Test (org.junit.Test)1 Property (org.ovirt.engine.api.model.Property)1 AbstractBackendSubResourceTest (org.ovirt.engine.api.restapi.resource.AbstractBackendSubResourceTest)1 Mapping (org.ovirt.engine.api.restapi.types.Mapping)1 V3OpenStackNetworkProvider (org.ovirt.engine.api.v3.types.V3OpenStackNetworkProvider)1 OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)1