use of org.ovirt.engine.core.bll.network.host.NicNameNicIdCompleter.NicNameAndNicIdAccessors in project ovirt-engine by oVirt.
the class NicNameNicIdCompleterTest method testProperBondBindingToNicNameAndNicIdAccessors.
@Test
public void testProperBondBindingToNicNameAndNicIdAccessors() {
CreateOrUpdateBond createOrUpdateBond = new CreateOrUpdateBond();
createOrUpdateBond.setName("nic name");
createOrUpdateBond.setId(Guid.newGuid());
NicNameAndNicIdAccessors accessors = new NicNameAndNicIdAccessors.FromCreateOrUpdateBondData(createOrUpdateBond);
assertThat(accessors.getId(), is(createOrUpdateBond.getId()));
assertThat(accessors.getName(), is(createOrUpdateBond.getName()));
accessors.setId(Guid.newGuid());
accessors.setName("another name");
assertThat(createOrUpdateBond.getId(), is(accessors.getId()));
assertThat(createOrUpdateBond.getName(), is(accessors.getName()));
}
use of org.ovirt.engine.core.bll.network.host.NicNameNicIdCompleter.NicNameAndNicIdAccessors in project ovirt-engine by oVirt.
the class NicNameNicIdCompleterTest method testCompleteWhenBothIdAndNameDoesNotReferenceExistingNic.
@Test
public void testCompleteWhenBothIdAndNameDoesNotReferenceExistingNic() throws Exception {
NicNameAndNicIdAccessors accessors = mock(NicNameAndNicIdAccessors.class);
Guid guidOfNotExistingNic = Guid.newGuid();
when(accessors.getId()).thenReturn(guidOfNotExistingNic);
when(accessors.getName()).thenReturn("notAExistingNicName");
completer.complete(accessors);
verify(accessors, never()).setName(any());
verify(accessors, never()).setId(any());
}
use of org.ovirt.engine.core.bll.network.host.NicNameNicIdCompleter.NicNameAndNicIdAccessors in project ovirt-engine by oVirt.
the class NicNameNicIdCompleterTest method testProperNetworkAttachmentBindingToNicNameAndNicIdAccessors.
@Test
public void testProperNetworkAttachmentBindingToNicNameAndNicIdAccessors() {
NetworkAttachment networkAttachment = new NetworkAttachment();
networkAttachment.setNicId(Guid.newGuid());
networkAttachment.setNicName("nic name");
NicNameAndNicIdAccessors accessors = new NicNameAndNicIdAccessors.FromNetworkAttachment(networkAttachment);
assertThat("id should be bound to nicId", accessors.getId(), is(networkAttachment.getNicId()));
assertThat("name should be bound to nicName", accessors.getName(), is(networkAttachment.getNicName()));
accessors.setId(Guid.newGuid());
accessors.setName("another name");
assertThat("id should be bound to nicId", networkAttachment.getNicId(), is(accessors.getId()));
assertThat("name should be bound to nicName", networkAttachment.getNicName(), is(accessors.getName()));
}
use of org.ovirt.engine.core.bll.network.host.NicNameNicIdCompleter.NicNameAndNicIdAccessors in project ovirt-engine by oVirt.
the class NicNameNicIdCompleterTest method testCompleteWhenUnsetIdAndName.
@Test
public void testCompleteWhenUnsetIdAndName() throws Exception {
NicNameAndNicIdAccessors withoutNameOrIdSet = mock(NicNameAndNicIdAccessors.class);
completer.complete(withoutNameOrIdSet);
verify(withoutNameOrIdSet, never()).setName(any());
verify(withoutNameOrIdSet, never()).setId(any());
}
Aggregations