use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendClusterNetworksResourceTest method testAddIncompleteParametersNoName.
@Test
public void testAddIncompleteParametersNoName() throws Exception {
Network model = new Network();
model.setDescription(DESCRIPTIONS[0]);
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "Network", "add", "id|name");
}
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendClusterNetworksResourceTest method testAddIdSuppliedButNoName.
@Test
public void testAddIdSuppliedButNoName() throws Exception {
setUriInfo(setUpBasicUriExpectations());
Network model = new Network();
model.setId("11111111-1111-1111-1111-111111111111");
setUpEntityQueryExpectations(1, null);
setUpGetNetworksByDataCenterExpectations(1, null);
setUpClusterExpectations(CLUSTER_ID);
setUpActionExpectations(ActionType.AttachNetworkToCluster, AttachNetworkToClusterParameter.class, new String[] { "ClusterId" }, new Object[] { CLUSTER_ID }, true, true);
collection.add(model);
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendClusterNetworksResourceTest method testAddNameSuppliedButNoId.
@Test
public void testAddNameSuppliedButNoId() throws Exception {
setUriInfo(setUpBasicUriExpectations());
Network model = new Network();
model.setName("orcus");
model.setDescription(DESCRIPTIONS[0]);
setUpEntityQueryExpectations(1, null);
setUpGetNetworksByDataCenterExpectations(1, null);
setUpClusterExpectations(CLUSTER_ID);
setUpActionExpectations(ActionType.AttachNetworkToCluster, AttachNetworkToClusterParameter.class, new String[] { "ClusterId" }, new Object[] { CLUSTER_ID }, true, true);
collection.add(model);
}
use of org.ovirt.engine.api.model.Network in project ovirt-engine by oVirt.
the class BackendDataCenterNetworksResourceTest 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.GetNetworksByDataCenterId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { DATA_CENTER_ID }, 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 BackendDataCenterNetworksResourceTest method testAddIncompleteParameters.
@Test
public void testAddIncompleteParameters() throws Exception {
Network model = new Network();
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "Network", "add", "name");
}
}
Aggregations