use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendDataCenterNetworksResourceTest method doTestBadAddNetwork.
private void doTestBadAddNetwork(boolean valid, boolean success, String detail) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.AddNetwork, AddNetworkStoragePoolParameters.class, new String[] { "StoragePoolId" }, new Object[] { DATA_CENTER_ID }, valid, success));
Network model = getModel(0);
model.setDataCenter(new DataCenter());
model.getDataCenter().setId(DATA_CENTER_ID.toString());
try {
collection.add(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyFault(wae, detail);
}
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class AbstractBackendNetworksResourceTest method getEntity.
@Override
protected org.ovirt.engine.core.common.businessentities.network.Network getEntity(int index) {
org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network();
NetworkCluster networkCluster = new NetworkCluster();
networkCluster.setDisplay(false);
networkCluster.setMigration(false);
networkCluster.setRequired(false);
networkCluster.setDefaultRoute(false);
network.setCluster(networkCluster);
network.setId(GUIDS[index]);
network.setName(NAMES[index]);
network.setDescription(DESCRIPTIONS[index]);
network.setDataCenterId(GUIDS[1]);
return network;
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class AbstractBackendVnicProfilesResourceTest method testAddVnicProfile.
@Test
public void testAddVnicProfile() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpNetworkQueryExpectations();
setUpCreationExpectations(ActionType.AddVnicProfile, AddVnicProfileParameters.class, new String[] {}, new Object[] {}, true, true, GUIDS[0], QueryType.GetVnicProfileById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, getEntity(0));
VnicProfile model = getModel(0);
model.setNetwork(new Network());
model.getNetwork().setId(NETWORK_ID.toString());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof VnicProfile);
verifyModel((VnicProfile) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class LinkHelperTest method testClusterNetworkLinks.
@Test
public void testClusterNetworkLinks() throws Exception {
Network network = new Network();
network.setId(NETWORK_ID);
network.setCluster(new Cluster());
network.getCluster().setId(CLUSTER_ID);
LinkHelper.addLinks(network);
assertEquals(CLUSTER_NETWORK_HREF, network.getHref());
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class IscsiBondMapperTest method verifyNetworks.
private static void verifyNetworks(Networks before, Networks after) {
if (before == null) {
assertNull(after);
} else {
assertEquals(before.getNetworks().size(), after.getNetworks().size());
Set<String> ids = new HashSet<>();
for (Network network : before.getNetworks()) {
ids.add(network.getId());
}
for (Network network : after.getNetworks()) {
ids.remove(network.getId());
}
assertEquals(0, ids.size());
}
}
Aggregations