code formatting

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1160900 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Herve Boutemy 2011-08-23 22:07:44 +00:00
parent ab6e3f0e06
commit 7da0995250
3 changed files with 44 additions and 52 deletions

View File

@ -77,7 +77,10 @@ public abstract class AbstractModelInterpolatorTest
private ModelBuildingRequest createModelBuildingRequest( Properties p )
{
ModelBuildingRequest config = new DefaultModelBuildingRequest();
if (p!= null) config.setSystemProperties( p);
if ( p != null )
{
config.setSystemProperties( p );
}
return config;
}
@ -123,8 +126,8 @@ public abstract class AbstractModelInterpolatorTest
ModelInterpolator interpolator = createInterpolator();
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model out = interpolator.interpolateModel( model, new File("."), createModelBuildingRequest(context),
collector );
Model out =
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ), collector );
assertProblemFree( collector );
assertEquals( "${test}/somepath", out.getScm().getConnection() );
@ -145,7 +148,7 @@ public abstract class AbstractModelInterpolatorTest
ModelInterpolator interpolator = createInterpolator();
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateModel( model, null, createModelBuildingRequest(context), collector );
interpolator.interpolateModel( model, null, createModelBuildingRequest( context ), collector );
assertColllectorState( 0, 1, 0, collector );
}
catch ( Exception e )
@ -169,8 +172,8 @@ public abstract class AbstractModelInterpolatorTest
ModelInterpolator interpolator = createInterpolator();
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model out = interpolator.interpolateModel( model, new File("."), createModelBuildingRequest(context),
collector );
Model out =
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ), collector );
assertProblemFree( collector );
@ -217,7 +220,6 @@ public abstract class AbstractModelInterpolatorTest
interpolator.interpolateModel( model, new File( "." ), createModelBuildingRequest( context ), collector );
assertColllectorState(0, 0, 1, collector );
assertEquals( "3.8.1", ( out.getDependencies().get( 0 ) ).getVersion() );
}
@ -277,7 +279,6 @@ public abstract class AbstractModelInterpolatorTest
assertColllectorState( 0, 0, 2, collector );
assertEquals( "foo-3.8.1", ( out.getDependencies().get( 0 ) ).getVersion() );
}
public void testBasedir()

View File

@ -41,7 +41,6 @@ public class StringSearchModelInterpolatorTest
extends AbstractModelInterpolatorTest
{
protected ModelInterpolator interpolator;
@Override
@ -49,7 +48,7 @@ public class StringSearchModelInterpolatorTest
throws Exception
{
super.setUp();
interpolator = lookup(ModelInterpolator.class);
interpolator = lookup( ModelInterpolator.class );
}
@ -82,17 +81,16 @@ public class StringSearchModelInterpolatorTest
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( values, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "value", values[0] );
assertEquals( "value2", values[1] );
}
private ModelBuildingRequest createModelBuildingRequest(Properties p)
private ModelBuildingRequest createModelBuildingRequest( Properties p )
{
ModelBuildingRequest config = new DefaultModelBuildingRequest();
config.setSystemProperties( p);
config.setSystemProperties( p );
return config;
}
@ -111,12 +109,11 @@ public class StringSearchModelInterpolatorTest
StringSearchModelInterpolator interpolator = (StringSearchModelInterpolator) createInterpolator();
ModelBuildingRequest config = createModelBuildingRequest(p);
ModelBuildingRequest config = createModelBuildingRequest( p );
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "value", obj.values[0] );
assertEquals( "value2", obj.values[1] );
@ -139,12 +136,11 @@ public class StringSearchModelInterpolatorTest
StringSearchModelInterpolator interpolator = (StringSearchModelInterpolator) createInterpolator();
ModelBuildingRequest config = createModelBuildingRequest(p);
ModelBuildingRequest config = createModelBuildingRequest( p );
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "value", obj.values.get( 0 ) );
assertEquals( "value2", obj.values.get( 1 ) );
@ -167,12 +163,11 @@ public class StringSearchModelInterpolatorTest
StringSearchModelInterpolator interpolator = (StringSearchModelInterpolator) createInterpolator();
ModelBuildingRequest config = createModelBuildingRequest(p);
ModelBuildingRequest config = createModelBuildingRequest( p );
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "key", obj.values.get( 0 ) );
assertEquals( "value2", obj.values.get( 1 ) );
@ -193,12 +188,11 @@ public class StringSearchModelInterpolatorTest
StringSearchModelInterpolator interpolator = (StringSearchModelInterpolator) createInterpolator();
ModelBuildingRequest config = createModelBuildingRequest(p);
ModelBuildingRequest config = createModelBuildingRequest( p );
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "${key}", obj.values.get( 0 ) );
}
@ -222,12 +216,11 @@ public class StringSearchModelInterpolatorTest
StringSearchModelInterpolator interpolator = (StringSearchModelInterpolator) createInterpolator();
ModelBuildingRequest config = createModelBuildingRequest(p);
ModelBuildingRequest config = createModelBuildingRequest( p );
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "value", ( (String[]) obj.values.get( 0 ) )[0] );
assertEquals( "value2", ( (String[]) obj.values.get( 0 ) )[1] );
@ -252,12 +245,11 @@ public class StringSearchModelInterpolatorTest
StringSearchModelInterpolator interpolator = (StringSearchModelInterpolator) createInterpolator();
ModelBuildingRequest config = createModelBuildingRequest(p);
ModelBuildingRequest config = createModelBuildingRequest( p );
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "value", obj.values.get( "key" ) );
assertEquals( "value2", obj.values.get( "key2" ) );
@ -280,12 +272,11 @@ public class StringSearchModelInterpolatorTest
StringSearchModelInterpolator interpolator = (StringSearchModelInterpolator) createInterpolator();
ModelBuildingRequest config = createModelBuildingRequest(p);
ModelBuildingRequest config = createModelBuildingRequest( p );
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "val", obj.values.get( "key" ) );
assertEquals( "value2", obj.values.get( "key2" ) );
@ -306,12 +297,11 @@ public class StringSearchModelInterpolatorTest
StringSearchModelInterpolator interpolator = (StringSearchModelInterpolator) createInterpolator();
ModelBuildingRequest config = createModelBuildingRequest(p);
ModelBuildingRequest config = createModelBuildingRequest( p );
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "${key}", obj.values.get( "key" ) );
}
@ -335,12 +325,11 @@ public class StringSearchModelInterpolatorTest
StringSearchModelInterpolator interpolator = (StringSearchModelInterpolator) createInterpolator();
ModelBuildingRequest config = createModelBuildingRequest(p);
ModelBuildingRequest config = createModelBuildingRequest( p );
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
assertProblemFree( collector );
assertProblemFree( collector );
assertEquals( "value", ( (String[]) obj.values.get( "key" ) )[0] );
assertEquals( "value2", ( (String[]) obj.values.get( "key" ) )[1] );
@ -370,27 +359,29 @@ public class StringSearchModelInterpolatorTest
List<Future<SimpleProblemCollector>> futures = new ArrayList<Future<SimpleProblemCollector>>();
for ( int i = 0; i < numItems; i++ )
{
Callable<SimpleProblemCollector> future = new Callable<SimpleProblemCollector>() {
public SimpleProblemCollector call() throws Exception {
Callable<SimpleProblemCollector> future = new Callable<SimpleProblemCollector>()
{
public SimpleProblemCollector call()
throws Exception
{
final ObjectWithMixedProtection obj = getValueList();
final ModelBuildingRequest config = createModelBuildingRequest(p);
final ModelBuildingRequest config = createModelBuildingRequest( p );
countDownLatch.await();
final SimpleProblemCollector collector = new SimpleProblemCollector();
interpolator.interpolateObject( obj, model, new File( "." ), config, collector);
interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
return collector;
}
};
FutureTask<SimpleProblemCollector> task = new FutureTask<SimpleProblemCollector>(future);
futures.add ( task);
new Thread( task).start();
FutureTask<SimpleProblemCollector> task = new FutureTask<SimpleProblemCollector>( future );
futures.add( task );
new Thread( task ).start();
}
countDownLatch.countDown(); // Start all the threads
for ( Future<SimpleProblemCollector> result : futures )
{
SimpleProblemCollector problemCollector = result.get(); // ArrayIndexOutOfBoundsException are typical indication of threading issues
assertProblemFree( problemCollector );
assertProblemFree( problemCollector );
}
}

View File

@ -36,7 +36,7 @@ public class DefaultModelValidatorTest
extends PlexusTestCase
{
private DefaultModelValidator validator;
private ModelValidator validator;
private Model read( String pom )
throws Exception
@ -94,7 +94,7 @@ public class DefaultModelValidatorTest
{
super.setUp();
validator = (DefaultModelValidator) lookup( ModelValidator.class );
validator = lookup( ModelValidator.class );
}
@Override