use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendAssignedVnicProfilesResource method addParents.
@Override
public VnicProfile addParents(VnicProfile vnicProfile) {
vnicProfile.setNetwork(new Network());
vnicProfile.getNetwork().setId(networkId);
return vnicProfile;
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendIscsiBondNetworksResourceTest method testAdd.
@Test
public void testAdd() throws Exception {
setUriInfo(setUpBasicUriExpectations());
Network network = getModel(0);
network.setId(NETWORK_ID.toString());
setUpGetEntityExpectations(QueryType.GetIscsiBondById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { ISCSI_BOND_ID }, getIscsiBondWithNoNetworks());
setUpActionExpectations(ActionType.EditIscsiBond, EditIscsiBondParameters.class, new String[] { "IscsiBond" }, new Object[] { getIscsiBondContainingNetwork() }, true, true, null);
Response response = collection.add(network);
assertEquals(200, response.getStatus());
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendNetworkResourceTest method testConflictedUpdate.
@Test
public void testConflictedUpdate() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpEntityQueryExpectations(1);
Network model = getModel(1);
model.setId(GUIDS[1].toString());
try {
resource.update(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyImmutabilityConstraint(wae);
}
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendNetworksResourceTest method testAddNetwork.
@Test
public void testAddNetwork() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpCreationExpectations(ActionType.AddNetwork, AddNetworkStoragePoolParameters.class, new String[] { "StoragePoolId" }, new Object[] { DATA_CENTER_ID }, true, true, // GUIDS[0],
null, QueryType.GetAllNetworks, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, asList(getEntity(0)));
Network model = getModel(0);
model.setDataCenter(new DataCenter());
model.getDataCenter().setId(DATA_CENTER_ID.toString());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Network);
verifyModel((Network) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendNetworksResourceTest method testAddNetworkWithNamedDataCenter.
@Test
public void testAddNetworkWithNamedDataCenter() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpEntityQueryExpectations(QueryType.GetStoragePoolByDatacenterName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[1] }, setUpStoragePool(DATA_CENTER_ID));
setUpCreationExpectations(ActionType.AddNetwork, AddNetworkStoragePoolParameters.class, new String[] { "StoragePoolId" }, new Object[] { DATA_CENTER_ID }, true, true, // GUIDS[0],
null, QueryType.GetAllNetworks, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, asList(getEntity(0)));
Network model = getModel(0);
model.setDataCenter(new DataCenter());
model.getDataCenter().setName(NAMES[1]);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Network);
verifyModel((Network) response.getEntity(), 0);
}
Aggregations