Further yang-parser-impl checkstyle fixes 99/63199/5
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 17 Sep 2017 08:50:42 +0000 (10:50 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 27 Sep 2017 13:26:15 +0000 (13:26 +0000)
Brings the violation count to below 500.

Change-Id: I22ee943c06bf04f3692a511f703573a0a57ec0ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
30 files changed:
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/rfc6020/repo/StatementSourceReferenceHandler.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/rfc6020/repo/YangErrorListener.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/rfc6020/repo/YangStatementStreamSource.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/rfc6020/repo/YinStatementStreamSource.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/rfc6020/repo/YinTextToDomTransformer.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/BuildGlobalContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/VirtualNamespaceContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/DeviateStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/Utils.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/MultipleRevImportBug6875Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/SettableSchemaProvider.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaContextFactoryTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaRepositoryTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/Bug5410Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/ActionStatementTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6868Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6869Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6870Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6874Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6876Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6878Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6883Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6884Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6885Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6887Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6897Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6901Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug8597Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveModulesAndSubmodulesTest.java

index 1ee3f9f38f3ad5b655338e710acbd55c70a8f543..a002d844c95e97b2352a686065e03ed896efbaad 100644 (file)
@@ -73,6 +73,7 @@ final class StatementSourceReferenceHandler extends DefaultHandler {
     }
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public void endElement(final String uri, final String localName, final String qName) {
         addTextIfNeeded();
         final Element closedEl = stack.pop();
index 91303dd76b8d2271c5b6c5a538ab7bc234f87e38..bedf967996cf8fc9f40864e57ad91500c4d8716b 100644 (file)
@@ -22,6 +22,7 @@ public final class YangErrorListener extends BaseErrorListener {
     private final List<YangSyntaxErrorException> exceptions = new ArrayList<>();
 
     @Override
+    @SuppressWarnings("checkstyle:parameterName")
     public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
             final int charPositionInLine, final String msg, final RecognitionException e) {
         LOG.debug("Syntax error at {}:{}: {}", line, charPositionInLine, msg, e);
@@ -30,6 +31,7 @@ public final class YangErrorListener extends BaseErrorListener {
         exceptions.add(new YangSyntaxErrorException(module, line, charPositionInLine, msg, e));
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     private static String getModuleName(final Recognizer<?, ?> recognizer) {
         if (!(recognizer instanceof Parser)) {
             return null;
index d7388e03c0980bea41f95b0279aeabdaee9ebf10..77f489675a817cc20de57e56814a92725263ba9b 100644 (file)
@@ -78,7 +78,7 @@ public final class YangStatementStreamSource implements Identifiable<SourceIdent
     public static YangStatementStreamSource create(final YangTextSchemaSource source) throws IOException,
             YangSyntaxErrorException {
         final StatementContext context;
-        try (final InputStream stream = source.openStream()) {
+        try (InputStream stream = source.openStream()) {
             context = parseYangSource(stream);
         }
 
@@ -146,11 +146,7 @@ public final class YangStatementStreamSource implements Identifiable<SourceIdent
         return context;
     }
 
-    /**
-     * @deprecated Provided for migration purposes only. Do not use.
-     */
-    @Deprecated
-    public static StatementContext parseYangSource(final InputStream stream) throws IOException,
+    private static StatementContext parseYangSource(final InputStream stream) throws IOException,
             YangSyntaxErrorException {
         final YangStatementLexer lexer = new YangStatementLexer(CharStreams.fromStream(stream));
         final CommonTokenStream tokens = new CommonTokenStream(lexer);
index 7588847b77adc3db101ebe0b75104dd453776901..a60caf05c9478f6204bfddd913beba7900fdced2 100644 (file)
@@ -55,7 +55,7 @@ public final class YinStatementStreamSource implements Identifiable<SourceIdenti
             public URI load(@Nonnull final String key) throws URISyntaxException {
                 return new URI(key);
             }
-    });
+        });
     private final SourceIdentifier identifier;
     private final Node root;
 
index ad167121bdbac584f7ec46254ebaae65a3bf0836..f8a2e3d9f6a5388c2eb1ba3e862cc80385d194ed 100644 (file)
@@ -39,12 +39,12 @@ public final class YinTextToDomTransformer extends SchemaSourceTransformer<YinTe
         return new YinTextToDomTransformer(provider, consumer);
     }
 
-    public static YinDomSchemaSource transformSource(final YinTextSchemaSource source) throws SAXException, IOException {
+    public static YinDomSchemaSource transformSource(final YinTextSchemaSource source) throws SAXException,
+            IOException {
         final Document doc = UntrustedXML.newDocumentBuilder().newDocument();
         final SAXParser parser = UntrustedXML.newSAXParser();
         final DefaultHandler handler = new StatementSourceReferenceHandler(doc, null);
         parser.parse(source.openStream(), handler);
         return YinDomSchemaSource.create(source.getIdentifier(), new DOMSource(doc));
     }
-
 }
index 51a39fb80592bfacb51896081e3daa75ebbee231..cc6bf8dda8bc72ec36c318e1a4cffd207d96822c 100644 (file)
@@ -256,6 +256,7 @@ class BuildGlobalContext extends NamespaceStorageSupport implements Registry {
         throw new SomeModifiersUnresolvedException(currentPhase, sourceId, cause);
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     private EffectiveSchemaContext transformEffective() throws ReactorException {
         Preconditions.checkState(finishedPhase == ModelProcessingPhase.EFFECTIVE_MODEL);
         final List<DeclaredStatement<?>> rootStatements = new ArrayList<>(sources.size());
@@ -300,6 +301,7 @@ class BuildGlobalContext extends NamespaceStorageSupport implements Registry {
         loadPhaseStatementsFor(libSources);
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     private void loadPhaseStatementsFor(final Set<SourceSpecificContext> sources) throws ReactorException {
         for (final SourceSpecificContext source : sources) {
             try {
@@ -333,16 +335,16 @@ class BuildGlobalContext extends NamespaceStorageSupport implements Registry {
             if (suppressed.length > 0) {
                 LOG.error("{} additional errors reported:", suppressed.length);
 
-                int i = 1;
+                int count = 1;
                 for (final Throwable t : suppressed) {
                     // FIXME: this should be configured in the appender, really
                     if (LOG.isDebugEnabled()) {
-                        LOG.error("Error {}: {}", i, t.getMessage(), t);
+                        LOG.error("Error {}: {}", count, t.getMessage(), t);
                     } else {
-                        LOG.error("Error {}: {}", i, t.getMessage());
+                        LOG.error("Error {}: {}", count, t.getMessage());
                     }
 
-                    i++;
+                    count++;
                 }
             }
 
@@ -357,6 +359,7 @@ class BuildGlobalContext extends NamespaceStorageSupport implements Registry {
         return buildFailure;
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     private void completePhaseActions() throws ReactorException {
         Preconditions.checkState(currentPhase != null);
         final List<SourceSpecificContext> sourcesToProgress = Lists.newArrayList(sources);
index 498894cc0a69d4f4e19f4485fbea87ed625737af..9f9f5390c30f8f316251a4fcfd24adea6d2cfa19 100644 (file)
@@ -405,6 +405,7 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
      * @param argument statement argument
      * @return A new substatement
      */
+    @SuppressWarnings("checkstyle:methodTypeParameterName")
     public final <CA, CD extends DeclaredStatement<CA>, CE extends EffectiveStatement<CA, CD>>
             StatementContextBase<CA, CD, CE> createSubstatement(final int offset,
                     final StatementDefinitionContext<CA, CD, CE> def, final StatementSourceReference ref,
index 7db50e0199f57112e33516bc6aeb0671a580aa98..013b427a4418784e41ecbaec1d6eec4327651508 100644 (file)
@@ -13,13 +13,13 @@ import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.DerivedNamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 
-final class VirtualNamespaceContext<K, V, N extends IdentifierNamespace<K, V>, DK>
+final class VirtualNamespaceContext<K, V, N extends IdentifierNamespace<K, V>, D>
         extends NamespaceBehaviourWithListeners<K, V, N> {
 
-    private final Multimap<DK, ValueAddedListener<K>> listeners = HashMultimap.create();
-    private final DerivedNamespaceBehaviour<K, V, DK, N, ?> derivedDelegate;
+    private final Multimap<D, ValueAddedListener<K>> listeners = HashMultimap.create();
+    private final DerivedNamespaceBehaviour<K, V, D, N, ?> derivedDelegate;
 
-    VirtualNamespaceContext(final DerivedNamespaceBehaviour<K, V, DK, N, ?> delegate) {
+    VirtualNamespaceContext(final DerivedNamespaceBehaviour<K, V, D, N, ?> delegate) {
         super(delegate);
         this.derivedDelegate = delegate;
     }
@@ -35,7 +35,7 @@ final class VirtualNamespaceContext<K, V, N extends IdentifierNamespace<K, V>, D
         listeners.put(derivedDelegate.getSignificantKey(key), listener);
     }
 
-    void addedToSourceNamespace(final NamespaceBehaviour.NamespaceStorageNode storage, final DK key, final V value) {
+    void addedToSourceNamespace(final NamespaceBehaviour.NamespaceStorageNode storage, final D key, final V value) {
         notifyListeners(storage, listeners.get(key).iterator(), value);
     }
 
index c5eabed9f71c1123964627c63f7ec6d2c33b0102..d947b7d407c5d904c5e93591d96f3ef5028d4c03 100644 (file)
@@ -169,6 +169,9 @@ public class DeviateStatementImpl extends AbstractDeclaredStatement<DeviateKind>
                             break;
                         case DELETE:
                             performDeviateDelete(sourceNodeStmtCtx, targetNodeStmtCtx);
+                            break;
+                        default:
+                            throw new IllegalStateException("Unsupported deviate " + deviateKind);
                     }
                 }
 
index a6414a29c125b4bd1619dd824d29a7e109e25129..55238de88809c74b32a1c056f06e679e32f74d94 100644 (file)
@@ -177,6 +177,7 @@ public final class Utils {
         return identifier;
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     static SchemaNodeIdentifier nodeIdentifierFromPath(final StmtContext<?, ?, ?> ctx, final String path) {
         // FIXME: is the path trimming really necessary??
         final List<QName> qNames = new ArrayList<>();
index 4c879ff0efc482f59190b392cda5fb367671fbe3..268ed0c6781ed4add6cf2ee0c86d604bfa1cabe0 100644 (file)
@@ -44,10 +44,14 @@ public class MultipleRevImportBug6875Test {
         final SharedSchemaRepository sharedSchemaRepository = new SharedSchemaRepository(
                 "shared-schema-repo-multiple-rev-import-test");
 
-        final SettableSchemaProvider<ASTSchemaSource> foo = getSourceProvider("/rfc7950/bug6875/yang1-1/foo.yang");
-        final SettableSchemaProvider<ASTSchemaSource> bar1 = getSourceProvider("/rfc7950/bug6875/yang1-1/bar@1999-01-01.yang");
-        final SettableSchemaProvider<ASTSchemaSource> bar2 = getSourceProvider("/rfc7950/bug6875/yang1-1/bar@2017-02-06.yang");
-        final SettableSchemaProvider<ASTSchemaSource> bar3 = getSourceProvider("/rfc7950/bug6875/yang1-1/bar@1970-01-01.yang");
+        final SettableSchemaProvider<ASTSchemaSource> foo = getSourceProvider(
+            "/rfc7950/bug6875/yang1-1/foo.yang");
+        final SettableSchemaProvider<ASTSchemaSource> bar1 = getSourceProvider(
+            "/rfc7950/bug6875/yang1-1/bar@1999-01-01.yang");
+        final SettableSchemaProvider<ASTSchemaSource> bar2 = getSourceProvider(
+            "/rfc7950/bug6875/yang1-1/bar@2017-02-06.yang");
+        final SettableSchemaProvider<ASTSchemaSource> bar3 = getSourceProvider(
+            "/rfc7950/bug6875/yang1-1/bar@1970-01-01.yang");
 
         setAndRegister(sharedSchemaRepository, foo);
         setAndRegister(sharedSchemaRepository, bar1);
@@ -64,11 +68,15 @@ public class MultipleRevImportBug6875Test {
         final SchemaContext context = schemaContextFuture.get();
         assertEquals(context.getModules().size(), 4);
 
-        assertTrue(findNode(context, ImmutableList.of(foo("root"), foo("my-container-1"))) instanceof ContainerSchemaNode);
-        assertTrue(findNode(context, ImmutableList.of(foo("root"), foo("my-container-2"))) instanceof ContainerSchemaNode);
+        assertTrue(findNode(context, ImmutableList.of(foo("root"), foo("my-container-1")))
+            instanceof ContainerSchemaNode);
+        assertTrue(findNode(context, ImmutableList.of(foo("root"), foo("my-container-2")))
+            instanceof ContainerSchemaNode);
 
-        assertTrue(findNode(context, ImmutableList.of(bar3("root"), foo("my-container-1"))) instanceof ContainerSchemaNode);
-        assertTrue(findNode(context, ImmutableList.of(bar3("root"), foo("my-container-2"))) instanceof ContainerSchemaNode);
+        assertTrue(findNode(context, ImmutableList.of(bar3("root"), foo("my-container-1")))
+            instanceof ContainerSchemaNode);
+        assertTrue(findNode(context, ImmutableList.of(bar3("root"), foo("my-container-2")))
+            instanceof ContainerSchemaNode);
 
         assertNull(findNode(context, ImmutableList.of(bar2("root"), foo("my-container-1"))));
         assertNull(findNode(context, ImmutableList.of(bar2("root"), foo("my-container-2"))));
@@ -82,9 +90,12 @@ public class MultipleRevImportBug6875Test {
         final SharedSchemaRepository sharedSchemaRepository = new SharedSchemaRepository(
                 "shared-schema-repo-multiple-rev-import-test");
 
-        final SettableSchemaProvider<ASTSchemaSource> foo = getSourceProvider("/rfc7950/bug6875/yang1-0/foo.yang");
-        final SettableSchemaProvider<ASTSchemaSource> bar1 = getSourceProvider("/rfc7950/bug6875/yang1-0/bar@1999-01-01.yang");
-        final SettableSchemaProvider<ASTSchemaSource> bar2 = getSourceProvider("/rfc7950/bug6875/yang1-0/bar@2017-02-06.yang");
+        final SettableSchemaProvider<ASTSchemaSource> foo = getSourceProvider(
+            "/rfc7950/bug6875/yang1-0/foo.yang");
+        final SettableSchemaProvider<ASTSchemaSource> bar1 = getSourceProvider(
+            "/rfc7950/bug6875/yang1-0/bar@1999-01-01.yang");
+        final SettableSchemaProvider<ASTSchemaSource> bar2 = getSourceProvider(
+            "/rfc7950/bug6875/yang1-0/bar@2017-02-06.yang");
 
         setAndRegister(sharedSchemaRepository, foo);
         setAndRegister(sharedSchemaRepository, bar1);
@@ -118,8 +129,8 @@ public class MultipleRevImportBug6875Test {
             ASTSchemaSource.class);
     }
 
-    private static SchemaNode findNode(final SchemaContext context, final Iterable<QName> qNames) {
-        return SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(qNames, true));
+    private static SchemaNode findNode(final SchemaContext context, final Iterable<QName> qnames) {
+        return SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(qnames, true));
     }
 
     private static QName foo(final String localName) {
index 1a41b15dbd9a9e7d8d9ea7b1aa7a98466a522f13..e2f3ba708dc7e14d2769d8dac0a372565d3a1279 100644 (file)
@@ -26,17 +26,22 @@ class SettableSchemaProvider<T extends SchemaSourceRepresentation> implements Sc
     private final T schemaSourceRepresentation;
     private final PotentialSchemaSource<T> potentialSchemaSource;
 
-    SettableSchemaProvider(final T schemaSourceRepresentation, final SourceIdentifier sourceIdentifier, final Class<T> representation, final int cost) {
+    SettableSchemaProvider(final T schemaSourceRepresentation, final SourceIdentifier sourceIdentifier,
+            final Class<T> representation, final int cost) {
         this.schemaSourceRepresentation = schemaSourceRepresentation;
         this.potentialSchemaSource = PotentialSchemaSource.create(sourceIdentifier, representation, cost);
     }
 
-    public static <T extends SchemaSourceRepresentation> SettableSchemaProvider<T> createRemote(final T schemaSourceRepresentation, final Class<T> representation) {
-        return new SettableSchemaProvider<>(schemaSourceRepresentation, schemaSourceRepresentation.getIdentifier(), representation, PotentialSchemaSource.Costs.REMOTE_IO.getValue());
+    public static <T extends SchemaSourceRepresentation> SettableSchemaProvider<T> createRemote(
+            final T schemaSourceRepresentation, final Class<T> representation) {
+        return new SettableSchemaProvider<>(schemaSourceRepresentation, schemaSourceRepresentation.getIdentifier(),
+                representation, PotentialSchemaSource.Costs.REMOTE_IO.getValue());
     }
 
-    public static <T extends SchemaSourceRepresentation> SettableSchemaProvider<T> createImmediate(final T schemaSourceRepresentation, final Class<T> representation) {
-        return new SettableSchemaProvider<>(schemaSourceRepresentation, schemaSourceRepresentation.getIdentifier(), representation, PotentialSchemaSource.Costs.IMMEDIATE.getValue());
+    public static <T extends SchemaSourceRepresentation> SettableSchemaProvider<T> createImmediate(
+            final T schemaSourceRepresentation, final Class<T> representation) {
+        return new SettableSchemaProvider<>(schemaSourceRepresentation, schemaSourceRepresentation.getIdentifier(),
+                representation, PotentialSchemaSource.Costs.IMMEDIATE.getValue());
     }
 
     @Override
@@ -61,6 +66,7 @@ class SettableSchemaProvider<T extends SchemaSourceRepresentation> implements Sc
     public void setResult() {
         future.set(schemaSourceRepresentation);
     }
+
     public void setException(final Throwable ex) {
         future.setException(ex);
     }
index 4f1512c4ace9c3c90bb48e2d8f6e7d0f85adbc6e..7de48bfabc863be8c65ec43986055dd530489fe5 100644 (file)
@@ -55,7 +55,8 @@ public class SharedSchemaContextFactoryTest {
 
     @Test
     public void testCreateSchemaContextWithDuplicateRequiredSources() throws Exception {
-        final SharedSchemaContextFactory sharedSchemaContextFactory = new SharedSchemaContextFactory(repository, filter);
+        final SharedSchemaContextFactory sharedSchemaContextFactory = new SharedSchemaContextFactory(repository,
+            filter);
         final ListenableFuture<SchemaContext> schemaContext =
                 sharedSchemaContextFactory.createSchemaContext(Arrays.asList(s1, s1, s2));
         assertNotNull(schemaContext.get());
@@ -79,7 +80,8 @@ public class SharedSchemaContextFactoryTest {
         repository.registerSchemaSource(provider, PotentialSchemaSource.create(
                 sIdWithoutRevision, ASTSchemaSource.class, PotentialSchemaSource.Costs.IMMEDIATE.getValue()));
 
-        final SharedSchemaContextFactory sharedSchemaContextFactory = new SharedSchemaContextFactory(repository, filter);
+        final SharedSchemaContextFactory sharedSchemaContextFactory = new SharedSchemaContextFactory(repository,
+            filter);
         final ListenableFuture<SchemaContext> schemaContext =
                 sharedSchemaContextFactory.createSchemaContext(Arrays.asList(sIdWithoutRevision, provider.getId()));
         assertNotNull(schemaContext.get());
index 016d18a0aedf07381cc1d26b8b9b197c7c3b1bc3..f0fa1877f1132152a3096ccde89839ccb4933228 100644 (file)
@@ -135,8 +135,8 @@ public class SharedSchemaRepositoryTest {
             "/ietf/network-topology@2013-10-21.yang");
         remoteTopologyYang.register(sharedSchemaRepository);
         remoteTopologyYang.setResult();
-        final SettableSchemaProvider<ASTSchemaSource> remoteModuleNoRevYang = getImmediateYangSourceProviderFromResource(
-            "/no-revision/module-without-revision.yang");
+        final SettableSchemaProvider<ASTSchemaSource> remoteModuleNoRevYang =
+                getImmediateYangSourceProviderFromResource("/no-revision/module-without-revision.yang");
         remoteModuleNoRevYang.register(sharedSchemaRepository);
 
         final SchemaContextFactory fact = sharedSchemaRepository.createSchemaContextFactory(ALWAYS_ACCEPT);
@@ -288,8 +288,8 @@ public class SharedSchemaRepositoryTest {
                 public InputStream openStream() throws IOException {
                     return new ByteArrayInputStream("running".getBytes(StandardCharsets.UTF_8));
                 }
-        }), PotentialSchemaSource.create(runningId, YangTextSchemaSource.class,
-            PotentialSchemaSource.Costs.REMOTE_IO.getValue()));
+            }), PotentialSchemaSource.create(runningId, YangTextSchemaSource.class,
+                PotentialSchemaSource.Costs.REMOTE_IO.getValue()));
 
         final TextToASTTransformer transformer = TextToASTTransformer.create(sharedSchemaRepository,
             sharedSchemaRepository);
@@ -305,7 +305,7 @@ public class SharedSchemaRepositoryTest {
             }
 
             @Override
-            public void onFailure(@Nonnull final Throwable t) {
+            public void onFailure(@Nonnull final Throwable cause) {
                 // Creation of schema context fails, since we do not provide regular sources, but we just want
                 // to check cache
                 final List<File> cachedSchemas = Arrays.asList(storageDir.listFiles());
index 62654c814e604d7e6d68d621b70e825772150cc6..26dae2b255d352c98076649b630ee56ffea6d64c 100644 (file)
@@ -77,14 +77,18 @@ public class Bug5410Test {
         final PatternConstraint pattern = getPatternConstraintOf(context, "leaf-with-pattern");
 
         final String rawRegex = pattern.getRawRegularExpression();
-        final String expectedYangRegex = "$0$.*|$1$[a-zA-Z0-9./]{1,8}$[a-zA-Z0-9./]{22}|$5$(rounds=\\d+$)?[a-zA-Z0-9./]{1,16}$[a-zA-Z0-9./]{43}|$6$(rounds=\\d+$)?[a-zA-Z0-9./]{1,16}$[a-zA-Z0-9./]{86}";
+        final String expectedYangRegex = "$0$.*|$1$[a-zA-Z0-9./]{1,8}$[a-zA-Z0-9./]{22}|$5$(rounds=\\d+$)?"
+                + "[a-zA-Z0-9./]{1,16}$[a-zA-Z0-9./]{43}|$6$(rounds=\\d+$)?[a-zA-Z0-9./]{1,16}$[a-zA-Z0-9./]{86}";
         assertEquals(expectedYangRegex, rawRegex);
 
         final String javaRegexFromYang = pattern.getRegularExpression();
-        final String expectedJavaRegex = "^\\$0\\$.*|\\$1\\$[a-zA-Z0-9./]{1,8}\\$[a-zA-Z0-9./]{22}|\\$5\\$(rounds=\\d+\\$)?[a-zA-Z0-9./]{1,16}\\$[a-zA-Z0-9./]{43}|\\$6\\$(rounds=\\d+\\$)?[a-zA-Z0-9./]{1,16}\\$[a-zA-Z0-9./]{86}$";
+        final String expectedJavaRegex = "^\\$0\\$.*|\\$1\\$[a-zA-Z0-9./]{1,8}\\$[a-zA-Z0-9./]{22}|\\$5\\$"
+                + "(rounds=\\d+\\$)?[a-zA-Z0-9./]{1,16}\\$[a-zA-Z0-9./]{43}|\\$6\\$(rounds=\\d+\\$)?"
+                + "[a-zA-Z0-9./]{1,16}\\$[a-zA-Z0-9./]{86}$";
         assertEquals(expectedJavaRegex, javaRegexFromYang);
 
-        final String value = "$6$AnrKGc0V$B/0/A.pWg4HrrA6YiEJOtFGibQ9Fmm5.4rI/00gEz3QeB7joSxBU3YtbHDm6NSkS1dKTQy3BWhwKKDS8nB5S//";
+        final String value = "$6$AnrKGc0V$B/0/A.pWg4HrrA6YiEJOtFGibQ9Fmm5.4rI/"
+                + "00gEz3QeB7joSxBU3YtbHDm6NSkS1dKTQy3BWhwKKDS8nB5S//";
         testPattern(javaRegexFromYang, ImmutableList.of(value), ImmutableList.of());
     }
 
@@ -199,16 +203,16 @@ public class Bug5410Test {
         }
     }
 
-    private static String javaRegexFromXSD(final String xsdRegex) {
-        return RegexUtils.getJavaRegexFromXSD(xsdRegex);
+    private static void testPattern(final String xsdRegex, final String unanchoredJavaRegex) {
+        testPattern(xsdRegex, '^' + unanchoredJavaRegex + '$', ImmutableList.of(), ImmutableList.of());
     }
 
     private static boolean testMatch(final String javaRegex, final String value) {
         return value.matches(javaRegex);
     }
 
-    private static void testPattern(final String xsdRegex, final String unanchoredJavaRegex) {
-        testPattern(xsdRegex, '^' + unanchoredJavaRegex + '$', ImmutableList.of(), ImmutableList.of());
+    private static String javaRegexFromXSD(final String xsdRegex) {
+        return RegexUtils.getJavaRegexFromXSD(xsdRegex);
     }
 
     private static PatternConstraint getPatternConstraintOf(final SchemaContext context, final String leafName) {
@@ -225,7 +229,9 @@ public class Bug5410Test {
         return QName.create(FOO_NS, FOO_REV, localName);
     }
 
-    private static void testInvalidPattern(final String xsdRegex, final String expectedMessage) throws UnsupportedEncodingException {
+    @SuppressWarnings("checkstyle:regexpSinglelineJava")
+    private static void testInvalidPattern(final String xsdRegex, final String expectedMessage)
+            throws UnsupportedEncodingException {
         final PrintStream stdout = System.out;
         final ByteArrayOutputStream output = new ByteArrayOutputStream();
         System.setOut(new PrintStream(output, true, "UTF-8"));
index afba32cd181b0e6629af769f354d292840de3a8f..643eef8b7acd00c03f5b7d8ce1f082c0b4c7f9cf 100644 (file)
@@ -90,8 +90,8 @@ public class ActionStatementTest {
             StmtTestUtils.parseYangSource("/rfc7950/action-stmt/foo-invalid.yang");
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final ReactorException e) {
-            assertTrue(e.getCause().getMessage().startsWith("Action (foo-namespace?revision=2016-12-13)" +
-                    "action-in-grouping is defined within a notification, rpc or another action"));
+            assertTrue(e.getCause().getMessage().startsWith("Action (foo-namespace?revision=2016-12-13)"
+                    "action-in-grouping is defined within a notification, rpc or another action"));
         }
     }
 
@@ -102,8 +102,8 @@ public class ActionStatementTest {
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final ReactorException e) {
             assertTrue(e.getCause().getMessage().startsWith(
-                    "Action (bar-namespace?revision=2016-12-13)my-action is defined within a list" +
-                            " that has no key statement"));
+                    "Action (bar-namespace?revision=2016-12-13)my-action is defined within a list"
+                            " that has no key statement"));
         }
     }
 
@@ -114,8 +114,8 @@ public class ActionStatementTest {
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final ReactorException e) {
             assertTrue(e.getCause().getMessage().startsWith(
-                    "Action (baz-namespace?revision=2016-12-13)action-in-grouping is defined within a " +
-                            "case statement"));
+                    "Action (baz-namespace?revision=2016-12-13)action-in-grouping is defined within a "
+                            "case statement"));
         }
     }
 
index 0131e3b04781895df2df8f131bcf81e9579cbb53..4b9569728290e0d3261406ab9a402292b8719fbd 100644 (file)
@@ -49,7 +49,8 @@ public class Bug6868Test {
                 ImmutableSet.of("my-container-1", "my-container-2", "my-container-3", "foo"));
         assertSchemaContextFor(ImmutableSet.of("foo", "bar", "baz", "imp:bar"),
                 ImmutableSet.of("my-container-1", "my-container-2", "my-container-3", "foo", "imp-bar"));
-        assertSchemaContextFor(ImmutableSet.of("foo", "baz", "imp:bar"), ImmutableSet.of("foo", "imp-bar", "imp-bar-2"));
+        assertSchemaContextFor(ImmutableSet.of("foo", "baz", "imp:bar"),
+            ImmutableSet.of("foo", "imp-bar", "imp-bar-2"));
     }
 
     private static void assertSchemaContextFor(final Set<String> supportedFeatures,
index 95fbb4175027be4fef1c0ef2840578e41930c79e..da54f7aa6c489b88f65151e28c9b07eac1d8a304 100644 (file)
@@ -83,7 +83,7 @@ public class Bug6869Test {
 
     private static SchemaNode findNode(final SchemaContext context, final Iterable<String> localNamesPath) {
         final Iterable<QName> qNames = Iterables.transform(localNamesPath,
-                localName -> QName.create(FOO_NS, FOO_REV, localName));
+            localName -> QName.create(FOO_NS, FOO_REV, localName));
         return SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(qNames, true));
     }
 
index 1ec0b6ed9ed4ebf4a5bf08be9d0a3fb578121a47..1b7efb0abfbc430c22b021c91a9c1f294bdab735 100644 (file)
@@ -62,7 +62,7 @@ public class Bug6870Test {
 
     private static SchemaNode findNode(final SchemaContext context, final Iterable<String> localNamesPath) {
         final Iterable<QName> qNames = Iterables.transform(localNamesPath,
-                localName -> QName.create(FOO_NS, FOO_REV, localName));
+            localName -> QName.create(FOO_NS, FOO_REV, localName));
         return SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(qNames, true));
     }
 
index a672030f0dd7f0fbee100d0d25afaba81ea62528..19f2312e634a3df8ee944a5aab4615b93f43bccf 100644 (file)
@@ -31,18 +31,19 @@ import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
 
 public class Bug6874Test {
 
-    private static final StatementStreamSource ROOT_MODULE = sourceForResource
-            ("/rfc7950/include-import-stmt-test/valid-11/root-module.yang");
-    private static final StatementStreamSource CHILD_MODULE = sourceForResource
-            ("/rfc7950/include-import-stmt-test/valid-11/child-module.yang");
-    private static final StatementStreamSource CHILD_MODULE_1 = sourceForResource
-            ("/rfc7950/include-import-stmt-test/valid-11/child-module-1.yang");
-    private static final StatementStreamSource IMPORTED_MODULE = sourceForResource
-            ("/rfc7950/include-import-stmt-test/valid-11/imported-module.yang");
+    private static final StatementStreamSource ROOT_MODULE = sourceForResource(
+        "/rfc7950/include-import-stmt-test/valid-11/root-module.yang");
+    private static final StatementStreamSource CHILD_MODULE = sourceForResource(
+        "/rfc7950/include-import-stmt-test/valid-11/child-module.yang");
+    private static final StatementStreamSource CHILD_MODULE_1 = sourceForResource(
+        "/rfc7950/include-import-stmt-test/valid-11/child-module-1.yang");
+    private static final StatementStreamSource IMPORTED_MODULE = sourceForResource(
+        "/rfc7950/include-import-stmt-test/valid-11/imported-module.yang");
 
     @Test
     public void valid11Test() throws Exception {
-        final SchemaContext schemaContext = StmtTestUtils.parseYangSources("/rfc7950/include-import-stmt-test/valid-11");
+        final SchemaContext schemaContext = StmtTestUtils.parseYangSources(
+            "/rfc7950/include-import-stmt-test/valid-11");
         assertNotNull(schemaContext);
 
         // Test for valid include statement
@@ -85,10 +86,10 @@ public class Bug6874Test {
         reactor.addSources(ROOT_MODULE, CHILD_MODULE, CHILD_MODULE_1, IMPORTED_MODULE);
 
         reactor.build().getRootStatements().forEach(declaredStmt -> {
-            if(declaredStmt instanceof ModuleStatementImpl) {
+            if (declaredStmt instanceof ModuleStatementImpl) {
                 declaredStmt.declaredSubstatements().forEach(subStmt -> {
-                    if (subStmt instanceof IncludeStatementImpl &&
-                            subStmt.rawArgument().equals("child-module")) {
+                    if (subStmt instanceof IncludeStatementImpl
+                            && subStmt.rawArgument().equals("child-module")) {
                         subStmt.declaredSubstatements().forEach(Bug6874Test::verifyDescAndRef);
                     }
                 });
@@ -97,7 +98,7 @@ public class Bug6874Test {
     }
 
     @SuppressWarnings("rawtypes")
-    private static void verifyDescAndRef (final DeclaredStatement stmt) {
+    private static void verifyDescAndRef(final DeclaredStatement stmt) {
         if (stmt instanceof DescriptionStatementImpl) {
             assertEquals("Yang 1.1: Allow description and reference in include and import.",
                 ((DescriptionStatementImpl) stmt).argument());
index 542d6164cdce0e30353942a46497b3b2cc43db73..6717159a6f500d397167bb32534019f0b1fbf31a 100644 (file)
@@ -48,8 +48,8 @@ public class Bug6876Test {
         assertNull(findNode(context, ImmutableList.of(bar("augment-target"), foo("mandatory-leaf"))));
     }
 
-    private static SchemaNode findNode(final SchemaContext context, final Iterable<QName> qNames) {
-        return SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(qNames, true));
+    private static SchemaNode findNode(final SchemaContext context, final Iterable<QName> qnames) {
+        return SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(qnames, true));
     }
 
     private static QName foo(final String localName) {
index 97b99d06a8116b4da03fd37bc3287261ea653199..92a214fc7cf98b3cd2a88810d422c2101192b856 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
 public class Bug6878Test {
 
     @Test
+    @SuppressWarnings("checkstyle:regexpSinglelineJava")
     public void testParsingXPathWithYang11Functions() throws Exception {
         final PrintStream stdout = System.out;
         final ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -37,6 +38,7 @@ public class Bug6878Test {
     }
 
     @Test
+    @SuppressWarnings("checkstyle:regexpSinglelineJava")
     public void shouldLogInvalidYang10XPath() throws Exception {
         final PrintStream stdout = System.out;
         final ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -52,6 +54,7 @@ public class Bug6878Test {
     }
 
     @Test
+    @SuppressWarnings("checkstyle:regexpSinglelineJava")
     public void shouldLogInvalidYang10XPath2() throws Exception {
         final PrintStream stdout = System.out;
         final ByteArrayOutputStream output = new ByteArrayOutputStream();
index 6f410dcb7c850231135cd14401c61b349ce9dd01..e7923e80303a0d861c7dd0e0cbb1de95630ac425 100644 (file)
@@ -53,7 +53,7 @@ public class Bug6883Test {
 
     private static AnyDataSchemaNode assertAnyData(final SchemaContext context, final Iterable<String> localNamesPath) {
         final Iterable<QName> qNames = Iterables.transform(localNamesPath,
-                localName -> QName.create(FOO_NS, FOO_REV, localName));
+            localName -> QName.create(FOO_NS, FOO_REV, localName));
         final SchemaNode findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context,
                 SchemaPath.create(qNames, true));
         assertTrue(findDataSchemaNode instanceof AnyDataSchemaNode);
index 99a78730dc10560ed56d8662933f977e9728b8e7..360b6ad0a6ca966f4f1a11cc6dbb1f7c2d895756 100644 (file)
@@ -44,8 +44,8 @@ public class Bug6884Test {
             instanceof ContainerSchemaNode);
     }
 
-    private static SchemaNode findNode(final SchemaContext context, final Iterable<QName> qNames) {
-        return SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(qNames, true));
+    private static SchemaNode findNode(final SchemaContext context, final Iterable<QName> qnames) {
+        return SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(qnames, true));
     }
 
     private static QName foo(final String localName) {
index be34f7cbec269614ea128d1cf2ea3e74c3ca7261..d6d8fdd0c613edc8ee3d9e0410702cab3d2d6138 100644 (file)
@@ -33,43 +33,43 @@ public class Bug6885Test {
 
     @Test
     public void invalidListLeafKeyTest1() throws Exception {
-        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)when statement is not allowed in " +
-                "(incorrect-list-keys-test?revision=2017-02-06)a2 leaf statement which is specified as a list key.";
+        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)when statement is not allowed in "
+                "(incorrect-list-keys-test?revision=2017-02-06)a2 leaf statement which is specified as a list key.";
         testForWhen("/rfc7950/list-keys-test/incorrect-list-keys-test.yang", exceptionMessage);
     }
 
     @Test
     public void invalidListLeafKeyTest2() throws Exception {
-        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)if-feature statement is not allowed in " +
-                "(incorrect-list-keys-test1?revision=2017-02-06)b leaf statement which is specified as a list key.";
+        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)if-feature statement is not allowed in "
+                "(incorrect-list-keys-test1?revision=2017-02-06)b leaf statement which is specified as a list key.";
         testForIfFeature("/rfc7950/list-keys-test/incorrect-list-keys-test1.yang", exceptionMessage);
     }
 
     @Test
     public void invalidListUsesLeafKeyTest() throws Exception {
-        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)if-feature statement is not allowed in " +
-                "(incorrect-list-keys-test2?revision=2017-02-06)a1 leaf statement which is specified as a list key.";
+        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)if-feature statement is not allowed in "
+                "(incorrect-list-keys-test2?revision=2017-02-06)a1 leaf statement which is specified as a list key.";
         testForIfFeature("/rfc7950/list-keys-test/incorrect-list-keys-test2.yang", exceptionMessage);
     }
 
     @Test
     public void invalidListUsesLeafKeyTest1() throws Exception {
-        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)when statement is not allowed in " +
-                "(incorrect-list-keys-test3?revision=2017-02-06)a2 leaf statement which is specified as a list key.";
+        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)when statement is not allowed in "
+                "(incorrect-list-keys-test3?revision=2017-02-06)a2 leaf statement which is specified as a list key.";
         testForWhen("/rfc7950/list-keys-test/incorrect-list-keys-test3.yang", exceptionMessage);
     }
 
     @Test
     public void invalidListUsesLeafKeyTest2() throws Exception {
-        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)if-feature statement is not allowed in " +
-                "(incorrect-list-keys-test4?revision=2017-02-06)a1 leaf statement which is specified as a list key.";
+        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)if-feature statement is not allowed in "
+                "(incorrect-list-keys-test4?revision=2017-02-06)a1 leaf statement which is specified as a list key.";
         testForIfFeature("/rfc7950/list-keys-test/incorrect-list-keys-test4.yang", exceptionMessage);
     }
 
     @Test
     public void invalidListUsesRefineLeafKeyTest() throws Exception {
-        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)if-feature statement is not allowed in " +
-                "(incorrect-list-keys-test5?revision=2017-02-06)a1 leaf statement which is specified as a list key.";
+        final String exceptionMessage = "(urn:ietf:params:xml:ns:yang:yin:1)if-feature statement is not allowed in "
+                "(incorrect-list-keys-test5?revision=2017-02-06)a1 leaf statement which is specified as a list key.";
         testForIfFeature("/rfc7950/list-keys-test/incorrect-list-keys-test5.yang", exceptionMessage);
     }
 
index 6242659e7528ada0f6359f3bc97051c51ea0c8a6..7f2f69977d20ca484ebc2a42be72b9cb83fd52d3 100644 (file)
@@ -91,8 +91,8 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof SourceException);
-            assertTrue(cause.getMessage().startsWith("Enum 'purple' is not a subset of its base enumeration type" +
-                    (foo?revision=2017-02-02)my-derived-enumeration-type."));
+            assertTrue(cause.getMessage().startsWith("Enum 'purple' is not a subset of its base enumeration type "
+                    + "(foo?revision=2017-02-02)my-derived-enumeration-type."));
         }
     }
 
@@ -104,8 +104,8 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof InvalidEnumDefinitionException);
-            assertTrue(cause.getMessage().startsWith("Enum 'magenta' is not a subset of its base enumeration type" +
-                    (foo?revision=2017-02-02)my-base-enumeration-type."));
+            assertTrue(cause.getMessage().startsWith("Enum 'magenta' is not a subset of its base enumeration type "
+                    + "(foo?revision=2017-02-02)my-base-enumeration-type."));
         }
     }
 
@@ -117,9 +117,9 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof InvalidEnumDefinitionException);
-            assertTrue(cause.getMessage().startsWith("Value of enum 'red' must be the same as the value of " +
-                    "corresponding enum in the base enumeration type (foo?revision=2017-02-02)" +
-                    "my-derived-enumeration-type."));
+            assertTrue(cause.getMessage().startsWith("Value of enum 'red' must be the same as the value of "
+                    + "corresponding enum in the base enumeration type (foo?revision=2017-02-02)"
+                    "my-derived-enumeration-type."));
         }
     }
 
@@ -131,9 +131,9 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof InvalidEnumDefinitionException);
-            assertTrue(cause.getMessage().startsWith("Value of enum 'black' must be the same as the value of " +
-                    "corresponding enum in the base enumeration type (foo?revision=2017-02-02)" +
-                    "my-base-enumeration-type."));
+            assertTrue(cause.getMessage().startsWith("Value of enum 'black' must be the same as the value of "
+                    + "corresponding enum in the base enumeration type (foo?revision=2017-02-02)"
+                    "my-base-enumeration-type."));
         }
     }
 
@@ -151,7 +151,8 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof SourceException);
-            assertTrue(cause.getMessage().startsWith("Restricted enumeration type is allowed only in YANG 1.1 version."));
+            assertTrue(cause.getMessage().startsWith(
+                "Restricted enumeration type is allowed only in YANG 1.1 version."));
         }
     }
 
@@ -163,7 +164,8 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof SourceException);
-            assertTrue(cause.getMessage().startsWith("Restricted enumeration type is allowed only in YANG 1.1 version."));
+            assertTrue(cause.getMessage().startsWith(
+                "Restricted enumeration type is allowed only in YANG 1.1 version."));
         }
     }
 
@@ -205,7 +207,7 @@ public class Bug6887Test {
         bitsType = bitsType.getBaseType();
         bits = bitsType.getBits();
         assertEquals(4, bits.size());
-        Bit bitA = createBit(createSchemaPath(true, bar.getQNameModule(), ImmutableList.of("my-base-bits-type",
+        final Bit bitA = createBit(createSchemaPath(true, bar.getQNameModule(), ImmutableList.of("my-base-bits-type",
                 "bits", "bit-a")), 1);
         bitB = createBit(createSchemaPath(true, bar.getQNameModule(), ImmutableList.of("my-base-bits-type",
                 "bits", "bit-b")), 2);
@@ -239,8 +241,8 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof SourceException);
-            assertTrue(cause.getMessage().startsWith("Bit 'bit-w' is not a subset of its base bits type" +
-                    (bar?revision=2017-02-02)my-derived-bits-type."));
+            assertTrue(cause.getMessage().startsWith("Bit 'bit-w' is not a subset of its base bits type "
+                    + "(bar?revision=2017-02-02)my-derived-bits-type."));
         }
     }
 
@@ -252,8 +254,8 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof InvalidBitDefinitionException);
-            assertTrue(cause.getMessage().startsWith("Bit 'bit-x' is not a subset of its base bits type" +
-                    (bar?revision=2017-02-02)my-base-bits-type."));
+            assertTrue(cause.getMessage().startsWith("Bit 'bit-x' is not a subset of its base bits type "
+                    + "(bar?revision=2017-02-02)my-base-bits-type."));
         }
     }
 
@@ -265,8 +267,8 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof InvalidBitDefinitionException);
-            assertTrue(cause.getMessage().startsWith("Position of bit 'bit-c' must be the same as the position of " +
-                    "corresponding bit in the base bits type (bar?revision=2017-02-02)my-derived-bits-type."));
+            assertTrue(cause.getMessage().startsWith("Position of bit 'bit-c' must be the same as the position of "
+                    "corresponding bit in the base bits type (bar?revision=2017-02-02)my-derived-bits-type."));
         }
     }
 
@@ -278,8 +280,8 @@ public class Bug6887Test {
         } catch (final ReactorException ex) {
             final Throwable cause = ex.getCause();
             assertTrue(cause instanceof InvalidBitDefinitionException);
-            assertTrue(cause.getMessage().startsWith("Position of bit 'bit-d' must be the same as the position of " +
-                    "corresponding bit in the base bits type (bar?revision=2017-02-02)my-base-bits-type."));
+            assertTrue(cause.getMessage().startsWith("Position of bit 'bit-d' must be the same as the position of "
+                    "corresponding bit in the base bits type (bar?revision=2017-02-02)my-base-bits-type."));
         }
     }
 
@@ -333,10 +335,9 @@ public class Bug6887Test {
         }
     }
 
-    private static SchemaPath createSchemaPath(final boolean absolute, final QNameModule qNameModule,
+    private static SchemaPath createSchemaPath(final boolean absolute, final QNameModule qnameModule,
             final Iterable<String> localNames) {
-        final Iterable<QName> qNames = Iterables.transform(localNames,
-                localName -> QName.create(qNameModule, localName));
-        return SchemaPath.create(qNames, true);
+        return SchemaPath.create(Iterables.transform(localNames,
+            localName -> QName.create(qnameModule, localName)), true);
     }
 }
index 3331f5325f56d2d98eef4c7e866807edb158dc85..c88851b334479b1a09897a7fb207d465ef836f4e 100644 (file)
@@ -89,12 +89,9 @@ public class Bug6897Test {
             StmtTestUtils.parseYangSource("/rfc7950/notifications-in-data-nodes/foo-invalid.yang");
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final SomeModifiersUnresolvedException e) {
-            assertTrue(e
-                    .getCause()
-                    .getMessage()
-                    .startsWith(
-                            "Notification (foo?revision=1970-01-01)grp-notification is defined within"
-                                    + " an rpc, action, or another notification"));
+            assertTrue(e.getCause().getMessage().startsWith(
+                "Notification (foo?revision=1970-01-01)grp-notification is defined within an rpc, action, or another "
+                        + "notification"));
         }
     }
 
@@ -105,8 +102,8 @@ public class Bug6897Test {
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final SomeModifiersUnresolvedException e) {
             assertTrue(e.getCause().getMessage().startsWith(
-                            "Notification (bar-namespace?revision=2016-12-08)my-notification is defined within a list" +
-                                    " that has no key statement"));
+                "Notification (bar-namespace?revision=2016-12-08)my-notification is defined within a list "
+                        + "that has no key statement"));
         }
     }
 
@@ -117,8 +114,8 @@ public class Bug6897Test {
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final SomeModifiersUnresolvedException e) {
             assertTrue(e.getCause().getMessage().startsWith(
-                    "Notification (baz-namespace?revision=2016-12-08)notification-in-grouping is defined within a " +
-                            "case statement"));
+                "Notification (baz-namespace?revision=2016-12-08)notification-in-grouping is defined within a case "
+                        + "statement"));
         }
     }
 }
index 6e480dfae409a8ab32092a25376898dd16aafa6a..80bd9d640947f6e990608957dd3410a40cc4653c 100644 (file)
@@ -32,7 +32,8 @@ public class Bug6901Test {
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final SomeModifiersUnresolvedException e) {
             assertTrue(e.getCause().getMessage().startsWith(
-                    "Leaf '(foo?revision=1970-01-01)enum-leaf' has default value 'two' marked with an if-feature statement."));
+                    "Leaf '(foo?revision=1970-01-01)enum-leaf' has default value 'two' marked with an if-feature "
+                            + "statement."));
         }
     }
 
@@ -43,7 +44,8 @@ public class Bug6901Test {
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final SomeModifiersUnresolvedException e) {
             assertTrue(e.getCause().getMessage().startsWith(
-                    "Leaf '(foo?revision=1970-01-01)enum-leaf' has default value 'two' marked with an if-feature statement."));
+                    "Leaf '(foo?revision=1970-01-01)enum-leaf' has default value 'two' marked with an if-feature "
+                            + "statement."));
         }
     }
 
@@ -54,7 +56,8 @@ public class Bug6901Test {
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final SomeModifiersUnresolvedException e) {
             assertTrue(e.getCause().getMessage().startsWith(
-                    "Leaf '(foo?revision=1970-01-01)enum-leaf' has default value 'two' marked with an if-feature statement."));
+                    "Leaf '(foo?revision=1970-01-01)enum-leaf' has default value 'two' marked with an if-feature "
+                            + "statement."));
         }
     }
 
@@ -65,7 +68,8 @@ public class Bug6901Test {
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final SomeModifiersUnresolvedException e) {
             assertTrue(e.getCause().getMessage().startsWith(
-                    "Typedef '(foo?revision=1970-01-01)bits-typedef-2' has default value 'two' marked with an if-feature statement."));
+                    "Typedef '(foo?revision=1970-01-01)bits-typedef-2' has default value 'two' marked with an "
+                            + "if-feature statement."));
         }
     }
 
@@ -76,7 +80,8 @@ public class Bug6901Test {
             fail("Test should fail due to invalid Yang 1.1");
         } catch (final SomeModifiersUnresolvedException e) {
             assertTrue(e.getCause().getMessage().startsWith(
-                    "Leaf '(foo?revision=1970-01-01)union-leaf' has default value 'two' marked with an if-feature statement."));
+                    "Leaf '(foo?revision=1970-01-01)union-leaf' has default value 'two' marked with an if-feature "
+                            + "statement."));
         }
     }
 
@@ -110,4 +115,4 @@ public class Bug6901Test {
             assertTrue(e.getCause().getMessage().startsWith("IF_FEATURE is not valid for BIT"));
         }
     }
-}
\ No newline at end of file
+}
index 7872aa4d68dd8642909b2cef0f804d422a66ba91..b89f5f20a9166602a763b8adb32dcbe469c5c5bf 100644 (file)
@@ -13,7 +13,7 @@ import static org.junit.Assert.fail;
 
 import java.util.Set;
 import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
+import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -24,26 +24,25 @@ public class Bug8597Test {
         final SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug8597");
         assertNotNull(context);
 
-        final Module foo = context.findModuleByName("foo",
-                SimpleDateFormatUtil.getRevisionFormat().parse("1970-01-01"));
+        final Module foo = context.findModuleByName("foo", QName.parseRevision("1970-01-01"));
         assertNotNull(foo);
 
         final Set<ModuleImport> imports = foo.getImports();
 
         for (final ModuleImport moduleImport : imports) {
             switch (moduleImport.getModuleName()) {
-            case "bar":
-                assertEquals(SimpleDateFormatUtil.getRevisionFormat().parse("1970-01-01"), moduleImport.getRevision());
-                assertEquals("bar-ref", moduleImport.getReference());
-                assertEquals("bar-desc", moduleImport.getDescription());
-                break;
-            case "baz":
-                assertEquals(SimpleDateFormatUtil.getRevisionFormat().parse("2010-10-10"), moduleImport.getRevision());
-                assertEquals("baz-ref", moduleImport.getReference());
-                assertEquals("baz-desc", moduleImport.getDescription());
-                break;
-            default:
-                fail("Module 'foo' should only contains import of module 'bar' and 'baz'");
+                case "bar":
+                    assertEquals(QName.parseRevision("1970-01-01"), moduleImport.getRevision());
+                    assertEquals("bar-ref", moduleImport.getReference());
+                    assertEquals("bar-desc", moduleImport.getDescription());
+                    break;
+                case "baz":
+                    assertEquals(QName.parseRevision("2010-10-10"), moduleImport.getRevision());
+                    assertEquals("baz-ref", moduleImport.getReference());
+                    assertEquals("baz-desc", moduleImport.getDescription());
+                    break;
+                default:
+                    fail("Module 'foo' should only contains import of module 'bar' and 'baz'");
             }
         }
     }
index 71fa0f091998304b4c0f267405a1a364a565489d..8e978ff49e145d698b9a712dd79f59708112de2a 100644 (file)
@@ -62,13 +62,13 @@ public class EffectiveModulesAndSubmodulesTest {
         Module imported = null;
         for (final Module module : modules) {
             switch (module.getName()) {
-            case "root-module":
-                root = module;
-                break;
-            case "imported-module":
-                imported = module;
-                break;
-            default:
+                case "root-module":
+                    root = module;
+                    break;
+                case "imported-module":
+                    imported = module;
+                    break;
+                default:
             }
             StmtTestUtils.printReferences(module, false, "");
             StmtTestUtils.printChilds(module.getChildNodes(), "      ");
@@ -100,13 +100,13 @@ public class EffectiveModulesAndSubmodulesTest {
         Module sub2 = null;
         for (final Module rootSubmodule : rootSubmodules) {
             switch (rootSubmodule.getName()) {
-            case "submodule-1":
-                sub1 = rootSubmodule;
-                break;
-            case "submodule-2":
-                sub2 = rootSubmodule;
-                break;
-            default:
+                case "submodule-1":
+                    sub1 = rootSubmodule;
+                    break;
+                case "submodule-2":
+                    sub2 = rootSubmodule;
+                    break;
+                default:
             }
         }
 
@@ -139,10 +139,10 @@ public class EffectiveModulesAndSubmodulesTest {
         Module sub1Submodule = null;
         for (final Module submodule : sub1Submodules) {
             switch (submodule.getName()) {
-            case "submodule-to-submodule-1":
-                sub1Submodule = submodule;
-                break;
-            default:
+                case "submodule-to-submodule-1":
+                    sub1Submodule = submodule;
+                    break;
+                default:
             }
         }
 
@@ -152,8 +152,7 @@ public class EffectiveModulesAndSubmodulesTest {
                 SimpleDateFormatUtil.DEFAULT_DATE_REV),
                 sub1Submodule.getQNameModule());
 
-        final Collection<DataSchemaNode> sub1SubmoduleChildNodes = sub1Submodule
-                .getChildNodes();
+        final Collection<DataSchemaNode> sub1SubmoduleChildNodes = sub1Submodule.getChildNodes();
         assertNotNull(sub1SubmoduleChildNodes);
         assertEquals(1, sub1SubmoduleChildNodes.size());
 
@@ -164,7 +163,6 @@ public class EffectiveModulesAndSubmodulesTest {
         findModulesSubTest(result, root, imported);
 
         getDataChildByNameSubTest(result, root);
-
     }
 
     private static void getDataChildByNameSubTest(final SchemaContext result, final Module root) {
@@ -217,5 +215,4 @@ public class EffectiveModulesAndSubmodulesTest {
 
         assertFalse(root.equals(imported));
     }
-
 }