Skip to content

Commit 580ca87

Browse files
committed
General clean up. Ensure my current email address is used. General documentation clean up. Added package-info.java files.
Signed-off-by: James R. Perkins <jperkins@ibm.com>
1 parent d9a09a5 commit 580ca87

35 files changed

+484
-73
lines changed

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at
63-
James Perkins <jpekrins@ibm.com>.
63+
James Perkins <jperkins@ibm.com>.
6464
All complaints will be reviewed and investigated promptly and fairly.
6565

6666
All community leaders are obligated to respect the privacy and security of the

CONTRIBUTING.adoc

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
= Contributing Guide
44

5-
Want to contribute to the WildFly Plugin Tools? We try to make it easy, and all contributions, even the smaller ones,
5+
Want to contribute to the WildFly Testing Tools? We try to make it easy, and all contributions, even the smaller ones,
66
are more than welcome. This includes bug reports, fixes, documentation, etc. First though, please read this page
77
(including the small print at the end).
88

99
== Legal
1010

11-
All original contributions to the WildFly Plugin Tools are licensed under the
11+
All original contributions to the WildFly Testing Tools are licensed under the
1212
https://www.apache.org/licenses/LICENSE-2.0[ASL - Apache License], version 2.0 or later, or, if another license is
1313
specified as governing the file or directory being modified, such other license.
1414

@@ -17,12 +17,10 @@ The DCO text is also included verbatim in the [dco.txt](dco.txt) file in the roo
1717

1818
== Reporting an issue
1919

20-
This project uses https://issues.redhat.com/browse/WFMP[JIRA] for filing issues. An account is required, However,
21-
if you do not wish to signup for an account, you can open a
22-
https://github.com/wildfly/wildfly-plugin-tools/discussions[discussion] and we will assist you in filing an issue.
20+
This project uses https://github.com/wildfly-extras/wildfly-testing-tools/issues[GitHub Issues] for tracking bugs and
21+
feature requests.
2322

24-
If you believe you found a bug, and it's likely possible, please indicate a way to reproduce it, what you are seeing and
25-
what you would expect to see.
23+
If you believe you found a bug, please indicate a way to reproduce it, what you are seeing and what you would expect to see.
2624

2725
== Before you contribute
2826

@@ -44,27 +42,28 @@ We use this information to acknowledge your contributions in release announcemen
4442
If you have not done so on this machine, you need to:
4543

4644
* Install Git and configure your GitHub access
47-
* Install Java SDK 11+ (OpenJDK recommended)
45+
* Install Java SDK 17+ (OpenJDK recommended)
4846

4947
=== IDE Config and Code Style
5048

51-
The WildFly Plugin Tools has a strictly enforced code style. Code formatting is done by the Eclipse code formatter,
52-
using the config files found in the
53-
https://github.com/wildfly/wildfly-dev-tools/tree/main/ide-config/src/main/resources[eclipse-code-formatter.xml]
54-
file. By default, when you run `./mvnw install`, the code will be formatted automatically. When submitting a pull
55-
request the CI build will fail if running the formatter results in any code changes, so it is recommended that you
56-
always run a full Maven build before submitting a pull request.
49+
The WildFly Testing Tools has a strictly enforced code style. Code formatting is done by the Eclipse code formatter,
50+
using the config files provided by the `org.wildfly.tools:ide-config` dependency. By default, when you run
51+
`./mvnw install`, the code will be formatted automatically. When submitting a pull request the CI build will fail if
52+
running the formatter results in any code changes, so it is recommended that you always run a full Maven build before
53+
submitting a pull request.
5754

5855
If you want to run the formatting without doing a full build, you can run `mvn process-sources`.
5956

6057
==== Eclipse Setup
6158

6259
Open the *Preferences* window, and then navigate to _Java_ -> _Code Style_ -> _Formatter_. Click _Import_ and then
63-
select the `eclipse-code-formatter.xml` downloaded from the above link or clone the repository and navigate to the file.
60+
select the `eclipse-code-formatter.xml` file from the https://github.com/wildfly/wildfly-dev-tools/tree/main/ide-config[wildfly-dev-tools ide-config] resources.
6461

65-
Next navigate to _Java_ -> _Code Style_ -> _Organize Imports_. Click _Import_ and select the `eclipse.importorder` file.
62+
Next navigate to _Java_ -> _Code Style_ -> _Organize Imports_. Click _Import_ and select the `eclipse.importorder` file
63+
from the same location.
6664

6765
==== IDEA Setup
6866

6967
Install the https://plugins.jetbrains.com/plugin/6546-adapter-for-eclipse-code-formatter/[Adapter for Eclipse Code Formatter].
70-
See the https://github.com/krasa/EclipseCodeFormatter#instructions[documentation] on how to configure the plugin.
68+
See the https://github.com/krasa/EclipseCodeFormatter#instructions[documentation] on how to configure the plugin with
69+
the `eclipse-code-formatter.xml` file from https://github.com/wildfly/wildfly-dev-tools/tree/main/ide-config[wildfly-dev-tools ide-config].

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ To use the tooling you can simply import the Bill of Materials POM:
3030
=== JUnit API
3131

3232
The JUnit API contains annotations for skipping tests if minimal module requirements are not met. It also supports
33-
injecting the value of the JBoss Home directory. This can be used with JUnit 5+ and the WildFly JUnit Extension
33+
injecting the value of the JBoss Home directory. This can be used with JUnit 6+ and the WildFly JUnit Extension
3434
or WildFly Arquillian.
3535

3636
[source,xml]
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright The WildFly Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/**
7+
* Annotations for conditional test execution and resource injection in WildFly-based tests.
8+
* <p>
9+
* This package provides JUnit annotations that can be used with any testing framework to conditionally
10+
* execute tests based on WildFly server configuration and inject server-related information.
11+
* </p>
12+
*
13+
* <h2>Key Annotations</h2>
14+
* <ul>
15+
* <li>{@link org.wildfly.testing.junit.annotation.RequiresModule @RequiresModule} - Skip tests when specific
16+
* WildFly modules are not available</li>
17+
* <li>{@link org.wildfly.testing.junit.annotation.AnyOf @AnyOf} - Run tests if any of multiple module
18+
* requirements are met</li>
19+
* <li>{@link org.wildfly.testing.junit.annotation.JBossHome @JBossHome} - Inject the WildFly installation
20+
* directory path</li>
21+
* </ul>
22+
*
23+
* <h2>Usage with WildFly JUnit Extension</h2>
24+
* <p>
25+
* These annotations work seamlessly with the {@code wildfly-junit-extension} module for full server lifecycle
26+
* management:
27+
* </p>
28+
*
29+
* <pre>{@code
30+
* @WildFlyTest
31+
* @RequiresModule("org.jboss.as.ejb3")
32+
* public class EjbTest {
33+
* // Test only runs if EJB module is available
34+
* }
35+
* }</pre>
36+
*
37+
* <h2>Usage with Other Frameworks</h2>
38+
* <p>
39+
* These annotations can also be used independently with Arquillian or other testing frameworks that
40+
* manage the WildFly server lifecycle. Simply add the {@code wildfly-junit-api} dependency and the
41+
* annotations will work as JUnit extensions.
42+
* </p>
43+
*
44+
* @author <a href="mailto:jperkins@ibm.com">James R. Perkins</a>
45+
*
46+
* @see org.wildfly.testing.junit.annotation.RequiresModule
47+
* @see org.wildfly.testing.junit.annotation.AnyOf
48+
* @see org.wildfly.testing.junit.annotation.JBossHome
49+
*/
50+
package org.wildfly.testing.junit.annotation;

api/src/main/java/org/wildfly/testing/junit/condition/JBossHomeParameterResolver.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public boolean supportsParameter(final ParameterContext parameterContext, final
3737
@Override
3838
public Object resolveParameter(final ParameterContext parameterContext, final ExtensionContext extensionContext)
3939
throws ParameterResolutionException {
40-
// TODO (jrp) look at how we did this before
4140
final Optional<Path> value = Support.resolveJBossHome(extensionContext);
4241
if (value.isEmpty()) {
4342
throw new ParameterResolutionException(

api/src/main/java/org/wildfly/testing/junit/condition/RequiresModuleExecutionCondition.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
2727
import org.junit.jupiter.api.extension.ExecutionCondition;
2828
import org.junit.jupiter.api.extension.ExtensionContext;
29+
import org.junit.platform.commons.JUnitException;
2930
import org.junit.platform.commons.support.AnnotationSupport;
3031
import org.wildfly.plugin.tools.VersionComparator;
3132
import org.wildfly.testing.junit.annotation.AnyOf;
@@ -149,7 +150,11 @@ private static ModuleDefinition parse(final Path moduleXmlFile) throws IOExcepti
149150
final DocumentBuilder builder = factory.newDocumentBuilder();
150151
final org.w3c.dom.Document document = builder.parse(in);
151152
final var moduleNode = document.getDocumentElement();
152-
name = moduleNode.getAttributes().getNamedItem("name").getTextContent();
153+
final var nameAttr = moduleNode.getAttributes().getNamedItem("name");
154+
if (nameAttr == null) {
155+
throw new JUnitException("Malformed module.xml: missing 'name' attribute in " + moduleXmlFile);
156+
}
157+
name = nameAttr.getTextContent();
153158
final var resources = document.getElementsByTagName("resources");
154159
if (resources.getLength() > 0) {
155160
// Use only the first resources, which there should only be one of
@@ -159,14 +164,25 @@ private static ModuleDefinition parse(final Path moduleXmlFile) throws IOExcepti
159164
final var node = nodes.item(i);
160165
if (node.getNodeName().equals("artifact")) {
161166
// Use the Maven GAV where the third entry should be the version
162-
final var artifactName = node.getAttributes().getNamedItem("name").getTextContent();
167+
final var artifactNameAttr = node.getAttributes().getNamedItem("name");
168+
if (artifactNameAttr == null) {
169+
throw new JUnitException(
170+
"Malformed module.xml: 'artifact' element missing 'name' attribute in " + moduleXmlFile);
171+
}
172+
final var artifactName = artifactNameAttr.getTextContent();
163173
final var gav = artifactName.split(":");
164174
if (gav.length > 2) {
165175
version = sanitizeVersion(gav[2]);
166176
}
167177
break;
168178
} else if (node.getNodeName().equals("resource-root")) {
169-
final String path = node.getAttributes().getNamedItem("path").getTextContent();
179+
final var pathAttr = node.getAttributes().getNamedItem("path");
180+
if (pathAttr == null) {
181+
throw new JUnitException(
182+
"Malformed module.xml: 'resource-root' element missing 'path' attribute in "
183+
+ moduleXmlFile);
184+
}
185+
final String path = pathAttr.getTextContent();
170186
final Path parent = moduleXmlFile.getParent();
171187
final Path jar = parent == null ? Path.of(path) : parent.resolve(path);
172188
try (JarFile jarFile = new JarFile(jar.toFile())) {

api/src/main/java/org/wildfly/testing/junit/condition/Support.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @author <a href="mailto:jperkins@ibm.com">James R. Perkins</a>
1717
*/
18-
public class Support {
18+
class Support {
1919

2020
/**
2121
* Resolves the servers base directory. This first uses the

api/src/test/java/org/wildfly/testing/junit/JBossHomeParameterTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
/**
1717
*
18-
* @author <a href="mailto:jpekrins@ibm.com">James R. Perkins</a>
18+
* @author <a href="mailto:jperkins@ibm.com">James R. Perkins</a>
1919
*/
2020
@Tag("env.var")
2121
@Tag("system.property")

api/src/test/java/org/wildfly/testing/junit/RequireArtifact.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.wildfly.testing.junit.annotation.RequiresModule;
1111

1212
/**
13-
* @author <a href="mailto:jpekrins@ibm.com">James R. Perkins</a>
13+
* @author <a href="mailto:jperkins@ibm.com">James R. Perkins</a>
1414
*/
1515
@SuppressWarnings("NewClassNamingConvention")
1616
@RequiresModule("org.wildfly.testing.junit.test.artifact")

api/src/test/java/org/wildfly/testing/junit/RequireMultiModules.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.wildfly.testing.junit.annotation.RequiresModules;
1212

1313
/**
14-
* @author <a href="mailto:jpekrins@ibm.com">James R. Perkins</a>
14+
* @author <a href="mailto:jperkins@ibm.com">James R. Perkins</a>
1515
*/
1616
@SuppressWarnings("NewClassNamingConvention")
1717
@RequiresModule("org.wildfly.testing.junit.test.resource-root")

0 commit comments

Comments
 (0)