コード例 #1
0
  @Test
  public void testNicLinks() throws Exception {
    Nic nic = new Nic();
    nic.setId(NIC_ID);

    nic.setVm(new Vm());
    nic.getVm().setId(VM_ID);

    LinkHelper.addLinks(nic);

    assertEquals(NIC_HREF, nic.getHref());
  }
コード例 #2
0
  @Test
  public void testAddIncompleteParameters() throws Exception {
    Nic model = new Nic();
    model.setName(null);

    setUriInfo(setUpBasicUriExpectations());
    try {
      collection.add(model);
      fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
      verifyIncompleteException(wae, "Nic", "add", "name");
    }
  }
コード例 #3
0
 @Override
 public Nic addParents(Nic nic) {
   InstanceType instanceType = new InstanceType();
   instanceType.setId(instanceTypeId.toString());
   nic.setInstanceType(instanceType);
   return nic;
 }
コード例 #4
0
 public Response add(Nic nic) {
   validateEnums(Nic.class, nic);
   validateParameters(nic, "name");
   return performCreate(
       VdcActionType.AddVmTemplateInterface,
       new AddVmTemplateInterfaceParameters(instanceTypeId, map(nic)),
       new NicResolver(nic.getName()));
 }
コード例 #5
0
 static void verifyModelSpecific(Nic model, int index) {
   assertEquals(GUIDS[index].toString(), model.getId());
   assertEquals(NAMES[index].toString(), model.getName());
   assertTrue(model.isSetVm());
   assertEquals(INSTANCE_TYPE_ID.toString(), model.getVm().getId());
   assertTrue(model.isSetMac());
   assertEquals(ADDRESSES[2].toString(), model.getMac().getAddress());
 }
コード例 #6
0
 static Nic getModel(int index) {
   Nic model = new Nic();
   model.setName(NAMES[index]);
   model.setInterface(NicInterface.RTL8139_VIRTIO.value());
   return model;
 }