Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-6842] do not use guava in test #311

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import static org.junit.Assert.assertThat;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand All @@ -39,7 +41,6 @@
import org.apache.maven.model.building.ModelSource;
import org.apache.maven.shared.utils.io.FileUtils;

import com.google.common.io.Files;

public class ProjectBuilderTest
extends AbstractCoreMavenComponentTestCase
Expand Down Expand Up @@ -142,19 +143,20 @@ public void testReadModifiedPoms() throws Exception {
String initialValue = System.setProperty( DefaultProjectBuilder.DISABLE_GLOBAL_MODEL_CACHE_SYSTEM_PROPERTY, Boolean.toString( true ) );
// TODO a similar test should be created to test the dependency management (basically all usages
// of DefaultModelBuilder.getCache() are affected by MNG-6530
File tempDir = Files.createTempDir();
FileUtils.copyDirectoryStructure (new File( "src/test/resources/projects/grandchild-check"), tempDir );

Path tempDir = Files.createTempDirectory(null);
FileUtils.copyDirectoryStructure (new File( "src/test/resources/projects/grandchild-check"), tempDir.toFile() );
try
{
MavenSession mavenSession = createMavenSession( null );
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
configuration.setRepositorySession( mavenSession.getRepositorySession() );
org.apache.maven.project.ProjectBuilder projectBuilder = lookup( org.apache.maven.project.ProjectBuilder.class );
File child = new File( tempDir, "child/pom.xml" );
File child = new File( tempDir.toFile(), "child/pom.xml" );
// build project once
projectBuilder.build( child, configuration );
// modify parent
File parent = new File( tempDir, "pom.xml" );
File parent = new File( tempDir.toFile(), "pom.xml" );
String parentContent = FileUtils.fileRead( parent );
parentContent = parentContent.replaceAll( "<packaging>pom</packaging>",
"<packaging>pom</packaging><properties><addedProperty>addedValue</addedProperty></properties>" );
Expand All @@ -173,7 +175,7 @@ public void testReadModifiedPoms() throws Exception {
{
System.setProperty( DefaultProjectBuilder.DISABLE_GLOBAL_MODEL_CACHE_SYSTEM_PROPERTY, initialValue );
}
FileUtils.deleteDirectory( tempDir );
FileUtils.deleteDirectory( tempDir.toFile() );
}
}

Expand Down