Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 87FD6104BD for ; Sat, 24 Oct 2015 18:49:11 +0000 (UTC) Received: (qmail 59345 invoked by uid 500); 24 Oct 2015 18:49:11 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 59303 invoked by uid 500); 24 Oct 2015 18:49:11 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 59294 invoked by uid 99); 24 Oct 2015 18:49:11 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Oct 2015 18:49:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C05D31A261F for ; Sat, 24 Oct 2015 18:49:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.79 X-Spam-Level: * X-Spam-Status: No, score=1.79 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id XYF_iBqZHnY9 for ; Sat, 24 Oct 2015 18:48:56 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTP id 1855742BA7 for ; Sat, 24 Oct 2015 18:48:56 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 43AE1E0F7D for ; Sat, 24 Oct 2015 18:48:55 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 3781C3A070E for ; Sat, 24 Oct 2015 18:48:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r970107 [8/28] - in /websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST: ./ css/ images/ images/logos/ images/profiles/ img/ js/ xref-test/ xref-test/org/ xref-test/org/apache/ xref-test/org/apache/felix/ xref-... Date: Sat, 24 Oct 2015 18:48:54 -0000 To: commits@felix.apache.org From: bimargulies@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151024184855.3781C3A070E@svn01-us-west.apache.org> Added: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/allclasses-frame.html ============================================================================== --- websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/allclasses-frame.html (added) +++ websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/allclasses-frame.html Sat Oct 24 18:48:51 2015 @@ -0,0 +1,38 @@ + + + + + + All Classes + + + + +

All Classes

+ + + + + \ No newline at end of file Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/allclasses-frame.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/allclasses-frame.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/index.html ============================================================================== --- websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/index.html (added) +++ websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/index.html Sat Oct 24 18:48:51 2015 @@ -0,0 +1,24 @@ + + + + + + + Maven Bundle Plugin 3.0.1-SNAPSHOT Reference + + + + + + + + + <body> + <h1>Frame Alert</h1> + <p> + You don't have frames. Go <a href="overview-summary.html">here</a> + </p> + </body> + + + Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/index.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/index.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/AbstractBundlePluginTest.html ============================================================================== --- websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/AbstractBundlePluginTest.html (added) +++ websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/AbstractBundlePluginTest.html Sat Oct 24 18:48:51 2015 @@ -0,0 +1,103 @@ + + + +AbstractBundlePluginTest xref + + + +
+1   package org.apache.felix.bundleplugin;
+2   
+3   
+4   /*
+5    * Licensed to the Apache Software Foundation (ASF) under one
+6    * or more contributor license agreements.  See the NOTICE file
+7    * distributed with this work for additional information
+8    * regarding copyright ownership.  The ASF licenses this file
+9    * to you under the Apache License, Version 2.0 (the
+10   * "License"); you may not use this file except in compliance
+11   * with the License.  You may obtain a copy of the License at
+12   *
+13   *   http://www.apache.org/licenses/LICENSE-2.0
+14   *
+15   * Unless required by applicable law or agreed to in writing,
+16   * software distributed under the License is distributed on an
+17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+18   * KIND, either express or implied.  See the License for the
+19   * specific language governing permissions and limitations
+20   * under the License.
+21   */
+22  
+23  import java.io.File;
+24  
+25  import org.apache.maven.artifact.Artifact;
+26  import org.apache.maven.artifact.DefaultArtifact;
+27  import org.apache.maven.artifact.handler.ArtifactHandler;
+28  import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+29  import org.apache.maven.artifact.repository.ArtifactRepository;
+30  import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+31  import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+32  import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
+33  import org.apache.maven.artifact.versioning.VersionRange;
+34  import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+35  import org.apache.maven.plugin.testing.stubs.ArtifactStub;
+36  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+37  import org.apache.maven.project.DefaultProjectBuilderConfiguration;
+38  import org.apache.maven.project.ProjectBuilderConfiguration;
+39  import org.codehaus.plexus.PlexusTestCase;
+40  
+41  
+42  /**
+43   * Common methods for bundle plugin testing
+44   * 
+45   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
+46   * @version $Id$
+47   */
+48  public abstract class AbstractBundlePluginTest extends AbstractMojoTestCase
+49  {
+50  
+51      protected MavenProjectStub getMavenProjectStub()
+52      {
+53          MavenProjectStub project = new MavenProjectStub();
+54          project.setGroupId("group");
+55          project.setArtifactId("project");
+56          project.setVersion( "1.2.3.4" );
+57  
+58          VersionRange versionRange = VersionRange.createFromVersion( project.getVersion() );
+59          ArtifactHandler artifactHandler = new DefaultArtifactHandler("pom");
+60          Artifact artifact =
+61              new DefaultArtifact( project.getGroupId(), project.getArtifactId(),
+62                                   versionRange, null, "pom", null, artifactHandler );
+63          artifact.setResolved( true );
+64          project.setArtifact( artifact );
+65          ProjectBuilderConfiguration projectBuilderConfiguration = new DefaultProjectBuilderConfiguration();
+66          ArtifactRepositoryLayout layout = new LegacyRepositoryLayout();
+67          ArtifactRepository artifactRepository = new DefaultArtifactRepository( "scratch", new File( getBasedir(), "target" + File.separatorChar + "scratch" ).toURI().toString(), layout );
+68          projectBuilderConfiguration.setLocalRepository( artifactRepository );
+69          project.setProjectBuilderConfiguration( projectBuilderConfiguration );
+70          return project;
+71      }
+72  
+73  
+74      protected ArtifactStub getArtifactStub()
+75      {
+76          ArtifactStub artifact = new ArtifactStub();
+77          artifact.setGroupId( "group" );
+78          artifact.setArtifactId( "artifact" );
+79          artifact.setVersion( "1.0" );
+80          return artifact;
+81      }
+82  
+83  
+84      protected File getTestBundle()
+85      {
+86          String osgiBundleFileName = "org.apache.maven.maven-model_2.1.0.SNAPSHOT.jar";
+87          return getTestFile( getBasedir(), "src/test/resources/" + osgiBundleFileName );
+88      }
+89  
+90  }
+
+
+ + + \ No newline at end of file Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/AbstractBundlePluginTest.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/AbstractBundlePluginTest.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/ArtifactStubFactory.html ============================================================================== --- websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/ArtifactStubFactory.html (added) +++ websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/ArtifactStubFactory.html Sat Oct 24 18:48:51 2015 @@ -0,0 +1,89 @@ + + + +ArtifactStubFactory xref + + + +
+1   package org.apache.felix.bundleplugin;
+2   
+3   /*
+4    * Licensed to the Apache Software Foundation (ASF) under one
+5    * or more contributor license agreements.  See the NOTICE file
+6    * distributed with this work for additional information
+7    * regarding copyright ownership.  The ASF licenses this file
+8    * to you under the Apache License, Version 2.0 (the
+9    * "License"); you may not use this file except in compliance
+10   * with the License.  You may obtain a copy of the License at
+11   *
+12   *   http://www.apache.org/licenses/LICENSE-2.0
+13   *
+14   * Unless required by applicable law or agreed to in writing,
+15   * software distributed under the License is distributed on an
+16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+17   * KIND, either express or implied.  See the License for the
+18   * specific language governing permissions and limitations
+19   * under the License.
+20   */
+21  
+22  import java.io.File;
+23  import java.io.IOException;
+24  import java.util.LinkedHashSet;
+25  import java.util.Set;
+26  
+27  import org.apache.maven.artifact.Artifact;
+28  
+29  /**
+30   * Fixed version of class that uses stable set ordering for reliable testing.
+31   */
+32  @SuppressWarnings( { "rawtypes", "unchecked" } )
+33  class ArtifactStubFactory extends org.apache.maven.plugin.testing.ArtifactStubFactory
+34  {
+35  
+36      public ArtifactStubFactory( File workingDir, boolean createFiles )
+37      {
+38          super( workingDir, createFiles );
+39      }
+40  
+41      @Override
+42      public Set getClassifiedArtifacts() throws IOException
+43      {
+44          Set set = new LinkedHashSet();
+45          set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "jar", "one" ) );
+46          set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", "two" ) );
+47          set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "jar", "three" ) );
+48          set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "jar", "four" ) );
+49          return set;
+50      }
+51  
+52      @Override
+53      public Set getScopedArtifacts() throws IOException
+54      {
+55          Set set = new LinkedHashSet();
+56          set.add( createArtifact( "g", "compile", "1.0", Artifact.SCOPE_COMPILE ) );
+57          set.add( createArtifact( "g", "provided", "1.0", Artifact.SCOPE_PROVIDED ) );
+58          set.add( createArtifact( "g", "test", "1.0", Artifact.SCOPE_TEST ) );
+59          set.add( createArtifact( "g", "runtime", "1.0", Artifact.SCOPE_RUNTIME ) );
+60          set.add( createArtifact( "g", "system", "1.0", Artifact.SCOPE_SYSTEM ) );
+61          return set;
+62      }
+63  
+64      @Override
+65      public Set getTypedArtifacts() throws IOException
+66      {
+67          Set set = new LinkedHashSet();
+68          set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) );
+69          set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) );
+70          set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "sources", null ) );
+71          set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "zip", null ) );
+72          set.add( createArtifact( "g", "e", "1.0", Artifact.SCOPE_COMPILE, "rar", null ) );
+73          return set;
+74      }
+75  
+76  }
+
+
+ + + \ No newline at end of file Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/ArtifactStubFactory.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/ArtifactStubFactory.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BlueprintComponentTest.html ============================================================================== --- websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BlueprintComponentTest.html (added) +++ websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BlueprintComponentTest.html Sat Oct 24 18:48:51 2015 @@ -0,0 +1,178 @@ + + + +BlueprintComponentTest xref + + + +
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   *   http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.felix.bundleplugin;
+20  
+21  
+22  import java.io.File;
+23  import java.util.ArrayList;
+24  import java.util.Arrays;
+25  import java.util.HashMap;
+26  import java.util.List;
+27  import java.util.Map;
+28  import java.util.Properties;
+29  import java.util.jar.Manifest;
+30  
+31  import aQute.bnd.osgi.Analyzer;
+32  import aQute.bnd.osgi.Jar;
+33  import aQute.bnd.osgi.Verifier;
+34  import aQute.libg.generics.Create;
+35  import junit.framework.TestCase;
+36  
+37  import org.apache.felix.utils.manifest.Clause;
+38  import org.apache.felix.utils.manifest.Parser;
+39  import org.apache.maven.artifact.Artifact;
+40  import org.apache.maven.artifact.DefaultArtifact;
+41  import org.apache.maven.artifact.handler.ArtifactHandler;
+42  import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+43  import org.apache.maven.artifact.versioning.VersionRange;
+44  import org.apache.maven.model.Resource;
+45  import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+46  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+47  import org.apache.maven.project.DefaultProjectBuilderConfiguration;
+48  import org.apache.maven.project.ProjectBuilderConfiguration;
+49  import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
+50  import org.apache.maven.shared.dependency.graph.DependencyNode;
+51  import org.osgi.framework.Constants;
+52  
+53  import aQute.bnd.osgi.Builder;
+54  
+55  
+56  public class BlueprintComponentTest extends AbstractMojoTestCase
+57  {
+58  
+59      public void testBlueprintServices() throws Exception
+60      {
+61          test( "service" );
+62      }
+63  
+64      public void testBlueprintGeneric() throws Exception
+65      {
+66          test( "generic" );
+67      }
+68  
+69      protected void test(String mode) throws Exception
+70      {
+71          MavenProjectStub project = new MavenProjectStub()
+72          {
+73              private final List resources = new ArrayList();
+74  
+75  
+76              @Override
+77              public void addResource( Resource resource )
+78              {
+79                  resources.add( resource );
+80              }
+81  
+82  
+83              @Override
+84              public List getResources()
+85              {
+86                  return resources;
+87              }
+88  
+89  
+90              @Override
+91              public File getBasedir()
+92              {
+93                  return new File( "target/tmp/basedir" );
+94              }
+95          };
+96          project.setGroupId("group");
+97          project.setArtifactId( "artifact" );
+98          project.setVersion( "1.1.0.0" );
+99          VersionRange versionRange = VersionRange.createFromVersion(project.getVersion());
+100         ArtifactHandler artifactHandler = new DefaultArtifactHandler( "jar" );
+101         Artifact artifact = new DefaultArtifact(project.getGroupId(),project.getArtifactId(),versionRange, null, "jar", null, artifactHandler);
+102         project.setArtifact(artifact);
+103 
+104         ProjectBuilderConfiguration projectBuilderConfiguration = new DefaultProjectBuilderConfiguration();
+105         projectBuilderConfiguration.setLocalRepository(null);
+106         project.setProjectBuilderConfiguration(projectBuilderConfiguration);
+107 
+108         Resource r = new Resource();
+109         r.setDirectory( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() );
+110         r.setIncludes(Arrays.asList("**/*.*"));
+111         project.addResource(r);
+112         project.addCompileSourceRoot(new File("src/test/resources").getAbsoluteFile().getCanonicalPath());
+113 
+114         ManifestPlugin plugin = new ManifestPlugin();
+115         plugin.setBuildDirectory( "target/tmp/basedir/target" );
+116         plugin.setOutputDirectory(new File("target/tmp/basedir/target/classes"));
+117         setVariableValueToObject(plugin, "m_dependencyGraphBuilder", lookup(DependencyGraphBuilder.class.getName(), "default"));
+118 
+119         Map instructions = new HashMap();
+120         instructions.put( "service_mode", mode );
+121         instructions.put( "Test", "Foo" );
+122 
+123         instructions.put( "nsh_interface", "foo.bar.Namespace" );
+124         instructions.put( "nsh_namespace", "ns" );
+125 
+126         instructions.put( "Export-Service", "p7.Foo;mk=mv" );
+127         instructions.put( "Import-Service", "org.osgi.service.cm.ConfigurationAdmin;availability:=optional" );
+128 
+129         Properties props = new Properties();
+130         DependencyNode dependencyGraph = plugin.buildDependencyGraph(project);
+131         Builder builder = plugin.buildOSGiBundle( project, dependencyGraph, instructions, props, plugin.getClasspath( project, dependencyGraph ) );
+132 
+133         Manifest manifest = builder.getJar().getManifest();
+134         String expSvc = manifest.getMainAttributes().getValue( Constants.EXPORT_SERVICE );
+135         String impSvc = manifest.getMainAttributes().getValue( Constants.IMPORT_SERVICE );
+136         assertNotNull( expSvc );
+137         assertNotNull( impSvc );
+138 
+139         String impPkg = manifest.getMainAttributes().getValue( Constants.IMPORT_PACKAGE );
+140         List<String> pkgs = Create.list();
+141         for (Clause clause : Parser.parseHeader(impPkg))
+142         {
+143             pkgs.add(clause.getName());
+144         }
+145         for ( int i = 1; i <= 14; i++ )
+146         {
+147             assertTrue( pkgs.contains( "p" + i ) );
+148         }
+149 
+150         new Verifier(builder).verify();
+151     }
+152 
+153     public void testAnalyzer() throws Exception
+154     {
+155         Analyzer analyzer = new Analyzer();
+156         Manifest manifest = new Manifest();
+157         manifest.read(getClass().getResourceAsStream("/test.mf"));
+158         Jar jar = new Jar("name");
+159         jar.setManifest(manifest);
+160         analyzer.setJar(jar);
+161         analyzer.analyze();
+162         new Verifier(analyzer).verify();
+163     }
+164 
+165 }
+
+
+ + + \ No newline at end of file Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BlueprintComponentTest.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BlueprintComponentTest.html ------------------------------------------------------------------------------ svn:mime-type = text/html Added: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html ============================================================================== --- websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html (added) +++ websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html Sat Oct 24 18:48:51 2015 @@ -0,0 +1,165 @@ + + + +BundleAllPluginTest xref + + + +
+1   package org.apache.felix.bundleplugin;
+2   
+3   
+4   /*
+5    * Licensed to the Apache Software Foundation (ASF) under one
+6    * or more contributor license agreements.  See the NOTICE file
+7    * distributed with this work for additional information
+8    * regarding copyright ownership.  The ASF licenses this file
+9    * to you under the Apache License, Version 2.0 (the
+10   * "License"); you may not use this file except in compliance
+11   * with the License.  You may obtain a copy of the License at
+12   *
+13   * http://www.apache.org/licenses/LICENSE-2.0
+14   *
+15   * Unless required by applicable law or agreed to in writing,
+16   * software distributed under the License is distributed on an
+17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+18   * KIND, either express or implied.  See the License for the
+19   * specific language governing permissions and limitations
+20   * under the License.
+21   */
+22  
+23  import java.io.File;
+24  import java.util.Collections;
+25  import java.util.Map;
+26  
+27  import org.apache.maven.artifact.Artifact;
+28  import org.apache.maven.artifact.DefaultArtifact;
+29  import org.apache.maven.artifact.handler.ArtifactHandler;
+30  import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+31  import org.apache.maven.artifact.versioning.VersionRange;
+32  import org.apache.maven.plugin.testing.stubs.ArtifactStub;
+33  import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+34  import org.apache.maven.project.MavenProject;
+35  import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
+36  
+37  
+38  /**
+39   * Test for {@link BundleAllPlugin}
+40   *
+41   * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+42   */
+43  public class BundleAllPluginTest extends AbstractBundlePluginTest
+44  {
+45  
+46      private BundleAllPlugin plugin;
+47  
+48  
+49      @Override
+50      protected void setUp() throws Exception
+51      {
+52          super.setUp();
+53          init();
+54      }
+55  
+56  
+57      private void init() throws Exception
+58      {
+59          plugin = new BundleAllPlugin();
+60          File baseDirectory = new File( getBasedir() );
+61          File buildDirectory = new File( baseDirectory, "target" );
+62          plugin.setBuildDirectory( buildDirectory.getPath() );
+63          File outputDirectory = new File( buildDirectory, "test-classes" );
+64          plugin.setOutputDirectory( outputDirectory );
+65          setVariableValueToObject(plugin, "m_dependencyGraphBuilder", lookup(DependencyGraphBuilder.class.getName(), "default"));
+66      }
+67  
+68  
+69      public void testSnapshotMatch()
+70      {
+71          ArtifactStub artifact = getArtifactStub();
+72          String bundleName;
+73  
+74          artifact.setVersion( "2.1-SNAPSHOT" );
+75          bundleName = "group.artifact_2.1.0.20070207_193904_2.jar";
+76  
+77          assertTrue( plugin.snapshotMatch( artifact, bundleName ) );
+78  
+79          artifact.setVersion( "2-SNAPSHOT" );
+80          assertFalse( plugin.snapshotMatch( artifact, bundleName ) );
+81  
+82          artifact.setArtifactId( "artifactx" );
+83          artifact.setVersion( "2.1-SNAPSHOT" );
+84          assertFalse( plugin.snapshotMatch( artifact, bundleName ) );
+85      }
+86  
+87  
+88      public void testNoReBundling() throws Exception
+89      {
+90          File testFile = getTestFile( "target/test-classes/org.apache.maven.maven-model_1.0.0.0.jar" );
+91          if ( testFile.exists() )
+92          {
+93              testFile.delete();
+94          }
+95  
+96          VersionRange versionRange = VersionRange.createFromVersion("1.0.0.0");
+97          ArtifactHandler artifactHandler = new DefaultArtifactHandler( "jar" );
+98          Artifact artifact = new DefaultArtifact("group","artifact",versionRange, null, "jar", null, artifactHandler);
+99  
+100         MavenProject project = getMavenProjectStub();
+101         project.setGroupId( artifact.getGroupId() );
+102         project.setArtifactId( artifact.getArtifactId() );
+103         project.setVersion( artifact.getVersion() );
+104         project.setArtifact( artifact );
+105         project.setArtifacts( Collections.EMPTY_SET );
+106         project.setDependencyArtifacts( Collections.EMPTY_SET );
+107         File bundleFile = getTestFile( "src/test/resources/org.apache.maven.maven-model_2.1.0.SNAPSHOT.jar" );
+108         artifact.setFile( bundleFile );
+109 
+110         BundleInfo bundleInfo = plugin.bundle( project );
+111 
+112         Map exports = bundleInfo.getExportedPackages();
+113         String[] packages = new String[]
+114             { "org.apache.maven.model.io.jdom", "org.apache.maven.model" };
+115 
+116         for ( int i = 0; i < packages.length; i++ )
+117         {
+118             assertTrue( "Bundle info does not contain a package that it is  exported in the manifest: " + packages[i],
+119                 exports.containsKey( packages[i] ) );
+120         }
+121 
+122         assertFalse( "Bundle info contains a package that it is not exported in the manifest",
+123             exports.containsKey( "org.apache.maven.model.io.xpp3" ) );
+124     }
+125 
+126     //    public void testRewriting()
+127     //        throws Exception
+128     //    {
+129     //
+130     //        MavenProjectStub project = new MavenProjectStub();
+131     //        project.setArtifact( getArtifactStub() );
+132     //        project.getArtifact().setFile( getTestBundle() );
+133     //        project.setDependencyArtifacts( Collections.EMPTY_SET );
+134     //        project.setVersion( project.getArtifact().getVersion() );
+135     //
+136     //        File output = new File( plugin.getBuildDirectory(), plugin.getBundleName( project ) );
+137     //        boolean delete = output.delete();
+138     //
+139     //        plugin.bundle( project );
+140     //
+141     //        init();
+142     //        try
+143     //        {
+144     //            plugin.bundle( project );
+145     //            fail();
+146     //        }
+147     //        catch ( RuntimeException e )
+148     //        {
+149     //            // expected
+150     //        }
+151     //    }
+152 }
+
+
+ + + \ No newline at end of file Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: websites/production/felix/components/bundle-plugin-archives/bundle-plugin-LATEST/xref-test/org/apache/felix/bundleplugin/BundleAllPluginTest.html ------------------------------------------------------------------------------ svn:mime-type = text/html