-
Notifications
You must be signed in to change notification settings - Fork 917
Action for running tests in parallel #7979
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
Merged
sdedic
merged 1 commit into
apache:master
from
petrovic-d:action-for-running-tests-in-parallel
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| Manifest-Version: 1.0 | ||
| OpenIDE-Module: org.netbeans.modules.projectapi/1 | ||
| OpenIDE-Module-Specification-Version: 1.98 | ||
| OpenIDE-Module-Specification-Version: 1.99 | ||
| OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/projectapi/Bundle.properties | ||
| OpenIDE-Module-Layer: org/netbeans/modules/projectapi/layer.xml | ||
| OpenIDE-Module-Needs: org.netbeans.spi.project.ProjectManagerImplementation |
65 changes: 65 additions & 0 deletions
65
ide/projectapi/src/org/netbeans/api/project/ContainedProjectFilter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.netbeans.api.project; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * Provides list of projects the project action should apply to | ||
| * | ||
| * <p> | ||
| * An action that processes multiple projects might use <code>ContainedProjectFilter</code> | ||
| * to operate only on a specific subset of projects. | ||
| * The use of <code>ContainedProjectFilter</code> is optional and determined | ||
| * by the requirements of individual actions. | ||
| * Actions employing this class must document their specific filtering logic | ||
| * and behavior. | ||
| * </p> | ||
| * | ||
| * @author Dusan Petrovic | ||
| * | ||
| * @since 1.99 | ||
| */ | ||
| public final class ContainedProjectFilter { | ||
|
|
||
| private final List<Project> projectsToProcess; | ||
|
|
||
| private ContainedProjectFilter(List<Project> projectsToProcess) { | ||
| this.projectsToProcess = projectsToProcess; | ||
| } | ||
|
|
||
| /** | ||
| * Static factory method to create an instance of ContainedProjectFilter. | ||
| * | ||
| * @param projectsToProcess the list of projects to include in the filter | ||
| * @return an Optional containing ContainedProjectFilter, or Optional.empty() if the list is null or empty | ||
| */ | ||
| public static Optional<ContainedProjectFilter> of(List<Project> projectsToProcess) { | ||
| if (projectsToProcess == null || projectsToProcess.isEmpty()) { | ||
| return Optional.empty(); | ||
| } | ||
| return Optional.of(new ContainedProjectFilter(projectsToProcess)); | ||
| } | ||
|
|
||
| public List<Project> getProjectsToProcess() { | ||
| return Collections.unmodifiableList(projectsToProcess); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 147 additions & 0 deletions
147
ide/projectapi/src/org/netbeans/spi/project/NestedClass.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| package org.netbeans.spi.project; | ||
|
|
||
| import java.util.Objects; | ||
| import org.openide.filesystems.FileObject; | ||
|
|
||
| /** | ||
| * Structure representing an identification of a nested class in a file. | ||
| * | ||
| * <p> | ||
| * <code>NestedClass</code> can be used to represent nested classes within parent class | ||
| * Example: | ||
| * If we have following structure: ParentClass (parent-of) ChildClass1 (parent-of) ChildClass2, | ||
| * for ChildClass1 className field would contain "ChildClass1" and topLevelClassName would contain "ParentClass", | ||
| * for ChildClass2 className field would contain "ChildClass1.ChildClass2" and topLevelClassName would contain "ParentClass" | ||
| * </p> | ||
| * | ||
| * @author Dusan Petrovic | ||
| * | ||
| * @since 1.99 | ||
| */ | ||
| public final class NestedClass { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really a request to change anything, just an observation: this whole angle around |
||
|
|
||
| private final FileObject file; | ||
| private final String className; | ||
| private final String topLevelClassName; | ||
|
|
||
| /** | ||
| * Creates a new instance holding the specified identification | ||
| * of a nested class. | ||
| * | ||
| * @param className name of a class inside the file | ||
| * @param topLevelClassName top level name of a class inside the file | ||
| * @param file file to be kept in the object | ||
| * @exception java.lang.IllegalArgumentException | ||
| * if the file or class name is {@code null} | ||
| * @since 1.99 | ||
| */ | ||
| public NestedClass(String className, String topLevelClassName, FileObject file) { | ||
| super(); | ||
| if (className == null) { | ||
| throw new IllegalArgumentException("className is <null>"); | ||
| } | ||
| if (topLevelClassName == null) { | ||
| throw new IllegalArgumentException("topLevelClassName is <null>"); | ||
| } | ||
| if (file == null) { | ||
| throw new IllegalArgumentException("file is <null>"); | ||
| } | ||
| this.className = className; | ||
| this.topLevelClassName = topLevelClassName; | ||
| this.file = file; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the file identification. | ||
| * | ||
| * @return file held by this object | ||
| * @since 1.99 | ||
| */ | ||
| public FileObject getFile() { | ||
| return file; | ||
| } | ||
|
|
||
| /** | ||
| * Returns name of a nested class within a file. | ||
| * | ||
| * @return class name held by this object | ||
| * @since 1.99 | ||
| */ | ||
| public String getClassName() { | ||
| return className; | ||
| } | ||
|
|
||
| /** | ||
| * Returns name of a top level class within a file. | ||
| * | ||
| * @return top level class name held by this object | ||
| * @since 1.99 | ||
| */ | ||
| public String getTopLevelClassName() { | ||
| return topLevelClassName; | ||
| } | ||
|
|
||
| /** | ||
| * Returns fully qualified name. | ||
| * | ||
| * @param packageName name of the package where the class is | ||
| * | ||
| * @return fully qualified name held by this object | ||
| * @since 1.99 | ||
| */ | ||
| public String getFQN(String packageName) { | ||
| return String.join(".", packageName, topLevelClassName, className); | ||
| } | ||
|
|
||
| /** | ||
| * Returns fully qualified name. | ||
| * | ||
| * @param packageName name of the package where the class is | ||
| * @param nestedClassSeparator separator for the nested classes | ||
| * | ||
| * @return fully qualified name held by this object | ||
| * @since 1.99 | ||
| */ | ||
| public String getFQN(String packageName, String nestedClassSeparator) { | ||
| return String.join(".", packageName, String.join(nestedClassSeparator, topLevelClassName, className.replace(".", nestedClassSeparator))); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int hash = 3; | ||
| hash = 41 * hash + Objects.hashCode(this.className); | ||
| hash = 41 * hash + Objects.hashCode(this.topLevelClassName); | ||
| hash = 41 * hash + Objects.hashCode(this.file); | ||
| return hash; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if ((obj == null) || (obj.getClass() != NestedClass.class)) { | ||
| return false; | ||
| } | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| final NestedClass other = (NestedClass) obj; | ||
| return other.file.equals(file) && other.className.equals(className) && other.topLevelClassName.equals(topLevelClassName); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.