X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fsal-netconf-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fsal%2Fconnect%2Fnetconf%2FLibraryModulesSchemasTest.java;h=81a3c99f1ec0a96f69e445ed18d311121b6c66f1;hb=refs%2Fchanges%2F30%2F101630%2F7;hp=7a8846db832f2de9ce88cc9fcb710d36734662e5;hpb=2295d50e7212d80a9bc752f655fa66790ad45022;p=netconf.git diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/LibraryModulesSchemasTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/LibraryModulesSchemasTest.java index 7a8846db83..81a3c99f1e 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/LibraryModulesSchemasTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/LibraryModulesSchemasTest.java @@ -8,15 +8,15 @@ package org.opendaylight.netconf.sal.connect.netconf; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.net.MalformedURLException; import java.net.URL; import java.util.Collections; import java.util.Map; -import org.junit.Assert; import org.junit.Test; -import org.opendaylight.yangtools.yang.common.Revision; -import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier; import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier; public class LibraryModulesSchemasTest { @@ -36,27 +36,21 @@ public class LibraryModulesSchemasTest { verifySchemas(libraryModulesSchemas); } - private static void verifySchemas(final LibraryModulesSchemas libraryModulesSchemas) throws MalformedURLException { final Map resolvedModulesSchema = libraryModulesSchemas.getAvailableModels(); - Assert.assertThat(resolvedModulesSchema.size(), is(3)); + assertThat(resolvedModulesSchema.size(), is(3)); - Assert.assertTrue(resolvedModulesSchema.containsKey(RevisionSourceIdentifier.create("module-with-revision", - Revision.of("2014-04-08")))); - Assert.assertThat(resolvedModulesSchema.get( - RevisionSourceIdentifier.create("module-with-revision", Revision.of("2014-04-08"))), + assertTrue(resolvedModulesSchema.containsKey(new SourceIdentifier("module-with-revision", "2014-04-08"))); + assertThat(resolvedModulesSchema.get(new SourceIdentifier("module-with-revision", "2014-04-08")), is(new URL("http://localhost:8181/yanglib/schemas/module-with-revision/2014-04-08"))); - Assert.assertTrue(resolvedModulesSchema.containsKey( - RevisionSourceIdentifier.create("another-module-with-revision", Revision.of("2013-10-21")))); - Assert.assertThat(resolvedModulesSchema.get( - RevisionSourceIdentifier.create("another-module-with-revision", Revision.of("2013-10-21"))), + assertTrue(resolvedModulesSchema.containsKey( + new SourceIdentifier("another-module-with-revision", "2013-10-21"))); + assertThat(resolvedModulesSchema.get(new SourceIdentifier("another-module-with-revision", "2013-10-21")), is(new URL("http://localhost:8181/yanglib/schemas/another-module-with-revision/2013-10-21"))); - Assert.assertTrue(resolvedModulesSchema.containsKey( - RevisionSourceIdentifier.create("module-without-revision"))); - Assert.assertThat(resolvedModulesSchema.get( - RevisionSourceIdentifier.create("module-without-revision")), + assertTrue(resolvedModulesSchema.containsKey(new SourceIdentifier("module-without-revision"))); + assertThat(resolvedModulesSchema.get(new SourceIdentifier("module-without-revision")), is(new URL("http://localhost:8181/yanglib/schemas/module-without-revision/"))); } @@ -66,23 +60,20 @@ public class LibraryModulesSchemasTest { LibraryModulesSchemas.create(getClass().getResource("/yang-library-fail.xml").toString()); final Map resolvedModulesSchema = libraryModulesSchemas.getAvailableModels(); - Assert.assertThat(resolvedModulesSchema.size(), is(1)); + assertThat(resolvedModulesSchema.size(), is(1)); - Assert.assertFalse(resolvedModulesSchema.containsKey( - RevisionSourceIdentifier.create("module-with-bad-url"))); + assertFalse(resolvedModulesSchema.containsKey(new SourceIdentifier("module-with-bad-url"))); //See BUG 8071 https://bugs.opendaylight.org/show_bug.cgi?id=8071 - //Assert.assertFalse(resolvedModulesSchema.containsKey( + //assertFalse(resolvedModulesSchema.containsKey( // RevisionSourceIdentifier.create("module-with-bad-revision", "bad-revision"))); - Assert.assertTrue(resolvedModulesSchema.containsKey( - RevisionSourceIdentifier.create("good-ol-module"))); + assertTrue(resolvedModulesSchema.containsKey(new SourceIdentifier("good-ol-module"))); } - @Test public void testCreateFromInvalidAll() throws Exception { // test bad yang lib url LibraryModulesSchemas libraryModulesSchemas = LibraryModulesSchemas.create("ObviouslyBadUrl"); - Assert.assertThat(libraryModulesSchemas.getAvailableModels(), is(Collections.emptyMap())); + assertThat(libraryModulesSchemas.getAvailableModels(), is(Collections.emptyMap())); // TODO test also fail on json and xml parsing. But can we fail not on runtime exceptions? }