Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static String[] resultingXcludes(List<String> currentXcludes, List<Strin

private List<String> makeNonNullList(List<String> in) {
if (in == null) {
return Collections.<String>emptyList();
return Collections.emptyList();
} else {
return in;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ public void testEjb4VersionValidation() throws MojoExecutionException {

protected EjbMojo lookupMojo() throws Exception {
File pomFile = new File(getBasedir(), DEFAULT_POM_PATH);
EjbMojo mojo = (EjbMojo) lookupMojo("ejb", pomFile);
EjbMojo mojo = lookupMojo("ejb", pomFile);

assertNotNull(mojo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class IncludesExcludesTest {
@Test
void emptyListsShouldResultInZeroSizeResults() {
IncludesExcludes ie = new IncludesExcludes(
Collections.<String>emptyList(), Collections.<String>emptyList(),
Collections.<String>emptyList(), Collections.<String>emptyList());
Collections.emptyList(), Collections.<String>emptyList(),
Collections.emptyList(), Collections.<String>emptyList());

assertArrayEquals(new String[0], ie.resultingIncludes());
assertArrayEquals(new String[0], ie.resultingExcludes());
Expand Down Expand Up @@ -64,7 +64,7 @@ void nullForExcludesShouldResultInZeroSizeResults() {
@Test
void nonNullForDefaultExcludesShouldResultInExcludesWithDefaultExcludes() {
IncludesExcludes ie =
new IncludesExcludes(null, null, Collections.<String>emptyList(), Arrays.asList("**/package.html"));
new IncludesExcludes(null, null, Collections.emptyList(), Arrays.asList("**/package.html"));

assertArrayEquals(new String[0], ie.resultingIncludes());
assertArrayEquals(new String[] {"**/package.html"}, ie.resultingExcludes());
Expand All @@ -73,7 +73,7 @@ void nonNullForDefaultExcludesShouldResultInExcludesWithDefaultExcludes() {
@Test
void nonNullForDefaultIncludesShouldResultInIncludesWithDefaultIncludes() {
IncludesExcludes ie =
new IncludesExcludes(null, null, Arrays.asList("**/package.html"), Collections.<String>emptyList());
new IncludesExcludes(null, null, Arrays.asList("**/package.html"), Collections.emptyList());

assertArrayEquals(new String[] {"**/package.html"}, ie.resultingIncludes());
assertArrayEquals(new String[0], ie.resultingExcludes());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Model;
import org.apache.maven.model.Profile;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
Expand All @@ -45,8 +43,6 @@ public class MavenProjectBasicStub extends MavenProject {

protected ModelStub model;

protected File file;

protected DefaultArtifact artifact;

public MavenProjectBasicStub(String id) throws Exception {
Expand Down Expand Up @@ -113,18 +109,10 @@ public String getArtifactId() {
return getModel().getArtifactId();
}

public String getPackaging() {
return "ejb";
}

public String getVersion() {
return identifier;
}

public void addProperty(String key, String value) {
properties.put(key, value);
}

public Properties getProperties() {
return properties;
}
Expand All @@ -133,13 +121,13 @@ public Properties getProperties() {
private void initializeParentFields() {
// the pom should be located in the isolated dummy root
super.setFile(new File(getBasedir(), "pom.xml"));
super.setDependencyArtifacts(Collections.<Artifact>emptySet());
super.setArtifacts(Collections.<Artifact>emptySet());
super.setExtensionArtifacts(Collections.<Artifact>emptySet());
super.setRemoteArtifactRepositories(Collections.<ArtifactRepository>emptyList());
super.setPluginArtifactRepositories(Collections.<ArtifactRepository>emptyList());
super.setCollectedProjects(Collections.<MavenProject>emptyList());
super.setActiveProfiles(Collections.<Profile>emptyList());
super.setDependencyArtifacts(Collections.emptySet());
super.setArtifacts(Collections.emptySet());
super.setExtensionArtifacts(Collections.emptySet());
super.setRemoteArtifactRepositories(Collections.emptyList());
super.setPluginArtifactRepositories(Collections.emptyList());
super.setCollectedProjects(Collections.emptyList());
super.setActiveProfiles(Collections.emptyList());
super.setOriginalModel(null);
super.setExecutionProject(this);
super.setArtifact(artifact);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public class MavenProjectBuildStub extends MavenProjectBasicStub {

protected String srcDirectory;

protected String targetDirectory;

protected String buildDirectory;

protected String outputDirectory;
Expand All @@ -57,10 +55,6 @@ public class MavenProjectBuildStub extends MavenProjectBasicStub {

protected String testResourcesDirectory;

protected String targetResourceDirectory;

protected String targetTestResourcesDirectory;

protected List<String> targetClassesList;

protected List<String> sourceFileList;
Expand Down Expand Up @@ -88,17 +82,6 @@ public MavenProjectBuildStub(String key) throws Exception {
model.setBuild(build);
}

public void addDirectory(String name) {
if (isValidPath(name)) {
directoryList.add(name);
}
}

public void setOutputDirectory(String dir) {
outputDirectory = buildDirectory + "/" + dir;
build.setOutputDirectory(outputDirectory);
}

public void addFile(String name, int type) {
if (isValidPath(name)) {
List<String> list = getList(type);
Expand All @@ -107,38 +90,16 @@ public void addFile(String name, int type) {
}
}

public void addFile(String name, String data, int type) {
File fileName = new File(name);

addFile(name, type);
dataMap.put(fileName.getName(), data);
}

public String getOutputDirectory() {
return outputDirectory;
}

public String getTestOutputDirectory() {
return testOutputDirectory;
}

public String getResourcesDirectory() {
return resourcesDirectory;
}

public String getTestResourcesDirectory() {
return testResourcesDirectory;
}

public Build getBuild() {
return build;
}

/**
* returns true if the path is relative and false if absolute also returns false if it is relative to the parent
*
* @param path
* @return
* @return true if the path is relative and false if absolute also returns false if it is relative to the parent
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline returns has bracers at the start and end of line (final dot is automatically added at inline return). But this needs Java 16, which we don't use yet for EJB plugin.

But this method has a parameter, so inline return statement is not applicable.

So this Javadoc should needs a useful description, a parameter description and the return description.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it does, and that's a separate pre-existing issue

*/
private boolean isValidPath(String path) {
boolean bRetVal = true;
Expand Down Expand Up @@ -257,7 +218,7 @@ private void createFiles(String parent, int type) {
if (!currentFile.exists()) {
try {
currentFile.createNewFile();
populateFile(currentFile, RESOURCES_FILE);
populateFile(currentFile);
} catch (IOException io) {
// TODO: handle exception
}
Expand All @@ -278,9 +239,9 @@ private void createFiles(String parent, String testparent) {
createFiles(testparent, RESOURCES_FILE);
}

private void populateFile(File file, int type) {
private void populateFile(File file) {
FileOutputStream outputStream;
String data = (String) dataMap.get(file.getName());
String data = dataMap.get(file.getName());

if ((data != null) && file.exists()) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,44 +31,6 @@ public MavenProjectResourcesStub(String id) throws Exception {
setupTestResources();
}

public void addInclude(String pattern) {
((Resource) build.getResources().get(0)).addInclude(pattern);
}

public void addExclude(String pattern) {
((Resource) build.getResources().get(0)).addExclude(pattern);
}

public void addTestInclude(String pattern) {
((Resource) build.getTestResources().get(0)).addInclude(pattern);
}

public void addTestExclude(String pattern) {
((Resource) build.getTestResources().get(0)).addExclude(pattern);
}

public void setTargetPath(String path) {
((Resource) build.getResources().get(0)).setTargetPath(path);
}

public void setTestTargetPath(String path) {
((Resource) build.getTestResources().get(0)).setTargetPath(path);
}

public void setDirectory(String dir) {
((Resource) build.getResources().get(0)).setDirectory(dir);
}

public void setTestDirectory(String dir) {
((Resource) build.getTestResources().get(0)).setDirectory(dir);
}

public void setResourceFiltering(int nIndex, boolean filter) {
if (build.getResources().size() > nIndex) {
((Resource) build.getResources().get(nIndex)).setFiltering(filter);
}
}

private void setupResources() {
Resource resource = new Resource();

Expand Down