static CpuProfile getModel(int index) { CpuProfile model = new CpuProfile(); model.setId(GUIDS[index].toString()); model.setName(NAMES[index]); model.setDescription(DESCRIPTIONS[index]); return model; }
@Test public void testConflictedUpdate() throws Exception { setUriInfo(setUpBasicUriExpectations()); setUpEntityQueryExpectations(1, 0, false); control.replay(); CpuProfile model = getModel(1); model.setId(GUIDS[1].toString()); try { resource.update(model); fail("expected WebApplicationException"); } catch (WebApplicationException wae) { verifyImmutabilityConstraint(wae); } }
@Override protected void validateParameters(CpuProfile cpuProfile) { validateParameters(cpuProfile, "name", "cluster.id"); String clusterId = cpuProfile.getCluster().getId(); // verify the cluster.id is well provided getEntity( Cluster.class, VdcQueryType.GetClusterById, new IdQueryParameters(asGuid(clusterId)), "cluster: id=" + clusterId); }