Fixed more ^M's
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1685427 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java b/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java
index d80f442..89824f4 100644
--- a/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java
@@ -1,122 +1,122 @@
-package org.apache.maven.shared.filtering;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isA;
-import static org.mockito.Mockito.when;
-
-import java.io.Reader;
-import java.io.StringReader;
-
-import org.codehaus.plexus.interpolation.Interpolator;
-import org.codehaus.plexus.interpolation.RecursionInterceptor;
-import org.codehaus.plexus.util.IOUtil;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-public abstract class AbstractInterpolatorFilterReaderLineEndingTest
-{
-
- @Mock
- private Interpolator interpolator;
-
- @Before
- public void onSetup()
- {
- MockitoAnnotations.initMocks( this );
- }
-
- @Test
- public void testDefaults()
- throws Exception
- {
- when( interpolator.interpolate( eq( "${a}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DONE_A" );
-
- Reader in = new StringReader( "text without expression" );
- Reader reader = getDollarBracesReader( in, interpolator, "\\" );
- assertEquals( "text without expression", IOUtil.toString( reader ) );
-
- in = new StringReader( "valid expression ${a}" );
- reader = getDollarBracesReader( in, interpolator, null );
- assertEquals( "valid expression DONE_A", IOUtil.toString( reader ) );
-
- in = new StringReader( "empty expression ${}" );
- reader = getDollarBracesReader( in, interpolator, null );
- assertEquals( "empty expression ${}", IOUtil.toString( reader ) );
-
- in = new StringReader( "dollar space expression $ {a}" );
- reader = getDollarBracesReader( in, interpolator, "\\" );
- assertEquals( "dollar space expression $ {a}", IOUtil.toString( reader ) );
-
- in = new StringReader( "space in expression ${ a}" );
- reader = getDollarBracesReader( in, interpolator, "\\" );
- assertEquals( "space in expression ${ a}", IOUtil.toString( reader ) );
-
- in = new StringReader( "escape dollar with expression \\${a}" );
- reader = getDollarBracesReader( in, interpolator, "\\" );
- assertEquals( "escape dollar with expression ${a}", IOUtil.toString( reader ) );
-
- in = new StringReader( "unknown expression ${unknown}" );
- reader = getDollarBracesReader( in, interpolator, "\\" );
- assertEquals( "unknown expression ${unknown}", IOUtil.toString( reader ) );
- }
-
- // MSHARED-198: custom delimiters doesn't work as expected
- @Test
- public void testCustomDelimiters()
- throws Exception
- {
- when( interpolator.interpolate( eq( "aaaFILTER.a.MEaaa" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DONE" );
- when( interpolator.interpolate( eq( "abcFILTER.a.MEabc" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DONE" );
-
- Reader in = new StringReader( "aaaFILTER.a.MEaaa" );
- Reader reader = getAaa_AaaReader( in, interpolator );
-
- assertEquals( "DONE", IOUtil.toString( reader ) );
-
- in = new StringReader( "abcFILTER.a.MEabc" );
- reader = getAbc_AbcReader( in, interpolator );
- assertEquals( "DONE", IOUtil.toString( reader ) );
- }
-
- // MSHARED-235: reader exceeds readAheadLimit
- @Test
- public void testMarkInvalid()
- throws Exception
- {
- Reader in = new StringReader( "@\").replace(p,\"]\").replace(q,\"" );
- Reader reader = getAtReader( in, interpolator, "\\" );
-
- assertEquals( "@\").replace(p,\"]\").replace(q,\"", IOUtil.toString( reader ) );
- }
-
- protected abstract Reader getAbc_AbcReader( Reader in, Interpolator interpolator );
-
- protected abstract Reader getAaa_AaaReader( Reader in, Interpolator interpolator );
-
- protected abstract Reader getDollarBracesReader( Reader in, Interpolator interpolator, String escapeString );
-
- protected abstract Reader getAtReader( Reader in, Interpolator interpolator, String escapeString );
-
+package org.apache.maven.shared.filtering;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.when;
+
+import java.io.Reader;
+import java.io.StringReader;
+
+import org.codehaus.plexus.interpolation.Interpolator;
+import org.codehaus.plexus.interpolation.RecursionInterceptor;
+import org.codehaus.plexus.util.IOUtil;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+public abstract class AbstractInterpolatorFilterReaderLineEndingTest
+{
+
+ @Mock
+ private Interpolator interpolator;
+
+ @Before
+ public void onSetup()
+ {
+ MockitoAnnotations.initMocks( this );
+ }
+
+ @Test
+ public void testDefaults()
+ throws Exception
+ {
+ when( interpolator.interpolate( eq( "${a}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DONE_A" );
+
+ Reader in = new StringReader( "text without expression" );
+ Reader reader = getDollarBracesReader( in, interpolator, "\\" );
+ assertEquals( "text without expression", IOUtil.toString( reader ) );
+
+ in = new StringReader( "valid expression ${a}" );
+ reader = getDollarBracesReader( in, interpolator, null );
+ assertEquals( "valid expression DONE_A", IOUtil.toString( reader ) );
+
+ in = new StringReader( "empty expression ${}" );
+ reader = getDollarBracesReader( in, interpolator, null );
+ assertEquals( "empty expression ${}", IOUtil.toString( reader ) );
+
+ in = new StringReader( "dollar space expression $ {a}" );
+ reader = getDollarBracesReader( in, interpolator, "\\" );
+ assertEquals( "dollar space expression $ {a}", IOUtil.toString( reader ) );
+
+ in = new StringReader( "space in expression ${ a}" );
+ reader = getDollarBracesReader( in, interpolator, "\\" );
+ assertEquals( "space in expression ${ a}", IOUtil.toString( reader ) );
+
+ in = new StringReader( "escape dollar with expression \\${a}" );
+ reader = getDollarBracesReader( in, interpolator, "\\" );
+ assertEquals( "escape dollar with expression ${a}", IOUtil.toString( reader ) );
+
+ in = new StringReader( "unknown expression ${unknown}" );
+ reader = getDollarBracesReader( in, interpolator, "\\" );
+ assertEquals( "unknown expression ${unknown}", IOUtil.toString( reader ) );
+ }
+
+ // MSHARED-198: custom delimiters doesn't work as expected
+ @Test
+ public void testCustomDelimiters()
+ throws Exception
+ {
+ when( interpolator.interpolate( eq( "aaaFILTER.a.MEaaa" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DONE" );
+ when( interpolator.interpolate( eq( "abcFILTER.a.MEabc" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DONE" );
+
+ Reader in = new StringReader( "aaaFILTER.a.MEaaa" );
+ Reader reader = getAaa_AaaReader( in, interpolator );
+
+ assertEquals( "DONE", IOUtil.toString( reader ) );
+
+ in = new StringReader( "abcFILTER.a.MEabc" );
+ reader = getAbc_AbcReader( in, interpolator );
+ assertEquals( "DONE", IOUtil.toString( reader ) );
+ }
+
+ // MSHARED-235: reader exceeds readAheadLimit
+ @Test
+ public void testMarkInvalid()
+ throws Exception
+ {
+ Reader in = new StringReader( "@\").replace(p,\"]\").replace(q,\"" );
+ Reader reader = getAtReader( in, interpolator, "\\" );
+
+ assertEquals( "@\").replace(p,\"]\").replace(q,\"", IOUtil.toString( reader ) );
+ }
+
+ protected abstract Reader getAbc_AbcReader( Reader in, Interpolator interpolator );
+
+ protected abstract Reader getAaa_AaaReader( Reader in, Interpolator interpolator );
+
+ protected abstract Reader getDollarBracesReader( Reader in, Interpolator interpolator, String escapeString );
+
+ protected abstract Reader getAtReader( Reader in, Interpolator interpolator, String escapeString );
+
}
\ No newline at end of file
diff --git a/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java b/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java
index fb8d953..dd4836b 100644
--- a/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java
@@ -1,58 +1,58 @@
-package org.apache.maven.shared.filtering;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Reader;
-
-import org.codehaus.plexus.interpolation.Interpolator;
-
-public class InterpolatorFilterReaderLineEndingTest
- extends AbstractInterpolatorFilterReaderLineEndingTest
-{
- @Override
- protected Reader getAaa_AaaReader( Reader in, Interpolator interpolator )
- {
- return new InterpolatorFilterReaderLineEnding( in, interpolator, "aaa", "aaa", true );
- }
-
- @Override
- protected Reader getAbc_AbcReader( Reader in, Interpolator interpolator )
- {
- return new InterpolatorFilterReaderLineEnding( in, interpolator, "abc", "abc", true );
- }
-
- @Override
- protected Reader getDollarBracesReader( Reader in, Interpolator interpolator, String escapeString )
- {
- InterpolatorFilterReaderLineEnding reader =
- new InterpolatorFilterReaderLineEnding( in, interpolator, "${", "}", true );
- reader.setEscapeString( escapeString );
- return reader;
- }
-
- @Override
- protected Reader getAtReader( Reader in, Interpolator interpolator, String escapeString )
- {
- InterpolatorFilterReaderLineEnding reader =
- new InterpolatorFilterReaderLineEnding( in, interpolator, "@", "@", true );
- reader.setEscapeString( escapeString );
- return reader;
- }
-}
+package org.apache.maven.shared.filtering;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Reader;
+
+import org.codehaus.plexus.interpolation.Interpolator;
+
+public class InterpolatorFilterReaderLineEndingTest
+ extends AbstractInterpolatorFilterReaderLineEndingTest
+{
+ @Override
+ protected Reader getAaa_AaaReader( Reader in, Interpolator interpolator )
+ {
+ return new InterpolatorFilterReaderLineEnding( in, interpolator, "aaa", "aaa", true );
+ }
+
+ @Override
+ protected Reader getAbc_AbcReader( Reader in, Interpolator interpolator )
+ {
+ return new InterpolatorFilterReaderLineEnding( in, interpolator, "abc", "abc", true );
+ }
+
+ @Override
+ protected Reader getDollarBracesReader( Reader in, Interpolator interpolator, String escapeString )
+ {
+ InterpolatorFilterReaderLineEnding reader =
+ new InterpolatorFilterReaderLineEnding( in, interpolator, "${", "}", true );
+ reader.setEscapeString( escapeString );
+ return reader;
+ }
+
+ @Override
+ protected Reader getAtReader( Reader in, Interpolator interpolator, String escapeString )
+ {
+ InterpolatorFilterReaderLineEnding reader =
+ new InterpolatorFilterReaderLineEnding( in, interpolator, "@", "@", true );
+ reader.setEscapeString( escapeString );
+ return reader;
+ }
+}
diff --git a/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java b/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java
index e256e4b..60ba6a2 100644
--- a/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java
@@ -1,124 +1,124 @@
-package org.apache.maven.shared.filtering;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isA;
-import static org.mockito.Mockito.when;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-
-import org.codehaus.plexus.interpolation.Interpolator;
-import org.codehaus.plexus.interpolation.RecursionInterceptor;
-import org.codehaus.plexus.util.IOUtil;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-public class MultiDelimiterInterpolatorFilterReaderLineEndingTest
- extends AbstractInterpolatorFilterReaderLineEndingTest
-{
-
- @Mock
- private Interpolator interpolator;
-
- @Before
- public void onSetup()
- {
- MockitoAnnotations.initMocks( this );
- }
-
- @Override
- protected Reader getAaa_AaaReader( Reader in, Interpolator interpolator )
- {
- MultiDelimiterInterpolatorFilterReaderLineEnding reader =
- new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
- reader.setDelimiterSpecs( Collections.singleton( "aaa*aaa" ) );
- return reader;
- }
-
- @Override
- protected Reader getAbc_AbcReader( Reader in, Interpolator interpolator )
- {
- MultiDelimiterInterpolatorFilterReaderLineEnding reader =
- new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
- reader.setDelimiterSpecs( Collections.singleton( "abc*abc" ) );
- return reader;
- }
-
- @Override
- protected Reader getDollarBracesReader( Reader in, Interpolator interpolator, String escapeString )
- {
- MultiDelimiterInterpolatorFilterReaderLineEnding reader =
- new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
- reader.setDelimiterSpecs( Collections.singleton( "${*}" ) );
- reader.setEscapeString( escapeString );
- return reader;
- }
-
- @Override
- protected Reader getAtReader( Reader in, Interpolator interpolator, String escapeString )
- {
- MultiDelimiterInterpolatorFilterReaderLineEnding reader =
- new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
- reader.setDelimiterSpecs( Collections.singleton( "@" ) );
- reader.setEscapeString( escapeString );
- return reader;
- }
-
- // MSHARED-199: Filtering doesn't work if 2 delimiters are used on the same line, the first one being left open
- @Test
- public void testLineWithSingleAtAndExpression()
- throws Exception
- {
- when( interpolator.interpolate( eq( "${foo}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "bar" );
-
- Reader in = new StringReader( "toto@titi.com ${foo}" );
- MultiDelimiterInterpolatorFilterReaderLineEnding reader =
- new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
- reader.setDelimiterSpecs( new HashSet<String>( Arrays.asList( "${*}", "@" ) ) );
-
- assertEquals( "toto@titi.com bar", IOUtil.toString( reader ) );
- }
-
- // http://stackoverflow.com/questions/21786805/maven-war-plugin-customize-filter-delimitters-in-webresources/
- @Test
- public void testAtDollarExpression()
- throws Exception
- {
- when( interpolator.interpolate( eq( "${db.server}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DB_SERVER" );
- when( interpolator.interpolate( eq( "${db.port}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DB_PORT" );
- when( interpolator.interpolate( eq( "${db.name}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DB_NAME" );
-
- Reader in = new StringReader( " url=\"jdbc:oracle:thin:\\@${db.server}:${db.port}:${db.name}\"" );
- MultiDelimiterInterpolatorFilterReaderLineEnding reader =
- new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
- reader.setEscapeString( "\\" );
- reader.setDelimiterSpecs( new HashSet<String>( Arrays.asList( "${*}", "@" ) ) );
-
- assertEquals( " url=\"jdbc:oracle:thin:@DB_SERVER:DB_PORT:DB_NAME\"", IOUtil.toString( reader ) );
- }
-}
+package org.apache.maven.shared.filtering;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.when;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+
+import org.codehaus.plexus.interpolation.Interpolator;
+import org.codehaus.plexus.interpolation.RecursionInterceptor;
+import org.codehaus.plexus.util.IOUtil;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+public class MultiDelimiterInterpolatorFilterReaderLineEndingTest
+ extends AbstractInterpolatorFilterReaderLineEndingTest
+{
+
+ @Mock
+ private Interpolator interpolator;
+
+ @Before
+ public void onSetup()
+ {
+ MockitoAnnotations.initMocks( this );
+ }
+
+ @Override
+ protected Reader getAaa_AaaReader( Reader in, Interpolator interpolator )
+ {
+ MultiDelimiterInterpolatorFilterReaderLineEnding reader =
+ new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
+ reader.setDelimiterSpecs( Collections.singleton( "aaa*aaa" ) );
+ return reader;
+ }
+
+ @Override
+ protected Reader getAbc_AbcReader( Reader in, Interpolator interpolator )
+ {
+ MultiDelimiterInterpolatorFilterReaderLineEnding reader =
+ new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
+ reader.setDelimiterSpecs( Collections.singleton( "abc*abc" ) );
+ return reader;
+ }
+
+ @Override
+ protected Reader getDollarBracesReader( Reader in, Interpolator interpolator, String escapeString )
+ {
+ MultiDelimiterInterpolatorFilterReaderLineEnding reader =
+ new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
+ reader.setDelimiterSpecs( Collections.singleton( "${*}" ) );
+ reader.setEscapeString( escapeString );
+ return reader;
+ }
+
+ @Override
+ protected Reader getAtReader( Reader in, Interpolator interpolator, String escapeString )
+ {
+ MultiDelimiterInterpolatorFilterReaderLineEnding reader =
+ new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
+ reader.setDelimiterSpecs( Collections.singleton( "@" ) );
+ reader.setEscapeString( escapeString );
+ return reader;
+ }
+
+ // MSHARED-199: Filtering doesn't work if 2 delimiters are used on the same line, the first one being left open
+ @Test
+ public void testLineWithSingleAtAndExpression()
+ throws Exception
+ {
+ when( interpolator.interpolate( eq( "${foo}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "bar" );
+
+ Reader in = new StringReader( "toto@titi.com ${foo}" );
+ MultiDelimiterInterpolatorFilterReaderLineEnding reader =
+ new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
+ reader.setDelimiterSpecs( new HashSet<String>( Arrays.asList( "${*}", "@" ) ) );
+
+ assertEquals( "toto@titi.com bar", IOUtil.toString( reader ) );
+ }
+
+ // http://stackoverflow.com/questions/21786805/maven-war-plugin-customize-filter-delimitters-in-webresources/
+ @Test
+ public void testAtDollarExpression()
+ throws Exception
+ {
+ when( interpolator.interpolate( eq( "${db.server}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DB_SERVER" );
+ when( interpolator.interpolate( eq( "${db.port}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DB_PORT" );
+ when( interpolator.interpolate( eq( "${db.name}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DB_NAME" );
+
+ Reader in = new StringReader( " url=\"jdbc:oracle:thin:\\@${db.server}:${db.port}:${db.name}\"" );
+ MultiDelimiterInterpolatorFilterReaderLineEnding reader =
+ new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true );
+ reader.setEscapeString( "\\" );
+ reader.setDelimiterSpecs( new HashSet<String>( Arrays.asList( "${*}", "@" ) ) );
+
+ assertEquals( " url=\"jdbc:oracle:thin:@DB_SERVER:DB_PORT:DB_NAME\"", IOUtil.toString( reader ) );
+ }
+}