@Override public Guid keyFrom(NetworkAttachment networkAttachment) { return networkAttachment.getNicId(); } }
@Override protected void setUpEntityExpectations(NetworkAttachment entity) { when(entity.getNicId()).thenReturn(HOST_NIC_ID); } }
@Override protected void setUpEntityExpectations(NetworkAttachment entity) { when(entity.getNicId()).thenReturn(HOST_NIC_ID); } }
private void assertNetworkAttachment(NetworkAttachment networkAttachment, Guid attachmentId, Guid networkId, Guid nicId) { assertThat("id mismatch", networkAttachment.getId(), is(attachmentId)); //$NON-NLS-1$ assertThat("network id mismatch", networkAttachment.getNetworkId(), equalTo(networkId)); //$NON-NLS-1$ assertThat("nicId mismatch", networkAttachment.getNicId(), equalTo(nicId)); //$NON-NLS-1$ }
public NetworkAttachment(NetworkAttachment networkAttachment) { id = networkAttachment.getId(); nicId = networkAttachment.getNicId(); nicName = networkAttachment.getNicName(); networkId = networkAttachment.getNetworkId(); networkName = networkAttachment.getNetworkName(); ipConfiguration = networkAttachment.getIpConfiguration(); properties = networkAttachment.getProperties(); overrideConfiguration = networkAttachment.isOverrideConfiguration(); reportedConfigurations = networkAttachment.getReportedConfigurations(); }
@Override protected MapSqlParameterSource createFullParametersMapper(NetworkAttachment networkAttachment) { MapSqlParameterSource mapper = createIdParameterMapper(networkAttachment.getId()) .addValue("network_id", networkAttachment.getNetworkId()) .addValue("nic_id", networkAttachment.getNicId()) .addValue("custom_properties", SerializationFactory.getSerializer().serialize(networkAttachment.getProperties())); mapIpConfiguration(networkAttachment, mapper); mapper.addValue("dns_resolver_configuration_id", getDnsResolverConfigurationId(networkAttachment)); return mapper; }
private void assertNetworkAttachmentEquals(NetworkAttachment expected, NetworkAttachment actual) { assertEquals(expected.getId(), actual.getId()); assertEquals(expected.getNetworkId(), actual.getNetworkId()); assertEquals(expected.getNicId(), actual.getNicId()); assertEquals(expected.getNicName(), actual.getNicName()); assertEquals(expected.getIpConfiguration(), actual.getIpConfiguration()); assertEquals(expected.getProperties().entrySet(), actual.getProperties().entrySet()); assertEquals(expected.getDnsResolverConfiguration(), actual.getDnsResolverConfiguration()); }
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("id", getId()) .append("networkId", getNetworkId()) .append("networkName", getNetworkName()) .append("nicId", getNicId()) .append("nicName", getNicName()) .append("ipConfiguration", getIpConfiguration()) .append("dnsResolverConfiguration", getDnsResolverConfiguration()) .append("properties", getProperties()) .append("overrideConfiguration", isOverrideConfiguration()) .build(); } }