From 12f5f66b1285e10bd9fd05c443651173cae02c3f Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Thu, 13 Jun 2013 09:21:59 +0200 Subject: [PATCH] Fixed platform dependant bugs in maven plugin Signed-off-by: Maros Marsalek --- .../plugin/it/YangToSourcesPluginTestIT.java | 18 ++++++++++-------- .../controller/yang2sources/plugin/Util.java | 2 +- .../plugin/YangToSourcesProcessor.java | 1 + 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin-it/src/test/java/org/opendaylight/controller/yang2sources/plugin/it/YangToSourcesPluginTestIT.java b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin-it/src/test/java/org/opendaylight/controller/yang2sources/plugin/it/YangToSourcesPluginTestIT.java index 0ea82f8fb8..9532d4efc9 100644 --- a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin-it/src/test/java/org/opendaylight/controller/yang2sources/plugin/it/YangToSourcesPluginTestIT.java +++ b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin-it/src/test/java/org/opendaylight/controller/yang2sources/plugin/it/YangToSourcesPluginTestIT.java @@ -48,8 +48,12 @@ public class YangToSourcesPluginTestIT { Verifier v = setUp("AdditionalConfig/", false); v.verifyTextInLog("[DEBUG] yang-to-sources: Additional configuration picked up for : org.opendaylight.controller.yang2sources.spi.CodeGeneratorTestImpl: {nm1=abcd=a.b.c.d, nm2=abcd2=a.b.c.d.2}"); v.verifyTextInLog("[DEBUG] yang-to-sources: Additional configuration picked up for : org.opendaylight.controller.yang2sources.spi.CodeGeneratorTestImpl: {c1=config}"); - v.verifyTextInLog("../files marked as resources: META-INF/yang"); - v.verifyTextInLog("target/generated-resources marked as resources for generator: org.opendaylight.controller.yang2sources.spi.CodeGeneratorTestImpl"); + v.verifyTextInLog(File.separator + + "files marked as resources: META-INF" + File.separator + + "yang"); + v.verifyTextInLog("target" + + File.separator + + "generated-resources marked as resources for generator: org.opendaylight.controller.yang2sources.spi.CodeGeneratorTestImpl"); } @Test @@ -105,9 +109,8 @@ public class YangToSourcesPluginTestIT { static Verifier setUp(String project, boolean ignoreF) throws VerificationException { - final URL path = YangToSourcesPluginTestIT - .class.getResource("/" + project - + "pom.xml"); + final URL path = YangToSourcesPluginTestIT.class.getResource("/" + + project + "pom.xml"); File parent = new File(path.getPath()); Verifier verifier = new Verifier(parent.getParent()); if (ignoreF) @@ -125,9 +128,8 @@ public class YangToSourcesPluginTestIT { @Test public void testFindResourceOnCp() throws VerificationException { - Verifier v1 = new Verifier( - new File(getClass().getResource("/GenerateTest1/pom.xml") - .getPath()).getParent()); + Verifier v1 = new Verifier(new File(getClass().getResource( + "/GenerateTest1/pom.xml").getPath()).getParent()); v1.executeGoal("clean"); v1.executeGoal("package"); v1.assertFilePresent("target/classes/META-INF/yang/testfile1.yang"); diff --git a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/Util.java b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/Util.java index 7b83af4242..e3b0b31215 100644 --- a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/Util.java +++ b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/Util.java @@ -216,7 +216,7 @@ final class Util { String entryName = entry.getName(); if (entryName - .startsWith(YangToSourcesProcessor.META_INF_YANG_STRING)) { + .startsWith(YangToSourcesProcessor.META_INF_YANG_STRING_JAR)) { if (entry.isDirectory() == false && entryName.endsWith(".yang")) { foundFilesForReporting.add(entryName); diff --git a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/YangToSourcesProcessor.java b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/YangToSourcesProcessor.java index a70ff956f0..a7b7f429cc 100644 --- a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/YangToSourcesProcessor.java +++ b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/YangToSourcesProcessor.java @@ -40,6 +40,7 @@ class YangToSourcesProcessor { static final String LOG_PREFIX = "yang-to-sources:"; static final String META_INF_YANG_STRING = "META-INF" + File.separator + "yang"; + static final String META_INF_YANG_STRING_JAR = "META-INF" + "/" + "yang"; static final File META_INF_YANG_DIR = new File(META_INF_YANG_STRING); private final Log log; -- 2.36.6