Skip to content

Commit

Permalink
o Update to maven-parent 25, fix tons of rat and checkstyle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
agudian committed Oct 25, 2014
1 parent 2e62ff4 commit e4ff032
Show file tree
Hide file tree
Showing 134 changed files with 1,064 additions and 658 deletions.
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
<!--
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.
-->

Guidelines for contributing
===========

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public class IntegrationTestMojo
*/
@Parameter( property = "failsafe.parallel.forcedTimeout" )
private double parallelTestsTimeoutForcedInSeconds;

/**
* A list of &lt;include> elements specifying the tests (by pattern) that should be included in testing. When not
* specified and when the <code>test</code> parameter is not specified, the default includes will be <code><br/>
Expand Down Expand Up @@ -219,7 +219,8 @@ public class IntegrationTestMojo
@Parameter( property = "failsafe.rerunFailingTestsCount", defaultValue = "0" )
protected int rerunFailingTestsCount;

protected int getRerunFailingTestsCount() {
protected int getRerunFailingTestsCount()
{
return rerunFailingTestsCount;
}

Expand Down Expand Up @@ -264,8 +265,8 @@ private String getEncodingOrDefault()
{
if ( StringUtils.isEmpty( encoding ) )
{
getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING +
", i.e. build is platform dependent!" );
getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+ ", i.e. build is platform dependent!" );
return ReaderFactory.FILE_ENCODING;
}
else
Expand Down Expand Up @@ -471,19 +472,23 @@ public void setForkedProcessTimeoutInSeconds( int forkedProcessTimeoutInSeconds
this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
}

public double getParallelTestsTimeoutInSeconds() {
public double getParallelTestsTimeoutInSeconds()
{
return parallelTestsTimeoutInSeconds;
}

public void setParallelTestsTimeoutInSeconds( double parallelTestsTimeoutInSeconds ) {
public void setParallelTestsTimeoutInSeconds( double parallelTestsTimeoutInSeconds )
{
this.parallelTestsTimeoutInSeconds = parallelTestsTimeoutInSeconds;
}

public double getParallelTestsTimeoutForcedInSeconds() {
public double getParallelTestsTimeoutForcedInSeconds()
{
return parallelTestsTimeoutForcedInSeconds;
}

public void setParallelTestsTimeoutForcedInSeconds( double parallelTestsTimeoutForcedInSeconds ) {
public void setParallelTestsTimeoutForcedInSeconds( double parallelTestsTimeoutForcedInSeconds )
{
this.parallelTestsTimeoutForcedInSeconds = parallelTestsTimeoutForcedInSeconds;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public class VerifyMojo
private boolean skipTests;

/**
* Set this to 'true' to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but quite
* convenient on occasion.
* Set this to 'true' to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but
* quite convenient on occasion.
*
* @since 2.4.3-alpha-2
*/
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.apache.maven.plugin.surefire;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -28,16 +29,16 @@
*/
public class ClasspathCache
{
private static final ConcurrentHashMap<String, Classpath> classpaths =
private static final ConcurrentHashMap<String, Classpath> CLASSPATHS =
new ConcurrentHashMap<String, Classpath>( 4 );

public static Classpath getCachedClassPath( @Nonnull String artifactId )
{
return classpaths.get( artifactId );
return CLASSPATHS.get( artifactId );
}

public static void setCachedClasspath( @Nonnull String key, @Nonnull Classpath classpath )
{
classpaths.put( key, classpath );
CLASSPATHS.put( key, classpath );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public ProviderList( ConfigurableProviderInfo dynamicProviderInfo, ProviderInfo.
}


@SuppressWarnings( "checkstyle:modifierorder" )
public @Nonnull List<ProviderInfo> resolve( @Nonnull Log log )
{
List<ProviderInfo> providersToRun = new ArrayList<ProviderInfo>();
Expand All @@ -65,6 +66,7 @@ public ProviderList( ConfigurableProviderInfo dynamicProviderInfo, ProviderInfo.
return autoDetectOneProvider();
}

@SuppressWarnings( "checkstyle:modifierorder" )
private @Nonnull List<ProviderInfo> autoDetectOneProvider()
{
List<ProviderInfo> providersToRun = new ArrayList<ProviderInfo>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class StartupReportConfiguration

public static final String PLAIN_REPORT_FORMAT = ConsoleReporter.PLAIN;

@SuppressWarnings( "checkstyle:parameternumber" )
public StartupReportConfiguration( boolean useFile, boolean printSummary, String reportFormat,
boolean redirectTestOutputToFile, boolean disableXmlReport,
@Nonnull File reportsDirectory, boolean trimStackTrace, String reportNameSuffix,
Expand Down Expand Up @@ -142,7 +143,8 @@ public File getReportsDirectory()
return reportsDirectory;
}

public int getRerunFailingTestsCount() {
public int getRerunFailingTestsCount()
{
return rerunFailingTestsCount;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.apache.maven.plugin.surefire;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -18,14 +19,11 @@
* under the License.
*/

import org.apache.maven.surefire.booter.Classpath;
import org.apache.maven.surefire.booter.KeyValueSource;
import org.apache.maven.surefire.util.internal.StringUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
Expand All @@ -36,6 +34,10 @@
import java.util.Properties;
import java.util.Set;

import org.apache.maven.surefire.booter.Classpath;
import org.apache.maven.surefire.booter.KeyValueSource;
import org.apache.maven.surefire.util.internal.StringUtils;

/**
* A properties implementation that preserves insertion order.
*/
Expand Down Expand Up @@ -111,19 +113,15 @@ public Iterable<Object> getStringKeySet()
return keySet();
}

private static final Set<String> keysThatCannotBeUsedAsSystemProperties = new HashSet<String>()
{{
add( "java.library.path" );
add( "file.encoding" );
add( "jdk.map.althashing.threshold" );
}};
private static final Set<String> KEYS_THAT_CANNOT_BE_USED_AS_SYSTEM_PROPERTIES = new HashSet<String>(
Arrays.asList( "java.library.path", "file.encoding", "jdk.map.althashing.threshold" ) );

public Set<Object> propertiesThatCannotBeSetASystemProperties()
{
Set<Object> result = new HashSet<Object>();
for ( Object key : getStringKeySet() )
{
if ( keysThatCannotBeUsedAsSystemProperties.contains( key ) )
if ( KEYS_THAT_CANNOT_BE_USED_AS_SYSTEM_PROPERTIES.contains( key ) )
{
result.add( key );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public File serialize( KeyValueSource sourceProperties, ProviderConfiguration bo
ClasspathConfiguration cp = providerConfiguration.getClasspathConfiguration();
properties.setClasspath( ClasspathConfiguration.CLASSPATH, cp.getTestClasspath() );
properties.setClasspath( ClasspathConfiguration.SUREFIRE_CLASSPATH, cp.getProviderClasspath() );
properties.setProperty( ClasspathConfiguration.ENABLE_ASSERTIONS, String.valueOf( cp.isEnableAssertions()) );
properties.setProperty( ClasspathConfiguration.ENABLE_ASSERTIONS, String.valueOf( cp.isEnableAssertions() ) );
properties.setProperty( ClasspathConfiguration.CHILD_DELEGATION, String.valueOf( cp.isChildDelegation() ) );

TestArtifactInfo testNg = booterConfiguration.getTestArtifact();
Expand All @@ -94,7 +94,8 @@ public File serialize( KeyValueSource sourceProperties, ProviderConfiguration bo
properties.setProperty( BooterConstants.SOURCE_DIRECTORY, testSuiteDefinition.getTestSourceDirectory() );
properties.addList( testSuiteDefinition.getSuiteXmlFiles(), BooterConstants.TEST_SUITE_XML_FILES );
properties.setNullableProperty( BooterConstants.REQUESTEDTEST, testSuiteDefinition.getRequestedTest() );
properties.setNullableProperty( BooterConstants.REQUESTEDTESTMETHOD, testSuiteDefinition.getRequestedTestMethod() );
properties.setNullableProperty( BooterConstants.REQUESTEDTESTMETHOD,
testSuiteDefinition.getRequestedTestMethod() );
properties.setNullableProperty( BooterConstants.RERUN_FAILING_TESTS_COUNT,
String.valueOf( testSuiteDefinition.getRerunFailingTestsCount() ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required| by applicable law or agreed to in writing,
* 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
Expand Down Expand Up @@ -122,6 +122,7 @@ public void add( Boolean aBoolean )
appendObject( aBoolean );
}

@SuppressWarnings( "checkstyle:magicnumber" )
private static String asHexString( byte[] bytes )
{
if ( bytes == null )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ public class ForkConfiguration

private final String debugLine;

public ForkConfiguration( Classpath bootClasspathConfiguration, File tmpDir, String debugLine, String jvmExecutable,
File workingDirectory, Properties modelProperties, String argLine, Map<String, String> environmentVariables,
boolean debugEnabled, int forkCount, boolean reuseForks )
@SuppressWarnings( "checkstyle:parameternumber" )
public ForkConfiguration( Classpath bootClasspathConfiguration, File tmpDir, String debugLine,
String jvmExecutable, File workingDirectory, Properties modelProperties, String argLine,
Map<String, String> environmentVariables, boolean debugEnabled, int forkCount,
boolean reuseForks )
{
this.bootClasspathConfiguration = bootClasspathConfiguration;
this.tempDirectory = tmpDir;
Expand Down Expand Up @@ -111,8 +113,8 @@ else if ( "none".equalsIgnoreCase( forkMode ) )
{
return FORK_NEVER;
}
else if ( forkMode.equals( FORK_NEVER ) || forkMode.equals( FORK_ONCE ) ||
forkMode.equals( FORK_ALWAYS ) || forkMode.equals( FORK_PERTHREAD ) )
else if ( forkMode.equals( FORK_NEVER ) || forkMode.equals( FORK_ONCE )
|| forkMode.equals( FORK_ALWAYS ) || forkMode.equals( FORK_PERTHREAD ) )
{
return forkMode;
}
Expand All @@ -135,7 +137,8 @@ public OutputStreamFlushableCommandline createCommandLine( List<String> classPat
throws SurefireBooterForkException
{
return createCommandLine( classPath,
startupConfiguration.getClassLoaderConfiguration().isManifestOnlyJarRequestedAndUsable(),
startupConfiguration.getClassLoaderConfiguration()
.isManifestOnlyJarRequestedAndUsable(),
startupConfiguration.isShadefire(), startupConfiguration.isProviderMainClass()
? startupConfiguration.getActualClassName()
: ForkedBooter.class.getName(), threadNumber );
Expand All @@ -151,7 +154,9 @@ OutputStreamFlushableCommandline createCommandLine( List<String> classPath, bool

if ( argLine != null )
{
cli.createArg().setLine( replaceThreadNumberPlaceholder( stripNewLines( replacePropertyExpressions( argLine ) ), threadNumber ) );
cli.createArg().setLine(
replaceThreadNumberPlaceholder( stripNewLines( replacePropertyExpressions( argLine ) ),
threadNumber ) );
}

if ( environmentVariables != null )
Expand Down Expand Up @@ -217,15 +222,18 @@ private String replaceThreadNumberPlaceholder( String argLine, int threadNumber
*/
private String replacePropertyExpressions( String argLine )
{
if ( argLine == null ) {
if ( argLine == null )
{
return null;
}

for ( Enumeration<?> e = modelProperties.propertyNames(); e.hasMoreElements(); ) {
for ( Enumeration<?> e = modelProperties.propertyNames(); e.hasMoreElements(); )
{
String key = e.nextElement().toString();
String field = "@{" + key + "}";
if ( argLine.contains(field) ) {
argLine = argLine.replace(field, modelProperties.getProperty(key, ""));
if ( argLine.contains( field ) )
{
argLine = argLine.replace( field, modelProperties.getProperty( key, "" ) );
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
package org.apache.maven.plugin.surefire.booterclient;

/*
* 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.
*/

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;

/**
* A bucket from which fork numbers can be drawn. Any drawn number needs to be returned to the bucket, in order to keep
* the range of provided values delivered as small as possible.
*
*
* @author Andreas Gudian
*/
public class ForkNumberBucket
Expand All @@ -32,15 +51,15 @@ protected ForkNumberBucket()
*/
public static int drawNumber()
{
return getInstance()._drawNumber();
return getInstance().drawNumberInternal();
}

/**
* @param number the number to return to the bucket so that it can be reused.
*/
public static void returnNumber( int number )
{
getInstance()._returnNumber( number );
getInstance().returnNumberInternal( number );
}

/**
Expand All @@ -55,7 +74,7 @@ private static ForkNumberBucket getInstance()
* @return a fork number that is not currently in use. The value must be returned to the bucket using
* {@link #returnNumber(int)}.
*/
protected int _drawNumber()
protected int drawNumberInternal()
{
Integer nextFree = qFree.poll();

Expand All @@ -80,7 +99,7 @@ protected int getHighestDrawnNumber()
/**
* @param number the number to return to the bucket so that it can be reused.
*/
protected void _returnNumber( int number )
protected void returnNumberInternal( int number )
{
qFree.add( Integer.valueOf( number ) );
}
Expand Down
Loading

0 comments on commit e4ff032

Please sign in to comment.