You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by mc...@apache.org on 2008/01/29 07:22:10 UTC
svn commit: r616180 - in
/felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin:
AbstractBundlePluginTest.java BundleAllPluginTest.java BundlePluginTest.java
Author: mcculls
Date: Mon Jan 28 22:22:10 2008
New Revision: 616180
URL: http://svn.apache.org/viewvc?rev=616180&view=rev
Log:
Apply Felix formatting
Modified:
felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java
felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
Modified: felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java?rev=616180&r1=616179&r2=616180&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java (original)
+++ felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/AbstractBundlePluginTest.java Mon Jan 28 22:22:10 2008
@@ -1,5 +1,6 @@
package org.apache.felix.bundleplugin;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,14 +25,14 @@
import org.apache.maven.plugin.testing.stubs.ArtifactStub;
import org.codehaus.plexus.PlexusTestCase;
+
/**
* Common methods for bundle plugin testing
*
* @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
* @version $Id$
*/
-public abstract class AbstractBundlePluginTest
- extends PlexusTestCase
+public abstract class AbstractBundlePluginTest extends PlexusTestCase
{
protected ArtifactStub getArtifactStub()
@@ -42,6 +43,7 @@
artifact.setVersion( "1.0" );
return artifact;
}
+
protected File getTestBundle()
{
Modified: felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java?rev=616180&r1=616179&r2=616180&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java (original)
+++ felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java Mon Jan 28 22:22:10 2008
@@ -1,5 +1,6 @@
package org.apache.felix.bundleplugin;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,7 +20,6 @@
* under the License.
*/
-import org.apache.felix.bundleplugin.BundleAllPlugin;
import java.io.File;
import java.util.Collections;
import java.util.Map;
@@ -29,25 +29,26 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
+
/**
* Test for {@link BundleAllPlugin}
*
* @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
* @version $Id$
*/
-public class BundleAllPluginTest
- extends AbstractBundlePluginTest
+public class BundleAllPluginTest extends AbstractBundlePluginTest
{
private BundleAllPlugin plugin;
- protected void setUp()
- throws Exception
+
+ protected void setUp() throws Exception
{
super.setUp();
init();
}
+
private void init()
{
plugin = new BundleAllPlugin();
@@ -60,6 +61,7 @@
plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() );
}
+
public void testSnapshotMatch()
{
ArtifactStub artifact = getArtifactStub();
@@ -78,8 +80,8 @@
assertFalse( plugin.snapshotMatch( artifact, bundleName ) );
}
- public void testNoReBundling()
- throws Exception
+
+ public void testNoReBundling() throws Exception
{
File testFile = getTestFile( "target/test-classes/org.apache.maven.maven-model_1.0.0.0.jar" );
if ( testFile.exists() )
@@ -103,44 +105,43 @@
BundleInfo bundleInfo = plugin.bundle( project );
Map exports = bundleInfo.getExportedPackages();
- String[] packages = new String[] {
- "org.apache.maven.model.io.jdom",
- "org.apache.maven.model" };
+ String[] packages = new String[]
+ { "org.apache.maven.model.io.jdom", "org.apache.maven.model" };
for ( int i = 0; i < packages.length; i++ )
{
assertTrue( "Bundle info does not contain a package that it is exported in the manifest: " + packages[i],
- exports.containsKey( packages[i] ) );
+ exports.containsKey( packages[i] ) );
}
assertFalse( "Bundle info contains a package that it is not exported in the manifest", exports
.containsKey( "org.apache.maven.model.io.xpp3" ) );
}
-// public void testRewriting()
-// throws Exception
-// {
-//
-// MavenProjectStub project = new MavenProjectStub();
-// project.setArtifact( getArtifactStub() );
-// project.getArtifact().setFile( getTestBundle() );
-// project.setDependencyArtifacts( Collections.EMPTY_SET );
-// project.setVersion( project.getArtifact().getVersion() );
-//
-// File output = new File( plugin.getBuildDirectory(), plugin.getBundleName( project ) );
-// boolean delete = output.delete();
-//
-// plugin.bundle( project );
-//
-// init();
-// try
-// {
-// plugin.bundle( project );
-// fail();
-// }
-// catch ( RuntimeException e )
-// {
-// // expected
-// }
-// }
+ // public void testRewriting()
+ // throws Exception
+ // {
+ //
+ // MavenProjectStub project = new MavenProjectStub();
+ // project.setArtifact( getArtifactStub() );
+ // project.getArtifact().setFile( getTestBundle() );
+ // project.setDependencyArtifacts( Collections.EMPTY_SET );
+ // project.setVersion( project.getArtifact().getVersion() );
+ //
+ // File output = new File( plugin.getBuildDirectory(), plugin.getBundleName( project ) );
+ // boolean delete = output.delete();
+ //
+ // plugin.bundle( project );
+ //
+ // init();
+ // try
+ // {
+ // plugin.bundle( project );
+ // fail();
+ // }
+ // catch ( RuntimeException e )
+ // {
+ // // expected
+ // }
+ // }
}
Modified: felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java?rev=616180&r1=616179&r2=616180&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java (original)
+++ felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java Mon Jan 28 22:22:10 2008
@@ -1,5 +1,6 @@
package org.apache.felix.bundleplugin;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -30,26 +31,27 @@
import aQute.lib.osgi.Analyzer;
import aQute.lib.osgi.Jar;
+
/**
* Test for {@link BundlePlugin}.
*
* @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
* @version $Id$
*/
-public class BundlePluginTest
- extends AbstractBundlePluginTest
+public class BundlePluginTest extends AbstractBundlePluginTest
{
private BundlePlugin plugin;
- protected void setUp()
- throws Exception
+
+ protected void setUp() throws Exception
{
super.setUp();
plugin = new BundlePlugin();
plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() );
}
+
public void testConvertVersionToOsgi()
{
String osgiVersion;
@@ -94,8 +96,8 @@
assertEquals( "1.4.1.20070217_082013_7", osgiVersion );
}
- public void testReadExportedModules()
- throws Exception
+
+ public void testReadExportedModules() throws Exception
{
File osgiBundleFile = getTestBundle();
@@ -109,7 +111,8 @@
PackageVersionAnalyzer analyzer = new PackageVersionAnalyzer();
Jar jar = new Jar( "name", osgiBundleFile );
analyzer.setJar( jar );
- analyzer.setClasspath( new Jar[] { jar } );
+ analyzer.setClasspath( new Jar[]
+ { jar } );
analyzer.setProperty( Analyzer.EXPORT_PACKAGE, "*" );
analyzer.calcManifest();
@@ -117,41 +120,41 @@
assertEquals( 3, analyzer.getExports().size() );
}
- public void testTransformDirectives()
- throws Exception
+
+ public void testTransformDirectives() throws Exception
{
Map instructions = new TreeMap();
- instructions.put("a", "1");
- instructions.put("-a", "2");
- instructions.put("_a", "3");
- instructions.put("A", "3");
- instructions.put("_A", "1");
- instructions.put("_b", "4");
- instructions.put("b", "6");
- instructions.put("_B", "6");
- instructions.put("-B", "5");
- instructions.put("B", "4");
+ instructions.put( "a", "1" );
+ instructions.put( "-a", "2" );
+ instructions.put( "_a", "3" );
+ instructions.put( "A", "3" );
+ instructions.put( "_A", "1" );
+ instructions.put( "_b", "4" );
+ instructions.put( "b", "6" );
+ instructions.put( "_B", "6" );
+ instructions.put( "-B", "5" );
+ instructions.put( "B", "4" );
- instructions.put("z", null);
- instructions.put("_z", null);
+ instructions.put( "z", null );
+ instructions.put( "_z", null );
Map transformedInstructions = plugin.transformDirectives( instructions );
- assertEquals( "1", transformedInstructions.get("a") );
- assertEquals( "3", transformedInstructions.get("-a") );
- assertEquals( null, transformedInstructions.get("_a") );
- assertEquals( "3", transformedInstructions.get("A") );
- assertEquals( "1", transformedInstructions.get("-A") );
- assertEquals( null, transformedInstructions.get("_A") );
- assertEquals( null, transformedInstructions.get("_b") );
- assertEquals( "4", transformedInstructions.get("-b") );
- assertEquals( "6", transformedInstructions.get("b") );
- assertEquals( null, transformedInstructions.get("_B") );
- assertEquals( "6", transformedInstructions.get("-B") );
- assertEquals( "4", transformedInstructions.get("B") );
+ assertEquals( "1", transformedInstructions.get( "a" ) );
+ assertEquals( "3", transformedInstructions.get( "-a" ) );
+ assertEquals( null, transformedInstructions.get( "_a" ) );
+ assertEquals( "3", transformedInstructions.get( "A" ) );
+ assertEquals( "1", transformedInstructions.get( "-A" ) );
+ assertEquals( null, transformedInstructions.get( "_A" ) );
+ assertEquals( null, transformedInstructions.get( "_b" ) );
+ assertEquals( "4", transformedInstructions.get( "-b" ) );
+ assertEquals( "6", transformedInstructions.get( "b" ) );
+ assertEquals( null, transformedInstructions.get( "_B" ) );
+ assertEquals( "6", transformedInstructions.get( "-B" ) );
+ assertEquals( "4", transformedInstructions.get( "B" ) );
- assertEquals( "", transformedInstructions.get("z") );
- assertEquals( "", transformedInstructions.get("-z") );
+ assertEquals( "", transformedInstructions.get( "z" ) );
+ assertEquals( "", transformedInstructions.get( "-z" ) );
}
}