Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-components</artifactId>
<version>43</version>
<version>44</version>
<relativePath />
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ public void testCustomDelimiters() throws Exception {
.thenReturn("DONE");

Reader in = new StringReader("aaaFILTER.a.MEaaa");
Reader reader = getAaa_AaaReader(in, interpolator);
Reader reader = getAaaAaaReader(in, interpolator);

assertEquals("DONE", IOUtils.toString(reader));

in = new StringReader("abcFILTER.a.MEabc");
reader = getAbc_AbcReader(in, interpolator);
reader = getAbcAbcReader(in, interpolator);
assertEquals("DONE", IOUtils.toString(reader));
}

Expand All @@ -108,9 +108,9 @@ public void testMarkInvalid() throws IOException {
}
}

protected abstract Reader getAbc_AbcReader(Reader in, Interpolator interpolator);
protected abstract Reader getAbcAbcReader(Reader in, Interpolator interpolator);

protected abstract Reader getAaa_AaaReader(Reader in, Interpolator interpolator);
protected abstract Reader getAaaAaaReader(Reader in, Interpolator interpolator);

protected abstract Reader getDollarBracesReader(Reader in, Interpolator interpolator, String escapeString);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
*
*/
public class FilteringUtilsTest {
private static final Path testDirectory = Paths.get(getBasedir(), "target/test-classes/");
private static final Path TEST_DIRECTORY = Paths.get(getBasedir(), "target/test-classes/");

@Test
public void testMSHARED1213CopyWithTargetAlreadyExisting0ByteFile() throws IOException {
Path fromFile = Paths.get(getBasedir() + "/src/test/units-files/MSHARED-1213/enunciate.xml");
Path toFile = testDirectory.resolve("MSHARED-1213-enunciate.xml");
Path toFile = TEST_DIRECTORY.resolve("MSHARED-1213-enunciate.xml");
Files.writeString(toFile, "");
FilteringUtils.copyFile(
fromFile,
Expand All @@ -66,7 +66,7 @@ public Reader getReader(Reader fileReader) {
@Test
public void testMSHARED1213CopyWithTargetAlreadyExistingJunkFile() throws IOException {
Path fromFile = Paths.get(getBasedir() + "/src/test/units-files/MSHARED-1213/enunciate.xml");
Path toFile = testDirectory.resolve("MSHARED-1213-enunciate.xml");
Path toFile = TEST_DIRECTORY.resolve("MSHARED-1213-enunciate.xml");
Files.writeString(toFile, "junk");
FilteringUtils.copyFile(
fromFile,
Expand All @@ -89,7 +89,7 @@ public Reader getReader(Reader fileReader) {
@Test
public void testMSHARED1213CopyWithTargetAlreadyExistingSameFile() throws IOException {
Path fromFile = Paths.get(getBasedir() + "/src/test/units-files/MSHARED-1213/enunciate.xml");
Path toFile = testDirectory.resolve("MSHARED-1213-enunciate.xml");
Path toFile = TEST_DIRECTORY.resolve("MSHARED-1213-enunciate.xml");
Files.copy(fromFile, toFile, StandardCopyOption.REPLACE_EXISTING);
FilteringUtils.copyFile(
fromFile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

public class InterpolatorFilterReaderLineEndingTest extends AbstractInterpolatorFilterReaderLineEndingTest {
@Override
protected Reader getAaa_AaaReader(Reader in, Interpolator interpolator) {
protected Reader getAaaAaaReader(Reader in, Interpolator interpolator) {
return new InterpolatorFilterReaderLineEnding(in, interpolator, "aaa", "aaa", true);
}

@Override
protected Reader getAbc_AbcReader(Reader in, Interpolator interpolator) {
protected Reader getAbcAbcReader(Reader in, Interpolator interpolator) {
return new InterpolatorFilterReaderLineEnding(in, interpolator, "abc", "abc", true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public class MultiDelimiterInterpolatorFilterReaderLineEndingTest
private Interpolator interpolator;

@Override
protected Reader getAaa_AaaReader(Reader in, Interpolator interpolator) {
protected Reader getAaaAaaReader(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) {
protected Reader getAbcAbcReader(Reader in, Interpolator interpolator) {
MultiDelimiterInterpolatorFilterReaderLineEnding reader =
new MultiDelimiterInterpolatorFilterReaderLineEnding(in, interpolator, true);
reader.setDelimiterSpecs(Collections.singleton("abc*abc"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
*/
@MavenDITest
public class PropertyUtilsTest {
private static final Path testDirectory = Paths.get(getBasedir(), "target/test-classes/");
private static final Path TEST_DIRECTORY = Paths.get(getBasedir(), "target/test-classes/");

@Test
public void testBasic() throws Exception {
Path basicProp = testDirectory.resolve("basic.properties");
Path basicProp = TEST_DIRECTORY.resolve("basic.properties");

Files.deleteIfExists(basicProp);

Expand All @@ -68,7 +68,7 @@ public void testBasic() throws Exception {

@Test
public void testSystemProperties() throws Exception {
Path systemProp = testDirectory.resolve("system.properties");
Path systemProp = TEST_DIRECTORY.resolve("system.properties");

Files.deleteIfExists(systemProp);

Expand All @@ -83,7 +83,7 @@ public void testSystemProperties() throws Exception {

@Test
public void testException() {
Path nonExistent = testDirectory.resolve("not_existent_file");
Path nonExistent = TEST_DIRECTORY.resolve("not_existent_file");

assertFalse(Files.exists(nonExistent), "property file exist: " + nonExistent);

Expand All @@ -110,7 +110,7 @@ public void testloadpropertiesFile() throws Exception {
*/
@Test
public void testCircularReferences() throws IOException {
Path basicProp = testDirectory.resolve("circular.properties");
Path basicProp = TEST_DIRECTORY.resolve("circular.properties");

Files.deleteIfExists(basicProp);

Expand Down Expand Up @@ -138,7 +138,7 @@ public void testCircularReferences() throws IOException {
*/
@Test
public void testCircularReferences3Vars() throws IOException {
Path basicProp = testDirectory.resolve("circular.properties");
Path basicProp = TEST_DIRECTORY.resolve("circular.properties");

Files.deleteIfExists(basicProp);

Expand Down
25 changes: 24 additions & 1 deletion src/test/java/org/apache/maven/shared/filtering/StubSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,30 @@
import java.util.Map;
import java.util.Optional;

import org.apache.maven.api.*;
import org.apache.maven.api.Artifact;
import org.apache.maven.api.ArtifactCoordinates;
import org.apache.maven.api.Dependency;
import org.apache.maven.api.DependencyCoordinates;
import org.apache.maven.api.DependencyScope;
import org.apache.maven.api.DownloadedArtifact;
import org.apache.maven.api.Language;
import org.apache.maven.api.Listener;
import org.apache.maven.api.LocalRepository;
import org.apache.maven.api.Node;
import org.apache.maven.api.Packaging;
import org.apache.maven.api.PathScope;
import org.apache.maven.api.PathType;
import org.apache.maven.api.ProducedArtifact;
import org.apache.maven.api.Project;
import org.apache.maven.api.ProjectScope;
import org.apache.maven.api.RemoteRepository;
import org.apache.maven.api.Service;
import org.apache.maven.api.Session;
import org.apache.maven.api.SessionData;
import org.apache.maven.api.Type;
import org.apache.maven.api.Version;
import org.apache.maven.api.VersionConstraint;
import org.apache.maven.api.VersionRange;
import org.apache.maven.api.annotations.Nonnull;
import org.apache.maven.api.annotations.Nullable;
import org.apache.maven.api.model.Repository;
Expand Down