You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ta...@apache.org on 2016/05/31 06:43:11 UTC

svn commit: r1746236 - in /ofbiz/trunk: ./ framework/base/ framework/base/config/ framework/base/src/org/ofbiz/base/config/ framework/documents/ framework/start/src/org/ofbiz/base/start/

Author: taher
Date: Tue May 31 06:43:11 2016
New Revision: 1746236

URL: http://svn.apache.org/viewvc?rev=1746236&view=rev
Log:
Remove cobertura and sonar completely. Ref OFBIZ-6783

After getting consensus from the community in the email thread below
we agreed to remove these two items because they make the startup
logic more complex and also because many things are broken and 
unmaintained for years.

It is a good idea to reintroduce cobertura in the future on a cleaner
implementation, hopefully completely away from the start component and
perhaps as a container implementation.

The email thread:
http://ofbiz.markmail.org/message/b4jovfhurczunbam?q=remove+cobertura

The related JIRA:
https://issues.apache.org/jira/browse/OFBIZ-6783

Modified:
    ofbiz/trunk/.classpath
    ofbiz/trunk/.gitignore
    ofbiz/trunk/build.xml
    ofbiz/trunk/common.xml
    ofbiz/trunk/framework/base/build.xml
    ofbiz/trunk/framework/base/config/ofbiz-containers.xml
    ofbiz/trunk/framework/base/src/org/ofbiz/base/config/CoberturaInstrumenter.java
    ofbiz/trunk/framework/documents/UnitTest.xml
    ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java
    ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Instrumenter.java
    ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java
    ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumentingClassLoader.java
    ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupControlPanel.java
    ofbiz/trunk/framework/start/src/org/ofbiz/base/start/test.properties
    ofbiz/trunk/ivy.xml
    ofbiz/trunk/macros.xml

Modified: ofbiz/trunk/.classpath
URL: http://svn.apache.org/viewvc/ofbiz/trunk/.classpath?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/.classpath (original)
+++ ofbiz/trunk/.classpath Tue May 31 06:43:11 2016
@@ -143,7 +143,7 @@
 	<classpathentry kind="src" path="applications/humanres/src"/>
 	<classpathentry kind="src" path="applications/workeffort/src"/>
 	<classpathentry kind="src" path="framework/base/config"/>
-	<classpathentry excluding="org/ofbiz/base/config/CoberturaInstrumenter.java" kind="src" path="framework/base/src"/>
+	<classpathentry kind="src" path="framework/base/src"/>
 	<classpathentry kind="src" path="framework/catalina/src"/>
 	<classpathentry kind="src" path="framework/common/src"/>
 	<classpathentry kind="src" path="framework/datafile/src"/>

Modified: ofbiz/trunk/.gitignore
URL: http://svn.apache.org/viewvc/ofbiz/trunk/.gitignore?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/.gitignore (original)
+++ ofbiz/trunk/.gitignore Tue May 31 06:43:11 2016
@@ -1,6 +1,5 @@
 applications/*/build
 framework/*/build
-framework/base/lib/cobertura-*.jar
 framework/base/lib/asm*.jar
 framework/base/lib/oro*.jar
 framework/entity/lib/jdbc/*.jar
@@ -16,9 +15,6 @@ runtime/SvnInfo.ftl
 runtime/GitInfo.ftl
 runtime/test-list-build.xml
 runtime/logs/access_log.*
-runtime/logs/cobertura-base.dat
-runtime/logs/cobertura-components.dat
-runtime/logs/cobertura-report
 runtime/logs/*.log*
 runtime/logs/*.html*
 runtime/logs/test-results/*

Modified: ofbiz/trunk/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.xml?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/build.xml (original)
+++ ofbiz/trunk/build.xml Tue May 31 06:43:11 2016
@@ -19,8 +19,7 @@ under the License.
 -->
 
 <project name="OFBiz Main Build" default="build" basedir="."
-    xmlns:ivy="antlib:org.apache.ivy.ant"
-    xmlns:sonar="antlib:org.sonar.ant:sonar">
+    xmlns:ivy="antlib:org.apache.ivy.ant">
 
     <taskdef uri="antlib:org.apache.ivy.ant" resource="org/apache/ivy/ant/antlib.xml">
         <classpath>
@@ -66,14 +65,6 @@ under the License.
         <copy file="runtime/data/derby.properties" todir="runtime/data/derby"/>
     </target>
 
-    <target name="sonar-init">
-        <taskdef uri="antlib:org.sonar.ant:sonar" resource="org/sonar/ant/antlib.xml">
-            <classpath>
-                <pathelement location="framework/base/lib/sonar-ant-task-1.3.jar" />
-            </classpath>
-        </taskdef>
-    </target>
-
     <!-- ================================================================== -->
     <!-- Removes all created files and directories                          -->
     <!-- ================================================================== -->
@@ -103,8 +94,6 @@ under the License.
     <target name="clean-downloads"
           description="Clean all downloaded files">
         <delete verbose="true" deleteonexit="true">
-            <fileset dir="framework/base/lib" includes="cobertura-*.jar"/>
-            <fileset dir="framework/base/lib" includes="sonar-*.jar"/>
             <fileset dir="framework/base/lib" includes="activemq-*.jar"/>
             <fileset dir="framework/entity/lib/jdbc" includes="postgresql-*.jar"/>
             <fileset dir="framework/entity/lib/jdbc" includes="mysql-*.jar"/>
@@ -1210,9 +1199,6 @@ under the License.
         </fail>
     </target>
 
-   <target name="run-tests-with-cobertura" depends="download-cobertura, run-tests"
-        description="Download Cobertura and perform code coverage (same as run-tests). You will need a valid Internet connection to download cobertura"/>
-
     <target name="_check-separated-tests-already-setup">
         <available file="runtime/test-list-build.xml" property="_separated-tests-already-setup"/>
     </target>
@@ -1310,116 +1296,6 @@ under the License.
         <ant antfile="runtime/test-list-build.xml" target="all-tests"/>
     </target>
 
-    <target name="cobertura-report"
-            description="Generate a HTML code coverage report with cobertura, can be found in runtime/logs/cobertura-report">
-        <delete dir="runtime/logs/cobertura-report"/>
-        <mkdir dir="runtime/logs/cobertura-report"/>
-        <taskdef resource="tasks.properties">
-            <classpath>
-                <fileset dir="framework/base/lib">
-                    <include name="cobertura-1.9.4.1.jar" />
-                    <include name="log4j-1.2.17.jar" />
-                    <include name="scripting/asm*.jar" />
-                    <include name="scripting/jakarta-oro-2.0.8.jar" />
-                </fileset>
-            </classpath>
-        </taskdef>
-        <cobertura-merge datafile="runtime/logs/cobertura.dat">
-            <fileset dir="runtime/logs">
-                <include name="cobertura-base.dat"/>
-                <include name="cobertura-components.dat"/>
-            </fileset>
-        </cobertura-merge>
-        <cobertura-report datafile="runtime/logs/cobertura.dat" destdir="runtime/logs/cobertura-report">
-            <dirset dir=".">
-                <include name="*/*/src"/>
-            </dirset>
-
-            <include name="**/*.java"/>
-        </cobertura-report>
-    </target>
-
-    <target name="cobertura-report-xml" depends="_setup-separated-test-run"
-            description="Generate a XML file from the cobertura report, this will be used by sonar">
-        <delete dir="runtime/logs/cobertura-report"/>
-        <mkdir dir="runtime/logs/cobertura-report"/>
-        <taskdef resource="tasks.properties">
-            <classpath>
-                <fileset dir="framework/base/lib">
-                    <include name="cobertura-1.9.4.1.jar" />
-                    <include name="log4j-1.2.17.jar" />
-                    <include name="scripting/asm*.jar" />
-                    <include name="scripting/jakarta-oro-2.0.8.jar" />
-                </fileset>
-            </classpath>
-        </taskdef>
-        <cobertura-merge datafile="runtime/logs/cobertura.dat">
-            <fileset dir="runtime/logs">
-                <include name="cobertura-base.dat"/>
-                <include name="cobertura-components.dat"/>
-            </fileset>
-        </cobertura-merge>
-        <cobertura-report format="xml" datafile="runtime/logs/cobertura.dat" destdir="runtime/logs/cobertura-report">
-            <dirset dir=".">
-                <include name="*/*/src"/>
-            </dirset>
-            <include name="**/*.java"/>
-        </cobertura-report>
-    </target>
-
-    <target name="sonar" depends="download-sonar-ant-task, sonar-init"
-            description="Sonar code analysis. You need a Sonar instance running to use it. More info on http://www.sonarsource.org/">
-        <exec executable="svn" dir="." output="runtime/svninfo_tmp.xml">
-            <arg value="info"/>
-            <arg value="--xml"/>
-        </exec>
-        <xmlproperty file="runtime/svninfo_tmp.xml"/>
-
-        <property name="sonar.sources" value="framework/base/src, framework/bi/src,
-            framework/catalina/src, framework/common/src, framework/datafile/src, framework/entity/src, framework/entityext/src,
-            framework/example/src, framework/geronimo/src, 
-            framework/minilang/src, framework/security/src, framework/service/src, framework/start/src,
-            framework/testtools/src, framework/webapp/src, framework/webtools/src, framework/widget/src,
-            applications/accounting/src, applications/commonext/src, applications/content/src, applications/humanres/src,
-            applications/manufacturing/src, applications/marketing/src, applications/order/src, applications/party/src,
-            applications/product/src, applications/securityext/src, applications/workeffort/src, specialpurpose/assetmaint/src,
-            specialpurpose/ebay/src, specialpurpose/ebaystore/src, specialpurpose/ecommerce/src, specialpurpose/googlebase/src,
-            specialpurpose/googlecheckout/src, specialpurpose/hhfacility/src, specialpurpose/oagis/src, specialpurpose/pos/src,
-            specialpurpose/scrum/src, specialpurpose/birt/src" />
-        <property name="sonar.tests" value="framework/base/src/org/ofbiz/base/test, framework/entity/src/org/ofbiz/entity/test,
-            framework/service/src/org/ofbiz/service/test,
-            applications/accounting/src/org/ofbiz/accounting/test, applications/content/src/org/ofbiz/content/test,
-            applications/product/src/org/ofbiz/product/test, applications/product/src/org/ofbiz/shipment/test,
-            applications/securityext/src/org/ofbiz/securityext/test" />
-
-        <!-- list of optional Sonar properties -->
-        <property name="sonar.projectName" value="Apache OFBiz" />
-        <sonar:sonar key="org.apache:ofbiz" version="${info.entry.commit(revision)}" xmlns:sonar="antlib:org.sonar.ant:sonar"/>
-        <property name="sonar.dynamicAnalysis" value="reuseReports" />
-        <property name="sonar.cobertura.reportPath" value="runtime/logs/cobertura-report/coverage.xml"/>
-        <property name="sonar.java.source" value="1.8" />
-        <property name="sonar.java.target" value="1.8" />
-        <!-- default for jdbc url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8-->
-        <property name="sonar.jdbc.url" value="${sonar.jdbc.url}"/>
-        <property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" />
-        <property name="sonar.jdbc.username" value="${sonar.jdbc.username}" />
-        <property name="sonar.jdbc.password" value="${sonar.jdbc.password}" />
-
-        <!-- SERVER ON A REMOTE HOST -->
-        <property name="sonar.host.url" value="${sonar.host.url}" />
-    </target>
-
-    <target name="full-sonar">
-        <antcall target="clean-all"/>
-        <antcall target="load-demo"/>
-        <antcall target="download-cobertura"/>
-        <antcall target="run-tests">
-          <param name="-portoffset" value="${portoffset}"/>
-        </antcall>
-        <antcall target="cobertura-report-xml"/>
-        <antcall target="sonar"/>
-    </target>
-
     <!-- ================================================================== -->
     <!--    Ivy targets, more info at  http://ant.apache.org/ivy/  -->
     <!-- ================================================================== -->
@@ -1434,10 +1310,6 @@ under the License.
         <echo>Please check that this version is appropriate for you!</echo>
     </target>
 
-    <target name="download-cobertura" description="Download cobertura related files">
-        <ivy:retrieve pattern="framework/base/lib/[artifact]-[revision].[ext]" conf="cobertura"/>
-    </target>
-
     <target name="download-PG-JDBC" description="Download postgres jdbc driver">        
         <ivy:retrieve pattern="framework/entity/lib/jdbc/[artifact]-[revision].[ext]" conf="postgres"/>
         <echo> </echo>        
@@ -1445,10 +1317,6 @@ under the License.
         <echo>Please check that this version is appropriate for you!</echo>        
     </target>
 
-    <target name="download-sonar-ant-task" description="Download sonar related files">
-        <ivy:retrieve pattern="framework/base/lib/[artifact]-[revision].[ext]" conf="sonar-ant-task"/>
-    </target>
-
     <target name="download-mySQL-JDBC" description="Download mySQL jdbc driver">
         <ivy:retrieve pattern="framework/entity/lib/jdbc/[artifact]-[revision].[ext]" conf="mysql"/>
         <echo> </echo>        

Modified: ofbiz/trunk/common.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/common.xml?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/common.xml (original)
+++ ofbiz/trunk/common.xml Tue May 31 06:43:11 2016
@@ -115,7 +115,6 @@ under the License.
                     <pathelement location="@{build.jar}"/>
                     <pathelement location="@{build-test.jar}"/>
                 </classpath>
-                <sysproperty key="net.sourceforge.cobertura.datafile" file="${build.dir}/test-results/cobertura.dat" />
                 <sysproperty key="ofbiz.home" value="${ofbiz.home.dir}"/>
                 <formatter usefile="false" type="plain"/>
                 <batchtest>
@@ -129,31 +128,6 @@ under the License.
         <run-junit/>
     </target>
 
-    <patternset id="cobertura-src-dirs">
-        <include name="src"/>
-    </patternset>
-
-    <target name="tests-cobertura" depends="jar">
-        <mkdir dir="${build.dir}/cobertura-lib"/>
-        <taskdef resource="tasks.properties" classpathref="cobertura.class.path"/>
-        <delete file="${build.dir}/test-results/cobertura.dat"/>
-        <cobertura-instrument datafile="${build.dir}/test-results/cobertura.dat" todir="${build.dir}/cobertura-lib">
-            <fileset dir="${build.dir}/lib">
-                <include name="*.jar"/>
-            </fileset>
-        </cobertura-instrument>
-        <run-junit build.jar="${build.dir}/cobertura-lib/${name}.jar" build-test.jar="${build.dir}/cobertura-lib/${name}-test.jar"/>
-        <delete dir="${build.dir}/test-results/cobertura-report"/>
-        <mkdir dir="${build.dir}/test-results/cobertura-report"/>
-        <cobertura-report datafile="${build.dir}/test-results/cobertura.dat" destdir="${build.dir}/test-results/cobertura-report">
-            <dirset dir=".">
-                <patternset refid="cobertura-src-dirs"/>
-            </dirset>
-
-            <include name="**/*.java"/>
-        </cobertura-report>
-    </target>
-
     <target name="all" depends="jar,docs"/>
     
     <!-- ================================================================== -->

Modified: ofbiz/trunk/framework/base/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/build.xml?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/build.xml (original)
+++ ofbiz/trunk/framework/base/build.xml Tue May 31 06:43:11 2016
@@ -58,19 +58,8 @@ under the License.
         <file name="org/ofbiz/base/util/collections/test/GenericMapTest.java"/>
     </filelist>
 
-    <patternset id="cobertura-src-dirs">
-        <include name="build/gen-src"/>
-        <include name="src"/>
-    </patternset>
-
     <target name="init">
-        <condition property="exclude.cobertura" value="org/ofbiz/base/config/Cobertura*.java">
-            <not>
-                <available classname="net.sourceforge.cobertura.instrument.ClassInstrumenter" classpathref="cobertura.class.path"/>
-            </not>
-        </condition>
         <patternset id="src.exc.set">
-            <exclude name="${exclude.cobertura}"/>
             <exclude name="org/ofbiz/base/util/OfbizJsBsfEngine.java"/>
         </patternset>
     </target>

Modified: ofbiz/trunk/framework/base/config/ofbiz-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/config/ofbiz-containers.xml?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/config/ofbiz-containers.xml (original)
+++ ofbiz/trunk/framework/base/config/ofbiz-containers.xml Tue May 31 06:43:11 2016
@@ -24,10 +24,7 @@ under the License.
     <!-- load the ofbiz component container (always first) -->
     <container name="component-container" loaders="main,rmi,pos,load-data" class="org.ofbiz.base.container.ComponentContainer"/>
 
-    <container name="component-container-test" loaders="test" class="org.ofbiz.base.container.ComponentContainer">
-        <property name="ofbiz.instrumenterClassName" value="org.ofbiz.base.config.CoberturaInstrumenter"/>
-        <property name="ofbiz.instrumenterFile" value="runtime/logs/cobertura-components.dat"/>
-    </container>
+    <container name="component-container-test" loaders="test" class="org.ofbiz.base.container.ComponentContainer"/>
 
     <container name="component-container-limited" loaders="limited" class="org.ofbiz.base.container.ComponentContainer">
         <property name="update-classpath" value="false"/>

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/config/CoberturaInstrumenter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/config/CoberturaInstrumenter.java?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/config/CoberturaInstrumenter.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/config/CoberturaInstrumenter.java Tue May 31 06:43:11 2016
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.base.config;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Collections;
-
-import net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler;
-import net.sourceforge.cobertura.coveragedata.ProjectData;
-
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.ClassWriter;
-import org.ofbiz.base.start.Instrumenter;
-
-public final class CoberturaInstrumenter implements Instrumenter {
-    private static final Constructor<?> INSTRUMENTER_CONSTRUCTOR;
-    private static final Method IS_INSTRUMENTED_METHOD;
-    static {
-        try {
-            Class<?> clz = CoberturaInstrumenter.class.getClassLoader().loadClass("net.sourceforge.cobertura.instrument.ClassInstrumenter");
-            INSTRUMENTER_CONSTRUCTOR = clz.getConstructor(ProjectData.class, ClassVisitor.class, Collection.class, Collection.class);
-            INSTRUMENTER_CONSTRUCTOR.setAccessible(true);
-            IS_INSTRUMENTED_METHOD = clz.getDeclaredMethod("isInstrumented");
-            IS_INSTRUMENTED_METHOD.setAccessible(true);
-        } catch (Throwable t) {
-            throw (InternalError) new InternalError(t.getMessage()).initCause(t);
-        }
-    }
-
-    protected File dataFile;
-    protected ProjectData projectData;
-    protected boolean forInstrumenting;
-
-    public File getDefaultFile() throws IOException {
-        return CoverageDataFileHandler.getDefaultDataFile();
-    }
-
-    public void open(File dataFile, boolean forInstrumenting) throws IOException {
-        System.setProperty("net.sourceforge.cobertura.datafile", dataFile.toString());
-        this.forInstrumenting = forInstrumenting;
-        this.dataFile = dataFile;
-        if (forInstrumenting) {
-            if (dataFile.exists()) {
-                projectData = CoverageDataFileHandler.loadCoverageData(dataFile);
-            } else {
-                projectData = new ProjectData();
-            }
-        }
-    }
-
-    public void close() throws IOException {
-        if (forInstrumenting) {
-            CoverageDataFileHandler.saveCoverageData(projectData, dataFile);
-        }
-    }
-
-    public byte[] instrumentClass(byte[] bytes) throws IOException {
-        if (forInstrumenting) {
-            ClassReader cr = new ClassReader(bytes);
-            ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS/* | ClassWriter.COMPUTE_FRAMES*/);
-            try {
-                ClassVisitor ci = (ClassVisitor) INSTRUMENTER_CONSTRUCTOR.newInstance(projectData, cw, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
-                cr.accept(ci, 0);
-                if (((Boolean) IS_INSTRUMENTED_METHOD.invoke(ci)).booleanValue()) {
-                    return cw.toByteArray();
-                }
-            } catch (Throwable t) {
-                throw (IOException) new IOException(t.getMessage()).initCause(t);
-            }
-        }
-        return bytes;
-    }
-}

Modified: ofbiz/trunk/framework/documents/UnitTest.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/documents/UnitTest.xml?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/documents/UnitTest.xml (original)
+++ ofbiz/trunk/framework/documents/UnitTest.xml Tue May 31 06:43:11 2016
@@ -217,33 +217,6 @@
                 </programlisting>
             </para>
         </section>
-        <section>
-            <title>2. Cobertura</title>
-            <para>
-                A Cobertura error message can show because of the test system requires a cobertura library that calculates the percentage of code accessed by tests like this:
-                <programlisting>
-                    [java] InstrumenterWorker.instrument - Code instrumentation has been disabled, unable to find instrumenter class org.ofbiz.base.config.CoberturaInstrumenter
-                </programlisting>
-                If you want to use cobertura, you have to install it:
-                <orderedlist>
-                    <listitem>
-                        <para>
-                            Execute the download-cobertura ant task
-                        </para>
-                    </listitem>
-                    <listitem>
-                        <para>
-                            Re-compile source code.
-                        </para>
-                    </listitem>
-                    <listitem>
-                        <para>
-                            Execute the run-tests ant task
-                        </para>
-                    </listitem>
-                </orderedlist>
-            </para>
-        </section>
     </section>
     <section>
         <title>Test result</title>

Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java (original)
+++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Config.java Tue May 31 06:43:11 2016
@@ -44,8 +44,6 @@ public final class Config {
     public final int portOffset;
     public final int adminPort;
     public final String containerConfig;
-    public final String instrumenterClassName;
-    public final String instrumenterFile;
     public final List<Map<String, String>> loaders;
     public final String logDir;
     public final boolean shutdownAfterLoad;
@@ -72,8 +70,6 @@ public final class Config {
         portOffset = getPortOffsetValue(ofbizCommands);
         adminPort = getAdminPort(props, portOffset);
         containerConfig = getAbsolutePath(props, "ofbiz.container.config", "framework/base/config/ofbiz-containers.xml", ofbizHome);
-        instrumenterClassName = getProperty(props, "ofbiz.instrumenterClassName", null);
-        instrumenterFile = getProperty(props, "ofbiz.instrumenterFile", null);
         loaders = getLoaders(props);
         logDir = getAbsolutePath(props, "ofbiz.log.dir", "runtime/logs", ofbizHome);
         shutdownAfterLoad = isShutdownAfterLoad(props);

Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Instrumenter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Instrumenter.java?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Instrumenter.java (original)
+++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Instrumenter.java Tue May 31 06:43:11 2016
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.base.start;
-
-import java.io.File;
-import java.io.IOException;
-
-interface Instrumenter {
-    File getDefaultFile() throws IOException;
-    void open(File dataFile, boolean forInstrumenting) throws IOException;
-    byte[] instrumentClass(byte[] bytes) throws IOException;
-    void close() throws IOException;
-}

Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java (original)
+++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java Tue May 31 06:43:11 2016
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-package org.ofbiz.base.start;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.Runtime;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-final class InstrumenterWorker {
-
-    public static final void copy(InputStream in, OutputStream out) throws IOException {
-        byte[] buf = new byte[4096];
-        int r;
-        while ((r = in.read(buf)) != -1) {
-            out.write(buf, 0, r);
-        }
-    }
-
-    public static List<File> instrument(List<File> srcPaths, String instrumenterFileName, String instrumenterClassName) {
-        if (instrumenterFileName == null) return srcPaths;
-        if (instrumenterClassName == null) return srcPaths;
-        Instrumenter instrumenter;
-        try {
-            List<URL> tmpUrls = new ArrayList<URL>();
-            for (File file: srcPaths) {
-                tmpUrls.add(file.toURI().toURL());
-            }
-            ClassLoader tmpLoader = new URLClassLoader(tmpUrls.toArray(new URL[tmpUrls.size()]), InstrumenterWorker.class.getClassLoader());
-            instrumenter = (Instrumenter) tmpLoader.loadClass(instrumenterClassName).newInstance();
-        } catch (IllegalAccessException e) {
-            e.printStackTrace();
-            return srcPaths;
-        } catch (InstantiationException e) {
-            e.printStackTrace();
-            return srcPaths;
-        } catch (IOException e) {
-            e.printStackTrace();
-            return srcPaths;
-        } catch (ClassNotFoundException e) {
-            return srcPaths;
-        }
-        ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors());
-        try {
-            File instrumenterFile = new File(instrumenterFileName);
-            instrumenterFile.delete();
-            instrumenter.open(instrumenterFile, true);
-            List<Future<File>> futures = new ArrayList<Future<File>>();
-            for (File file: srcPaths) {
-                String path = file.getPath();
-                if (path.matches(".*/ofbiz[^/]*\\.(jar|zip)")) {
-                    futures.add(executor.submit(new FileInstrumenter(instrumenter, file)));
-                } else {
-                    futures.add(new ConstantFutureFile(file));
-                }
-            }
-            List<File> result = new ArrayList<File>(futures.size());
-            for (Future<File> future: futures) {
-                result.add(future.get());
-            }
-            instrumenter.close();
-            return result;
-        } catch (ExecutionException e) {
-            e.printStackTrace();
-            return srcPaths;
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-            return srcPaths;
-        } catch (IOException e) {
-            e.printStackTrace();
-            return srcPaths;
-        } finally {
-            executor.shutdown();
-        }
-    }
-
-    private static final class ConstantFutureFile implements Future<File> {
-        private final File file;
-
-        protected ConstantFutureFile(File file) {
-            this.file = file;
-        }
-
-        public boolean cancel(boolean mayInterruptIfRunning) {
-            return false;
-        }
-
-        public File get() {
-            return file;
-        }
-
-        public File get(long timeout, TimeUnit  unit) {
-            return file;
-        }
-
-        public boolean isCancelled() {
-            return false;
-        }
-
-        public boolean isDone() {
-            return true;
-        }
-    }
-
-    private static final class FileInstrumenter implements Callable<File> {
-        private final Instrumenter instrumenter;
-        private final File file;
-        private final String path;
-
-        protected FileInstrumenter(Instrumenter instrumenter, File file) {
-            this.instrumenter = instrumenter;
-            this.file = file;
-            this.path = file.getPath();
-        }
-
-        public File call() throws IOException {
-            System.err.println(Thread.currentThread() + ":instrumenting " + path);
-            String prefix = path.substring(0, path.length() - 4);
-            int slash = prefix.lastIndexOf("/");
-            if (slash != -1) prefix = prefix.substring(slash + 1);
-            prefix += "-";
-            File zipTmp = File.createTempFile("instrumented-" + prefix, path.substring(path.length() - 4));
-            try {
-                zipTmp.deleteOnExit();
-                ZipInputStream zin = new ZipInputStream(new FileInputStream(file));
-                ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(zipTmp));
-                ZipEntry entry;
-                while ((entry = zin.getNextEntry()) != null) {
-                    InputStream in;
-                    long size;
-                    if (entry.getName().endsWith(".class")) {
-                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                        copy(zin, baos);
-                        byte[] bytes = instrumenter.instrumentClass(baos.toByteArray());
-                        size = bytes.length;
-                        in = new ByteArrayInputStream(bytes);
-                    } else {
-                        in = zin;
-                        size = entry.getSize();
-                    }
-                    ZipEntry newEntry = new ZipEntry(entry);
-                    newEntry.setSize(size);
-                    newEntry.setCompressedSize(-1);
-                    zout.putNextEntry(newEntry);
-                    copy(in, zout);
-                    if (entry.getName().endsWith(".class")) {
-                        in.close();
-                    }
-                }
-                zout.close();
-                return zipTmp;
-            } catch (IOException e) {
-                zipTmp.delete();
-                throw e;
-            }
-        }
-    }
-}
-

Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumentingClassLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumentingClassLoader.java?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumentingClassLoader.java (original)
+++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumentingClassLoader.java Tue May 31 06:43:11 2016
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *******************************************************************************/
-
-package org.ofbiz.base.start;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-/*
- * Instrumenting class loader. 
- */
-final class InstrumentingClassLoader extends NativeLibClassLoader {
-
-    private static final void copy(InputStream in, OutputStream out) throws IOException {
-        byte[] buf = new byte[4096];
-        int r;
-        while ((r = in.read(buf)) != -1) {
-            out.write(buf, 0, r);
-        }
-    }
-
-    private final Instrumenter instrumenter;
-
-    InstrumentingClassLoader(URL[] urls, ClassLoader parent, String instrumenterFileName, String instrumenterClassName)
-            throws Exception {
-        super(new URL[0], parent);
-        URLClassLoader tmpLoader = new URLClassLoader(urls, InstrumenterWorker.class.getClassLoader());
-        try {
-            instrumenter = (Instrumenter) tmpLoader.loadClass(instrumenterClassName).newInstance();
-        } finally {
-            tmpLoader.close();
-        }
-        File instrumenterFile = new File(instrumenterFileName);
-        instrumenterFile.delete();
-        instrumenter.open(instrumenterFile, true);
-        System.out.println("Instrumenter file opened");
-        for (URL url : urls) {
-            addURL(url);
-        }
-    }
-
-    @Override
-    public void addURL(URL url) {
-        File file;
-        try {
-            file = new File(url.toURI());
-        } catch (URISyntaxException e) {
-            file = new File(url.getPath());
-        }
-        String path = file.getPath();
-        if (path.matches(".*/ofbiz[^/]*\\.(jar|zip)")) {
-            String prefix = path.substring(0, path.length() - 4);
-            int slash = prefix.lastIndexOf("/");
-            if (slash != -1)
-                prefix = prefix.substring(slash + 1);
-            prefix += "-";
-            File zipTmp = null;
-            try {
-                zipTmp = File.createTempFile("instrumented-" + prefix, path.substring(path.length() - 4));
-                zipTmp.deleteOnExit();
-                ZipInputStream zin = new ZipInputStream(new FileInputStream(file));
-                ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(zipTmp));
-                ZipEntry entry;
-                while ((entry = zin.getNextEntry()) != null) {
-                    InputStream in;
-                    long size;
-                    if (entry.getName().endsWith(".class")) {
-                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                        copy(zin, baos);
-                        byte[] bytes = instrumenter.instrumentClass(baos.toByteArray());
-                        size = bytes.length;
-                        in = new ByteArrayInputStream(bytes);
-                    } else {
-                        in = zin;
-                        size = entry.getSize();
-                    }
-                    ZipEntry newEntry = new ZipEntry(entry);
-                    newEntry.setSize(size);
-                    newEntry.setCompressedSize(-1);
-                    zout.putNextEntry(newEntry);
-                    copy(in, zout);
-                    if (entry.getName().endsWith(".class")) {
-                        in.close();
-                    }
-                }
-                zout.close();
-                System.out.println("Instrumented file: " + zipTmp.getCanonicalPath());
-                super.addURL(zipTmp.toURI().toURL());
-            } catch (IOException e) {
-                System.err.println("Exception thrown while instrumenting " + file + ": ");
-                e.printStackTrace(System.err);
-                if (zipTmp != null) {
-                    zipTmp.delete();
-                }
-            }
-        } else {
-            super.addURL(url);
-        }
-    }
-
-    void closeInstrumenter() throws IOException {
-        instrumenter.close();
-    }
-}

Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupControlPanel.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupControlPanel.java?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupControlPanel.java (original)
+++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/StartupControlPanel.java Tue May 31 06:43:11 2016
@@ -212,14 +212,6 @@ final class StartupControlPanel {
             }
         }
         NativeLibClassLoader classloader = new NativeLibClassLoader(classPath.getUrls(), parent);
-        if (config.instrumenterFile != null && config.instrumenterClassName != null) {
-            try {
-                classloader = new InstrumentingClassLoader(classPath.getUrls(), parent, config.instrumenterFile,
-                        config.instrumenterClassName);
-            } catch (Exception e) {
-                System.out.println("Instrumenter not enabled - " + e);
-            }
-        }
         classloader.addNativeClassPath(System.getProperty("java.library.path"));
         for (File folder : classPath.getNativeFolders()) {
             classloader.addNativeClassPath(folder);
@@ -256,13 +248,6 @@ final class StartupControlPanel {
             }
             loaders.trimToSize();
         }
-        if (classloader instanceof InstrumentingClassLoader) {
-            try {
-                ((InstrumentingClassLoader)classloader).closeInstrumenter();
-            } catch (IOException e) {
-                throw new StartupException(e.getMessage(), e);
-            }
-        }
         StringBuilder sb = new StringBuilder();
         for (String path : classloader.getNativeLibPaths()) {
             if (sb.length() > 0) {

Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/test.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/test.properties?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/test.properties (original)
+++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/test.properties Tue May 31 06:43:11 2016
@@ -40,9 +40,6 @@ ofbiz.start.loader1.loaders=test
 # -- Auto-Shutdown after load
 ofbiz.auto.shutdown=true
 
-ofbiz.instrumenterClassName=org.ofbiz.base.config.CoberturaInstrumenter
-ofbiz.instrumenterFile=runtime/logs/cobertura-base.dat
-
 # --- Default Derby system home directory
 #derby.system.home=runtime/data/derby
 

Modified: ofbiz/trunk/ivy.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/ivy.xml?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/ivy.xml (original)
+++ ofbiz/trunk/ivy.xml Tue May 31 06:43:11 2016
@@ -26,24 +26,13 @@
     </info>
     <configurations>
         <conf name="activemq" description="downloads the ActiveMQ jars"/>
-        <conf name="cobertura" description="downloads cobertura 1.9.4.1 (GPL2.0) http://cobertura.sourceforge.net/"/>
         <conf name="mysql" description="downloads the mysql JDBC driver"/>
         <conf name="postgres" description="downloads the postgres JDBC driver"/>
-        <conf name="sonar-ant-task" description="downloads the ant sonar task (need sonar>=2.8)
-            http://docs.codehaus.org/display/SONAR/Analyzing+with+SonarQube+Ant+Task"/>
     </configurations>
     <dependencies>
         <dependency org="org.apache.activemq" name="activemq-all" rev="5.4.2" conf="activemq->default"/>
-        <dependency org="net.sourceforge.cobertura" name="cobertura" rev="1.9.4.1" conf="cobertura->default"/>
         <dependency org="mysql" name="mysql-connector-java" rev="5.1.36" conf="mysql->default"/>
         <dependency org="postgresql" name="postgresql" rev="9.0-801.jdbc4" conf="postgres->default"/>
-        <dependency org="org.codehaus.sonar-plugins" name="sonar-ant-task" rev="1.3" conf="sonar-ant-task->default"/>
-
-        <!--Exclusions for cobertura-->
-        <exclude module="log4j" conf="cobertura"/>
-        <exclude module="ant" conf="cobertura"/>
-        <exclude module="asm" conf="cobertura"/>
-        <exclude module="oro" conf="cobertura"/>
     </dependencies>
 
 </ivy-module>

Modified: ofbiz/trunk/macros.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/macros.xml?rev=1746236&r1=1746235&r2=1746236&view=diff
==============================================================================
--- ofbiz/trunk/macros.xml (original)
+++ ofbiz/trunk/macros.xml Tue May 31 06:43:11 2016
@@ -57,12 +57,6 @@ under the License.
   <fileset dir="${ofbiz.home.dir}/framework/base/lib/scripting/" includes="*.jar"/>
   <pathelement location="${ofbiz.home.dir}/framework/base/lib/ant/ant-apache-bsf-1.7.1.jar"/>
  </path>
- <path id="cobertura.class.path">
-  <pathelement location="${ofbiz.home.dir}/framework/base/lib/cobertura-1.9.4.1.jar" />
-  <pathelement location="${ofbiz.home.dir}/framework/base/lib/log4j-1.2.17.jar" />
-  <pathelement location="${ofbiz.home.dir}/framework/base/lib/scripting/asm-3.2.jar" />
-  <pathelement location="${ofbiz.home.dir}/framework/base/lib/scripting/jakarta-oro-2.0.8.jar" />
- </path>
  <path id="local.class.path"/>
  <presetdef name="default-javac">
   <javac debug="on" deprecation="on" destdir="${build.dir}/classes" srcdir="${src.dir}" classpathref="local.class.path">