There are a few places using deprecated constructs, update them.
Change-Id: Iee4ddb62f37f2d548bb3b2b2b6f2e88e92dd738e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
*/
package org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import java.util.Collections;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
@Override
public FlowsStatisticsUpdate createNotification(final FlowStatistics flowStatistics,
final InstanceIdentifier<FlowStatistics> path) {
- Preconditions.checkArgument(flowStatistics != null);
- Preconditions.checkArgument(path != null);
-
- final FlowAndStatisticsMapListBuilder fsmlBuilder = new FlowAndStatisticsMapListBuilder(flowStatistics);
- fsmlBuilder.setFlowId(new FlowId(path.firstKeyOf(Flow.class).getId().getValue()));
+ checkArgument(flowStatistics != null);
+ checkArgument(path != null);
- final FlowsStatisticsUpdateBuilder builder = new FlowsStatisticsUpdateBuilder();
- builder.setId(getNodeId(path));
- builder.setMoreReplies(Boolean.FALSE);
- // NOTE : fix if it needs, but we have to ask DataStore for the NodeConnector list
- builder.setNodeConnector(Collections.emptyList());
- builder.setFlowAndStatisticsMapList(Collections.singletonList(fsmlBuilder.build()));
- return builder.build();
+ return new FlowsStatisticsUpdateBuilder()
+ .setId(getNodeId(path))
+ .setMoreReplies(Boolean.FALSE)
+ // NOTE : fix if it needs, but we have to ask DataStore for the NodeConnector list
+ .setNodeConnector(Collections.emptyMap())
+ .setFlowAndStatisticsMapList(Collections.singletonList(new FlowAndStatisticsMapListBuilder(flowStatistics)
+ .setFlowId(new FlowId(path.firstKeyOf(Flow.class).getId().getValue()))
+ .build()))
+ .build();
}
}
*/
package org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat;
-import com.google.common.base.Preconditions;
-import java.util.Collections;
+import static com.google.common.base.Preconditions.checkArgument;
+
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
/**
* Implementation define a contract between {@link FlowTableStatistics} data object
@Override
public FlowTableStatisticsUpdate createNotification(final FlowTableStatistics flowTableStatistics,
final InstanceIdentifier<FlowTableStatistics> path) {
- Preconditions.checkArgument(flowTableStatistics != null);
- Preconditions.checkArgument(path != null);
-
- final FlowTableAndStatisticsMapBuilder ftsmBuilder = new FlowTableAndStatisticsMapBuilder(flowTableStatistics);
- ftsmBuilder.withKey(new FlowTableAndStatisticsMapKey(
- new TableId(path.firstKeyOf(Table.class).getId())));
+ checkArgument(flowTableStatistics != null);
+ checkArgument(path != null);
- final FlowTableStatisticsUpdateBuilder builder = new FlowTableStatisticsUpdateBuilder();
- builder.setId(getNodeId(path));
- builder.setMoreReplies(Boolean.FALSE);
- // NOTE : fix if it needs, but we have to ask DataStore for the NodeConnector list
- builder.setNodeConnector(Collections.emptyList());
- builder.setFlowTableAndStatisticsMap(Collections.singletonList(ftsmBuilder.build()));
- return builder.build();
+ return new FlowTableStatisticsUpdateBuilder()
+ .setId(getNodeId(path))
+ .setMoreReplies(Boolean.FALSE)
+ // NOTE : fix if it needs, but we have to ask DataStore for the NodeConnector list
+ .setNodeConnector(BindingMap.of())
+ .setFlowTableAndStatisticsMap(BindingMap.of(new FlowTableAndStatisticsMapBuilder(flowTableStatistics)
+ .withKey(new FlowTableAndStatisticsMapKey(new TableId(path.firstKeyOf(Table.class).getId())))
+ .build()))
+ .build();
}
}
*/
package org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper;
-import org.mockito.ArgumentMatchers;
-import org.mockito.Mockito;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.verify;
+
import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
public final class TestSupplierVerifyHelper {
-
private TestSupplierVerifyHelper() {
- throw new UnsupportedOperationException("Test utility class");
+ // Hidden on purpose
}
- public static void verifyDataTreeChangeListenerRegistration(DataBroker dataBroker) {
-
- Mockito.verify(dataBroker).registerDataTreeChangeListener(
- ArgumentMatchers.<DataTreeIdentifier>any(),
- ArgumentMatchers.<DataTreeChangeListener>any());
+ public static void verifyDataTreeChangeListenerRegistration(final DataBroker dataBroker) {
+ verify(dataBroker).registerDataTreeChangeListener(any(), any());
}
}