From 2f4af023ba570112f6033330ca9e48245e7c9830 Mon Sep 17 00:00:00 2001
From: Martin Simka
Date: Mon, 9 Jan 2023 16:17:11 +0100
Subject: [PATCH] [#199] default to WildFly connection configuration
fixes https://github.com/wildfly-extras/creaper/issues/199
- switch default protocol to `http-remoting`
- switch default port to 9990
- drop `creaper.wildfly` property
- drop `remoting` protocol support
---
CHANGELOG.md | 5 ++
README.md | 54 +++----------------
.../core/online/ManagementProtocol.java | 5 +-
.../creaper/core/online/OnlineOptions.java | 35 ++++--------
testsuite/pom.xml | 34 ++++++------
5 files changed, 39 insertions(+), 94 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f604d1f..d6de90d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,11 @@
## 2.0.0 (not yet released)
+- switch default protocol to `http-remoting`
+- switch default port to 9990
+- drop `creaper.wildfly` property
+- drop `remoting` protocol support
+
## 2.0.0-Alpha.4
- compatibility with WildFly Core 20.0.0.Beta3 (WildFly 28)
diff --git a/README.md b/README.md
index 39691e99..771d1047 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Creaper
-Creaper is a small library for JBoss AS 7 and WildFly management with a slight
+Creaper is a small library for WildFly management with a slight
bias towards testing. It provides a simple API for managing a running server
(online) or rewriting a configuration XML file of a stopped server (offline).
Note that manipulating the XML files is generally discouraged and should only
@@ -26,7 +26,7 @@ separate projects as extensions of the creaper and maintained there.
### Creaper-testsuite
Contains integration tests for the operations, commands and other functionalities provided by creaper, which are
-executed against different versions of JBoss AS 7/WildFly making sure that Creaper remains rock solid piece of code :-)
+executed against different versions of WildFly making sure that Creaper remains rock solid piece of code :-)
## Install
@@ -62,7 +62,7 @@ The latest and greatest released version is __`1.6.2`__.
Creaper follows [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html)
(aka _SemVer_) for versioning and also as a compatibility promise.
-### JBoss AS 7 / WildFly Client Libraries
+### WildFly Client Libraries
__You have to provide both `*-controller-client` and `*-cli` yourself.__
If you want to use commands for patching, you also have to provide
@@ -531,7 +531,7 @@ Build a management client like this:
ManagementClient.online(OnlineOptions
.standalone()
- .hostAndPort("localhost", 9999)
+ .hostAndPort("localhost", 9990)
.build()
);
@@ -552,7 +552,7 @@ This was for standalone mode. For domain, it looks very similar:
.forProfile("default")
.forHost("master")
.build()
- .hostAndPort("localhost", 9999)
+ .hostAndPort("localhost", 9990)
.build()
);
@@ -595,46 +595,6 @@ expressed by throwing an exception. These exceptions are considered fatal;
that is, if an exception happens, the server is in an unknown state and the
only reasonable action is aborting everything and reporting a major fail.
-#### WildFly
-
-By default, `OnlineOptions.standalone().localDefault()` configures a management
-client that connects to `localhost:9999` using the `remote` protocol, which
-makes sense for JBoss AS 7.
-
-If you want to connect to WildFly (any version), you can use the `protocol`
-method:
-
- ManagementClient.online(OnlineOptions
- .standalone()
- .localDefault()
- .protocol(ManagementProtocol.HTTP_REMOTING)
- .build()
- );
-
-This changes the protocol to `http-remoting` and also changes the default port
-to `9990`. If you define the port directly (using `hostAndPort`), you still
-have to define the correct protocol.
-
-Also, you can use `.protocol(ManagementProtocol.REMOTE)` to switch
-the protocol back to `remote`, which is useful when using WildFly client
-libraries against an AS7-based server. (It can't work the other way around,
-so if you have AS7 client libraries and specify `http-remoting`, you'll get
-an exception.)
-
-Alternatively, you can define a system property `creaper.wildfly` (its value
-is ignored, the system property just needs to be defined). This switches
-the default protocol to `http-remoting` and the default port to `9990`
-(in case SSL is configured, this switches the default protocol to
-`https-remoting` and the default port to `9993`).
-
-This way, you can run the same code against JBoss AS 7 and WildFly without
-the need to rewrite or recompile anything. Just define a system property, and
-provide a proper version of client libraries (as explained above).
-
-Note that it would actually be possible to implement handling
-of the `creaper.wildfly` system property completely outside of Creaper just
-in terms of the `protocol` method.
-
#### HTTP transport
If you want to use HTTP transport for executing operation (`.protocol(ManagementProtocol.HTTP)`),
@@ -648,7 +608,7 @@ server looks like this:
ManagementClient.offline(OfflineOptions
.standalone()
- .rootDirectory(new File("/tmp/jboss-eap-6.3"))
+ .rootDirectory(new File("/tmp/widfly-10"))
.configurationFile("standalone.xml")
.build()
);
@@ -657,7 +617,7 @@ server looks like this:
.domain()
.forProfile("default")
.build()
- .rootDirectory(new File("/tmp/jboss-eap-6.3"))
+ .rootDirectory(new File("/tmp/wildfly-10"))
.configurationFile("standalone.xml")
.build()
);
diff --git a/core/src/main/java/org/wildfly/extras/creaper/core/online/ManagementProtocol.java b/core/src/main/java/org/wildfly/extras/creaper/core/online/ManagementProtocol.java
index 8006d35c..3cb41b2e 100644
--- a/core/src/main/java/org/wildfly/extras/creaper/core/online/ManagementProtocol.java
+++ b/core/src/main/java/org/wildfly/extras/creaper/core/online/ManagementProtocol.java
@@ -1,8 +1,6 @@
package org.wildfly.extras.creaper.core.online;
public enum ManagementProtocol {
- /** Used in JBoss AS 7. Default port 9999. */
- REMOTE("remote"),
/** Used in WildFly. Default port 9990. */
HTTP_REMOTING("http-remoting"),
/** Used in WildFly. Default port 9993. */
@@ -17,8 +15,7 @@ public enum ManagementProtocol {
HTTP("http"),
/**
* {@code HTTPS} imposes the same limitations as {@link #HTTP}.
- * Default port is 9443 (AS7) and can be set to 9993 (WildFly) by setting the system property
- * {@code creaper.wildfly} or by configuring the port explicitly.
+ * Default port 9993.
*/
HTTPS("https"),
;
diff --git a/core/src/main/java/org/wildfly/extras/creaper/core/online/OnlineOptions.java b/core/src/main/java/org/wildfly/extras/creaper/core/online/OnlineOptions.java
index bfe3e037..530529cc 100644
--- a/core/src/main/java/org/wildfly/extras/creaper/core/online/OnlineOptions.java
+++ b/core/src/main/java/org/wildfly/extras/creaper/core/online/OnlineOptions.java
@@ -23,7 +23,6 @@
* quite a number of public types.
*/
public final class OnlineOptions {
- private static final String CREAPER_WILDFLY = "creaper.wildfly";
public final boolean isStandalone;
@@ -48,26 +47,22 @@ public final class OnlineOptions {
final boolean isWrappedClient; // see OnlineManagementClientImpl.reconnect
private OnlineOptions(Data data) {
- if (data.protocol == null && System.getProperty(CREAPER_WILDFLY) != null) {
+ if (data.protocol == null) {
if (data.sslOptions == null) {
data.protocol = ManagementProtocol.HTTP_REMOTING;
} else {
data.protocol = ManagementProtocol.HTTPS_REMOTING;
}
- // if the protocol wasn't set manually and the system property isn't set,
- // it _doesn't_ mean that it's "remote"! see also OptionalOnlineOptions.protocol below
+ // if the protocol wasn't set manually, it _doesn't_ mean that it's "http-remoting"!
+ // see also OptionalOnlineOptions.protocol below
}
if (data.localDefault) {
data.host = "localhost";
- if (data.protocol == ManagementProtocol.HTTP_REMOTING || data.protocol == ManagementProtocol.HTTP) {
- data.port = 9990;
- } else if (data.protocol == ManagementProtocol.HTTPS_REMOTING) {
+ if (data.protocol == ManagementProtocol.HTTPS_REMOTING || data.protocol == ManagementProtocol.HTTPS) {
data.port = 9993;
- } else if (data.protocol == ManagementProtocol.HTTPS) {
- data.port = System.getProperty(CREAPER_WILDFLY) != null ? 9993 : 9443;
} else {
- data.port = 9999;
+ data.port = 9990;
}
}
@@ -196,10 +191,9 @@ private ConnectionOnlineOptions(Data data) {
/**
* Connect to {@code localhost} and use the default management port of the application server.
- * This is {@code 9999} by default (JBoss AS 7), and if the system property {@code creaper.wildfly} is defined,
- * it changes to 9990 or (if {@link OptionalOnlineOptions#ssl(SslOptions) ssl} is used) to 9993 (WildFly).
- * This makes it easy to run the same code against both AS7 and WildFly only by defining a single system
- * property.
+ * This is {@code 9990} by default, but if {@link OptionalOnlineOptions#ssl(SslOptions) ssl} is not null,
+ * then it is 9993.
+ *
*
* Alternatively, the {@link OptionalOnlineOptions#protocol(ManagementProtocol) protocol()} method
* can be used, which takes precedence over the methods described above. When it is called, the default port
@@ -324,22 +318,13 @@ public OptionalOnlineOptions bootTimeout(int timeoutInMillis) {
*
This also affects the server port, if {@link ConnectionOnlineOptions#localDefault() localDefault}
* is used.
*
- * AS7 uses a native remoting protocol, called {@code remote}. WildFly uses the remoting protocol wrapped
- * in HTTP (using the HTTP upgrade mechanism), called {@code http-remoting}, or uses its secured version
- * called {@code https-remoting}. When the client libraries on classpath match the server version, they should
- * choose the correct protocol automatically, so in this situation, this method is not required. However, when
- * using a single set of client libraries for all server versions (which is possible, because the client
- * libraries should be backward compatible), this method must be used to specify the type of the server.
+ * WildFly uses the remoting protocol wrapped in HTTP (using the HTTP upgrade mechanism),
+ * called {@code http-remoting}, or uses its secured version called {@code https-remoting}.
*
*
The server port is only affected by this method when
* {@link ConnectionOnlineOptions#localDefault() localDefault} is used. When server port is specified directly
* (using {@link ConnectionOnlineOptions#hostAndPort(String, int) hostAndPort}), this method doesn't change it.
*
- *
- * If the {@code creaper.wildfly} system property is set (because of
- * {@link ConnectionOnlineOptions#localDefault() localDefault}), it is also used as a signal that the protocol
- * should be {@code http-remoting}, but this method has a priority. When the system property is not set,
- * it doesn't mean that the protocol should be {@code remote}; we simply don't know.
*/
public OptionalOnlineOptions protocol(ManagementProtocol protocol) {
if (protocol == null) {
diff --git a/testsuite/pom.xml b/testsuite/pom.xml
index 9ae15299..fb485dc6 100644
--- a/testsuite/pom.xml
+++ b/testsuite/pom.xml
@@ -81,8 +81,6 @@
org.wildfly.extras.creaper.test.WildFly11Tests
- -Dcreaper.wildfly
-
org.wildfly
wildfly-dist
${version.wildfly10}
@@ -421,7 +419,7 @@
${wildfly10.arquillianContainer.version}
${ignoredCategory.wildfly}
- ${specialJvmArgs.wildfly}
+
@@ -467,7 +465,7 @@
${wildfly11.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -514,7 +512,7 @@
${wildfly12.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -561,7 +559,7 @@
${wildfly13.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -608,7 +606,7 @@
${wildfly14.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -655,7 +653,7 @@
${wildfly15.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -702,7 +700,7 @@
${wildfly16.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -749,7 +747,7 @@
${wildfly17.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -796,7 +794,7 @@
${wildfly18.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -843,7 +841,7 @@
${wildfly19.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -890,7 +888,7 @@
${wildfly20.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -937,7 +935,7 @@
${wildfly21.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -984,7 +982,7 @@
${wildfly22.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -1031,7 +1029,7 @@
${wildfly23.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -1078,7 +1076,7 @@
${wildfly24.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+
@@ -1125,7 +1123,7 @@
${wildfly25.arquillianContainer.version}
${ignoredCategory.wildfly11}
- ${specialJvmArgs.wildfly}
+