import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableList;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.transportpce.common.mapping.PortMapping;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.ChangeNotification;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.change.notification.Edit;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.change.notification.EditBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.Ports;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.packs.CircuitPacksKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container.OrgOpenroadmDevice;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.EditOperationType;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.binding.DataObjectIdentifier;
-@RunWith(MockitoJUnitRunner.StrictStubs.class)
+@ExtendWith(MockitoExtension.class)
public class DeviceListener710Test {
@Mock
private PortMapping portMapping;
@Test
- public void testOnChangeNotificationWhenPortUpdated() throws InterruptedException {
+ void testOnChangeNotificationWhenPortUpdated() throws InterruptedException {
ChangeNotification notification = mock(ChangeNotification.class);
Mapping oldMapping = mock(Mapping.class);
ImmutableList<Edit> editList = createEditList();
}
@Test
- public void testOnChangeNotificationWhenNoEditList() {
+ void testOnChangeNotificationWhenNoEditList() {
ChangeNotification notification = mock(ChangeNotification.class);
when(notification.getEdit()).thenReturn(null);
DeviceListener710 listener = new DeviceListener710("node1", portMapping);
}
@Test
- public void testOnChangeNotificationWhenOtherthingUpdated() {
+ void testOnChangeNotificationWhenOtherthingUpdated() {
ChangeNotification notification = mock(ChangeNotification.class);
ImmutableList<Edit> editList = createBadEditList();
when(notification.getEdit()).thenReturn(editList);
}
private ImmutableList<Edit> createEditList() {
- InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ DataObjectIdentifier<Ports> portId = DataObjectIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"))
- .child(Ports.class, new PortsKey("port1"));
+ .child(Ports.class, new PortsKey("port1"))
+ .build();
Edit edit = new EditBuilder()
.setOperation(EditOperationType.Merge)
.setTarget(portId)
}
private ImmutableList<Edit> createBadEditList() {
- InstanceIdentifier<CircuitPacks> cpId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"));
+ DataObjectIdentifier<CircuitPacks> cpId = DataObjectIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"))
+ .build();
Edit edit = new EditBuilder()
.setOperation(EditOperationType.Merge)
.setTarget(cpId)