@Mapping(from = MacPool.class, to = org.ovirt.engine.api.model.MacPool.class) public static org.ovirt.engine.api.model.MacPool map(MacPool entity, org.ovirt.engine.api.model.MacPool template) { if (entity == null) { return template; } org.ovirt.engine.api.model.MacPool model = template == null ? new org.ovirt.engine.api.model.MacPool() : template; model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setAllowDuplicates(entity.isAllowDuplicateMacAddresses()); model.setDescription(entity.getDescription()); model.setDefaultPool(entity.isDefaultPool()); mapRanges(entity, model); return model; }
@Override public V3MacPool adapt(MacPool from) { V3MacPool to = new V3MacPool(); if (from.isSetLinks()) { to.getLinks().addAll(adaptOut(from.getLinks())); if (from.isSetActions()) { to.setActions(adaptOut(from.getActions())); if (from.isSetAllowDuplicates()) { to.setAllowDuplicates(from.isAllowDuplicates()); if (from.isSetComment()) { to.setComment(from.getComment()); if (from.isSetDefaultPool()) { to.setDefaultPool(from.isDefaultPool()); 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());
static MacPool getModel(int index) { MacPool model = new MacPool(); model.setId(GUIDS[index].toString()); model.setName(NAMES[index]); model.setDescription(DESCRIPTIONS[index]); return model; }
@Mapping(from = org.ovirt.engine.api.model.MacPool.class, to = MacPool.class) public static MacPool map(org.ovirt.engine.api.model.MacPool model, MacPool template) { if (model == null) { return template; } MacPool entity = template == null ? new MacPool() : template; if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetAllowDuplicates()) { entity.setAllowDuplicateMacAddresses(model.isAllowDuplicates()); } if (model.isSetDefaultPool()) { entity.setDefaultPool(model.isDefaultPool()); } if (model.isSetRanges()) { mapRanges(model, entity); } return entity; }
public static void validateAdd(MacPool pool) { if (pool == null) { throw new ValidationException("Parameter 'pool' is mandatory but was not provided."); } if (pool.getName()==null) { throw new ValidationException("Parameter 'pool.name' is mandatory but was not provided."); } if (pool.getRanges()==null || pool.getRanges().getRanges()==null || pool.getRanges().getRanges().size() == 0 || pool.getRanges().getRanges().get(0).getTo()==null) { throw new ValidationException("Parameter 'pool.ranges.to' is mandatory but was not provided."); } if (pool.getRanges()==null || pool.getRanges().getRanges()==null || pool.getRanges().getRanges().size() == 0 || pool.getRanges().getRanges().get(0).getFrom()==null) { throw new ValidationException("Parameter 'pool.ranges.from' is mandatory but was not provided."); } }
@Override public MacPool adapt(V3MacPool from) { MacPool to = new MacPool(); if (from.isSetLinks()) { to.getLinks().addAll(adaptIn(from.getLinks())); to.setActions(adaptIn(from.getActions())); to.setAllowDuplicates(from.isAllowDuplicates()); to.setComment(from.getComment()); to.setDefaultPool(from.isDefaultPool()); to.setDescription(from.getDescription()); to.setId(from.getId()); to.setHref(from.getHref()); to.setName(from.getName()); to.setRanges(new Ranges()); to.getRanges().getRanges().addAll(adaptIn(from.getRanges().getRanges()));
@Override protected void verify(MacPool model, MacPool transform) { assertNotNull(transform); assertEquals(model.getId(), transform.getId()); assertEquals(model.getName(), transform.getName()); assertEquals(model.getDescription(), transform.getDescription()); assertEquals(model.isDefaultPool(), transform.isDefaultPool()); assertEquals(model.isAllowDuplicates(), transform.isAllowDuplicates()); } }
/** * Create an instance of {@link MacPool } * */ public MacPool createMacPool() { return new MacPool(); }
@Override protected void verify(DataCenter model, DataCenter transform) { assertNotNull(transform); assertEquals(model.getName(), transform.getName()); assertEquals(model.getId(), transform.getId()); assertEquals(model.getDescription(), transform.getDescription()); assertEquals(model.getComment(), transform.getComment()); assertEquals(model.isLocal(), transform.isLocal()); assertEquals(model.getStorageFormat(), transform.getStorageFormat()); assertEquals(model.getMacPool().getId(), transform.getMacPool().getId()); assertEquals(model.getQuotaMode(), transform.getQuotaMode()); }
private static void mapRanges(org.ovirt.engine.api.model.MacPool model, MacPool entity) { final List<MacRange> ranges = new ArrayList<>(); for (org.ovirt.engine.api.model.Range range : model.getRanges().getRanges()) { ranges.add(mapRange(range)); } entity.setRanges(ranges); }
@Test public void testConflictedUpdate() { setUriInfo(setUpBasicUriExpectations()); setUpEntityQueryExpectations(1, 0, false); MacPool model = getModel(1); model.setId(GUIDS[1].toString()); verifyImmutabilityConstraint(assertThrows(WebApplicationException.class, () -> resource.update(model))); }
static MacPool getModel(int index) { MacPool model = new MacPool(); model.setId(GUIDS[index].toString()); model.setName(NAMES[index]); model.setDescription(DESCRIPTIONS[index]); return model; }
protected MacPool createIncompleteMacPool() { MacPool macPool = new MacPool(); return macPool; }