Bump yangtools to 3.0.0 83/81383/14
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 4 Apr 2019 20:32:47 +0000 (22:32 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 9 Apr 2019 21:39:29 +0000 (23:39 +0200)
This bumps yangtools to 3.0.0, making minor adjustements to cope
with the API changes. We also remove checkstyle-logging, as it no
longer ships from yangtools -- spotbugs is more than competent to
handle the validation provided by checkstyle-logging.

Change-Id: I6c4dedcf46a0761d5e2a65fb1a1a25c2d06255fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AbstractRIBSupport.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/RIBSupportTest.java
binding-parent/pom.xml
config-loader/config-loader-impl/src/main/java/org/opendaylight/bgpcep/config/loader/impl/ConfigLoaderImpl.java
features/bgp/odl-bgpcep-bgp-dependencies/src/main/feature/feature.xml
parent/pom.xml
testtool-parent/pom.xml

index 09bc13edb6c2dcefe9338b10159c9a62285bc3ee..f8e04e34ec94a4373ef9df171ecb3ed7b702ac36 100644 (file)
@@ -325,8 +325,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
             return;
         }
 
-        final DataTreeCandidateNode modifiedAttrs = table.getModifiedChild(ATTRIBUTES_NID);
-        if (modifiedAttrs != null) {
+        table.getModifiedChild(ATTRIBUTES_NID).ifPresent(modifiedAttrs -> {
             final YangInstanceIdentifier effAttrsPath = effectiveTablePath.node(ATTRIBUTES_NID);
             final Optional<NormalizedNode<?, ?>> optAttrsAfter = modifiedAttrs.getDataAfter();
             if (optAttrsAfter.isPresent()) {
@@ -335,10 +334,9 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
             } else {
                 tx.delete(LogicalDatastoreType.OPERATIONAL, effAttrsPath);
             }
-        }
+        });
 
-        final DataTreeCandidateNode modifiedRoutes = table.getModifiedChild(ROUTES_NID);
-        if (modifiedRoutes != null) {
+        table.getModifiedChild(ROUTES_NID).ifPresent(modifiedRoutes -> {
             final RIBSupport<?, ?, ?, ?> ribSupport = ribContext.getRibSupport();
             switch (modifiedRoutes.getModificationType()) {
                 case APPEARED:
@@ -365,7 +363,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
                     LOG.warn("Ignoring modified routes {}", modifiedRoutes);
                     break;
             }
-        }
+        });
     }
 
     private void writeTable(final DOMDataWriteTransaction tx, final RIBSupportContext ribContext,
index 09ad5be727164cca759fdc8d15cecea16dd69204..723ef966ef8cc51cca17024829d3deaf5e11364e 100644 (file)
@@ -374,17 +374,12 @@ public abstract class AbstractRIBSupport<
 
     @Override
     public final Collection<DataTreeCandidateNode> changedRoutes(final DataTreeCandidateNode routes) {
-        final DataTreeCandidateNode myRoutes = routes.getModifiedChild(this.routesContainerIdentifier);
-        if (myRoutes == null) {
-            return Collections.emptySet();
-        }
-        final DataTreeCandidateNode routesMap = myRoutes.getModifiedChild(routeNid());
-        if (routesMap == null) {
-            return Collections.emptySet();
-        }
-        // Well, given the remote possibility of augmentation, we should perform a filter here,
-        // to make sure the type matches what routeType() reports.
-        return routesMap.getChildNodes();
+        return routes.getModifiedChild(this.routesContainerIdentifier)
+            .flatMap(myRoutes -> myRoutes.getModifiedChild(routeNid()))
+            // Well, given the remote possibility of augmentation, we should perform a filter here,
+            // to make sure the type matches what routeType() reports.
+            .map(DataTreeCandidateNode::getChildNodes)
+            .orElse(Collections.emptySet());
     }
 
     @Override
index ef803b9cbe5095d4fd7b432701575eaafb021cb4..32429287e0442645c788ecefca90bdffbe7239c7 100644 (file)
@@ -12,7 +12,7 @@ import static junit.framework.TestCase.assertFalse;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 
@@ -108,13 +108,13 @@ public class RIBSupportTest extends AbstractConcurrentDataBrokerTest {
         this.subTree = Mockito.mock(DataTreeCandidateNode.class);
         final DataTreeCandidateNode emptyNode = Mockito.mock(DataTreeCandidateNode.class);
         final DataTreeCandidateNode node = Mockito.mock(DataTreeCandidateNode.class);
-        doReturn(null).when(this.emptyTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
+        doReturn(Optional.empty()).when(this.emptyTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
 
-        doReturn(emptyNode).when(this.emptySubTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
-        doReturn(null).when(emptyNode).getModifiedChild(new NodeIdentifier(Ipv4Route.QNAME));
+        doReturn(Optional.of(emptyNode)).when(this.emptySubTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
+        doReturn(Optional.empty()).when(emptyNode).getModifiedChild(new NodeIdentifier(Ipv4Route.QNAME));
 
-        doReturn(node).when(this.subTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
-        doReturn(node).when(node).getModifiedChild(new NodeIdentifier(Ipv4Route.QNAME));
+        doReturn(Optional.of(node)).when(this.subTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
+        doReturn(Optional.of(node)).when(node).getModifiedChild(new NodeIdentifier(Ipv4Route.QNAME));
         final Collection<DataTreeCandidateNode> emptyCollection = new HashSet<>();
         doReturn(emptyCollection).when(node).getChildNodes();
 
index 6e7517b7dade573f4553c64c6e36937c9c3fb966..a1780c8c1061d6dfd27feb23936efc4e7c492b3c 100644 (file)
                 <configuration>
                      <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
                  </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.opendaylight.yangtools</groupId>
-                        <artifactId>checkstyle-logging</artifactId>
-                        <version>2.1.8</version>
-                    </dependency>
-                </dependencies>
             </plugin>
             <plugin>
                 <groupId>com.github.spotbugs</groupId>
index b3a53eec6d38a5634bec28e12984eb57a2852fc4..111a3b59b535cd8e369b304f766e5a44dcd1a9b5 100644 (file)
@@ -30,7 +30,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import javax.annotation.concurrent.GuardedBy;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -126,8 +125,7 @@ public final class ConfigLoaderImpl implements ConfigLoader, AutoCloseable {
                     .findDataSchemaNode(this.schemaContext, config.getSchemaPath());
             try (XmlParserStream xmlParser = XmlParserStream.create(streamWriter, this.schemaContext, schemaNode)) {
                 xmlParser.parse(reader);
-            } catch (final URISyntaxException | XMLStreamException | IOException | ParserConfigurationException
-                    | SAXException e) {
+            } catch (final URISyntaxException | XMLStreamException | IOException | SAXException e) {
                 LOG.warn("Failed to parse xml", e);
             } finally {
                 reader.close();
index 53f222936f5ccea2aed0ffa5e12cbf57ee03a489..5371262ad3f77d0f08ff4e574714d3506b4b3cfc 100644 (file)
@@ -8,6 +8,6 @@
   -->
 <features name="odl-bgpcep-bgp-dependencies-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
     <feature name="odl-bgpcep-bgp-dependencies" version="${project.version}">
-        <feature version="[2.1,3)">odl-yangtools-data-api</feature>
+        <feature version="[3,4)">odl-yangtools-data-api</feature>
     </feature>
 </features>
index 0d1fa72de8b1cfd0e2951a714cf2fe6021ab7191..59a9932b1868fb7f93ca6c9ea28c4ef695d0fb98 100644 (file)
@@ -51,7 +51,7 @@
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>yangtools-artifacts</artifactId>
-                <version>2.1.8</version>
+                <version>3.0.0</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.opendaylight.yangtools</groupId>
-                        <artifactId>checkstyle-logging</artifactId>
-                        <version>2.1.8</version>
-                    </dependency>
-                </dependencies>
                 <configuration>
                     <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
                 </configuration>
index 7840868a1b9d107cd1d4e5dacb9fef4e55825cae..6a58996f14541b2e0a5ae1d2705d5e6820e8f8a4 100644 (file)
                 <configuration>
                     <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
                 </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.opendaylight.yangtools</groupId>
-                        <artifactId>checkstyle-logging</artifactId>
-                        <version>2.1.8</version>
-                    </dependency>
-                </dependencies>
             </plugin>
             <plugin>
                 <groupId>com.github.spotbugs</groupId>