use of org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager in project maven-plugins by apache.
the class JavadocReportTest method testTaglets.
/**
* Method to test the taglet artifact configuration
*
* @throws Exception if any
*/
public void testTaglets() throws Exception {
// ----------------------------------------------------------------------
// taglet-test: check if a taglet is used
// ----------------------------------------------------------------------
File testPom = new File(unit, "taglet-test/taglet-test-plugin-config.xml");
JavadocReport mojo = lookupMojo(testPom);
MavenSession session = spy(newMavenSession(mojo.project));
ProjectBuildingRequest buildingRequest = mock(ProjectBuildingRequest.class);
when(buildingRequest.getRemoteRepositories()).thenReturn(mojo.project.getRemoteArtifactRepositories());
when(session.getProjectBuildingRequest()).thenReturn(buildingRequest);
MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(localRepo));
when(buildingRequest.getRepositorySession()).thenReturn(repositorySession);
when(session.getRepositorySession()).thenReturn(repositorySession);
LegacySupport legacySupport = lookup(LegacySupport.class);
legacySupport.setSession(session);
setVariableValueToObject(mojo, "session", session);
mojo.execute();
File apidocs = new File(getBasedir(), "target/test/unit/taglet-test/target/site/apidocs");
assertTrue(new File(apidocs, "index.html").exists());
File appFile = new File(apidocs, "taglet/test/App.html");
assertTrue(appFile.exists());
String appString = readFile(appFile);
assertTrue(appString.contains("<b>To Do:</b>"));
}
use of org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager in project maven-dependency-plugin by apache.
the class TestIncludeExcludeUnpackMojo method setUp.
protected void setUp() throws Exception {
// required for mojo lookups to work
super.setUp("unpack", true, false);
File testPom = new File(getBasedir(), "target/test-classes/unit/unpack-test/plugin-config.xml");
mojo = (UnpackMojo) lookupMojo("unpack", testPom);
mojo.setOutputDirectory(new File(this.testDir, "outputDirectory"));
// mojo.silent = true;
// it needs to get the archivermanager
// stubFactory.setUnpackableFile( mojo.getArchiverManager() );
// i'm using one file repeatedly to archive so I can test the name
// programmatically.
stubFactory.setSrcFile(new File(getBasedir() + File.separatorChar + PACKED_FILE_PATH));
Artifact artifact = stubFactory.createArtifact("test", "test", "1.0", Artifact.SCOPE_COMPILE, "jar", null);
ArtifactItem item = stubFactory.getArtifactItem(artifact);
List<ArtifactItem> list = new ArrayList<ArtifactItem>(1);
list.add(item);
assertNotNull(mojo);
assertNotNull(mojo.getProject());
mojo.setArchiverManager((ArchiverManager) lookup(ArchiverManager.ROLE));
mojo.setMarkersDirectory(new File(this.testDir, "markers"));
mojo.setArtifactItems(list);
MavenSession session = newMavenSession(mojo.getProject());
setVariableValueToObject(mojo, "session", session);
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(stubFactory.getWorkingDir()));
}
use of org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager in project maven-dependency-plugin by apache.
the class TestGetMojo method setUp.
protected void setUp() throws Exception {
// required for mojo lookups to work
super.setUp("markers", false);
File testPom = new File(getBasedir(), "target/test-classes/unit/get-test/plugin-config.xml");
assert testPom.exists();
mojo = (GetMojo) lookupMojo("get", testPom);
assertNotNull(mojo);
LegacySupport legacySupport = lookup(LegacySupport.class);
legacySupport.setSession(newMavenSession(new MavenProjectStub()));
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) legacySupport.getRepositorySession();
repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(testDir.getAbsolutePath()));
setVariableValueToObject(mojo, "session", legacySupport.getSession());
}
use of org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager in project maven-dependency-plugin by apache.
the class TestCopyMojo method setUp.
protected void setUp() throws Exception {
super.setUp("copy", false, false);
File testPom = new File(getBasedir(), "target/test-classes/unit/copy-test/plugin-config.xml");
mojo = (CopyMojo) lookupMojo("copy", testPom);
mojo.setOutputDirectory(new File(this.testDir, "outputDirectory"));
mojo.setSilent(true);
assertNotNull(mojo);
assertNotNull(mojo.getProject());
// MavenProject project = mojo.getProject();
// init classifier things
MavenSession session = newMavenSession(mojo.getProject());
setVariableValueToObject(mojo, "session", session);
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(stubFactory.getWorkingDir()));
}
use of org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager in project maven-dependency-plugin by apache.
the class TestClassifierTypeTranslator method setUp.
protected void setUp() throws Exception {
super.setUp("classifiertype-translator", false);
artifactHandlerManager = new DefaultArtifactHandlerManager();
this.setVariableValueToObject(artifactHandlerManager, "artifactHandlers", new HashMap());
artifactFactory = new DefaultArtifactFactory();
this.setVariableValueToObject(artifactFactory, "artifactHandlerManager", artifactHandlerManager);
artifactRepository = new StubArtifactRepository(null);
DependencyArtifactStubFactory factory = new DependencyArtifactStubFactory(null, false);
artifacts = factory.getMixedArtifacts();
repoManager = lookup(RepositoryManager.class);
MavenSession session = newMavenSession(new MavenProjectStub());
buildingRequest = session.getProjectBuildingRequest();
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(stubFactory.getWorkingDir()));
}
Aggregations