Hi, Try doing a # gem install zip
You need to have rubygems installed - http://rubygems.org/pages/download -Chintana On Tue, Mar 20, 2012 at 5:44 AM, Afkham Azeez <[email protected]> wrote: > How do you manually run this ruby script? > > ruby gen_emma_coverage.rb instrument > /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home > > Above command did not work on Mac OS X. > > I got the following error. > > gen_emma_coverage.rb:3:in `require': no such file to load -- zip/zip > (LoadError) > from gen_emma_coverage.rb:3 > > > On Tue, Mar 20, 2012 at 9:59 AM, Charitha Kankanamge <[email protected]>wrote: > >> *.em file (EMMA meta data holder) has been generated by "instr" command >> (xargs >> -n 1 $JAVA_HOME/jre/bin/java -cp emma.jar emma instr -m overwrite -cp < >> jarlist.txt), so this command execution did not happen correctly or failed. >> >> [1] http://emma.sourceforge.net/userguide/ar01s02s03.html >> >> >> >> On Tue, Mar 20, 2012 at 9:12 AM, Afkham Azeez <[email protected]> wrote: >> >>> OK. I got the hang of it. But now it is failing with the following error. >>> >>> Caused by: java.io.FileNotFoundException: Source >>> '/Users/azeez/projects/wso2/org/carbon/kernel/trunk/distribution/integration/tests/target/carbontmp1332214836127/wso2carbon-core-4.0.0-SNAPSHOT/coverage.em' >>> does not exist >>> at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:767) >>> at >>> org.apache.commons.io.FileUtils.copyFileToDirectory(FileUtils.java:706) >>> at >>> org.apache.commons.io.FileUtils.copyFileToDirectory(FileUtils.java:670) >>> at >>> org.wso2.carbon.integration.framework.utils.ServerUtils.instrumentJarsForEmma(ServerUtils.java:232) >>> at >>> org.wso2.carbon.integration.framework.utils.ServerUtils.startServerUsingCarbonHome(ServerUtils.java:55) >>> >>> >>> On Tue, Mar 20, 2012 at 8:44 AM, Afkham Azeez <[email protected]> wrote: >>> >>>> Can you please explain how that method works? >>>> >>>> 1. What does the following block do? >>>> >>>> for (File file : new File(emmaHome).listFiles()) { >>>> if >>>> (file.getName().startsWith("org.wso2.carbon.integration.core")) { >>>> ArchiveManipulator archiveManipulator = new >>>> ArchiveManipulator(); >>>> archiveManipulator.extract(file.getAbsolutePath(), >>>> emmaHome); >>>> } else if (file.getName().startsWith("emma")) { >>>> emmaJarName = file.getName(); >>>> } >>>> } >>>> >>>> >>>> 2. What does the following block do? >>>> >>>> for (File file : new File[]{new File(carbonHome), emmaOutput}) { >>>> FileUtils.copyFileToDirectory(new File(carbonHome + >>>> File.separator + "lib" + >>>> File.separator + "emma.jar"), file); >>>> FileUtils.copyFileToDirectory(new File(emmaHome + >>>> "gen_emma_coverage.rb"), file); >>>> FileUtils.copyFileToDirectory(new File(jarList), file); >>>> } >>>> >>>> gen_emma_coverage.rb is inside the resources directory in the Maven >>>> module. How does it get picked? >>>> >>>> >>>> On Tue, Mar 20, 2012 at 8:28 AM, Thilini Ishaka <[email protected]>wrote: >>>> >>>>> If I recall, we initially generated the coverage report manually by >>>>> using below set of steps. >>>>> Then the ServerUtils is used to handle that. >>>>> >>>>> 1. Create a jarlist.txt >>>>> eg:* find >>>>> /home/thilini/Desktop/wso2greg-3.6.0/repository/components/plugins/ >> >>>>> /home/thilini/Desktop/wso2greg-3.6.0/repository/components/plugins/jarlist.txt >>>>> * (jarlist.txt should contain absolute paths of jars. Remove >>>>> unwanted jars from the list. If not there will be issues when starting the >>>>> server) >>>>> >>>>> 2. xargs -n 1 $JAVA_HOME/jre/bin/java -cp emma.jar emma instr -m >>>>> overwrite -cp < jarlist.txt >>>>> 3. ruby dynamicImportsPatcher.rb < jarlist.txt (Before running this >>>>> step need to install rubyzip. Use sudo apt-get install libzip-ruby1.8) >>>>> 4. Copy emma.jar to */repository/components/plugins, >>>>> /repository/components/lib *and */lib *directories. >>>>> 4. Start Carbon Server >>>>> 5. Do the test >>>>> 6. Shutdown server >>>>> 7. cp wso2greg-3.6.0/coverage.ec . >>>>> 8. java -cp emma.jar emma report -r html -in coverage.em,coverage.ec >>>>> >>>>> <http://coverage.ec/>Thanks >>>>> Thilini >>>>> >>>>> On Tue, Mar 20, 2012 at 8:02 AM, Afkham Azeez <[email protected]> wrote: >>>>> >>>>>> Emma has been disabled for the past few months, and inevitably, the >>>>>> code that does the instrumentation does not work. Can the person who >>>>>> wrote >>>>>> the following method please explain how it works? >>>>>> >>>>>> public synchronized static void instrumentJarsForEmma(String >>>>>> carbonHome) throws IOException { >>>>>> String workingDir = System.getProperty("user.dir"); >>>>>> try { >>>>>> System.setProperty("user.dir", carbonHome); >>>>>> String emmaHome = System.getProperty("emma.home"); >>>>>> if (emmaHome == null) { >>>>>> return; >>>>>> } else if (!emmaHome.endsWith(File.separator)) { >>>>>> emmaHome += File.separator; >>>>>> } >>>>>> File emmaOutput = new >>>>>> File(System.getProperty("emma.output")); >>>>>> if (!emmaOutput.exists()) { >>>>>> FileUtils.forceMkdir(emmaOutput); >>>>>> } >>>>>> String emmaJarName = null; >>>>>> for (File file : new File(emmaHome).listFiles()) { >>>>>> if >>>>>> (file.getName().startsWith("org.wso2.carbon.integration.core")) { >>>>>> ArchiveManipulator archiveManipulator = new >>>>>> ArchiveManipulator(); >>>>>> >>>>>> archiveManipulator.extract(file.getAbsolutePath(), emmaHome); >>>>>> } else if (file.getName().startsWith("emma")) { >>>>>> emmaJarName = file.getName(); >>>>>> } >>>>>> } >>>>>> >>>>>> if (emmaJarName == null) { >>>>>> return; >>>>>> } >>>>>> >>>>>> String jarList = System.getProperty("jar.list"); >>>>>> >>>>>> >>>>>> FileUtils.copyFile(new File(emmaHome + emmaJarName), >>>>>> new File(carbonHome + File.separator + >>>>>> "repository" + >>>>>> File.separator + "components" + >>>>>> File.separator + "plugins" + >>>>>> File.separator + "emma.jar")); >>>>>> FileUtils.copyFile(new File(emmaHome + emmaJarName), >>>>>> new File(carbonHome + File.separator + >>>>>> "repository" + >>>>>> File.separator + "components" + >>>>>> File.separator + "lib" + >>>>>> File.separator + "emma.jar")); >>>>>> FileUtils.copyFile(new File(emmaHome + emmaJarName), >>>>>> new File(carbonHome + File.separator + "lib" + >>>>>> File.separator + "emma.jar")); >>>>>> for (File file : new File[]{new File(carbonHome), >>>>>> emmaOutput}) { >>>>>> FileUtils.copyFileToDirectory(new File(carbonHome + >>>>>> File.separator + "lib" + >>>>>> File.separator + "emma.jar"), file); >>>>>> FileUtils.copyFileToDirectory(new File(emmaHome + >>>>>> "gen_emma_coverage.rb"), file); >>>>>> FileUtils.copyFileToDirectory(new File(jarList), >>>>>> file); >>>>>> } >>>>>> >>>>>> String temp; >>>>>> Process process = Runtime.getRuntime().exec(new >>>>>> String[]{"ruby", >>>>>> "gen_emma_coverage.rb", "instrument", >>>>>> System.getenv("JAVA_HOME")}, null, >>>>>> new File(carbonHome)); >>>>>> BufferedReader reader = new BufferedReader( >>>>>> new InputStreamReader(process.getInputStream())); >>>>>> try { >>>>>> while ((temp = reader.readLine()) != null) { >>>>>> System.out.println(temp); >>>>>> } >>>>>> } catch (IOException ignored) { >>>>>> } >>>>>> FileUtils.copyFileToDirectory(new File(carbonHome + >>>>>> File.separator + "coverage.em"), >>>>>> emmaOutput); >>>>>> } finally { >>>>>> System.setProperty("user.dir", workingDir); >>>>>> } >>>>>> } >>>>>> >>>>>> -- >>>>>> *Afkham Azeez* >>>>>> Director of Architecture; WSO2, Inc.; http://wso2.com >>>>>> Member; Apache Software Foundation; http://www.apache.org/ >>>>>> * <http://www.apache.org/>** >>>>>> email: **[email protected]* <[email protected]>* cell: +94 77 3320919 >>>>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>* >>>>>> twitter: >>>>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> >>>>>> * >>>>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez* >>>>>> * >>>>>> * >>>>>> *Lean . Enterprise . Middleware* >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Regards* >>>>> >>>>> *Thilini Ishaka* >>>>> *WSO2 Inc. http://wso2.com >>>>> * >>>>> *Mobile: +94 71 840 8171 * >>>>> * +94 77 211 8797* >>>>> *Bolg: thiliniishaka.blogspot.com* >>>>> >>>>> >>>> >>>> >>>> -- >>>> *Afkham Azeez* >>>> Director of Architecture; WSO2, Inc.; http://wso2.com >>>> Member; Apache Software Foundation; http://www.apache.org/ >>>> * <http://www.apache.org/>** >>>> email: **[email protected]* <[email protected]>* cell: +94 77 3320919 >>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>* >>>> twitter: >>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> >>>> * >>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez* >>>> * >>>> * >>>> *Lean . Enterprise . Middleware* >>>> >>>> >>> >>> >>> -- >>> *Afkham Azeez* >>> Director of Architecture; WSO2, Inc.; http://wso2.com >>> Member; Apache Software Foundation; http://www.apache.org/ >>> * <http://www.apache.org/>** >>> email: **[email protected]* <[email protected]>* cell: +94 77 3320919 >>> blog: **http://blog.afkham.org* <http://blog.afkham.org>* >>> twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> >>> * >>> linked-in: **http://lk.linkedin.com/in/afkhamazeez* >>> * >>> * >>> *Lean . Enterprise . Middleware* >>> >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> > > > -- > *Afkham Azeez* > Director of Architecture; WSO2, Inc.; http://wso2.com > Member; Apache Software Foundation; http://www.apache.org/ > * <http://www.apache.org/>** > email: **[email protected]* <[email protected]>* cell: +94 77 3320919 > blog: **http://blog.afkham.org* <http://blog.afkham.org>* > twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> > * > linked-in: **http://lk.linkedin.com/in/afkhamazeez* > * > * > *Lean . Enterprise . Middleware* > > -- Chintana Wilamuna Associate Technical Lead WSO2, Inc.; http://wso2.com lean.enterprise.middleware phone: +94 75 211 1106 blog: http://engwar.com/ photos: http://flickr.com/photos/chintana linkedin: http://www.linkedin.com/in/engwar twitter: twitter.com/std_err
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
