import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
+import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlRootElement;
-import org.opendaylight.netconf.api.DocumentedException;
import org.opendaylight.netconf.api.NetconfMessage;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
public SimulatedCreateSubscription(final String id, final Optional<File> notificationsFile) {
super(id);
- Optional<Notifications> notifs;
+ final Optional<Notifications> notifs;
if (notificationsFile.isPresent()) {
notifs = Optional.of(loadNotifications(notificationsFile.get()));
}
if (notifs.isPresent()) {
- Map<Notification, NetconfMessage> preparedMessages = Maps.newHashMapWithExpectedSize(
- notifs.get().getNotificationList().size());
- for (final Notification notification : notifs.get().getNotificationList()) {
+ final Collection<Notification> toCopy = notifs.get().getNotificationList();
+ final Map<Notification, NetconfMessage> preparedMessages = Maps.newHashMapWithExpectedSize(toCopy.size());
+ for (final Notification notification : toCopy) {
final NetconfMessage parsedNotification = parseNetconfNotification(notification.getContent());
preparedMessages.put(notification, parsedNotification);
}
} else {
this.notifications = Collections.emptyMap();
}
-
}
private static Notifications loadNotifications(final File file) {
}
@Override
- protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement)
- throws DocumentedException {
+ protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
long delayAggregator = 0;
for (final Map.Entry<Notification, NetconfMessage> notification : notifications.entrySet()) {