From: Tomas Olvecky Date: Tue, 29 Apr 2014 09:40:42 +0000 (+0200) Subject: Clean up yang-test to stop modifying source files during build. X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~159^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=253649c19083fb44874ef983d4f89f7aafabdd6c Clean up yang-test to stop modifying source files during build. In yang-test-plugin remove auto generated headers so that things like timestamp changes will not be reported as changed files after build. Also move an artifact definition in commons pom and sal-binding-it as enforced by the sort plugin. Change-Id: I5d851d65c149611800a1f7418eb4b642e3fd8260 Signed-off-by: Tomas Olvecky --- diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index f30d4b005a..e0891662ea 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -247,11 +247,6 @@ jersey-core ${jersey.version} - - javax.ws.rs - jsr311-api - ${jsr311.api.version} - com.sun.jersey jersey-server @@ -429,6 +424,11 @@ netty-transport ${netty.version} + + javax.ws.rs + jsr311-api + ${jsr311.api.version} + orbit javax.activation diff --git a/opendaylight/config/yang-test-plugin/src/main/java/org/opendaylight/controller/config/yang/test/plugin/ProcessSources.java b/opendaylight/config/yang-test-plugin/src/main/java/org/opendaylight/controller/config/yang/test/plugin/ProcessSources.java index f2a56f2b1b..7a20f22440 100644 --- a/opendaylight/config/yang-test-plugin/src/main/java/org/opendaylight/controller/config/yang/test/plugin/ProcessSources.java +++ b/opendaylight/config/yang-test-plugin/src/main/java/org/opendaylight/controller/config/yang/test/plugin/ProcessSources.java @@ -44,22 +44,53 @@ public class ProcessSources extends AbstractMojo{ File[] sourceFiles = sourceDirectory.listFiles(); for (File sourceFile: sourceFiles) { - if(sourceFile.getName().endsWith("Module.java") || sourceFile.getName().endsWith("ModuleFactory.java")) { - File stubFile = new File(sourceFile.getPath().replace(".java", "Stub.txt")); - if (stubFile.exists()) { - try { - rewrite(sourceFile, FileUtils.readFileToString(stubFile)); - } catch (IOException e) { - getLog().error("Error while reading/writing to files.", e); + if (sourceFile.getName().endsWith(".java")) { + String sourceContent; + try { + sourceContent = FileUtils.readFileToString(sourceFile); + } catch (IOException e) { + getLog().error("Cannot read " + sourceFile.getAbsolutePath(), e); + continue; + } + if (sourceFile.getName().endsWith("Module.java") || sourceFile.getName().endsWith("ModuleFactory.java")) { + File stubFile = new File(sourceFile.getPath().replace(".java", "Stub.txt")); + if (stubFile.exists()) { + String stubContent = null; + try { + stubContent = FileUtils.readFileToString(stubFile); + } catch (IOException e) { + getLog().error("Cannot read " + stubFile.getAbsolutePath(), e); + } + if (stubContent != null) { + sourceContent = rewriteStub(sourceContent, stubContent); + } } } + // remove copyright headers as they can contain timestamp + sourceContent = removeCopyrights(sourceContent); + + // replace the file content + try { + FileUtils.write(sourceFile, sourceContent); + } catch (IOException e) { + getLog().error("Cannot write " + sourceFile.getAbsolutePath(), e); + } } + } } - private static void rewrite(File sourceFile, String replaceTODOWith) throws IOException { - String source = FileUtils.readFileToString(sourceFile); - String target = Pattern.compile("^.*TODO.*\n.*throw new java.lang.UnsupportedOperationException.*$", Pattern.MULTILINE).matcher(source).replaceFirst(replaceTODOWith); - FileUtils.write(sourceFile, target); + private static Pattern MULTILINE_COMMENT_PATTERN = Pattern.compile("/\\*.*\\*/", Pattern.MULTILINE | Pattern.DOTALL); + private static String removeCopyrights(String source) { + String target = MULTILINE_COMMENT_PATTERN.matcher(source).replaceAll("\n"); + //FileUtils.write(sourceFile, target); + return target; + } + + private static Pattern UNSUPPORTED_OP_PATTERN = Pattern.compile("^.*TODO.*\n.*throw new java.lang.UnsupportedOperationException.*$", Pattern.MULTILINE); + + private static String rewriteStub(String source, String replaceTODOWith) { + String target = UNSUPPORTED_OP_PATTERN.matcher(source).replaceFirst(replaceTODOWith); + return target; } } diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModule.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModule.java index 07d7438a00..78ac362e59 100644 --- a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModule.java +++ b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModule.java @@ -1,10 +1,5 @@ -/* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ + + package org.opendaylight.controller.config.yang.test.impl; public class DepTestImplModule extends org.opendaylight.controller.config.yang.test.impl.AbstractDepTestImplModule { public DepTestImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModuleFactory.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModuleFactory.java index ae6ae67584..026dd9aca2 100644 --- a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModuleFactory.java +++ b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModuleFactory.java @@ -1,19 +1,5 @@ -/* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ -/* -* Generated file -* -* Generated from: yang module name: config-test-impl yang module local name: impl-dep -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Fri Apr 25 11:50:32 CEST 2014 -* -* Do not modify this file unless it is present under src/main directory -*/ + + package org.opendaylight.controller.config.yang.test.impl; public class DepTestImplModuleFactory extends org.opendaylight.controller.config.yang.test.impl.AbstractDepTestImplModuleFactory { diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModule.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModule.java index a5b7f55df3..ddf72f39b4 100644 --- a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModule.java +++ b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModule.java @@ -1,10 +1,5 @@ -/* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ + + package org.opendaylight.controller.config.yang.test.impl; public class IdentityTestModule extends org.opendaylight.controller.config.yang.test.impl.AbstractIdentityTestModule { public IdentityTestModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModuleFactory.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModuleFactory.java index 07012263e1..3a4348d376 100644 --- a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModuleFactory.java +++ b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModuleFactory.java @@ -1,19 +1,5 @@ -/* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ -/* -* Generated file -* -* Generated from: yang module name: config-test-impl yang module local name: impl-identity-test -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Fri Apr 25 11:50:32 CEST 2014 -* -* Do not modify this file unless it is present under src/main directory -*/ + + package org.opendaylight.controller.config.yang.test.impl; public class IdentityTestModuleFactory extends org.opendaylight.controller.config.yang.test.impl.AbstractIdentityTestModuleFactory { diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModule.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModule.java index ecbf4aba33..943fe3b0d7 100644 --- a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModule.java +++ b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModule.java @@ -1,10 +1,5 @@ -/* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ + + package org.opendaylight.controller.config.yang.test.impl; public class NetconfTestImplModule extends org.opendaylight.controller.config.yang.test.impl.AbstractNetconfTestImplModule { public NetconfTestImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleFactory.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleFactory.java index 3baee6c132..587089b10f 100644 --- a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleFactory.java +++ b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleFactory.java @@ -1,19 +1,5 @@ -/* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ -/* -* Generated file -* -* Generated from: yang module name: config-test-impl yang module local name: impl-netconf -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Fri Apr 25 11:50:32 CEST 2014 -* -* Do not modify this file unless it is present under src/main directory -*/ + + package org.opendaylight.controller.config.yang.test.impl; public class NetconfTestImplModuleFactory extends org.opendaylight.controller.config.yang.test.impl.AbstractNetconfTestImplModuleFactory { diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleUtil.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleUtil.java index 4de9804337..1d5cda036f 100644 --- a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleUtil.java +++ b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleUtil.java @@ -1,10 +1,5 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ + + package org.opendaylight.controller.config.yang.test.impl; import com.google.common.collect.Lists; diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModule.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModule.java index 9132407356..7b049e7b57 100644 --- a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModule.java +++ b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModule.java @@ -1,10 +1,5 @@ -/* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ + + package org.opendaylight.controller.config.yang.test.impl; public class TestImplModule extends org.opendaylight.controller.config.yang.test.impl.AbstractTestImplModule { public TestImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModuleFactory.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModuleFactory.java index 6f9118bf92..de9ac2fef3 100644 --- a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModuleFactory.java +++ b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModuleFactory.java @@ -1,19 +1,5 @@ -/* -* Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. -* -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0 which accompanies this distribution, -* and is available at http://www.eclipse.org/legal/epl-v10.html -*/ -/* -* Generated file -* -* Generated from: yang module name: config-test-impl yang module local name: impl -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Fri Apr 25 11:50:32 CEST 2014 -* -* Do not modify this file unless it is present under src/main directory -*/ + + package org.opendaylight.controller.config.yang.test.impl; public class TestImplModuleFactory extends org.opendaylight.controller.config.yang.test.impl.AbstractTestImplModuleFactory { diff --git a/opendaylight/md-sal/sal-binding-dom-it/pom.xml b/opendaylight/md-sal/sal-binding-dom-it/pom.xml index 21fa207d78..d1354f897f 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-dom-it/pom.xml @@ -14,6 +14,10 @@ junit junit + + org.opendaylight.yangtools + yang-binding + org.opendaylight.controller sal-binding-broker-impl @@ -25,10 +29,6 @@ test-jar test - - org.opendaylight.yangtools - yang-binding - org.opendaylight.controller.model model-flow-management @@ -54,26 +54,6 @@ - - org.opendaylight.yangtools - yang-maven-plugin - - - - generate-sources - - - - - org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl - ${salGeneratorPath} - - - true - - - - org.jacoco jacoco-maven-plugin @@ -98,6 +78,26 @@ + + org.opendaylight.yangtools + yang-maven-plugin + + + + generate-sources + + + + + org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl + ${salGeneratorPath} + + + true + + + +