@Override public VnicProfile addParents(VnicProfile vnicProfile) { vnicProfile.setNetwork(new Network()); vnicProfile.getNetwork().setId(networkId); return vnicProfile; }
model.setNetwork(new Network()); model.getNetwork().setId(entity.getNetworkId().toString());
@Override public Response add(VnicProfile vnicProfile) { if (!vnicProfile.isSetNetwork() || !vnicProfile.getNetwork().isSetId()) { vnicProfile.setNetwork(new Network()); vnicProfile.getNetwork().setId(networkId); } return super.add(vnicProfile); }
@Test public void testAddVnicProfile() { 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); }
private void doTestBadAddVnicProfile(boolean valid, boolean success, String detail) { setUriInfo(setUpActionExpectations(ActionType.AddVnicProfile, AddVnicProfileParameters.class, new String[] {}, new Object[] {}, valid, success)); VnicProfile model = getModel(0); model.setNetwork(new Network()); model.getNetwork().setId(NETWORK_ID.toString()); verifyFault(assertThrows(WebApplicationException.class, () -> collection.add(model)), detail); }
to.setNetwork(adaptIn(from.getNetwork()));