Skip to content

Commit

Permalink
wip: hack
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-rew committed Nov 7, 2024
1 parent 8a66e5f commit a273ba8
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/test/java/ch/ivyteam/ivy/maven/ProjectMojoRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.MojoRule;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.crypto.SettingsDecrypter;
import org.apache.maven.settings.crypto.SettingsDecryptionRequest;
import org.apache.maven.settings.crypto.SettingsDecryptionResult;

import com.google.inject.Binder;
import com.google.inject.Module;

import ch.ivyteam.ivy.maven.util.PathUtils;

Expand All @@ -45,13 +53,51 @@ public class ProjectMojoRule<T extends Mojo> extends MojoRule {
public MavenProject project;

public ProjectMojoRule(Path srcDir, String mojoName) {

super(new AbstractMojoTestCase() {

@Override
protected void setUp() throws Exception {
// TODO Auto-generated method stub
super.setUp();
}

@Override
protected void setupContainer() {
// TODO Auto-generated method stub
super.setupContainer();
}

@Override
protected void addGuiceModules(List<Module> modules) {
// TODO Auto-generated method stub
modules.add(new Module() {

@Override
public void configure(Binder binder) {
binder.bind(SettingsDecrypter.class).toInstance(new SettingsDecrypter() {

@Override
public SettingsDecryptionResult decrypt(SettingsDecryptionRequest request) {
// TODO Auto-generated method stub
return null;
}
});
}
});
}

});

this.templateProjectDir = srcDir;
this.mojoName = mojoName;
}

@Override
@SuppressWarnings("unchecked")
protected void before() throws Throwable {
System.err.println("rock it");

projectDir = Files.createTempDirectory("MyBaseProject");
copyDirectory(templateProjectDir, projectDir);
project = readMavenProject(projectDir.toFile());
Expand Down

0 comments on commit a273ba8

Please sign in to comment.