org.ovirt.engine.core.common.businessentities.network.Network.setId()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.ovirt.engine.core.common.businessentities.network.Network.setId()方法的一些代码示例,展示了Network.setId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Network.setId()方法的具体详情如下:
包路径:org.ovirt.engine.core.common.businessentities.network.Network
类名称:Network
方法名:setId

Network.setId介绍

暂无

代码示例

代码示例来源:origin: oVirt/ovirt-engine

@Override
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
  T entity = createNetworkEntity();
  entity.setId(getGuidDefaultEmpty(rs, "id"));
  entity.setName(rs.getString("name"));
  entity.setVdsmName(rs.getString("vdsm_name"));
  entity.setDescription(rs.getString("description"));
  entity.setComment(rs.getString("free_text_comment"));
  entity.setType((Integer) rs.getObject("type"));
  entity.setAddr(rs.getString("addr"));
  entity.setSubnet(rs.getString("subnet"));
  entity.setGateway(rs.getString("gateway"));
  entity.setVlanId((Integer) rs.getObject("vlan_id"));
  entity.setStp(rs.getBoolean("stp"));
  entity.setDataCenterId(getGuidDefaultEmpty(rs, "storage_pool_id"));
  entity.setMtu(rs.getInt("mtu"));
  entity.setVmNetwork(rs.getBoolean("vm_network"));
  Guid providerId = getGuid(rs, "provider_network_provider_id");
  if (providerId != null) {
    entity.setProvidedBy(new ProviderNetwork(
        providerId,
        rs.getString("provider_network_external_id"),
        getGuid(rs, "provider_physical_network_id")));
  }
  entity.setQosId(getGuid(rs, "qos_id"));
  entity.setLabel(rs.getString("label"));
  Guid dnsResolverConfigurationId = getGuid(rs, "dns_resolver_configuration_id");
  entity.setDnsResolverConfiguration(dnsResolverConfigurationDao.get(dnsResolverConfigurationId));
  return entity;
}

代码示例来源:origin: oVirt/ovirt-engine

protected void setGetNetworksQueryExpectations(int times) {
    while (times-- > 0) {
      ArrayList<org.ovirt.engine.core.common.businessentities.network.Network> networks = new ArrayList<>();
      org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network();
      network.setId(GUIDS[0]);
      network.setName("orcus");
      networks.add(network);
      setUpEntityQueryExpectations(QueryType.GetAllNetworksByClusterId,
          IdQueryParameters.class,
          new String[] { "Id" },
          new Object[] { GUIDS[0] },
          networks);
    }
  }
}

代码示例来源:origin: oVirt/ovirt-engine

protected void setGetNetworksQueryExpectations(int times) {
    while (times-- > 0) {
      ArrayList<org.ovirt.engine.core.common.businessentities.network.Network> networks = new ArrayList<>();
      org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network();
      network.setId(GUIDS[0]);
      network.setName("orcus");
      networks.add(network);
      setUpEntityQueryExpectations(QueryType.GetAllNetworksByClusterId,
          IdQueryParameters.class,
          new String[] { "Id" },
          new Object[] { GUIDS[0] },
          networks);
    }
  }
}

代码示例来源:origin: oVirt/ovirt-engine

private Network createNetwork(String networkA) {
  Network result = new Network();
  result.setId(Guid.newGuid());
  result.setName(networkA);
  return result;
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
protected org.ovirt.engine.core.common.businessentities.network.Network getEntity(int index) {
  org.ovirt.engine.core.common.businessentities.network.Network network = new org.ovirt.engine.core.common.businessentities.network.Network();
  NetworkCluster networkCluster = new NetworkCluster();
  networkCluster.setDisplay(false);
  networkCluster.setMigration(false);
  networkCluster.setRequired(false);
  networkCluster.setDefaultRoute(false);
  network.setCluster(networkCluster);
  network.setId(GUIDS[index]);
  network.setName(NAMES[index]);
  network.setDescription(DESCRIPTIONS[index]);
  network.setDataCenterId(GUIDS[1]);
  return network;
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Ensures that saving a network works as expected.
 */
@Test
public void testSave() {
  List<NetworkCluster> clustersFromDB = networkClusterDao.getAllForCluster(FixturesTool.CLUSTER);
  DnsResolverConfiguration dnsResolverConfiguration =
      dnsResolverConfigurationDao.get(FixturesTool.EXISTING_DNS_RESOLVER_CONFIGURATION);
  dnsResolverConfiguration.setId(null);
  NetworkCluster clusterFromDB = clustersFromDB.get(0);
  assertNotNull(clusterFromDB);
  newNet.setCluster(clusterFromDB);
  newNet.setId(Guid.newGuid());
  newNet.setDnsResolverConfiguration(dnsResolverConfiguration);
  dao.save(newNet);
  Network result = dao.getByNameAndDataCenter(newNet.getName(), FixturesTool.DATA_CENTER);
  assertNotNull(result);
  assertEquals(newNet, result);
}

代码示例来源:origin: oVirt/ovirt-engine

entity.setCluster(template != null && template.getCluster() != null ? template.getCluster() : new NetworkCluster());
if (model.isSetId()) {
  entity.setId(GuidUtils.asGuid(model.getId()));

代码示例来源:origin: oVirt/ovirt-engine

private static Network cloneNetwork(Network instance) {
  Network obj = new Network();
  obj.setAddr(instance.getAddr());
  obj.setDescription(instance.getDescription());
  obj.setComment(instance.getComment());
  obj.setId(instance.getId());
  obj.setName(instance.getName());
  obj.setVdsmName(instance.getVdsmName());
  obj.setSubnet(instance.getSubnet());
  obj.setGateway(instance.getGateway());
  obj.setType(instance.getType());
  obj.setVlanId(instance.getVlanId());
  obj.setStp(instance.getStp());
  obj.setDataCenterId(instance.getDataCenterId());
  obj.setMtu(instance.getMtu());
  obj.setVmNetwork(instance.isVmNetwork());
  if (instance.getCluster() !=null){
    obj.setCluster(cloneNetworkCluster(instance.getCluster()));
  }
  if (instance.getProvidedBy() != null) {
    obj.setProvidedBy(cloneProviderNetwork(instance.getProvidedBy()));
  }
  return obj;
}

相关文章