This is an automated email from the ASF dual-hosted git repository. martin_s pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/archiva-components.git
commit d31c492c2ac204bb955ae4e9a818801634ecbefe Author: Martin Stockhammer <[email protected]> AuthorDate: Thu Nov 21 21:31:21 2019 +0100 Formatting code --- .editorconfig | 16 +-- README.adoc | 27 ++--- expression-evaluator/pom.xml | 3 +- .../evaluator/DefaultExpressionEvaluator.java | 29 +++-- .../components/evaluator/EvaluatorException.java | 7 +- .../components/evaluator/ExpressionEvaluator.java | 3 +- .../components/evaluator/ExpressionSource.java | 1 - .../sources/PropertiesExpressionSource.java | 6 +- .../sources/SystemPropertyExpressionSource.java | 3 +- expression-evaluator/src/site/site.xml | 22 ++-- .../sources/DefaultExpressionEvaluatorTest.java | 61 +++++------ graph/src/test/resources/log4j2-test.xml | 24 ++-- pom.xml | 65 +++++------ spring-apacheds/pom.xml | 20 ++-- .../archiva/components/apacheds/ApacheDs.java | 15 ++- .../components/apacheds/DefaultApacheDs.java | 91 ++++++++------- .../archiva/components/apacheds/Partition.java | 15 ++- spring-apacheds/src/site/site.xml | 22 ++-- .../archiva/components/apacheds/ApacheDsTest.java | 92 ++++++++-------- spring-apacheds/src/test/resources/log4j2-test.xml | 24 ++-- .../src/test/resources/spring-context.xml | 14 +-- .../src/main/resources/META-INF/spring-context.xml | 8 +- .../components/cache/ehcache/EhcacheCache.java | 25 +++-- .../components/cache/ehcache/EhcacheCreator.java | 6 +- .../src/main/resources/META-INF/spring-context.xml | 8 +- .../src/test/resources/log4j2-test.xml | 24 ++-- .../src/test/resources/spring-context-disk.xml | 30 ++--- .../src/test/resources/spring-context.xml | 122 ++++++++++----------- .../src/main/resources/META-INF/spring-context.xml | 8 +- .../src/test/resources/log4j2-test.xml | 24 ++-- .../src/test/resources/spring-context.xml | 62 +++++------ .../spring-cache-providers/src/site/site.xml | 12 +- .../src/main/resources/META-INF/spring-context.xml | 8 +- spring-cache/src/site/site.xml | 20 ++-- spring-registry/pom.xml | 31 +++--- spring-registry/spring-registry-api/pom.xml | 3 +- .../archiva/components/registry/Registry.java | 21 ++-- spring-registry/spring-registry-commons/pom.xml | 3 +- .../commons/CommonsConfigurationRegistry.java | 5 +- .../commons/ConfigurationListenerDelegate.java | 14 +-- .../src/main/resources/META-INF/spring-context.xml | 8 +- .../registry/test/AbstractRegistryTest.java | 65 ++++++----- .../test/CommonsConfigurationRegistryTest.java | 102 ++++++++--------- .../components/registry/test/Component.java | 30 ++--- .../components/registry/test/DefaultComponent.java | 29 ++--- .../archiva/components/registry/test/Nested.java | 2 +- .../org/codehaus/plexus/registry/phase.properties | 1 - .../org/codehaus/plexus/registry/test.properties | 2 - .../org/codehaus/plexus/registry/test.xml | 48 ++++---- .../src/test/resources/spring-context.xml | 60 +++++----- .../src/test/resources/test-save.xml | 12 +- spring-registry/src/site/site.xml | 22 ++-- spring-taskqueue/pom.xml | 3 +- src/site/site.xml | 68 ++++++------ 54 files changed, 716 insertions(+), 730 deletions(-) diff --git a/.editorconfig b/.editorconfig index bfd8fa2..6635bd7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -111,7 +111,7 @@ ij_java_for_statement_wrap = off ij_java_generate_final_locals = false ij_java_generate_final_parameters = false ij_java_if_brace_force = never -ij_java_imports_layout = *,|,javax.**,java.**,|,$* +ij_java_imports_layout = *, |, javax.**, java.**, |, $* ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = false ij_java_insert_override_annotation = true @@ -142,7 +142,7 @@ ij_java_method_parameters_right_paren_on_new_line = false ij_java_method_parameters_wrap = off ij_java_modifier_list_wrap = false ij_java_names_count_to_use_import_on_demand = 3 -ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.* +ij_java_packages_to_use_import_on_demand = java.awt.*, javax.swing.* ij_java_parameter_annotation_wrap = off ij_java_parentheses_expression_new_line_after_left_paren = false ij_java_parentheses_expression_right_paren_on_new_line = false @@ -256,7 +256,7 @@ ij_java_wrap_first_method_in_call_chain = false ij_java_wrap_long_lines = false -[{*.cjs,*.js}] +[{*.cjs, *.js}] ij_continuation_indent_size = 2 ij_javascript_align_imports = false ij_javascript_align_multiline_array_initializer_expression = false @@ -276,7 +276,7 @@ ij_javascript_array_initializer_wrap = off ij_javascript_assignment_wrap = off ij_javascript_binary_operation_sign_on_next_line = false ij_javascript_binary_operation_wrap = off -ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**/*,@angular/material,@angular/material/typings/** +ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**/*, @angular/material, @angular/material/typings/** ij_javascript_blank_lines_after_imports = 1 ij_javascript_blank_lines_around_class = 1 ij_javascript_blank_lines_around_field = 0 @@ -418,17 +418,17 @@ ij_javascript_while_brace_force = never ij_javascript_while_on_new_line = false ij_javascript_wrap_comments = false -[{*.zsh,*.bash,*.sh}] +[{*.zsh, *.bash, *.sh}] ij_shell_binary_ops_start_line = false ij_shell_keep_column_alignment_padding = false ij_shell_minify_program = false ij_shell_redirect_followed_by_space = false ij_shell_switch_cases_indented = false -[{.asciidoctorconfig,*.ad,*.adoc,*.asciidoc}] +[{.asciidoctorconfig, *.ad, *.adoc, *.asciidoc}] ij_asciidoc_formatting_enabled = true -ij_asciidoc_one_sentence_per_line = true +ij_asciidoc_one_sentence_per_line = false [pom.xml] tab_width = 2 -indent_size = 2 \ No newline at end of file +indent_size = 2 diff --git a/README.adoc b/README.adoc index f1ae3f2..2b4e6d1 100644 --- a/README.adoc +++ b/README.adoc @@ -1,9 +1,10 @@ Archiva Documentation - Component Documentation + ======================================================= == Licensing information -Archiva Compontents is developed under the Apache License Version 2.0 +Archiva Compontents is developed under the Apache License Version 2.0 :toc: @@ -19,23 +20,22 @@ Users with questions may mail to [email protected]. == How to build and publish the pages for the archiva web content -This module and the children contain web content and project reports that can be published to the +This module and the children contain web content and project reports that can be published to the archiva web site: https://archiva.apache.org -The web content parts of this module and submodules are published to the path +The web content parts of this module and submodules are published to the path /components/ === Use the script -There is a shell script +deploySite.sh+ which you can run to generate the site check and publish to +There is a shell script +deploySite.sh+ which you can run to generate the site check and publish to the remote repository. It works only on Linux, on other platforms you have to go the next section. The script is interactive, it asks you to confirm the publish after generation of the staging part. .Execute - - ./deploySite.sh + ./deploySite.sh All arguments are appended to the mvn calls. @@ -43,17 +43,16 @@ All arguments are appended to the mvn calls. ==== Building the pages -You need enough free disk space to publish the web content. The archiva web site repository is big, +You need enough free disk space to publish the web content. The archiva web site repository is big, but the maven build will only checkout the necessary directories for this build (sparse checkout). For all the commands you have to change to this site directory: .The following creates the site to the staging folder - - mvn clean site + mvn clean site mvn site:stage -The result can be checked in +The result can be checked in site/target/staging/components/ @@ -66,13 +65,12 @@ to the remote repository, you may add this parameter: where +${path-to-your-local-archiva}+ is the path where a bare clone of the archiva-web-content.git is stored. -NOTE: You cannot use +mvn site:run+ because this will place the submodules into the same folder and - overwrite each other. +NOTE: You cannot use +mvn site:run+ because this will place the submodules into the same folder and +overwrite each other. ==== Publish the pages .This command publishes to the git repository - mvn scm-publish:publish-scm After publishing to the git repository the gitpubsub mechanism is transferring it to the HTTP server. @@ -82,10 +80,9 @@ to the remote repository, you may add this parameter: -DsiteRepositoryUrl=scm:git:file:///${path-to-your-local-archiva}/archiva-web-content.git - === Some notes about the build process -A sparse checkout of the git repository will be created in +A sparse checkout of the git repository will be created in .site-content diff --git a/expression-evaluator/pom.xml b/expression-evaluator/pom.xml index f323200..96fabe2 100644 --- a/expression-evaluator/pom.xml +++ b/expression-evaluator/pom.xml @@ -17,7 +17,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/DefaultExpressionEvaluator.java b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/DefaultExpressionEvaluator.java index 00cfef5..2c1f8df 100644 --- a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/DefaultExpressionEvaluator.java +++ b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/DefaultExpressionEvaluator.java @@ -28,19 +28,18 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * DefaultExpressionEvaluator + * DefaultExpressionEvaluator * * @author <a href="mailto:[email protected]">Joakim Erdfelt</a> - * */ public class DefaultExpressionEvaluator implements ExpressionEvaluator { private List<ExpressionSource> expressionSources; - public DefaultExpressionEvaluator() + public DefaultExpressionEvaluator( ) { - expressionSources = new ArrayList<>(); + expressionSources = new ArrayList<>( ); } public void addExpressionSource( ExpressionSource source ) @@ -51,7 +50,7 @@ public class DefaultExpressionEvaluator public String expand( String str ) throws EvaluatorException { - return recursiveExpand( str, new ArrayList<String>() ); + return recursiveExpand( str, new ArrayList<String>( ) ); } private String recursiveExpand( String str, List<String> seenExpressions ) @@ -69,7 +68,7 @@ public class DefaultExpressionEvaluator return str; } - if ( this.expressionSources.isEmpty() ) + if ( this.expressionSources.isEmpty( ) ) { throw new EvaluatorException( "Unable to expand expressions with empty ExpressionSource list." ); } @@ -79,7 +78,7 @@ public class DefaultExpressionEvaluator int offset = 0; String expression; String value; - StringBuilder expanded = new StringBuilder(); + StringBuilder expanded = new StringBuilder( ); while ( mat.find( offset ) ) { @@ -111,21 +110,21 @@ public class DefaultExpressionEvaluator if ( expanded.indexOf( "$$" ) >= 0 ) { // Special case for escaped content. - return expanded.toString().replaceAll( "\\$\\$", "\\$" ); + return expanded.toString( ).replaceAll( "\\$\\$", "\\$" ); } else { // return expanded - return expanded.toString(); + return expanded.toString( ); } } private String findValue( String expression ) { - String newExpression = expression.trim(); + String newExpression = expression.trim( ); if ( newExpression.startsWith( "${" ) && newExpression.endsWith( "}" ) ) { - newExpression = newExpression.substring( 2, newExpression.length() - 1 ); + newExpression = newExpression.substring( 2, newExpression.length( ) - 1 ); } if ( StringUtils.isEmpty( newExpression ) ) @@ -134,10 +133,10 @@ public class DefaultExpressionEvaluator } String value = null; - Iterator it = this.expressionSources.iterator(); - while ( it.hasNext() ) + Iterator it = this.expressionSources.iterator( ); + while ( it.hasNext( ) ) { - ExpressionSource source = (ExpressionSource) it.next(); + ExpressionSource source = (ExpressionSource) it.next( ); value = source.getExpressionValue( newExpression ); if ( value != null ) { @@ -147,7 +146,7 @@ public class DefaultExpressionEvaluator return null; } - public List getExpressionSourceList() + public List getExpressionSourceList( ) { return this.expressionSources; } diff --git a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/EvaluatorException.java b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/EvaluatorException.java index b2c68cc..9e73dc3 100644 --- a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/EvaluatorException.java +++ b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/EvaluatorException.java @@ -20,17 +20,16 @@ package org.apache.archiva.components.evaluator; */ /** - * EvaluatorException + * EvaluatorException * * @author <a href="mailto:[email protected]">Joakim Erdfelt</a> - * */ public class EvaluatorException extends Exception { - public EvaluatorException() + public EvaluatorException( ) { - super(); + super( ); } public EvaluatorException( String message, Throwable cause ) diff --git a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/ExpressionEvaluator.java b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/ExpressionEvaluator.java index 0aeae57..620286e 100644 --- a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/ExpressionEvaluator.java +++ b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/ExpressionEvaluator.java @@ -25,7 +25,6 @@ import java.util.List; * ExpressionEvaluator * * @author <a href="mailto:[email protected]">Joakim Erdfelt</a> - * */ public interface ExpressionEvaluator { @@ -51,7 +50,7 @@ public interface ExpressionEvaluator * * @return the list of expression sources. */ - List getExpressionSourceList(); + List getExpressionSourceList( ); /** * Remove a specific expression source. diff --git a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/ExpressionSource.java b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/ExpressionSource.java index 39d15cb..c7072de 100644 --- a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/ExpressionSource.java +++ b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/ExpressionSource.java @@ -23,7 +23,6 @@ package org.apache.archiva.components.evaluator; * ExpressionSource * * @author <a href="mailto:[email protected]">Joakim Erdfelt</a> - * */ public interface ExpressionSource { diff --git a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/sources/PropertiesExpressionSource.java b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/sources/PropertiesExpressionSource.java index 4f157cb..0a7c9b9 100644 --- a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/sources/PropertiesExpressionSource.java +++ b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/sources/PropertiesExpressionSource.java @@ -24,11 +24,9 @@ import org.apache.archiva.components.evaluator.ExpressionSource; import java.util.Properties; /** - * PropertiesExpressionSource + * PropertiesExpressionSource * * @author <a href="mailto:[email protected]">Joakim Erdfelt</a> - * - * */ public class PropertiesExpressionSource implements ExpressionSource @@ -52,7 +50,7 @@ public class PropertiesExpressionSource } } - public Properties getProperties() + public Properties getProperties( ) { return properties; } diff --git a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/sources/SystemPropertyExpressionSource.java b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/sources/SystemPropertyExpressionSource.java index 522c973..c0e8596 100644 --- a/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/sources/SystemPropertyExpressionSource.java +++ b/expression-evaluator/src/main/java/org/apache/archiva/components/evaluator/sources/SystemPropertyExpressionSource.java @@ -22,10 +22,9 @@ package org.apache.archiva.components.evaluator.sources; import org.apache.archiva.components.evaluator.ExpressionSource; /** - * SystemPropertyExpressionSource + * SystemPropertyExpressionSource * * @author <a href="mailto:[email protected]">Joakim Erdfelt</a> - * */ public class SystemPropertyExpressionSource implements ExpressionSource diff --git a/expression-evaluator/src/site/site.xml b/expression-evaluator/src/site/site.xml index c3cfc21..5a23523 100644 --- a/expression-evaluator/src/site/site.xml +++ b/expression-evaluator/src/site/site.xml @@ -18,17 +18,17 @@ ~ under the License. --> -<project name="Expression Evaluator" > +<project name="Expression Evaluator"> - <publishDate format="yyyy-MM-dd" position="none" /> + <publishDate format="yyyy-MM-dd" position="none"/> - <body> - <menu ref="modules" /> - <menu ref="reports" /> - <menu ref="ASF" /> - <breadcrumbs> - <item name="Archiva Components" href="../index.html" /> - <item name="Expression Evaluator" href="index.html" /> - </breadcrumbs> - </body> + <body> + <menu ref="modules"/> + <menu ref="reports"/> + <menu ref="ASF"/> + <breadcrumbs> + <item name="Archiva Components" href="../index.html"/> + <item name="Expression Evaluator" href="index.html"/> + </breadcrumbs> + </body> </project> diff --git a/expression-evaluator/src/test/java/org/apache/archiva/components/evaluator/sources/DefaultExpressionEvaluatorTest.java b/expression-evaluator/src/test/java/org/apache/archiva/components/evaluator/sources/DefaultExpressionEvaluatorTest.java index 423ea6f..5d72a4a 100644 --- a/expression-evaluator/src/test/java/org/apache/archiva/components/evaluator/sources/DefaultExpressionEvaluatorTest.java +++ b/expression-evaluator/src/test/java/org/apache/archiva/components/evaluator/sources/DefaultExpressionEvaluatorTest.java @@ -23,8 +23,6 @@ import junit.framework.TestCase; import org.apache.archiva.components.evaluator.DefaultExpressionEvaluator; import org.apache.archiva.components.evaluator.EvaluatorException; import org.apache.archiva.components.evaluator.ExpressionEvaluator; -import org.apache.archiva.components.evaluator.sources.PropertiesExpressionSource; -import org.apache.archiva.components.evaluator.sources.SystemPropertyExpressionSource; import java.util.Properties; @@ -32,28 +30,27 @@ import java.util.Properties; * DefaultExpressionEvaluatorTest * * @author <a href="mailto:[email protected]">Joakim Erdfelt</a> - * */ public class DefaultExpressionEvaluatorTest extends TestCase { private ExpressionEvaluator evaluator; - protected void setUp() + protected void setUp( ) throws Exception { - super.setUp(); + super.setUp( ); - evaluator = new DefaultExpressionEvaluator(); + evaluator = new DefaultExpressionEvaluator( ); } - public void testSimple() + public void testSimple( ) throws EvaluatorException { - Properties props = new Properties(); + Properties props = new Properties( ); props.setProperty( "fruit", "apple" ); - PropertiesExpressionSource propsSource = new PropertiesExpressionSource(); + PropertiesExpressionSource propsSource = new PropertiesExpressionSource( ); propsSource.setProperties( props ); evaluator.addExpressionSource( propsSource ); @@ -64,13 +61,13 @@ public class DefaultExpressionEvaluatorTest assertEquals( expected, actual ); } - public void testSimpleStartOfLine() + public void testSimpleStartOfLine( ) throws EvaluatorException { - Properties props = new Properties(); + Properties props = new Properties( ); props.setProperty( "fruit", "apple" ); - PropertiesExpressionSource propsSource = new PropertiesExpressionSource(); + PropertiesExpressionSource propsSource = new PropertiesExpressionSource( ); propsSource.setProperties( props ); evaluator.addExpressionSource( propsSource ); @@ -81,13 +78,13 @@ public class DefaultExpressionEvaluatorTest assertEquals( expected, actual ); } - public void testSimpleEndOfLine() + public void testSimpleEndOfLine( ) throws EvaluatorException { - Properties props = new Properties(); + Properties props = new Properties( ); props.setProperty( "fruit", "apple" ); - PropertiesExpressionSource propsSource = new PropertiesExpressionSource(); + PropertiesExpressionSource propsSource = new PropertiesExpressionSource( ); propsSource.setProperties( props ); evaluator.addExpressionSource( propsSource ); @@ -98,10 +95,10 @@ public class DefaultExpressionEvaluatorTest assertEquals( expected, actual ); } - public void testSimpleSystemProperty() + public void testSimpleSystemProperty( ) throws EvaluatorException { - evaluator.addExpressionSource( new SystemPropertyExpressionSource() ); + evaluator.addExpressionSource( new SystemPropertyExpressionSource( ) ); String userHome = System.getProperty( "user.home" ); String expression = "My HOME directory is ${user.home}"; @@ -111,10 +108,10 @@ public class DefaultExpressionEvaluatorTest assertEquals( expected, actual ); } - public void testMultiExpression() + public void testMultiExpression( ) throws EvaluatorException { - evaluator.addExpressionSource( new SystemPropertyExpressionSource() ); + evaluator.addExpressionSource( new SystemPropertyExpressionSource( ) ); String userName = System.getProperty( "user.name" ); String userHome = System.getProperty( "user.home" ); @@ -131,16 +128,16 @@ public class DefaultExpressionEvaluatorTest * <p/> * The result (with the bug) was "2.0.4${prj.ver.suf}" */ - public void testMultiExpressionVersionBug() + public void testMultiExpressionVersionBug( ) throws EvaluatorException { - Properties props = new Properties(); + Properties props = new Properties( ); props.setProperty( "prj.ver.maj", "2" ); props.setProperty( "prj.ver.min", "0" ); props.setProperty( "prj.ver.inc", "4" ); props.setProperty( "prj.ver.suf", "-SNAPSHOT" ); - PropertiesExpressionSource propsSource = new PropertiesExpressionSource(); + PropertiesExpressionSource propsSource = new PropertiesExpressionSource( ); propsSource.setProperties( props ); evaluator.addExpressionSource( propsSource ); @@ -151,10 +148,10 @@ public class DefaultExpressionEvaluatorTest assertEquals( expected, actual ); } - public void testEscaping() + public void testEscaping( ) throws EvaluatorException { - evaluator.addExpressionSource( new SystemPropertyExpressionSource() ); + evaluator.addExpressionSource( new SystemPropertyExpressionSource( ) ); String userName = System.getProperty( "user.name" ); String userHome = System.getProperty( "user.home" ); @@ -165,11 +162,11 @@ public class DefaultExpressionEvaluatorTest assertEquals( expected, actual ); } - public void testRecursiveSimple() + public void testRecursiveSimple( ) throws EvaluatorException { - PropertiesExpressionSource propsource = new PropertiesExpressionSource(); - Properties props = new Properties(); + PropertiesExpressionSource propsource = new PropertiesExpressionSource( ); + Properties props = new Properties( ); // Create intentional recursive lookup. props.setProperty( "main.dir", "${target.dir}/classes" ); @@ -178,7 +175,7 @@ public class DefaultExpressionEvaluatorTest propsource.setProperties( props ); evaluator.addExpressionSource( propsource ); - evaluator.addExpressionSource( new SystemPropertyExpressionSource() ); + evaluator.addExpressionSource( new SystemPropertyExpressionSource( ) ); String expression = "My classes directory is ${main.dir}"; String expected = "My classes directory is ./target/classes"; @@ -187,10 +184,10 @@ public class DefaultExpressionEvaluatorTest assertEquals( expected, actual ); } - public void testRecursiveCycle() + public void testRecursiveCycle( ) { - PropertiesExpressionSource propsource = new PropertiesExpressionSource(); - Properties props = new Properties(); + PropertiesExpressionSource propsource = new PropertiesExpressionSource( ); + Properties props = new Properties( ); // Create intentional recursive lookup. props.setProperty( "main.dir", "${test.dir}/target/classes" ); @@ -199,7 +196,7 @@ public class DefaultExpressionEvaluatorTest propsource.setProperties( props ); evaluator.addExpressionSource( propsource ); - evaluator.addExpressionSource( new SystemPropertyExpressionSource() ); + evaluator.addExpressionSource( new SystemPropertyExpressionSource( ) ); try { diff --git a/graph/src/test/resources/log4j2-test.xml b/graph/src/test/resources/log4j2-test.xml index 8389489..2b7d447 100644 --- a/graph/src/test/resources/log4j2-test.xml +++ b/graph/src/test/resources/log4j2-test.xml @@ -18,19 +18,19 @@ ~ under the License. --> <configuration> - <appenders> - <Console name="console" target="SYSTEM_OUT"> - <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/> - </Console> - </appenders> - <loggers> - <logger name="org.apache.archiva" level="info"/> - <logger name="org.apache.archiva.components.graph" level="info"/> + <appenders> + <Console name="console" target="SYSTEM_OUT"> + <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/> + </Console> + </appenders> + <loggers> + <logger name="org.apache.archiva" level="info"/> + <logger name="org.apache.archiva.components.graph" level="info"/> - <root level="error" includeLocation="true"> - <appender-ref ref="console"/> - </root> - </loggers> + <root level="error" includeLocation="true"> + <appender-ref ref="console"/> + </root> + </loggers> </configuration> diff --git a/pom.xml b/pom.xml index a0c52ba..fb4fd32 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -50,7 +51,7 @@ <module>graph</module> <module>spring-registry</module> <module>spring-cache</module> - </modules> + </modules> <scm> <connection>scm:git:https://github.com/apache/archiva-components.git</connection> @@ -169,9 +170,9 @@ <version>1</version> </dependency> <dependency> - <groupId>javax.annotation</groupId> - <artifactId>javax.annotation-api</artifactId> - <version>${javax.annotation.version}</version> + <groupId>javax.annotation</groupId> + <artifactId>javax.annotation-api</artifactId> + <version>${javax.annotation.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> @@ -210,7 +211,7 @@ <artifactId>junit-vintage-engine</artifactId> <version>${junit.jupiter.version}</version> <scope>test</scope> - </dependency> + </dependency> </dependencies> </dependencyManagement> <dependencies> @@ -221,32 +222,32 @@ <scope>test</scope> </dependency> - <!-- JUNIT 5 --> - <dependency> - <groupId>org.junit.platform</groupId> - <artifactId>junit-platform-launcher</artifactId> - <version>${junit.platform.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.platform</groupId> - <artifactId>junit-platform-console-standalone</artifactId> - <version>${junit.platform.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>${junit.jupiter.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.vintage</groupId> - <artifactId>junit-vintage-engine</artifactId> - <version>${junit.jupiter.version}</version> - <scope>test</scope> - </dependency> - + <!-- JUNIT 5 --> + <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-launcher</artifactId> + <version>${junit.platform.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.platform</groupId> + <artifactId>junit-platform-console-standalone</artifactId> + <version>${junit.platform.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>${junit.jupiter.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + <version>${junit.jupiter.version}</version> + <scope>test</scope> + </dependency> + </dependencies> <build> diff --git a/spring-apacheds/pom.xml b/spring-apacheds/pom.xml index 113fc15..4cfc2fd 100644 --- a/spring-apacheds/pom.xml +++ b/spring-apacheds/pom.xml @@ -17,7 +17,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -44,11 +45,11 @@ <artifactId>apacheds-core</artifactId> <version>${apacheds.version}</version> </dependency> - <dependency> - <groupId>org.apache.directory.server</groupId> - <artifactId>apacheds-core-shared</artifactId> - <version>${apacheds.version}</version> - </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-core-shared</artifactId> + <version>${apacheds.version}</version> + </dependency> <dependency> <groupId>org.apache.directory.server</groupId> <artifactId>apacheds-server-jndi</artifactId> @@ -75,13 +76,12 @@ <version>${apacheds.version}</version> </dependency> <dependency> - <groupId>org.apache.directory.server</groupId> - <artifactId>apacheds-bootstrap-partition</artifactId> - <version>${apacheds.version}</version> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-bootstrap-partition</artifactId> + <version>${apacheds.version}</version> </dependency> - <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> diff --git a/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/ApacheDs.java b/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/ApacheDs.java index a72ef3e..b640416 100644 --- a/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/ApacheDs.java +++ b/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/ApacheDs.java @@ -27,7 +27,6 @@ import java.util.Set; /** * @author <a href="mailto:[email protected]">Trygve Laugstøl</a> - * */ public interface ApacheDs { @@ -40,7 +39,7 @@ public interface ApacheDs void setPort( int port ); - int getPort(); + int getPort( ); void setEnableNetworking( boolean enableNetworking ); @@ -64,24 +63,24 @@ public interface ApacheDs // Server control // ---------------------------------------------------------------------- - void startServer() + void startServer( ) throws Exception; - void stopServer() + void stopServer( ) throws Exception; - void sync() + void sync( ) throws Exception; - boolean isStopped(); + boolean isStopped( ); // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- - InitialDirContext getAdminContext() + InitialDirContext getAdminContext( ) throws NamingException; - InitialDirContext getSystemContext() + InitialDirContext getSystemContext( ) throws NamingException; } diff --git a/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/DefaultApacheDs.java b/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/DefaultApacheDs.java index a1583aa..aa73184 100644 --- a/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/DefaultApacheDs.java +++ b/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/DefaultApacheDs.java @@ -44,13 +44,12 @@ import java.util.Set; /** * @author <a href="mailto:[email protected]">Trygve Laugstøl</a> * @author Olivier Lamy - * */ public class DefaultApacheDs implements ApacheDs { - private Logger logger = LoggerFactory.getLogger( getClass() ); + private Logger logger = LoggerFactory.getLogger( getClass( ) ); // ---------------------------------------------------------------------- // Configuration @@ -72,7 +71,7 @@ public class DefaultApacheDs private MutableServerStartupConfiguration configuration; - private Set partitionConfigurations = new HashSet(); + private Set partitionConfigurations = new HashSet( ); // ---------------------------------------------------------------------- // ApacheDs Implementation @@ -88,13 +87,13 @@ public class DefaultApacheDs this.enableNetworking = enableNetworking; } - public InitialDirContext getAdminContext() + public InitialDirContext getAdminContext( ) throws NamingException { - assertIsStarted(); + assertIsStarted( ); - Hashtable environment = new Hashtable( configuration.toJndiEnvironment() ); - environment.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() ); + Hashtable environment = new Hashtable( configuration.toJndiEnvironment( ) ); + environment.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName( ) ); environment.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" ); environment.put( Context.SECURITY_CREDENTIALS, password ); environment.put( Context.SECURITY_AUTHENTICATION, "simple" ); @@ -102,13 +101,13 @@ public class DefaultApacheDs return new InitialDirContext( environment ); } - public InitialDirContext getSystemContext() + public InitialDirContext getSystemContext( ) throws NamingException { - assertIsStarted(); + assertIsStarted( ); - Hashtable environment = new Hashtable( configuration.toJndiEnvironment() ); - environment.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() ); + Hashtable environment = new Hashtable( configuration.toJndiEnvironment( ) ); + environment.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName( ) ); environment.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" ); environment.put( Context.SECURITY_CREDENTIALS, password ); environment.put( Context.SECURITY_AUTHENTICATION, "simple" ); @@ -119,7 +118,7 @@ public class DefaultApacheDs public void addPartition( String name, String root, Set indexedAttributes, Attributes partitionAttributes ) throws NamingException { - MutablePartitionConfiguration configuration = new MutablePartitionConfiguration(); + MutablePartitionConfiguration configuration = new MutablePartitionConfiguration( ); configuration.setId( name ); configuration.setSuffix( root ); configuration.setIndexedAttributes( indexedAttributes ); @@ -130,12 +129,12 @@ public class DefaultApacheDs public void addPartition( Partition partition ) throws NamingException { - MutablePartitionConfiguration configuration = new MutablePartitionConfiguration(); + MutablePartitionConfiguration configuration = new MutablePartitionConfiguration( ); - configuration.setId( partition.getName() ); - configuration.setSuffix( partition.getSuffix() ); - configuration.setIndexedAttributes( partition.getIndexedAttributes() ); - configuration.setContextEntry( partition.getContextAttributes() ); + configuration.setId( partition.getName( ) ); + configuration.setSuffix( partition.getSuffix( ) ); + configuration.setIndexedAttributes( partition.getIndexedAttributes( ) ); + configuration.setContextEntry( partition.getContextAttributes( ) ); //configuration.setSynchOnWrite( true ); configuration.setCacheSize( 1 ); //configuration.setOptimizerEnabled( false ); @@ -150,7 +149,7 @@ public class DefaultApacheDs throw new NamingException( "Illegal argument, there has to be at least one domain component." ); } - StringBuilder suffix = new StringBuilder(); + StringBuilder suffix = new StringBuilder( ); for ( int i = 0; i < domainComponents.length; i++ ) { @@ -176,11 +175,11 @@ public class DefaultApacheDs objectClass.add( "extensibleObject" ); attributes.put( objectClass ); - Partition partition = new Partition(); + Partition partition = new Partition( ); partition.setName( name ); - partition.setSuffix( suffix.toString() ); + partition.setSuffix( suffix.toString( ) ); partition.setContextAttributes( attributes ); - HashSet set = new HashSet(); + HashSet set = new HashSet( ); set.add( "uid" ); set.add( "cn" ); partition.setIndexedAttributes( set ); @@ -190,45 +189,45 @@ public class DefaultApacheDs return partition; } - public void startServer() + public void startServer( ) throws Exception { logger.info( "Starting Apache Directory Server server." ); - logger.info( "ApacheDS basedir: {}", basedir.getAbsolutePath() ); + logger.info( "ApacheDS basedir: {}", basedir.getAbsolutePath( ) ); File logs = new File( basedir, "logs" ); - if ( !logs.exists() && !logs.mkdirs() ) + if ( !logs.exists( ) && !logs.mkdirs( ) ) { - throw new Exception( "Could not create logs directory: " + logs.getAbsolutePath() ); + throw new Exception( "Could not create logs directory: " + logs.getAbsolutePath( ) ); } - Properties environment = new Properties(); + Properties environment = new Properties( ); environment.setProperty( "java.naming.security.authentication", "simple" ); environment.setProperty( "java.naming.security.principal", "uid=admin,ou=system" ); if ( password != null ) { environment.setProperty( "java.naming.security.credentials", password ); } - MutableServerStartupConfiguration configuration = new MutableServerStartupConfiguration(); + MutableServerStartupConfiguration configuration = new MutableServerStartupConfiguration( ); configuration.setWorkingDirectory( basedir ); configuration.setAllowAnonymousAccess( true ); //configuration.setEnableNtp( false ); //configuration.setEnableKerberos( false ); //configuration.setEnableChangePassword( false ); - LdapConfiguration config = new LdapConfiguration(); + LdapConfiguration config = new LdapConfiguration( ); config.setIpPort( port ); configuration.setLdapConfiguration( config ); configuration.setEnableNetworking( enableNetworking ); configuration.setSynchPeriodMillis( 100 ); - if ( configuration.getPartitionConfigurations() == null || ( configuration.getPartitionConfigurations() != null - && configuration.getPartitionConfigurations().isEmpty() ) ) + if ( configuration.getPartitionConfigurations( ) == null || ( configuration.getPartitionConfigurations( ) != null + && configuration.getPartitionConfigurations( ).isEmpty( ) ) ) { configuration.setPartitionConfigurations( partitionConfigurations ); } - Properties env = new Properties(); + Properties env = new Properties( ); env.setProperty( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" ); if ( password != null ) { @@ -236,8 +235,8 @@ public class DefaultApacheDs } env.setProperty( Context.SECURITY_AUTHENTICATION, "simple" ); env.setProperty( Context.PROVIDER_URL, "ou=system" ); - env.setProperty( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() ); - env.putAll( configuration.toJndiEnvironment() ); + env.setProperty( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName( ) ); + env.putAll( configuration.toJndiEnvironment( ) ); InitialDirContext context = new InitialDirContext( env ); //Attributes inetAttributes = context.getAttributes( "cn=inetorgperson,ou=schema" ); @@ -251,7 +250,7 @@ public class DefaultApacheDs stopped = false; } - public void stopServer() + public void stopServer( ) throws Exception { if ( stopped ) @@ -261,40 +260,40 @@ public class DefaultApacheDs logger.info( "Stopping Apache Directory Server server." ); - sync(); + sync( ); stopped = true; - Hashtable env = new Hashtable(); - env.putAll( new ShutdownConfiguration().toJndiEnvironment() ); + Hashtable env = new Hashtable( ); + env.putAll( new ShutdownConfiguration( ).toJndiEnvironment( ) ); new InitialDirContext( env ); logger.info( "Apache Directory Server server stopped." ); } - public boolean isStopped() + public boolean isStopped( ) { return stopped; } - public void sync() + public void sync( ) throws Exception { logger.info( "Sync'ing Apache Directory Server server." ); - Hashtable env = new Hashtable(); - env.putAll( new SyncConfiguration().toJndiEnvironment() ); + Hashtable env = new Hashtable( ); + env.putAll( new SyncConfiguration( ).toJndiEnvironment( ) ); new InitialDirContext( env ); } - public void stop() + public void stop( ) { try { if ( !stopped ) { - stopServer(); + stopServer( ); } } catch ( Exception e ) @@ -307,7 +306,7 @@ public class DefaultApacheDs // // ---------------------------------------------------------------------- - private void assertIsStarted() + private void assertIsStarted( ) throws NamingException { if ( configuration == null ) @@ -316,7 +315,7 @@ public class DefaultApacheDs } } - public int getPort() + public int getPort( ) { return port; } @@ -326,7 +325,7 @@ public class DefaultApacheDs this.port = port; } - public String getPassword() + public String getPassword( ) { return password; } diff --git a/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/Partition.java b/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/Partition.java index 8932d8d..fae1071 100644 --- a/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/Partition.java +++ b/spring-apacheds/src/main/java/org/apache/archiva/components/apacheds/Partition.java @@ -21,12 +21,11 @@ package org.apache.archiva.components.apacheds; import javax.naming.directory.Attributes; import javax.naming.directory.BasicAttributes; -import java.util.Set; import java.util.HashSet; +import java.util.Set; /** * @author <a href="mailto:[email protected]">Trygve Laugstøl</a> - * */ public class Partition { @@ -38,7 +37,7 @@ public class Partition private Attributes contextAttributes; - public String getName() + public String getName( ) { return name; } @@ -48,7 +47,7 @@ public class Partition this.name = name; } - public String getSuffix() + public String getSuffix( ) { return suffix; } @@ -58,11 +57,11 @@ public class Partition this.suffix = suffix; } - public Set getIndexedAttributes() + public Set getIndexedAttributes( ) { if ( indexedAttributes == null ) { - indexedAttributes = new HashSet(); + indexedAttributes = new HashSet( ); } return indexedAttributes; @@ -73,11 +72,11 @@ public class Partition this.indexedAttributes = indexedAttributes; } - public Attributes getContextAttributes() + public Attributes getContextAttributes( ) { if ( contextAttributes == null ) { - contextAttributes = new BasicAttributes(); + contextAttributes = new BasicAttributes( ); } return contextAttributes; diff --git a/spring-apacheds/src/site/site.xml b/spring-apacheds/src/site/site.xml index 26378ff..b902c45 100644 --- a/spring-apacheds/src/site/site.xml +++ b/spring-apacheds/src/site/site.xml @@ -18,17 +18,17 @@ ~ under the License. --> -<project name="Spring Apacheds Component" > +<project name="Spring Apacheds Component"> - <publishDate format="yyyy-MM-dd" position="none" /> + <publishDate format="yyyy-MM-dd" position="none"/> - <body> - <menu ref="modules" /> - <menu ref="reports" /> - <menu ref="ASF" /> - <breadcrumbs> - <item name="Archiva Components" href="../index.html" /> - <item name="Spring ApacheDs" href="index.html" /> - </breadcrumbs> - </body> + <body> + <menu ref="modules"/> + <menu ref="reports"/> + <menu ref="ASF"/> + <breadcrumbs> + <item name="Archiva Components" href="../index.html"/> + <item name="Spring ApacheDs" href="index.html"/> + </breadcrumbs> + </body> </project> diff --git a/spring-apacheds/src/test/java/org/apache/archiva/components/apacheds/ApacheDsTest.java b/spring-apacheds/src/test/java/org/apache/archiva/components/apacheds/ApacheDsTest.java index 92363a5..073e2d3 100644 --- a/spring-apacheds/src/test/java/org/apache/archiva/components/apacheds/ApacheDsTest.java +++ b/spring-apacheds/src/test/java/org/apache/archiva/components/apacheds/ApacheDsTest.java @@ -21,7 +21,6 @@ package org.apache.archiva.components.apacheds; import junit.framework.TestCase; import org.apache.directory.shared.ldap.util.AttributeUtils; -import org.apache.archiva.components.apacheds.ApacheDs; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; @@ -45,11 +44,10 @@ import java.io.File; /** * @author <a href="mailto:[email protected]">Trygve Laugstøl</a> * @author Olivier Lamy - * */ @RunWith( SpringJUnit4ClassRunner.class ) -@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) +@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml"} ) public class ApacheDsTest extends TestCase { @@ -58,28 +56,27 @@ public class ApacheDsTest @Inject private ApacheDs apacheDs; - private Logger logger = LoggerFactory.getLogger( getClass() ); + private Logger logger = LoggerFactory.getLogger( getClass( ) ); - protected void setUp() + protected void setUp( ) throws Exception { - super.setUp(); + super.setUp( ); - } @Test - public void testBasic() + public void testBasic( ) throws Exception { apacheDs.setBasedir( new File( "./target/plexus-home" ) ); - - apacheDs.addSimplePartition( "test", new String[]{"plexus", "codehaus", "org"} ).getSuffix(); - apacheDs.startServer(); - InitialDirContext context = apacheDs.getAdminContext(); + apacheDs.addSimplePartition( "test", new String[]{"plexus", "codehaus", "org"} ).getSuffix( ); + apacheDs.startServer( ); + + InitialDirContext context = apacheDs.getAdminContext( ); String cn = "trygvis"; createUser( context, cn, createDn( cn ) ); @@ -89,50 +86,49 @@ public class ApacheDsTest createUser( context, cn, createDn( cn ) ); assertExist( context, createDn( cn ), "cn", cn ); - SearchControls ctls = new SearchControls(); + SearchControls ctls = new SearchControls( ); ctls.setDerefLinkFlag( true ); ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE ); - ctls.setReturningAttributes( new String[] { "*" } ); + ctls.setReturningAttributes( new String[]{"*"} ); + + String filter = "(&(objectClass=inetOrgPerson)(cn=trygvis))"; - String filter = "(&(objectClass=inetOrgPerson)(cn=trygvis))"; - NamingEnumeration<SearchResult> results = context.search( suffix, filter, ctls ); - - assertTrue( "a result should have been returned", results.hasMoreElements() ); - - SearchResult result = results.nextElement(); - - Attributes attrs = result.getAttributes(); - - logger.info("Attributes {}", AttributeUtils.toString( attrs ) ); - - assertFalse( "should only have one result returned", results.hasMoreElements() ); - - apacheDs.stopServer(); + assertTrue( "a result should have been returned", results.hasMoreElements( ) ); + + SearchResult result = results.nextElement( ); + + Attributes attrs = result.getAttributes( ); + + logger.info( "Attributes {}", AttributeUtils.toString( attrs ) ); + + assertFalse( "should only have one result returned", results.hasMoreElements( ) ); + + apacheDs.stopServer( ); // ---------------------------------------------------------------------- // Start it again // ---------------------------------------------------------------------- - apacheDs.startServer(); + apacheDs.startServer( ); + + context = apacheDs.getAdminContext( ); - context = apacheDs.getAdminContext(); - assertExist( context, createDn( "trygvis" ), "cn", "trygvis" ); context.unbind( createDn( "trygvis" ) ); assertExist( context, createDn( "bolla" ), "cn", "bolla" ); context.unbind( createDn( "bolla" ) ); - apacheDs.stopServer(); + apacheDs.stopServer( ); } private void createUser( DirContext context, String cn, String dn ) throws NamingException { - Attributes attributes = new BasicAttributes(); + Attributes attributes = new BasicAttributes( ); BasicAttribute objectClass = new BasicAttribute( "objectClass" ); objectClass.add( "top" ); objectClass.add( "inetOrgPerson" ); @@ -150,23 +146,23 @@ public class ApacheDsTest private void assertExist( DirContext context, String dn, String attribute, String value ) throws NamingException { - SearchControls ctls = new SearchControls(); + SearchControls ctls = new SearchControls( ); ctls.setDerefLinkFlag( true ); ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE ); - ctls.setReturningAttributes( new String[] { "*" } ); - - BasicAttributes matchingAttributes = new BasicAttributes(); - matchingAttributes.put( attribute, value ); - - NamingEnumeration<SearchResult> results = context.search( suffix, matchingAttributes ); - //NamingEnumeration<SearchResult> results = context.search( suffix, "(" + attribute + "=" + value + ")", ctls ); - - assertTrue( results.hasMoreElements() ); - SearchResult result = results.nextElement(); - Attributes attrs = result.getAttributes(); - Attribute testAttr = attrs.get( attribute ); - assertEquals( value, testAttr.get() ); - + ctls.setReturningAttributes( new String[]{"*"} ); + + BasicAttributes matchingAttributes = new BasicAttributes( ); + matchingAttributes.put( attribute, value ); + + NamingEnumeration<SearchResult> results = context.search( suffix, matchingAttributes ); + //NamingEnumeration<SearchResult> results = context.search( suffix, "(" + attribute + "=" + value + ")", ctls ); + + assertTrue( results.hasMoreElements( ) ); + SearchResult result = results.nextElement( ); + Attributes attrs = result.getAttributes( ); + Attribute testAttr = attrs.get( attribute ); + assertEquals( value, testAttr.get( ) ); + } } diff --git a/spring-apacheds/src/test/resources/log4j2-test.xml b/spring-apacheds/src/test/resources/log4j2-test.xml index a92f48e..be578fb 100644 --- a/spring-apacheds/src/test/resources/log4j2-test.xml +++ b/spring-apacheds/src/test/resources/log4j2-test.xml @@ -18,19 +18,19 @@ ~ under the License. --> <configuration> - <appenders> - <Console name="console" target="SYSTEM_OUT"> - <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/> - </Console> - </appenders> - <loggers> - <logger name="org.apache.archiva" level="info"/> - <logger name="org.apache.archiva.components.apacheds" level="info" /> + <appenders> + <Console name="console" target="SYSTEM_OUT"> + <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/> + </Console> + </appenders> + <loggers> + <logger name="org.apache.archiva" level="info"/> + <logger name="org.apache.archiva.components.apacheds" level="info"/> - <root level="error" includeLocation="true"> - <appender-ref ref="console"/> - </root> - </loggers> + <root level="error" includeLocation="true"> + <appender-ref ref="console"/> + </root> + </loggers> </configuration> diff --git a/spring-apacheds/src/test/resources/spring-context.xml b/spring-apacheds/src/test/resources/spring-context.xml index dfc99fa..1d8d63e 100755 --- a/spring-apacheds/src/test/resources/spring-context.xml +++ b/spring-apacheds/src/test/resources/spring-context.xml @@ -23,10 +23,10 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> - <bean name="apacheDS" class="org.apache.archiva.components.apacheds.DefaultApacheDs"> - <property name="basedir" value="./target/apacheds"/> - <property name="port" value="10390"/> - <property name="enableNetworking" value="true"/> - <property name="password" value="secret"/> - </bean> -</beans> \ No newline at end of file + <bean name="apacheDS" class="org.apache.archiva.components.apacheds.DefaultApacheDs"> + <property name="basedir" value="./target/apacheds"/> + <property name="port" value="10390"/> + <property name="enableNetworking" value="true"/> + <property name="password" value="secret"/> + </bean> +</beans> diff --git a/spring-cache/spring-cache-api/src/main/resources/META-INF/spring-context.xml b/spring-cache/spring-cache-api/src/main/resources/META-INF/spring-context.xml index 69eff8d..a6d39c9 100644 --- a/spring-cache/spring-cache-api/src/main/resources/META-INF/spring-context.xml +++ b/spring-cache/spring-cache-api/src/main/resources/META-INF/spring-context.xml @@ -26,8 +26,8 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - <context:annotation-config/> - <context:component-scan - base-package="org.apache.archiva.components.cache.builder"/> + <context:annotation-config/> + <context:component-scan + base-package="org.apache.archiva.components.cache.builder"/> -</beans> \ No newline at end of file +</beans> diff --git a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCache.java b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCache.java index 7f3d74c..c114255 100644 --- a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCache.java +++ b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCache.java @@ -43,7 +43,7 @@ import java.nio.file.Path; /** * EhcacheCache * configuration document available <a href="http://www.ehcache.org/documentation/configuration/index">EhcacheUserGuide</a> - * + * <p> * You can use the system property <code>org.apache.archiva.ehcache.diskStore</code> to set the default disk store path. * * @author <a href="mailto:[email protected]">Joakim Erdfelt</a> @@ -129,7 +129,7 @@ public class EhcacheCache<V, T> /** * Location on disk for the ehcache store. */ - private String diskStorePath = System.getProperties().containsKey( EHCACHE_DISK_STORE_PROPERTY ) ? + private String diskStorePath = System.getProperties( ).containsKey( EHCACHE_DISK_STORE_PROPERTY ) ? System.getProperty( EHCACHE_DISK_STORE_PROPERTY ) : System.getProperty( "java.io.tmpdir" ) + "/ehcache-archiva"; @@ -172,7 +172,7 @@ public class EhcacheCache<V, T> */ private int maxElementsOnDisk; - private boolean statisticsEnabled = true; + private boolean statisticsEnabled = true; private Path configurationFile = null; @@ -217,9 +217,11 @@ public class EhcacheCache<V, T> else { Configuration configuration; - if (configurationFile != null && Files.exists( configurationFile) && Files.isReadable( configurationFile )) { + if ( configurationFile != null && Files.exists( configurationFile ) && Files.isReadable( configurationFile ) ) + { configuration = ConfigurationFactory.parseConfiguration( configurationFile.toFile( ) ); - } else + } + else { configuration = new Configuration( ); } @@ -251,11 +253,13 @@ public class EhcacheCache<V, T> getDiskExpiryThreadIntervalSeconds( ) ).overflowToOffHeap( isOverflowToOffHeap( ) ).maxEntriesLocalDisk( getMaxElementsOnDisk( ) ); - cacheConfiguration.addPersistence( new PersistenceConfiguration() ); - if (isDiskPersistent()) + cacheConfiguration.addPersistence( new PersistenceConfiguration( ) ); + if ( isDiskPersistent( ) ) { cacheConfiguration.getPersistenceConfiguration( ).setStrategy( PersistenceConfiguration.Strategy.LOCALTEMPSWAP.name( ) ); - } else { + } + else + { cacheConfiguration.getPersistenceConfiguration( ).setStrategy( PersistenceConfiguration.Strategy.NONE.name( ) ); } @@ -380,8 +384,8 @@ public class EhcacheCache<V, T> } /** - * @deprecated This flag is ignored. The persistence strategy is always overflow to disk, if on. * @return true, or false + * @deprecated This flag is ignored. The persistence strategy is always overflow to disk, if on. */ public boolean isOverflowToDisk( ) { @@ -470,8 +474,8 @@ public class EhcacheCache<V, T> } /** - * @deprecated This flag is ignored. The persistence strategy is always overflow to disk, if on. * @param overflowToDisk true, or false + * @deprecated This flag is ignored. The persistence strategy is always overflow to disk, if on. */ public void setOverflowToDisk( boolean overflowToDisk ) { @@ -579,6 +583,7 @@ public class EhcacheCache<V, T> /** * Returns the path to the configuration file or <code>null</code>, if not set. + * * @return the path of the configuration file or <code>null</code> */ public Path getConfigurationFile( ) diff --git a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCreator.java b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCreator.java index d0cd773..af521a9 100644 --- a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCreator.java +++ b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCreator.java @@ -52,13 +52,13 @@ public class EhcacheCreator if ( hints.getDiskOverflowPath( ) != null ) { - overflowPath = hints.getDiskOverflowPath( ).toPath(); + overflowPath = hints.getDiskOverflowPath( ).toPath( ); } else { try { - overflowPath = Files.createTempDirectory( "ehcache-archiva-"+hints.getName()); + overflowPath = Files.createTempDirectory( "ehcache-archiva-" + hints.getName( ) ); } catch ( IOException e ) { @@ -66,7 +66,7 @@ public class EhcacheCreator } } - cache.setDiskStorePath( overflowPath.toAbsolutePath( ).toString() ); + cache.setDiskStorePath( overflowPath.toAbsolutePath( ).toString( ) ); } cache.setMaxElementsInMemory( hints.getMaxElements( ) ); diff --git a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/spring-context.xml b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/spring-context.xml index 21e14d1..b3c52f1 100644 --- a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/spring-context.xml +++ b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/resources/META-INF/spring-context.xml @@ -27,8 +27,8 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true"> - <context:annotation-config/> - <context:component-scan - base-package="org.apache.archiva.components.cache.ehcache"/> + <context:annotation-config/> + <context:component-scan + base-package="org.apache.archiva.components.cache.ehcache"/> -</beans> \ No newline at end of file +</beans> diff --git a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/log4j2-test.xml b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/log4j2-test.xml index a80d159..ab778b6 100644 --- a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/log4j2-test.xml +++ b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/log4j2-test.xml @@ -18,19 +18,19 @@ ~ under the License. --> <configuration> - <appenders> - <Console name="console" target="SYSTEM_OUT"> - <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/> - </Console> - </appenders> - <loggers> - <logger name="org.apache.archiva" level="warn"/> - <logger name="org.apache.archiva.components.cache" level="info"/> + <appenders> + <Console name="console" target="SYSTEM_OUT"> + <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/> + </Console> + </appenders> + <loggers> + <logger name="org.apache.archiva" level="warn"/> + <logger name="org.apache.archiva.components.cache" level="info"/> - <root level="error" includeLocation="true"> - <appender-ref ref="console"/> - </root> - </loggers> + <root level="error" includeLocation="true"> + <appender-ref ref="console"/> + </root> + </loggers> </configuration> diff --git a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml index c045289..ecd9d17 100644 --- a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml +++ b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml @@ -24,19 +24,19 @@ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - <bean name="cache#test-cache-int-disk" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> - <property name="diskExpiryThreadIntervalSeconds" value="600"/> - <property name="diskPersistent" value="true"/> - <property name="diskStorePath" value="./target/ehcache-test-store-disk-int"/> - <property name="eternal" value="true"/> - <!--property name="maxElementsInMemory" value="1"/--> - <property name="memoryEvictionPolicy" value="LRU"/> - <property name="name" value="test-cache-int-disk"/> - <property name="overflowToDisk" value="true"/> - <property name="timeToIdleSeconds" value="6000"/> - <property name="timeToLiveSeconds" value="3000"/> - <property name="maxElementsOnDisk" value="10000"/> - <property name="maxBytesLocalHeap" value="1"/> - </bean> + <bean name="cache#test-cache-int-disk" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> + <property name="diskExpiryThreadIntervalSeconds" value="600"/> + <property name="diskPersistent" value="true"/> + <property name="diskStorePath" value="./target/ehcache-test-store-disk-int"/> + <property name="eternal" value="true"/> + <!--property name="maxElementsInMemory" value="1"/--> + <property name="memoryEvictionPolicy" value="LRU"/> + <property name="name" value="test-cache-int-disk"/> + <property name="overflowToDisk" value="true"/> + <property name="timeToIdleSeconds" value="6000"/> + <property name="timeToLiveSeconds" value="3000"/> + <property name="maxElementsOnDisk" value="10000"/> + <property name="maxBytesLocalHeap" value="1"/> + </bean> -</beans> \ No newline at end of file +</beans> diff --git a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context.xml b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context.xml index 2e2b659..688d09d 100644 --- a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context.xml +++ b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context.xml @@ -24,69 +24,69 @@ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - <bean name="cache#ehcache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> - <property name="diskExpiryThreadIntervalSeconds" value="600"/> - <property name="diskPersistent" value="false"/> - <property name="diskStorePath" value="./target/ehcache-test-store"/> - <property name="eternal" value="false"/> - <property name="maxElementsInMemory" value="1000"/> - <property name="memoryEvictionPolicy" value="LRU"/> - <property name="name" value="test-cache"/> - <property name="overflowToDisk" value="false"/> - <property name="timeToIdleSeconds" value="600"/> - <property name="timeToLiveSeconds" value="300"/> - </bean> + <bean name="cache#ehcache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> + <property name="diskExpiryThreadIntervalSeconds" value="600"/> + <property name="diskPersistent" value="false"/> + <property name="diskStorePath" value="./target/ehcache-test-store"/> + <property name="eternal" value="false"/> + <property name="maxElementsInMemory" value="1000"/> + <property name="memoryEvictionPolicy" value="LRU"/> + <property name="name" value="test-cache"/> + <property name="overflowToDisk" value="false"/> + <property name="timeToIdleSeconds" value="600"/> + <property name="timeToLiveSeconds" value="300"/> + </bean> - <bean name="cache#alwaysrefresh" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> - <property name="diskExpiryThreadIntervalSeconds" value="600"/> - <property name="diskPersistent" value="false"/> - <property name="diskStorePath" value="./target/ehcache-test-store"/> - <property name="eternal" value="false"/> - <property name="maxElementsInMemory" value="1000"/> - <property name="memoryEvictionPolicy" value="LRU"/> - <property name="name" value="alwaysrefresh"/> - <property name="overflowToDisk" value="false"/> - <property name="timeToIdleSeconds" value="0"/> - <property name="timeToLiveSeconds" value="1"/> - </bean> + <bean name="cache#alwaysrefresh" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> + <property name="diskExpiryThreadIntervalSeconds" value="600"/> + <property name="diskPersistent" value="false"/> + <property name="diskStorePath" value="./target/ehcache-test-store"/> + <property name="eternal" value="false"/> + <property name="maxElementsInMemory" value="1000"/> + <property name="memoryEvictionPolicy" value="LRU"/> + <property name="name" value="alwaysrefresh"/> + <property name="overflowToDisk" value="false"/> + <property name="timeToIdleSeconds" value="0"/> + <property name="timeToLiveSeconds" value="1"/> + </bean> - <bean name="cache#neverrefresh" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> - <property name="diskExpiryThreadIntervalSeconds" value="600"/> - <property name="diskPersistent" value="false"/> - <property name="diskStorePath" value="./target/ehcache-test-store"/> - <property name="eternal" value="true"/> - <property name="maxElementsInMemory" value="1000"/> - <property name="memoryEvictionPolicy" value="LRU"/> - <property name="name" value="neverrefresh"/> - <property name="overflowToDisk" value="false"/> - <property name="timeToIdleSeconds" value="0"/> - <property name="timeToLiveSeconds" value="0"/> - </bean> + <bean name="cache#neverrefresh" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> + <property name="diskExpiryThreadIntervalSeconds" value="600"/> + <property name="diskPersistent" value="false"/> + <property name="diskStorePath" value="./target/ehcache-test-store"/> + <property name="eternal" value="true"/> + <property name="maxElementsInMemory" value="1000"/> + <property name="memoryEvictionPolicy" value="LRU"/> + <property name="name" value="neverrefresh"/> + <property name="overflowToDisk" value="false"/> + <property name="timeToIdleSeconds" value="0"/> + <property name="timeToLiveSeconds" value="0"/> + </bean> - <bean name="cache#onesecondrefresh" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> - <property name="diskExpiryThreadIntervalSeconds" value="600"/> - <property name="diskPersistent" value="false"/> - <property name="diskStorePath" value="./target/ehcache-test-store"/> - <property name="eternal" value="false"/> - <property name="maxElementsInMemory" value="1000"/> - <property name="memoryEvictionPolicy" value="LRU"/> - <property name="name" value="onesecondrefresh"/> - <property name="overflowToDisk" value="false"/> - <property name="timeToIdleSeconds" value="1"/> - <property name="timeToLiveSeconds" value="1"/> - </bean> + <bean name="cache#onesecondrefresh" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> + <property name="diskExpiryThreadIntervalSeconds" value="600"/> + <property name="diskPersistent" value="false"/> + <property name="diskStorePath" value="./target/ehcache-test-store"/> + <property name="eternal" value="false"/> + <property name="maxElementsInMemory" value="1000"/> + <property name="memoryEvictionPolicy" value="LRU"/> + <property name="name" value="onesecondrefresh"/> + <property name="overflowToDisk" value="false"/> + <property name="timeToIdleSeconds" value="1"/> + <property name="timeToLiveSeconds" value="1"/> + </bean> - <bean name="cache#twosecondrefresh" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> - <property name="diskExpiryThreadIntervalSeconds" value="600"/> - <property name="diskPersistent" value="false"/> - <property name="diskStorePath" value="./target/ehcache-test-store"/> - <property name="eternal" value="false"/> - <property name="maxElementsInMemory" value="1000"/> - <property name="memoryEvictionPolicy" value="LRU"/> - <property name="name" value="onesecondrefresh"/> - <property name="overflowToDisk" value="false"/> - <property name="timeToIdleSeconds" value="2"/> - <property name="timeToLiveSeconds" value="2"/> - </bean> + <bean name="cache#twosecondrefresh" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"> + <property name="diskExpiryThreadIntervalSeconds" value="600"/> + <property name="diskPersistent" value="false"/> + <property name="diskStorePath" value="./target/ehcache-test-store"/> + <property name="eternal" value="false"/> + <property name="maxElementsInMemory" value="1000"/> + <property name="memoryEvictionPolicy" value="LRU"/> + <property name="name" value="onesecondrefresh"/> + <property name="overflowToDisk" value="false"/> + <property name="timeToIdleSeconds" value="2"/> + <property name="timeToLiveSeconds" value="2"/> + </bean> -</beans> \ No newline at end of file +</beans> diff --git a/spring-cache/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/spring-context.xml b/spring-cache/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/spring-context.xml index 7fdf4f0..95552b1 100644 --- a/spring-cache/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/spring-context.xml +++ b/spring-cache/spring-cache-providers/spring-cache-hashmap/src/main/resources/META-INF/spring-context.xml @@ -26,8 +26,8 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - <context:annotation-config/> - <context:component-scan - base-package="org.apache.archiva.components.cache.hashmap"/> + <context:annotation-config/> + <context:component-scan + base-package="org.apache.archiva.components.cache.hashmap"/> -</beans> \ No newline at end of file +</beans> diff --git a/spring-cache/spring-cache-providers/spring-cache-hashmap/src/test/resources/log4j2-test.xml b/spring-cache/spring-cache-providers/spring-cache-hashmap/src/test/resources/log4j2-test.xml index a80d159..ab778b6 100644 --- a/spring-cache/spring-cache-providers/spring-cache-hashmap/src/test/resources/log4j2-test.xml +++ b/spring-cache/spring-cache-providers/spring-cache-hashmap/src/test/resources/log4j2-test.xml @@ -18,19 +18,19 @@ ~ under the License. --> <configuration> - <appenders> - <Console name="console" target="SYSTEM_OUT"> - <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/> - </Console> - </appenders> - <loggers> - <logger name="org.apache.archiva" level="warn"/> - <logger name="org.apache.archiva.components.cache" level="info"/> + <appenders> + <Console name="console" target="SYSTEM_OUT"> + <PatternLayout pattern="[%t] %-5p %c %x - %m%n"/> + </Console> + </appenders> + <loggers> + <logger name="org.apache.archiva" level="warn"/> + <logger name="org.apache.archiva.components.cache" level="info"/> - <root level="error" includeLocation="true"> - <appender-ref ref="console"/> - </root> - </loggers> + <root level="error" includeLocation="true"> + <appender-ref ref="console"/> + </root> + </loggers> </configuration> diff --git a/spring-cache/spring-cache-providers/spring-cache-hashmap/src/test/resources/spring-context.xml b/spring-cache/spring-cache-providers/spring-cache-hashmap/src/test/resources/spring-context.xml index a64550c..94ca0d5 100644 --- a/spring-cache/spring-cache-providers/spring-cache-hashmap/src/test/resources/spring-context.xml +++ b/spring-cache/spring-cache-providers/spring-cache-hashmap/src/test/resources/spring-context.xml @@ -24,34 +24,34 @@ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - <bean name="cache#hashmap" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> - <property name="cacheHitRatio" value="1.0"/> - <property name="cacheMaxSize" value="0"/> - <property name="refreshTime" value="0"/> - </bean> - - <bean name="cache#never" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> - <property name="cacheHitRatio" value="1.0"/> - <property name="cacheMaxSize" value="0"/> - <property name="refreshTime" value="0"/> - </bean> - - <bean name="cache#alwaysrefresh" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> - <property name="cacheHitRatio" value="1.0"/> - <property name="cacheMaxSize" value="0"/> - <property name="refreshTime" value="-1"/> - </bean> - - <bean name="cache#onesecondrefresh" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> - <property name="cacheHitRatio" value="1.0"/> - <property name="cacheMaxSize" value="0"/> - <property name="refreshTime" value="1"/> - </bean> - - <bean name="cache#twosecondrefresh" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> - <property name="cacheHitRatio" value="1.0"/> - <property name="cacheMaxSize" value="0"/> - <property name="refreshTime" value="2"/> - </bean> - -</beans> \ No newline at end of file + <bean name="cache#hashmap" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> + <property name="cacheHitRatio" value="1.0"/> + <property name="cacheMaxSize" value="0"/> + <property name="refreshTime" value="0"/> + </bean> + + <bean name="cache#never" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> + <property name="cacheHitRatio" value="1.0"/> + <property name="cacheMaxSize" value="0"/> + <property name="refreshTime" value="0"/> + </bean> + + <bean name="cache#alwaysrefresh" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> + <property name="cacheHitRatio" value="1.0"/> + <property name="cacheMaxSize" value="0"/> + <property name="refreshTime" value="-1"/> + </bean> + + <bean name="cache#onesecondrefresh" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> + <property name="cacheHitRatio" value="1.0"/> + <property name="cacheMaxSize" value="0"/> + <property name="refreshTime" value="1"/> + </bean> + + <bean name="cache#twosecondrefresh" class="org.apache.archiva.components.cache.hashmap.HashMapCache"> + <property name="cacheHitRatio" value="1.0"/> + <property name="cacheMaxSize" value="0"/> + <property name="refreshTime" value="2"/> + </bean> + +</beans> diff --git a/spring-cache/spring-cache-providers/src/site/site.xml b/spring-cache/spring-cache-providers/src/site/site.xml index c89abf2..7dcb278 100644 --- a/spring-cache/spring-cache-providers/src/site/site.xml +++ b/spring-cache/spring-cache-providers/src/site/site.xml @@ -19,10 +19,10 @@ --> <project name="Spring Cache Component"> - <publishDate format="dd MMM yyyy" position="none"/> - <version position="left"/> - <body> - <menu ref="parent"/> - <menu ref="modules"/> - </body> + <publishDate format="dd MMM yyyy" position="none"/> + <version position="left"/> + <body> + <menu ref="parent"/> + <menu ref="modules"/> + </body> </project> diff --git a/spring-cache/spring-cache-test/src/main/resources/META-INF/spring-context.xml b/spring-cache/spring-cache-test/src/main/resources/META-INF/spring-context.xml index a813355..d2c22f9 100644 --- a/spring-cache/spring-cache-test/src/main/resources/META-INF/spring-context.xml +++ b/spring-cache/spring-cache-test/src/main/resources/META-INF/spring-context.xml @@ -26,8 +26,8 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> - <context:annotation-config/> - <context:component-scan - base-package="org.apache.archiva.components.cache.test.examples.wine"/> + <context:annotation-config/> + <context:component-scan + base-package="org.apache.archiva.components.cache.test.examples.wine"/> -</beans> \ No newline at end of file +</beans> diff --git a/spring-cache/src/site/site.xml b/spring-cache/src/site/site.xml index 59fc9e7..adf5f99 100644 --- a/spring-cache/src/site/site.xml +++ b/spring-cache/src/site/site.xml @@ -20,15 +20,15 @@ <project name="Spring Cache Component"> - <publishDate format="yyyy-MM-dd" position="none"/> + <publishDate format="yyyy-MM-dd" position="none"/> - <body> - <menu ref="modules"/> - <menu ref="reports"/> - <menu ref="ASF"/> - <breadcrumbs> - <item name="Redback Components" href="../index.html"/> - <item name="Spring Cache" href="index.html"/> - </breadcrumbs> - </body> + <body> + <menu ref="modules"/> + <menu ref="reports"/> + <menu ref="ASF"/> + <breadcrumbs> + <item name="Redback Components" href="../index.html"/> + <item name="Spring Cache" href="index.html"/> + </breadcrumbs> + </body> </project> diff --git a/spring-registry/pom.xml b/spring-registry/pom.xml index 671d680..cac3926 100644 --- a/spring-registry/pom.xml +++ b/spring-registry/pom.xml @@ -14,12 +14,13 @@ ~ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupId>org.apache.archiva.components</groupId> <artifactId>archiva-components</artifactId> <version>3.0-SNAPSHOT</version> - </parent> + </parent> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.archiva.components.registry</groupId> <artifactId>archiva-components-spring-registry</artifactId> @@ -113,19 +114,19 @@ <reporting> <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jxr-plugin</artifactId> - <reportSets> - <reportSet> - <id>aggregate</id> - <inherited>false</inherited> - <reports> - <report>aggregate</report> - </reports> - </reportSet> - </reportSets> - </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jxr-plugin</artifactId> + <reportSets> + <reportSet> + <id>aggregate</id> + <inherited>false</inherited> + <reports> + <report>aggregate</report> + </reports> + </reportSet> + </reportSets> + </plugin> </plugins> </reporting> diff --git a/spring-registry/spring-registry-api/pom.xml b/spring-registry/spring-registry-api/pom.xml index 8f61718..09237ca 100644 --- a/spring-registry/spring-registry-api/pom.xml +++ b/spring-registry/spring-registry-api/pom.xml @@ -17,7 +17,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/spring-registry/spring-registry-api/src/main/java/org/apache/archiva/components/registry/Registry.java b/spring-registry/spring-registry-api/src/main/java/org/apache/archiva/components/registry/Registry.java index 2be4b3c..9291b99 100644 --- a/spring-registry/spring-registry-api/src/main/java/org/apache/archiva/components/registry/Registry.java +++ b/spring-registry/spring-registry-api/src/main/java/org/apache/archiva/components/registry/Registry.java @@ -37,7 +37,7 @@ public interface Registry * * @return the registry contents */ - String dump(); + String dump( ); /** * Get a string value from the registry. If not found, <code>null</code> is returned. @@ -69,8 +69,7 @@ public interface Registry * * @param key the key in the registry * @return the value - * @throws java.util.NoSuchElementException - * if the key is not found + * @throws java.util.NoSuchElementException if the key is not found */ int getInt( String key ); @@ -96,8 +95,7 @@ public interface Registry * * @param key the key in the registry * @return the value - * @throws java.util.NoSuchElementException - * if the key is not found + * @throws java.util.NoSuchElementException if the key is not found */ boolean getBoolean( String key ); @@ -161,7 +159,7 @@ public interface Registry * * @return whether the registry contains any elements */ - boolean isEmpty(); + boolean isEmpty( ); /** * Get a list of strings at the given key in the registry. @@ -211,7 +209,7 @@ public interface Registry * @throws RegistryException if there was a problem saving the registry * @throws UnsupportedOperationException if the registry is not writable */ - void save() + void save( ) throws RegistryException, UnsupportedOperationException; /** @@ -235,14 +233,15 @@ public interface Registry * * @return the set of keys */ - Collection<String> getKeys(); + Collection<String> getKeys( ); /** * Get all the keys in this registry. - * @since 2.1 + * * @return the set of keys + * @since 2.1 */ - Collection<String> getFullKeys(); + Collection<String> getFullKeys( ); /** * Remove a keyed element from the registry. @@ -258,5 +257,5 @@ public interface Registry */ void removeSubset( String key ); - void initialize() throws RegistryException; + void initialize( ) throws RegistryException; } diff --git a/spring-registry/spring-registry-commons/pom.xml b/spring-registry/spring-registry-commons/pom.xml index a163fba..a56ef68 100644 --- a/spring-registry/spring-registry-commons/pom.xml +++ b/spring-registry/spring-registry-commons/pom.xml @@ -17,7 +17,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/CommonsConfigurationRegistry.java b/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/CommonsConfigurationRegistry.java index 6894541..6602f1d 100644 --- a/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/CommonsConfigurationRegistry.java +++ b/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/CommonsConfigurationRegistry.java @@ -22,7 +22,6 @@ package org.apache.archiva.components.registry.commons; import org.apache.archiva.components.registry.Registry; import org.apache.archiva.components.registry.RegistryException; import org.apache.archiva.components.registry.RegistryListener; -import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.CombinedConfiguration; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; @@ -34,7 +33,6 @@ import org.apache.commons.configuration.XMLConfiguration; import org.apache.commons.configuration.event.EventSource; import org.apache.commons.configuration.tree.DefaultExpressionEngine; import org.apache.commons.lang3.StringUtils; - import org.apache.commons.text.StringSubstitutor; import org.apache.commons.text.lookup.StringLookupFactory; import org.slf4j.Logger; @@ -328,7 +326,8 @@ public class CommonsConfigurationRegistry public void addConfigurationFromResource( String resource, String prefix ) throws RegistryException { - if (!(this.configuration instanceof CombinedConfiguration)) { + if ( !( this.configuration instanceof CombinedConfiguration ) ) + { throw new RegistryException( "This is not a combined configuration so cannot add resource" ); } CombinedConfiguration configuration = (CombinedConfiguration) this.configuration; diff --git a/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/ConfigurationListenerDelegate.java b/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/ConfigurationListenerDelegate.java index e0847f0..4320eab 100644 --- a/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/ConfigurationListenerDelegate.java +++ b/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/ConfigurationListenerDelegate.java @@ -49,30 +49,30 @@ public class ConfigurationListenerDelegate public void configurationChanged( ConfigurationEvent event ) { - if ( event.getPropertyName() != null ) + if ( event.getPropertyName( ) != null ) { - if ( event.isBeforeUpdate() ) + if ( event.isBeforeUpdate( ) ) { - listener.beforeConfigurationChange( registry, event.getPropertyName(), event.getPropertyValue() ); + listener.beforeConfigurationChange( registry, event.getPropertyName( ), event.getPropertyValue( ) ); } else { - listener.afterConfigurationChange( registry, event.getPropertyName(), event.getPropertyValue() ); + listener.afterConfigurationChange( registry, event.getPropertyName( ), event.getPropertyValue( ) ); } } } // needed to be sure elements are properly removed from the listeners list @Override - public int hashCode() + public int hashCode( ) { - return this.listener.hashCode(); + return this.listener.hashCode( ); } @Override public boolean equals( Object obj ) { - if ( ConfigurationListenerDelegate.class.isAssignableFrom( obj.getClass() ) ) + if ( ConfigurationListenerDelegate.class.isAssignableFrom( obj.getClass( ) ) ) { ConfigurationListenerDelegate delegate = ConfigurationListenerDelegate.class.cast( obj ); return delegate.listener == this.listener; diff --git a/spring-registry/spring-registry-commons/src/main/resources/META-INF/spring-context.xml b/spring-registry/spring-registry-commons/src/main/resources/META-INF/spring-context.xml index b624dac..290bf62 100644 --- a/spring-registry/spring-registry-commons/src/main/resources/META-INF/spring-context.xml +++ b/spring-registry/spring-registry-commons/src/main/resources/META-INF/spring-context.xml @@ -27,9 +27,9 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true"> - <context:annotation-config /> - <context:component-scan - base-package="org.apache.archiva.components.registry.commons"/> + <context:annotation-config/> + <context:component-scan + base-package="org.apache.archiva.components.registry.commons"/> + - </beans> diff --git a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/AbstractRegistryTest.java b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/AbstractRegistryTest.java index daf07db..8c57fe7 100644 --- a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/AbstractRegistryTest.java +++ b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/AbstractRegistryTest.java @@ -32,11 +32,10 @@ import java.util.NoSuchElementException; /** * @author Olivier Lamy - * * @since 8 feb. 07 */ @RunWith( value = SpringJUnit4ClassRunner.class ) -@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) +@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml"} ) public abstract class AbstractRegistryTest extends TestCase { @@ -44,35 +43,35 @@ public abstract class AbstractRegistryTest @Inject protected ApplicationContext applicationContext; - public abstract String getRoleHint(); + public abstract String getRoleHint( ); - public Registry getRegistry() + public Registry getRegistry( ) throws Exception { - return getRegistry( getRoleHint() ); + return getRegistry( getRoleHint( ) ); } public Registry getRegistry( String name ) throws Exception { Registry registry = applicationContext.getBean( name, Registry.class ); - registry.initialize(); + registry.initialize( ); return registry; } @Test - public void testInt() + public void testInt( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); assertEquals( "not 2 ", 2, registry.getInt( "two" ) ); } @Test - public void testIntUnknown() + public void testIntUnknown( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); try { registry.getInt( "unknown" ); @@ -85,36 +84,36 @@ public abstract class AbstractRegistryTest } @Test - public void testString() + public void testString( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); assertEquals( "not foo ", "foo", registry.getString( "string" ) ); } @Test - public void testStringUnknown() + public void testStringUnknown( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); String value = registry.getString( "unknown" ); assertNull( "unknow not null", value ); } @Test - public void testBoolean() + public void testBoolean( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); assertEquals( "not true ", true, registry.getBoolean( "boolean" ) ); } @Test - public void testBooleanUnknown() + public void testBooleanUnknown( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); try { registry.getBoolean( "unknown" ); @@ -127,62 +126,62 @@ public abstract class AbstractRegistryTest } @Test - public void testIsNotEmpty() + public void testIsNotEmpty( ) throws Exception { - assertFalse( getRegistry().isEmpty() ); + assertFalse( getRegistry( ).isEmpty( ) ); } @Test - public void testGetSubRegistry() + public void testGetSubRegistry( ) throws Exception { - assertNotNull( getRegistry().getSubset( "subOne" ) ); + assertNotNull( getRegistry( ).getSubset( "subOne" ) ); } @Test - public void testgetSubsetValues() + public void testgetSubsetValues( ) throws Exception { - Registry sub = getRegistry().getSubset( "subOne" ); + Registry sub = getRegistry( ).getSubset( "subOne" ); assertNotNull( sub ); assertEquals( "entryOne", sub.getString( "firstEntry" ) ); assertEquals( "entryTwo", sub.getString( "secondEntry" ) ); } @Test - public void testgetSubsetEmpty() + public void testgetSubsetEmpty( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); assertNotNull( registry.getSubset( "none" ) ); - assertTrue( registry.getSubset( "none" ).isEmpty() ); + assertTrue( registry.getSubset( "none" ).isEmpty( ) ); } @Test - public void testSetBoolean() + public void testSetBoolean( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); registry.setBoolean( "keyTrue", true ); assertTrue( registry.getBoolean( "keyTrue" ) ); } @Test - public void testSetInt() + public void testSetInt( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); registry.setInt( "keyInt", 3 ); assertEquals( 3, registry.getInt( "keyInt" ) ); } @Test - public void testSetString() + public void testSetString( ) throws Exception { - Registry registry = getRegistry(); + Registry registry = getRegistry( ); registry.setString( "what", "zorglub" ); assertEquals( "zorglub", registry.getString( "what" ) ); } diff --git a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/CommonsConfigurationRegistryTest.java b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/CommonsConfigurationRegistryTest.java index bab97f3..b6ccc0e 100644 --- a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/CommonsConfigurationRegistryTest.java +++ b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/CommonsConfigurationRegistryTest.java @@ -44,54 +44,54 @@ public class CommonsConfigurationRegistryTest { private Registry registry; - private final Logger logger = LoggerFactory.getLogger( getClass() ); + private final Logger logger = LoggerFactory.getLogger( getClass( ) ); private static final int INT_TEST_VALUE = 8080; - public String getRoleHint() + public String getRoleHint( ) { return "builder"; } @Test - public void testDefaultConfiguration() + public void testDefaultConfiguration( ) throws Exception { registry = getRegistry( "default" ); assertEquals( "Check system property override", System.getProperty( "user.dir" ), - registry.getString( "user.dir" ) ); + registry.getString( "user.dir" ) ); assertEquals( "Check system property", System.getProperty( "user.home" ), registry.getString( "user.home" ) ); assertNull( "Check other properties are not loaded", registry.getString( "test.value" ) ); } @Test - public void testBuilderConfiguration() + public void testBuilderConfiguration( ) throws Exception { registry = getRegistry( "builder" ); assertEquals( "Check system property override", "new user dir", registry.getString( "user.dir" ) ); assertEquals( "Check system property default", System.getProperty( "user.home" ), - registry.getString( "user.home" ) ); + registry.getString( "user.home" ) ); assertEquals( "Check other properties are loaded", "foo", registry.getString( "test.value" ) ); assertEquals( "Check other properties are loaded", 1, registry.getInt( "test.number" ) ); assertTrue( "Check other properties are loaded", registry.getBoolean( "test.boolean" ) ); } @Test - public void testDump() + public void testDump( ) throws Exception { registry = getRegistry( "default" ); - String dump = registry.dump(); + String dump = registry.dump( ); assertTrue( dump.startsWith( "Configuration Dump.\n\"" ) ); } @Test - public void testDefaults() + public void testDefaults( ) throws Exception { registry = getRegistry( "builder" ); @@ -102,7 +102,7 @@ public class CommonsConfigurationRegistryTest try { registry.getInt( "foo" ); - fail(); + fail( ); } catch ( NoSuchElementException e ) { @@ -114,7 +114,7 @@ public class CommonsConfigurationRegistryTest try { registry.getBoolean( "foo" ); - fail(); + fail( ); } catch ( NoSuchElementException e ) { @@ -125,20 +125,20 @@ public class CommonsConfigurationRegistryTest } @Test - public void testInterpolation() + public void testInterpolation( ) throws Exception { registry = getRegistry( "builder" ); assertEquals( "Check system property interpolation", System.getProperty( "user.home" ) + "/.m2/repository", - registry.getString( "repository" ) ); + registry.getString( "repository" ) ); assertEquals( "Check configuration value interpolation", "foo/bar", - registry.getString( "test.interpolation" ) ); + registry.getString( "test.interpolation" ) ); } @Test - public void testAddConfigurationXmlFile() + public void testAddConfigurationXmlFile( ) throws Exception { registry = getRegistry( "default" ); @@ -146,12 +146,12 @@ public class CommonsConfigurationRegistryTest registry.addConfigurationFromFile( new File( "./src/test/resources/org/codehaus/plexus/registry/test.xml" ) ); assertEquals( "Check system property default", System.getProperty( "user.dir" ), - registry.getString( "user.dir" ) ); + registry.getString( "user.dir" ) ); assertEquals( "Check other properties are loaded", "foo", registry.getString( "test.value" ) ); } @Test - public void testAddConfigurationPropertiesFile() + public void testAddConfigurationPropertiesFile( ) throws Exception { registry = getRegistry( "default" ); @@ -160,13 +160,13 @@ public class CommonsConfigurationRegistryTest new File( "./src/test/resources/org/codehaus/plexus/registry/test.properties" ) ); assertEquals( "Check system property default", System.getProperty( "user.dir" ), - registry.getString( "user.dir" ) ); + registry.getString( "user.dir" ) ); assertEquals( "Check other properties are loaded", "baz", registry.getString( "foo.bar" ) ); assertNull( "Check other properties are not loaded", registry.getString( "test.value" ) ); } @Test - public void testAddConfigurationXmlResource() + public void testAddConfigurationXmlResource( ) throws Exception { registry = getRegistry( "default" ); @@ -174,12 +174,12 @@ public class CommonsConfigurationRegistryTest registry.addConfigurationFromResource( "org/codehaus/plexus/registry/test.xml" ); assertEquals( "Check system property default", System.getProperty( "user.dir" ), - registry.getString( "user.dir" ) ); + registry.getString( "user.dir" ) ); assertEquals( "Check other properties are loaded", "foo", registry.getString( "test.value" ) ); } @Test - public void testAddConfigurationPropertiesResource() + public void testAddConfigurationPropertiesResource( ) throws Exception { registry = getRegistry( "default" ); @@ -187,13 +187,13 @@ public class CommonsConfigurationRegistryTest registry.addConfigurationFromResource( "org/codehaus/plexus/registry/test.properties" ); assertEquals( "Check system property default", System.getProperty( "user.dir" ), - registry.getString( "user.dir" ) ); + registry.getString( "user.dir" ) ); assertEquals( "Check other properties are loaded", "baz", registry.getString( "foo.bar" ) ); assertNull( "Check other properties are not loaded", registry.getString( "test.value" ) ); } @Test - public void testAddConfigurationUnrecognisedType() + public void testAddConfigurationUnrecognisedType( ) throws Exception { registry = getRegistry( "default" ); @@ -201,7 +201,7 @@ public class CommonsConfigurationRegistryTest try { registry.addConfigurationFromResource( "org/codehaus/plexus/registry/test.foo" ); - fail(); + fail( ); } catch ( RegistryException e ) { @@ -212,7 +212,7 @@ public class CommonsConfigurationRegistryTest { registry.addConfigurationFromFile( new File( "./src/test/resources/org/codehaus/plexus/registry/test.foo" ) ); - fail(); + fail( ); } catch ( RegistryException e ) { @@ -221,17 +221,17 @@ public class CommonsConfigurationRegistryTest } @Test - public void testIsEmpty() + public void testIsEmpty( ) throws Exception { registry = getRegistry( "default" ); - assertFalse( registry.isEmpty() ); - assertTrue( registry.getSubset( "foo" ).isEmpty() ); + assertFalse( registry.isEmpty( ) ); + assertTrue( registry.getSubset( "foo" ).isEmpty( ) ); } @Test - public void testGetSubset() + public void testGetSubset( ) throws Exception { registry = getRegistry( "builder" ); @@ -243,13 +243,13 @@ public class CommonsConfigurationRegistryTest } @Test - public void testGetSubsetList() + public void testGetSubsetList( ) throws Exception { registry = getRegistry( "builder" ); List list = registry.getSubsetList( "objects.object" ); - assertEquals( 2, list.size() ); + assertEquals( 2, list.size( ) ); Registry r = (Registry) list.get( 0 ); assertTrue( "bar".equals( r.getString( "foo" ) ) || "baz".equals( r.getString( "foo" ) ) ); r = (Registry) list.get( 1 ); @@ -257,32 +257,32 @@ public class CommonsConfigurationRegistryTest } @Test - public void testGetProperties() + public void testGetProperties( ) throws Exception { registry = getRegistry( "builder" ); Properties properties = registry.getProperties( "properties" ); - assertEquals( 2, properties.size() ); + assertEquals( 2, properties.size( ) ); assertEquals( "bar", properties.getProperty( "foo" ) ); assertEquals( "baz", properties.getProperty( "bar" ) ); } @Test - public void testGetList() + public void testGetList( ) throws Exception { registry = getRegistry( "builder" ); List list = registry.getList( "strings.string" ); - assertEquals( 3, list.size() ); + assertEquals( 3, list.size( ) ); assertEquals( "s1", list.get( 0 ) ); assertEquals( "s2", list.get( 1 ) ); assertEquals( "s3", list.get( 2 ) ); } @Test - public void testGetSection() + public void testGetSection( ) throws Exception { registry = getRegistry( "builder" ); @@ -293,7 +293,7 @@ public class CommonsConfigurationRegistryTest } @Test - public void testRemoveKey() + public void testRemoveKey( ) throws Exception { registry = getRegistry( "builder" ); @@ -305,7 +305,7 @@ public class CommonsConfigurationRegistryTest } @Test - public void testRemoveSubset() + public void testRemoveSubset( ) throws Exception { registry = getRegistry( "builder" ); @@ -335,7 +335,7 @@ public class CommonsConfigurationRegistryTest */ @Test - public void testGetDontForceCreateByName() + public void testGetDontForceCreateByName( ) throws Exception { registry = getRegistry( "noForceCreate" ); @@ -344,7 +344,7 @@ public class CommonsConfigurationRegistryTest } @Test - public void testSaveSection() + public void testSaveSection( ) throws Exception { File src = new File( "./src/test/resources/test-save.xml" ); @@ -354,19 +354,19 @@ public class CommonsConfigurationRegistryTest registry = getRegistry( "test-save" ); Registry registry = this.registry.getSection( "org.codehaus.plexus.registry" ); - assertEquals( "check list elements", Arrays.asList( new String[]{ "1", "2", "3" } ), - registry.getList( "listElements.listElement" ) ); + assertEquals( "check list elements", Arrays.asList( new String[]{"1", "2", "3"} ), + registry.getList( "listElements.listElement" ) ); registry.remove( "listElements.listElement(1)" ); - registry.save(); + registry.save( ); XMLConfiguration configuration = new XMLConfiguration( dest ); - assertEquals( Arrays.asList( new String[]{ "1", "3" } ), configuration.getList( "listElements.listElement" ) ); + assertEquals( Arrays.asList( new String[]{"1", "3"} ), configuration.getList( "listElements.listElement" ) ); // file in ${basedir}/target/conf/shared.xml Registry section = this.registry.getSection( "org.apache.maven.shared.app.user" ); section.setString( "foo", "zloug" ); - section.save(); + section.save( ); configuration = new XMLConfiguration( new File( "target/conf/shared.xml" ) ); assertNotNull( configuration.getString( "foo" ) ); @@ -375,24 +375,24 @@ public class CommonsConfigurationRegistryTest @Test - public void test_listener() + public void test_listener( ) throws Exception { registry = getRegistry( "default" ); - int listenerSize = CommonsConfigurationRegistry.class.cast( registry ).getChangeListenersSize(); + int listenerSize = CommonsConfigurationRegistry.class.cast( registry ).getChangeListenersSize( ); - MockChangeListener mockChangeListener = new MockChangeListener(); + MockChangeListener mockChangeListener = new MockChangeListener( ); registry.addChangeListener( mockChangeListener ); - registry.addChangeListener( new MockChangeListener() ); + registry.addChangeListener( new MockChangeListener( ) ); - assertEquals( listenerSize + 2, CommonsConfigurationRegistry.class.cast( registry ).getChangeListenersSize() ); + assertEquals( listenerSize + 2, CommonsConfigurationRegistry.class.cast( registry ).getChangeListenersSize( ) ); registry.removeChangeListener( mockChangeListener ); - assertEquals( listenerSize + 1, CommonsConfigurationRegistry.class.cast( registry ).getChangeListenersSize() ); + assertEquals( listenerSize + 1, CommonsConfigurationRegistry.class.cast( registry ).getChangeListenersSize( ) ); } private static class MockChangeListener diff --git a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/Component.java b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/Component.java index 92c424b..84e3426 100644 --- a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/Component.java +++ b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/Component.java @@ -28,33 +28,33 @@ import java.util.Properties; */ public interface Component { - String ROLE = Component.class.getName(); + String ROLE = Component.class.getName( ); - String getKey(); + String getKey( ); - Properties getProperties(); + Properties getProperties( ); - String getConfigKey(); + String getConfigKey( ); - Properties getConfigProperties(); + Properties getConfigProperties( ); - Map getMap(); + Map getMap( ); - List getList(); + List getList( ); - Map getConfigMap(); + Map getConfigMap( ); - List getConfigList(); + List getConfigList( ); - Properties getMergeProperties(); + Properties getMergeProperties( ); - int getNumber(); + int getNumber( ); - int getConfigNumber(); + int getConfigNumber( ); - Nested getNested(); + Nested getNested( ); - Nested getConfigNested(); + Nested getConfigNested( ); - List getMergeList(); + List getMergeList( ); } diff --git a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/DefaultComponent.java b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/DefaultComponent.java index 9b94733..32d9532 100644 --- a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/DefaultComponent.java +++ b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/DefaultComponent.java @@ -18,6 +18,7 @@ package org.apache.archiva.components.registry.test; * specific language governing permissions and limitations * under the License. */ + import java.util.List; import java.util.Map; import java.util.Properties; @@ -56,72 +57,72 @@ public class DefaultComponent private List mergeList; - public List getMergeList() + public List getMergeList( ) { return mergeList; } - public Nested getConfigNested() + public Nested getConfigNested( ) { return configNested; } - public Nested getNested() + public Nested getNested( ) { return nested; } - public int getNumber() + public int getNumber( ) { return number; } - public int getConfigNumber() + public int getConfigNumber( ) { return configNumber; } - public String getConfigKey() + public String getConfigKey( ) { return configKey; } - public Properties getConfigProperties() + public Properties getConfigProperties( ) { return configProperties; } - public String getKey() + public String getKey( ) { return key; } - public Properties getProperties() + public Properties getProperties( ) { return properties; } - public Map getMap() + public Map getMap( ) { return map; } - public List getList() + public List getList( ) { return list; } - public Map getConfigMap() + public Map getConfigMap( ) { return configMap; } - public List getConfigList() + public List getConfigList( ) { return configList; } - public Properties getMergeProperties() + public Properties getMergeProperties( ) { return mergeProperties; } diff --git a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/Nested.java b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/Nested.java index c29d6b6..01f7d7a 100644 --- a/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/Nested.java +++ b/spring-registry/spring-registry-commons/src/test/java/org/apache/archiva/components/registry/test/Nested.java @@ -26,7 +26,7 @@ public class Nested { private String foo; - public String getFoo() + public String getFoo( ) { return foo; } diff --git a/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/phase.properties b/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/phase.properties index 3b0a55e..0da9916 100644 --- a/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/phase.properties +++ b/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/phase.properties @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - Component.default.number=2 Component.default.key=value1 Component.default.properties.org.jpox.PreserveCase=always diff --git a/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/test.properties b/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/test.properties index 332952e..0d3e13c 100644 --- a/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/test.properties +++ b/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/test.properties @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # - user.dir=new user dir foo.bar=baz - # test from plexus-registry tests subOne.firstEntry=entryOne subOne.secondEntry=entryTwo diff --git a/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/test.xml b/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/test.xml index 921aed7..1aec1a2 100644 --- a/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/test.xml +++ b/spring-registry/spring-registry-commons/src/test/resources/org/codehaus/plexus/registry/test.xml @@ -15,28 +15,28 @@ --> <configuration> - <test> - <value>foo</value> - <number>1</number> - <boolean>true</boolean> - <interpolation>${test.value}/bar</interpolation> - </test> - <repository>${user.home}/.m2/repository</repository> - <objects> - <object> - <foo>bar</foo> - </object> - <object> - <foo>baz</foo> - </object> - </objects> - <properties> - <foo>bar</foo> - <bar>baz</bar> - </properties> - <strings> - <string>s1</string> - <string>s2</string> - <string>s3</string> - </strings> + <test> + <value>foo</value> + <number>1</number> + <boolean>true</boolean> + <interpolation>${test.value}/bar</interpolation> + </test> + <repository>${user.home}/.m2/repository</repository> + <objects> + <object> + <foo>bar</foo> + </object> + <object> + <foo>baz</foo> + </object> + </objects> + <properties> + <foo>bar</foo> + <bar>baz</bar> + </properties> + <strings> + <string>s1</string> + <string>s2</string> + <string>s3</string> + </strings> </configuration> diff --git a/spring-registry/spring-registry-commons/src/test/resources/spring-context.xml b/spring-registry/spring-registry-commons/src/test/resources/spring-context.xml index 2174eda..3775340 100755 --- a/spring-registry/spring-registry-commons/src/test/resources/spring-context.xml +++ b/spring-registry/spring-registry-commons/src/test/resources/spring-context.xml @@ -24,26 +24,26 @@ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - <alias name="commons-configuration" alias="default"/> + <alias name="commons-configuration" alias="default"/> - <bean name="builder" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"> - <property name="properties"> - <value> - <![CDATA[ + <bean name="builder" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"> + <property name="properties"> + <value> + <![CDATA[ <configuration> <xml fileName="org/codehaus/plexus/registry/test.xml"/> <properties fileName="org/codehaus/plexus/registry/test.properties" config-name="properties"/> </configuration> ]]> - </value> - </property> - </bean> + </value> + </property> + </bean> - <bean name="test-save" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"> - <property name="properties"> - <value> - <![CDATA[ + <bean name="test-save" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"> + <property name="properties"> + <value> + <![CDATA[ <configuration> <system/> <xml fileName="${basedir}/target/test-classes/test-save.xml" @@ -71,32 +71,32 @@ </configuration> ]]> - </value> - </property> - </bean> + </value> + </property> + </bean> - <bean name="forceCreate" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"> - <property name="properties"> - <value> - <![CDATA[ + <bean name="forceCreate" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"> + <property name="properties"> + <value> + <![CDATA[ <configuration> <xml fileName="${basedir}/target/foo-forced" config-name="foo" config-forceCreate="true" config-optional="true"/> </configuration> ]]> - </value> - </property> - </bean> + </value> + </property> + </bean> - <bean name="noForceCreate" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"> - <property name="properties"> - <value> - <![CDATA[ + <bean name="noForceCreate" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry"> + <property name="properties"> + <value> + <![CDATA[ <configuration> <xml fileName="${basedir}/target/foo" config-name="foo" config-optional="true"/> </configuration> ]]> - </value> - </property> - </bean> + </value> + </property> + </bean> -</beans> \ No newline at end of file +</beans> diff --git a/spring-registry/spring-registry-commons/src/test/resources/test-save.xml b/spring-registry/spring-registry-commons/src/test/resources/test-save.xml index 76667ad..1083a2d 100644 --- a/spring-registry/spring-registry-commons/src/test/resources/test-save.xml +++ b/spring-registry/spring-registry-commons/src/test/resources/test-save.xml @@ -15,9 +15,9 @@ --> <registry> - <listElements> - <listElement>1</listElement> - <listElement>2</listElement> - <listElement>3</listElement> - </listElements> -</registry> \ No newline at end of file + <listElements> + <listElement>1</listElement> + <listElement>2</listElement> + <listElement>3</listElement> + </listElements> +</registry> diff --git a/spring-registry/src/site/site.xml b/spring-registry/src/site/site.xml index 654539b..fbec8b6 100644 --- a/spring-registry/src/site/site.xml +++ b/spring-registry/src/site/site.xml @@ -18,17 +18,17 @@ ~ under the License. --> -<project name="Spring Registry Component" > +<project name="Spring Registry Component"> - <publishDate format="yyyy-MM-dd" position="none" /> + <publishDate format="yyyy-MM-dd" position="none"/> - <body> - <menu ref="modules" /> - <menu ref="reports" /> - <menu ref="ASF" /> - <breadcrumbs> - <item name="Redback Components" href="../index.html" /> - <item name="Spring Registry" href="index.html" /> - </breadcrumbs> - </body> + <body> + <menu ref="modules"/> + <menu ref="reports"/> + <menu ref="ASF"/> + <breadcrumbs> + <item name="Redback Components" href="../index.html"/> + <item name="Spring Registry" href="index.html"/> + </breadcrumbs> + </body> </project> diff --git a/spring-taskqueue/pom.xml b/spring-taskqueue/pom.xml index 7455939..e305213 100644 --- a/spring-taskqueue/pom.xml +++ b/spring-taskqueue/pom.xml @@ -17,7 +17,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> diff --git a/src/site/site.xml b/src/site/site.xml index 1db23b2..533437e 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -18,43 +18,43 @@ ~ under the License. --> -<project name="Archiva Components" > +<project name="Archiva Components"> - <bannerLeft> - <name>Apache Archiva</name> - <src>http://archiva.apache.org/images/archiva.png</src> - <!-- have to add the index.html to get the right location, due to bug in Doxia. Still not correct for subdirectories though --> - <href>http://archiva.apache.org/index.html</href> - </bannerLeft> - <bannerRight> - <name>Apache Software Foundation</name> - <src>http://www.apache.org/images/asf_logo_wide.png</src> - <href>http://www.apache.org/</href> - </bannerRight> + <bannerLeft> + <name>Apache Archiva</name> + <src>http://archiva.apache.org/images/archiva.png</src> + <!-- have to add the index.html to get the right location, due to bug in Doxia. Still not correct for subdirectories though --> + <href>http://archiva.apache.org/index.html</href> + </bannerLeft> + <bannerRight> + <name>Apache Software Foundation</name> + <src>http://www.apache.org/images/asf_logo_wide.png</src> + <href>http://www.apache.org/</href> + </bannerRight> - <custom> - <fluidoSkin> - <topBarEnabled>true</topBarEnabled> - <sideBarEnabled>false</sideBarEnabled> - <skipGenerationDate>true</skipGenerationDate> - <googleSearch> - <sitesearch>http://archiva.apache.org/components</sitesearch> - </googleSearch> - </fluidoSkin> - </custom> + <custom> + <fluidoSkin> + <topBarEnabled>true</topBarEnabled> + <sideBarEnabled>false</sideBarEnabled> + <skipGenerationDate>true</skipGenerationDate> + <googleSearch> + <sitesearch>http://archiva.apache.org/components</sitesearch> + </googleSearch> + </fluidoSkin> + </custom> - <publishDate format="yyyy-MM-dd" position="none" /> + <publishDate format="yyyy-MM-dd" position="none"/> - <body> - <links> - <item name="Archiva" href="../index.html"/> - </links> + <body> + <links> + <item name="Archiva" href="../index.html"/> + </links> - <menu ref="modules" /> - <menu ref="reports" /> - <menu ref="ASF" /> - <breadcrumbs> - <item name="Archiva" href="../index.html" /> - </breadcrumbs> - </body> + <menu ref="modules"/> + <menu ref="reports"/> + <menu ref="ASF"/> + <breadcrumbs> + <item name="Archiva" href="../index.html"/> + </breadcrumbs> + </body> </project>
