├── .github └── workflows │ ├── ci.yml │ └── examples-ci.yml ├── .gitignore ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── docs ├── guide │ ├── index.adoc │ ├── intro │ │ └── index.adoc │ └── maven-plugin │ │ ├── goals │ │ ├── dev-watch │ │ │ └── index.adoc │ │ ├── dev │ │ │ └── index.adoc │ │ ├── help │ │ │ └── index.adoc │ │ ├── index.adoc │ │ ├── package │ │ │ └── index.adoc │ │ ├── run │ │ │ └── index.adoc │ │ ├── shutdown │ │ │ └── index.adoc │ │ └── start │ │ │ └── index.adoc │ │ └── index.adoc ├── pom.xml └── scripts │ └── assembly-docs.xml ├── examples ├── README.md ├── arquillian │ ├── hollow-jar │ │ ├── README.md │ │ ├── pom.xml │ │ └── src │ │ │ └── test │ │ │ ├── java │ │ │ └── org │ │ │ │ └── wildfly │ │ │ │ └── plugins │ │ │ │ └── demo │ │ │ │ └── hollowjar │ │ │ │ ├── GreeterEJB.java │ │ │ │ ├── HelloWorldEndpoint.java │ │ │ │ ├── HollowJarITCase.java │ │ │ │ ├── RestApplication.java │ │ │ │ └── TestUtil.java │ │ │ └── resources │ │ │ └── arquillian.xml │ ├── jaxrs │ │ ├── README.md │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── wildfly │ │ │ │ └── plugins │ │ │ │ └── demo │ │ │ │ └── jaxrs │ │ │ │ ├── HelloWorldEndpoint.java │ │ │ │ └── RestApplication.java │ │ │ └── test │ │ │ ├── java │ │ │ └── org │ │ │ │ └── wildfly │ │ │ │ └── plugins │ │ │ │ └── demo │ │ │ │ └── jaxrs │ │ │ │ ├── JaxrsITCase.java │ │ │ │ └── TestUtil.java │ │ │ └── resources │ │ │ └── arquillian.xml │ └── pom.xml ├── authentication │ ├── README.md │ ├── extra-content │ │ └── standalone │ │ │ └── configuration │ │ │ ├── bootable-groups.properties │ │ │ └── bootable-users.properties │ ├── pom.xml │ ├── runtime-authentication.cli │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── auth │ │ │ └── TestServlet.java │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml ├── byteman │ ├── README.md │ └── byteman.btm ├── dev-mode │ └── README.md ├── ejb-in-ear │ ├── README.md │ ├── ear │ │ └── pom.xml │ ├── ejb │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ ├── META-INF │ │ │ └── beans.xml │ │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── ejb │ │ │ └── GreeterEJB.java │ ├── pom.xml │ └── web │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── web │ │ │ ├── HelloWorldEndpoint.java │ │ │ └── RestApplication.java │ │ └── webapp │ │ └── WEB-INF │ │ └── beans.xml ├── ejb-in-war │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── ejbinwar │ │ │ ├── controller │ │ │ └── Greeter.java │ │ │ └── ejb │ │ │ └── GreeterEJB.java │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.xhtml ├── ejb-persistent-clustered-timers │ ├── README.md │ ├── helm.yaml │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── ejb │ │ │ └── timers │ │ │ └── clustered │ │ │ └── AutomaticRecurringTimer.java │ │ ├── resources │ │ └── META-INF │ │ │ └── persistence.xml │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml ├── elytron-oidc-client │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── security │ │ │ └── examples │ │ │ └── SecuredServlet.java │ │ └── webapp │ │ ├── WEB-INF │ │ ├── oidc.json │ │ └── web.xml │ │ └── index.html ├── gradle-mdb-rar │ ├── .mvn │ │ └── wrapper │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── build.gradle │ ├── compose.yaml │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── kafka.yaml │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── kafka │ │ │ ├── JaxRsActivator.java │ │ │ ├── KafkaQueueResource.java │ │ │ └── SimpleMDB.java │ │ ├── resources │ │ └── deploy-kafka-rar.cli │ │ └── webapp │ │ └── WEB-INF │ │ └── jboss-deployment-structure.xml ├── hollow-jar │ ├── README.md │ └── pom.xml ├── https │ ├── README.md │ ├── extra-content │ │ └── standalone │ │ │ └── configuration │ │ │ └── keystore.jks │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── wildfly │ │ └── plugins │ │ └── demo │ │ └── https │ │ └── TestServlet.java ├── jaxrs │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── wildfly │ │ └── plugins │ │ └── demo │ │ └── jaxrs │ │ ├── HelloWorldEndpoint.java │ │ └── RestApplication.java ├── jaxws │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── jaxws │ │ │ └── JSEBean.java │ │ └── webapp │ │ └── WEB-INF │ │ └── jboss-web.xml ├── jib-layers │ ├── README.md │ ├── app-layer │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── applayer │ │ │ ├── HelloWorldEndpoint.java │ │ │ └── RestApplication.java │ ├── pom.xml │ └── server-layer │ │ └── pom.xml ├── jib │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── wildfly │ │ └── plugins │ │ └── demo │ │ └── jib │ │ ├── HelloWorldEndpoint.java │ │ └── RestApplication.java ├── jkube │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── wildfly │ │ └── plugins │ │ └── demo │ │ └── jkube │ │ ├── HelloWorldEndpoint.java │ │ └── RestApplication.java ├── jsf-ejb-jpa │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── jsf │ │ │ ├── Task.java │ │ │ ├── TaskBean.java │ │ │ └── TaskController.java │ │ ├── resources │ │ └── META-INF │ │ │ ├── persistence.xml │ │ │ └── sql │ │ │ └── data.sql │ │ └── webapp │ │ ├── WEB-INF │ │ ├── beans.xml │ │ ├── jsf-ejb-jpa-ds.xml │ │ └── web.xml │ │ ├── index.xhtml │ │ └── resources │ │ └── css │ │ └── styles.css ├── logging-json │ ├── README.md │ ├── config │ │ └── logging.properties │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── logging │ │ │ ├── model │ │ │ └── LogMessage.java │ │ │ ├── rest │ │ │ ├── DeploymentLogResource.java │ │ │ └── JaxRsActivator.java │ │ │ ├── service │ │ │ └── ScheduledLogger.java │ │ │ └── util │ │ │ └── Resources.java │ │ ├── resources │ │ └── META-INF │ │ │ └── beans.xml │ │ └── webapp │ │ ├── assets │ │ └── js │ │ │ └── app.js │ │ └── index.html ├── logging │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── wildfly │ │ └── plugins │ │ └── demo │ │ └── logging │ │ ├── HelloWorldEndpoint.java │ │ └── RestApplication.java ├── microprofile-config │ ├── README.adoc │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── microprofile │ │ │ └── config │ │ │ └── MicroProfileConfigEndpoint.java │ │ ├── resources │ │ └── META-INF │ │ │ └── microprofile-config.properties │ │ └── webapp │ │ └── WEB-INF │ │ └── beans.xml ├── pom.xml ├── postgresql │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── tasksrs │ │ │ ├── model │ │ │ ├── Task.java │ │ │ ├── TaskDao.java │ │ │ ├── TaskDaoImpl.java │ │ │ ├── TaskUser.java │ │ │ ├── TaskUserDao.java │ │ │ └── TaskUserDaoImpl.java │ │ │ └── service │ │ │ └── TaskResource.java │ │ ├── resources │ │ └── META-INF │ │ │ └── persistence.xml │ │ └── webapp │ │ └── WEB-INF │ │ ├── beans.xml │ │ └── web.xml ├── remote-microprofile-config │ ├── Dockerfile │ ├── README.adoc │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── microprofile │ │ │ └── config │ │ │ └── MicroProfileConfigEndpoint.java │ │ ├── resources │ │ └── META-INF │ │ │ └── microprofile-config.properties │ │ └── webapp │ │ └── WEB-INF │ │ └── beans.xml ├── scripts │ ├── add-user.cli │ ├── anonymous-management.cli │ ├── authentication.cli │ ├── cli.properties │ ├── configure-oidc.cli │ ├── disable-http.cli │ ├── ejb-persistent-clustered-timers.cli │ ├── https.cli │ ├── logging-json-handler.cli │ ├── logging.cli │ ├── mp-config.cli │ ├── os-clustering-dns-ping.cli │ └── os-https.cli ├── secmanager │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── secmgr │ │ │ ├── HelloWorldEndpoint.java │ │ │ └── RestApplication.java │ │ └── webapp │ │ └── META-INF │ │ └── permissions.xml ├── slim │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── wildfly │ │ └── plugins │ │ └── demo │ │ └── slim │ │ ├── HelloWorldEndpoint.java │ │ └── RestApplication.java ├── web-clustering-dns-ping │ ├── README.md │ ├── helm.yaml │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── web │ │ │ └── clustering │ │ │ ├── MyServlet.java │ │ │ └── User.java │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml ├── web-clustering │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── web │ │ │ └── clustering │ │ │ ├── MyServlet.java │ │ │ └── User.java │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml └── web-console │ ├── README.md │ ├── pom.xml │ └── src │ └── main │ └── java │ └── org │ └── wildfly │ └── plugins │ └── demo │ └── web │ └── console │ ├── HelloWorldEndpoint.java │ └── RestApplication.java ├── extensions ├── cloud │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── wildfly │ │ │ │ └── plugins │ │ │ │ └── bootablejar │ │ │ │ └── extensions │ │ │ │ └── cloud │ │ │ │ └── CloudExtension.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── org.wildfly.core.jar.boot.RuntimeExtension │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── bootablejar │ │ │ └── extensions │ │ │ └── cloud │ │ │ └── CloudExtensionTestCase.java │ │ └── resources │ │ └── openshift.properties └── pom.xml ├── perf-tests ├── README.md ├── plugin-memory │ └── pom.xml └── pom.xml ├── plugin ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── bootablejar │ │ │ └── maven │ │ │ ├── cli │ │ │ ├── CLIExecutor.java │ │ │ ├── CLIForkedExecutor.java │ │ │ ├── LocalCLIExecutor.java │ │ │ └── RemoteCLIExecutor.java │ │ │ ├── cloud │ │ │ ├── CloudConfig.java │ │ │ └── JGroupsUtil.java │ │ │ ├── common │ │ │ ├── FeaturePack.java │ │ │ ├── LegacyPatchCleaner.java │ │ │ ├── MavenProxySelector.java │ │ │ ├── MavenRepositoriesEnricher.java │ │ │ ├── OverriddenArtifact.java │ │ │ └── Utils.java │ │ │ └── goals │ │ │ ├── AbstractBuildBootableJarMojo.java │ │ │ ├── AbstractDevBootableJarMojo.java │ │ │ ├── AbstractServerConnection.java │ │ │ ├── BuildBootableJarMojo.java │ │ │ ├── ChannelConfiguration.java │ │ │ ├── ChannelMavenArtifactRepositoryManager.java │ │ │ ├── CliSession.java │ │ │ ├── DevBootableJarMojo.java │ │ │ ├── DevWatchBootableJarMojo.java │ │ │ ├── DevWatchContext.java │ │ │ ├── Expression.java │ │ │ ├── MavenJBossLogger.java │ │ │ ├── MavenProjectArtifactVersions.java │ │ │ ├── MavenUpgrade.java │ │ │ ├── RunBootableJarMojo.java │ │ │ ├── ScannedModules.java │ │ │ ├── ShutdownBootableJarMojo.java │ │ │ └── StartBootableJarMojo.java │ └── resources │ │ └── org │ │ └── wildfly │ │ └── plugins │ │ └── bootablejar │ │ └── maven │ │ └── cloud │ │ ├── logging.properties │ │ ├── openshift-clustering-script.cli │ │ ├── openshift-https-script.cli │ │ ├── openshift-infinispan-script.cli │ │ ├── openshift-interfaces-script.cli │ │ ├── openshift-logging-script.cli │ │ ├── openshift-management-script.cli │ │ ├── openshift-tx-script.cli │ │ ├── openshift-undertow-script.cli │ │ └── openshift-webservices-script.cli │ └── test │ └── java │ └── org │ └── wildfly │ └── plugins │ └── bootablejar │ └── maven │ ├── common │ └── ArgumentParsingTestCase.java │ └── goals │ ├── ChannelConfigurationTestCase.java │ ├── DevWatchContextTestCase.java │ ├── ExpressionTestCase.java │ ├── MavenUgradeTestCase.java │ ├── TestEnvironment.java │ ├── TestFilter.java │ ├── TestLogger.java │ └── TestProjectContext.java ├── pom.xml ├── release_process.adoc └── tests ├── pom.xml └── src └── test ├── java └── org │ └── wildfly │ └── plugins │ └── bootablejar │ └── maven │ └── goals │ ├── AbstractBootableJarMojoTestCase.java │ ├── AbstractConfiguredMojoTestCase.java │ ├── AbstractDevWatchTestCase.java │ ├── CLIScriptBootTestCase.java │ ├── ChannelsTestCase.java │ ├── CustomFileNameTestCase.java │ ├── DefaultCloudConfigurationExcludeLayerTestCase.java │ ├── DefaultCloudConfigurationTestCase.java │ ├── DefaultCloudConfigurationWithFPTestCase.java │ ├── DefaultConfigurationSecurityManagerTestCase.java │ ├── DefaultConfigurationTestCase.java │ ├── DefaultConfigurationWithFPTestCase.java │ ├── DevAppTestCase.java │ ├── DevServerTestCase.java │ ├── DevWatchCliTestCase.java │ ├── DevWatchEjbTestCase.java │ ├── DevWatchExtraTestCase.java │ ├── DevWatchInvalidProvisioningTestCase.java │ ├── DevWatchJarTestCase.java │ ├── DevWatchTestCase.java │ ├── HollowJarTestCase.java │ ├── HollowJarWithDeploymentTestCase.java │ ├── IncludedDefaultConfigurationCloudTestCase.java │ ├── IncludedDefaultConfigurationNoLayersTestCase.java │ ├── IncludedDefaultConfigurationTestCase.java │ ├── InvalidCLIPropertiesTestCase.java │ ├── InvalidCLIScriptTestCase.java │ ├── InvalidExcludeRequiredLayerTestCase.java │ ├── InvalidFPLandFPListTestCase.java │ ├── InvalidIncludeExcludeLayerTestCase.java │ ├── InvalidNoFPTestCase.java │ ├── InvalidNotProvisonedExcludedLayerTestCase.java │ ├── InvalidProvisioningFileandLayersTestCase.java │ ├── InvalidSwappingLayerTestCase.java │ ├── InvalidUnkonwnLayerTestCase.java │ ├── LayersConfigurationTestCase.java │ ├── LayersOverrideProvisioningConfigurationTestCase.java │ ├── OpenShiftConfigurationTestCase.java │ ├── ProvisioningConfigurationTestCase.java │ ├── SkipTestCase.java │ ├── TestEnvironment.java │ ├── UpgradeArtifactDumpTestCase.java │ ├── UpgradeArtifactEE9TransformTestCase.java │ ├── UpgradeArtifactFPLTestCase.java │ ├── UpgradeArtifactInvalidFPTestCase.java │ ├── UpgradeArtifactInvalidTestCase.java │ ├── UpgradeArtifactSlimTestCase.java │ ├── UpgradeArtifactTestCase.java │ ├── UpgradeArtifactUnknownArtifactTestCase.java │ ├── UpgradeArtifactVersOverrideTestCase.java │ └── WebServicesTestCase.java └── resources ├── cli ├── add-prop.cli └── add-prop2.cli ├── poms ├── client-pom.xml ├── invalid-fp-upgrade-artifact-pom.xml ├── invalid-upgrade-artifact-pom.xml ├── invalid-upgrade-unknown-artifact-pom.xml ├── invalid1-pom.xml ├── invalid10-pom.xml ├── invalid2-pom.xml ├── invalid3-pom.xml ├── invalid4-pom.xml ├── invalid5-pom.xml ├── invalid6-pom.xml ├── invalid7-pom.xml ├── invalid8-pom.xml ├── invalid9-pom.xml ├── test1-pom.xml ├── test10-pom.xml ├── test11-pom.xml ├── test12-pom.xml ├── test13-pom.xml ├── test14-pom.xml ├── test15-pom.xml ├── test16-pom.xml ├── test17-pom.xml ├── test18-pom.xml ├── test19-pom.xml ├── test2-pom.xml ├── test20-pom.xml ├── test21-pom.xml ├── test22-pom.xml ├── test3-pom.xml ├── test4-pom.xml ├── test5-pom.xml ├── test6-pom.xml ├── test7-pom.xml ├── test8-pom.xml ├── test9-pom.xml ├── upgrade-artifact-dump-pom.xml ├── upgrade-artifact-ee9-pom.xml ├── upgrade-artifact-fpl-pom.xml ├── upgrade-artifact-pom.xml ├── upgrade-artifact-slim-pom.xml └── upgrade-artifact-vers-override-pom.xml ├── projects ├── channels │ └── pom.xml ├── ejb │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── ejb │ │ │ ├── GreeterEJB.java │ │ │ └── TestEJB.java │ │ └── resources │ │ └── META-INF │ │ ├── beans.xml │ │ └── ejb-jar.xml ├── jar │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── wildfly │ │ │ └── plugins │ │ │ └── demo │ │ │ └── ejb │ │ │ ├── GreeterEJB.java │ │ │ └── TestEJB.java │ │ └── resources │ │ └── META-INF │ │ ├── beans.xml │ │ └── ejb-jar.xml └── jaxrs │ ├── extra-content │ └── somefile.txt │ ├── pom.xml │ ├── scripts │ └── logging.cli │ └── src │ └── main │ ├── java │ └── org │ │ └── wildfly │ │ └── plugins │ │ └── demo │ │ └── jaxrs │ │ ├── HelloWorldEndpoint.java │ │ └── RestApplication.java │ ├── resources │ └── myresources.properties │ └── webapp │ ├── WEB-INF │ └── empty.txt │ └── index.html ├── provisioning └── provisioning1.xml └── test.war /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Maven target folder 2 | target/ 3 | 4 | # Ignore Eclipse files 5 | .settings/ 6 | .checkstyle 7 | .classpath 8 | .project 9 | 10 | # Ignore Intellij files 11 | *.iml 12 | *.iws 13 | *.ipr 14 | .idea/ 15 | 16 | examples/slim/my-maven-repo/ 17 | examples/**/nb-configuration.xml 18 | /extensions/cloud/target/ 19 | 20 | #gradle 21 | examples/gradle-mdb-rar/.gradle/ 22 | examples/gradle-mdb-rar/.mvn/**/*.jar 23 | examples/gradle-mdb-rar/build/ 24 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @jfdenise 2 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Security Contacts and Procedures 4 | 5 | WildFly community takes security very seriously, and we aim to take immediate action to address serious security-related problems that involve 6 | our products or services. 7 | 8 | Please report any suspected security vulnerability in this project to Red Hat Product Security at secalert@redhat.com. 9 | You can use our GPG key to communicate with us securely. 10 | 11 | To report an issue in any Red Hat branded website or online service, please contact Red Hat Information Security at site-security@redhat.com. 12 | https://access.redhat.com/security/team/contact 13 | 14 | -------------------------------------------------------------------------------- /docs/guide/index.adoc: -------------------------------------------------------------------------------- 1 | = WildFly Bootable JAR Documentation 2 | Jean-Francois Denise 3 | :revnumber: {version} 4 | :revdate: {localdate} 5 | :toc: left 6 | :icons: font 7 | :imagesdir: images 8 | :linkattrs: 9 | :sectnums: 10 | :sectanchors: 11 | :sectlinks: 12 | 13 | :ec2-pub-ip-dash: 1-2-3-4 14 | :ec2-pub-ip: 1.2.3.4 15 | 16 | (C) 2019 The original authors. 17 | 18 | include::intro/index.adoc[] 19 | 20 | include::maven-plugin/index.adoc[] 21 | -------------------------------------------------------------------------------- /docs/guide/maven-plugin/goals/dev-watch/index.adoc: -------------------------------------------------------------------------------- 1 | include::../../../../../plugin/target/generated-sources/plugin/dev-watch-mojo.adoc[] 2 | -------------------------------------------------------------------------------- /docs/guide/maven-plugin/goals/dev/index.adoc: -------------------------------------------------------------------------------- 1 | include::../../../../../plugin/target/generated-sources/plugin/dev-mojo.adoc[] 2 | -------------------------------------------------------------------------------- /docs/guide/maven-plugin/goals/help/index.adoc: -------------------------------------------------------------------------------- 1 | include::../../../../../plugin/target/generated-sources/plugin/help-mojo.adoc[] 2 | -------------------------------------------------------------------------------- /docs/guide/maven-plugin/goals/index.adoc: -------------------------------------------------------------------------------- 1 | ### Goals overview 2 | 3 | [options="autowidth"] 4 | |=== 5 | |<<_dev>> |Build and start a WildFly bootable JAR for dev mode. 6 | |<<_help>> |Prints help for the plugin. 7 | |<<_package>> |Build a WildFly bootable JAR. 8 | |<<_run>> |Run a WildFly bootable JAR (blocking). 9 | |<<_shutdown>> |Shutdown a WildFly bootable JAR. 10 | |<<_start>> |Start a WildFly bootable JAR (non blocking). 11 | |=== 12 | 13 | include::dev/index.adoc[] 14 | include::dev-watch/index.adoc[] 15 | include::help/index.adoc[] 16 | include::package/index.adoc[] 17 | include::run/index.adoc[] 18 | include::shutdown/index.adoc[] 19 | include::start/index.adoc[] 20 | 21 | -------------------------------------------------------------------------------- /docs/guide/maven-plugin/goals/package/index.adoc: -------------------------------------------------------------------------------- 1 | include::../../../../../plugin/target/generated-sources/plugin/package-mojo.adoc[] 2 | -------------------------------------------------------------------------------- /docs/guide/maven-plugin/goals/run/index.adoc: -------------------------------------------------------------------------------- 1 | include::../../../../../plugin/target/generated-sources/plugin/run-mojo.adoc[] 2 | -------------------------------------------------------------------------------- /docs/guide/maven-plugin/goals/shutdown/index.adoc: -------------------------------------------------------------------------------- 1 | include::../../../../../plugin/target/generated-sources/plugin/shutdown-mojo.adoc[] 2 | -------------------------------------------------------------------------------- /docs/guide/maven-plugin/goals/start/index.adoc: -------------------------------------------------------------------------------- 1 | include::../../../../../plugin/target/generated-sources/plugin/start-mojo.adoc[] 2 | -------------------------------------------------------------------------------- /docs/guide/maven-plugin/index.adoc: -------------------------------------------------------------------------------- 1 | ## Maven plugin 2 | 3 | This chapter is dedicated to the Maven plugin that can be used to build WildFly bootable JAR. Maven 4 | coordinates of the Maven plugin artifact are 5 | 6 | [source,xml,subs=attributes+] 7 | ---- 8 | 9 | org.wildfly.plugins 10 | wildfly-jar-maven-plugin 11 | {revnumber} 12 | 13 | ---- 14 | 15 | include::goals/index.adoc[] -------------------------------------------------------------------------------- /docs/scripts/assembly-docs.xml: -------------------------------------------------------------------------------- 1 | 19 | 21 | 22 | docs 23 | 24 | tar.gz 25 | 26 | 27 | false 28 | 29 | 30 | 31 | target/generated-docs 32 | / 33 | 34 | images/** 35 | sources/** 36 | index.html 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | Each directory (except the _scripts_ directory that contains WildFly CLI scripts shared by some examples) 2 | contains an example that covers a specific use-case in which WildFly bootable JAR Maven plugin is used. Each directory contains a README.md file 3 | that contains the information to build and run the example. 4 | 5 | NB: The released examples depend on the released plugin. In the master branch, 6 | the examples depend on the SNAPSHOT build of the plugin. 7 | -------------------------------------------------------------------------------- /examples/arquillian/hollow-jar/README.md: -------------------------------------------------------------------------------- 1 | # Hollow JAR / Arquillian testing example 2 | 3 | Arquillian is used to deploy a JAX-RS resource and an EJB into the Hollow JAR. 4 | 5 | In this scenario, part of the Arquillian test is run as a client 6 | (testcase annotated with ```@RunAsClient```) and in-container. 7 | 8 | The Arquillian XML descriptor is located in _src/test/resources/arquillian.xml_ 9 | 10 | Build and run tests 11 | =================== 12 | 13 | * To build and run tests: `mvn clean verify` 14 | -------------------------------------------------------------------------------- /examples/arquillian/hollow-jar/src/test/java/org/wildfly/plugins/demo/hollowjar/GreeterEJB.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.hollowjar; 2 | 3 | import jakarta.ejb.Stateful; 4 | 5 | /** 6 | * A simple Hello World EJB. The EJB does not use an interface. 7 | * 8 | */ 9 | @Stateful 10 | public class GreeterEJB { 11 | /** 12 | * This method takes a name and returns a personalised greeting. 13 | * 14 | * @param name the name of the person to be greeted 15 | * @return the personalised greeting. 16 | */ 17 | public String sayHello(String name) { 18 | return "Hello " + name; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/arquillian/hollow-jar/src/test/java/org/wildfly/plugins/demo/hollowjar/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.hollowjar; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | 10 | @Path("/hello") 11 | public class HelloWorldEndpoint { 12 | @GET 13 | @Produces("text/plain") 14 | public Response doGet() { 15 | return Response.ok("Hello from WildFly bootable jar!").build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/arquillian/hollow-jar/src/test/java/org/wildfly/plugins/demo/hollowjar/HollowJarITCase.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.hollowjar; 2 | 3 | import java.net.URL; 4 | import jakarta.ejb.EJB; 5 | import org.jboss.arquillian.container.test.api.Deployment; 6 | import org.jboss.arquillian.container.test.api.RunAsClient; 7 | 8 | import org.jboss.arquillian.junit.Arquillian; 9 | import org.jboss.arquillian.test.api.ArquillianResource; 10 | import org.jboss.shrinkwrap.api.Archive; 11 | import org.jboss.shrinkwrap.api.ShrinkWrap; 12 | import org.jboss.shrinkwrap.api.spec.WebArchive; 13 | import static org.junit.Assert.assertEquals; 14 | import static org.junit.Assert.assertNotNull; 15 | import org.junit.Test; 16 | import org.junit.runner.RunWith; 17 | 18 | @RunWith(Arquillian.class) 19 | public class HollowJarITCase { 20 | 21 | @EJB(mappedName = "java:module/GreeterEJB") 22 | private GreeterEJB ejb; 23 | 24 | @Deployment 25 | public static Archive deploy() { 26 | WebArchive war = ShrinkWrap.create(WebArchive.class, "testapp.war"); 27 | war.addClass(GreeterEJB.class); 28 | war.addClass(HelloWorldEndpoint.class); 29 | war.addClass(RestApplication.class); 30 | return war; 31 | } 32 | 33 | @Test 34 | @RunAsClient 35 | public void testURL(@ArquillianResource URL url) throws Exception { 36 | String result = TestUtil.performCall(new URL(url.toString() + "hello")); 37 | assertEquals(result, "Hello from WildFly bootable jar!", result); 38 | } 39 | 40 | @Test 41 | public void testEjb() throws Exception { 42 | assertNotNull(ejb); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /examples/arquillian/hollow-jar/src/test/java/org/wildfly/plugins/demo/hollowjar/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.hollowjar; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/arquillian/hollow-jar/src/test/java/org/wildfly/plugins/demo/hollowjar/TestUtil.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.hollowjar; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.net.HttpURLConnection; 7 | import java.net.URL; 8 | 9 | public class TestUtil { 10 | 11 | static String performCall(URL url) throws Exception { 12 | final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 13 | conn.setDoInput(true); 14 | return processResponse(conn); 15 | } 16 | 17 | private static String processResponse(HttpURLConnection conn) throws IOException { 18 | int responseCode = conn.getResponseCode(); 19 | if (responseCode != HttpURLConnection.HTTP_OK) { 20 | try (InputStream err = conn.getErrorStream()) { 21 | String response = err != null ? read(err) : null; 22 | throw new IOException(String.format("HTTP Status %d Response: %s", responseCode, response)); 23 | } 24 | } 25 | try (InputStream in = conn.getInputStream()) { 26 | return read(in); 27 | } 28 | } 29 | 30 | private static String read(final InputStream in) throws IOException { 31 | final ByteArrayOutputStream out = new ByteArrayOutputStream(); 32 | int b; 33 | while ((b = in.read()) != -1) { 34 | out.write(b); 35 | } 36 | return out.toString(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/arquillian/hollow-jar/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | ${bootable.jar} 8 | false 9 | 127.0.0.1 10 | 9990 11 | 9990 12 | 8 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/arquillian/jaxrs/README.md: -------------------------------------------------------------------------------- 1 | # JAX-RS / Arquillian testing example 2 | 3 | Build a bootable JAR containing a JAX-RS resource and test it using Arquillian. 4 | 5 | In this scenario, the Arquillian test is run as a client (test annotated with ```@RunAsClient```). 6 | 7 | The Arquillian XML descriptor is located in _src/test/resources/arquillian.xml_ 8 | 9 | Build, test and run 10 | =================== 11 | 12 | * To build and run tests: `mvn clean verify` 13 | * To run: `mvn wildfly-jar:run` 14 | * Access the application: `http://127.0.0.1:8080/hello` 15 | -------------------------------------------------------------------------------- /examples/arquillian/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jaxrs; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | 10 | @Path("/hello") 11 | public class HelloWorldEndpoint { 12 | @GET 13 | @Produces("text/plain") 14 | public Response doGet() { 15 | return Response.ok("Hello from WildFly bootable jar!").build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/arquillian/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jaxrs; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/arquillian/jaxrs/src/test/java/org/wildfly/plugins/demo/jaxrs/JaxrsITCase.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jaxrs; 2 | 3 | import java.net.URL; 4 | 5 | import org.jboss.arquillian.container.test.api.RunAsClient; 6 | import org.jboss.arquillian.junit.Arquillian; 7 | import static org.junit.Assert.assertEquals; 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | /** 12 | */ 13 | @RunWith(Arquillian.class) 14 | @RunAsClient 15 | public class JaxrsITCase { 16 | 17 | 18 | @Test 19 | public void testURL() throws Exception { 20 | String result = TestUtil.performCall(new URL("http://127.0.0.1:8080/hello")); 21 | System.out.println("RESULT " + result); 22 | assertEquals(result, "Hello from WildFly bootable jar!", result); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /examples/arquillian/jaxrs/src/test/java/org/wildfly/plugins/demo/jaxrs/TestUtil.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jaxrs; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.net.HttpURLConnection; 7 | import java.net.URL; 8 | 9 | public class TestUtil { 10 | 11 | static String performCall(URL url) throws Exception { 12 | final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 13 | conn.setDoInput(true); 14 | return processResponse(conn); 15 | } 16 | 17 | private static String processResponse(HttpURLConnection conn) throws IOException { 18 | int responseCode = conn.getResponseCode(); 19 | if (responseCode != HttpURLConnection.HTTP_OK) { 20 | try (InputStream err = conn.getErrorStream()) { 21 | String response = err != null ? read(err) : null; 22 | throw new IOException(String.format("HTTP Status %d Response: %s", responseCode, response)); 23 | } 24 | } 25 | try (InputStream in = conn.getInputStream()) { 26 | return read(in); 27 | } 28 | } 29 | 30 | private static String read(final InputStream in) throws IOException { 31 | final ByteArrayOutputStream out = new ByteArrayOutputStream(); 32 | int b; 33 | while ((b = in.read()) != -1) { 34 | out.write(b); 35 | } 36 | return out.toString(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/arquillian/jaxrs/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | ${bootable.jar} 8 | false 9 | 127.0.0.1 10 | 9990 11 | 9990 12 | 8 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /examples/arquillian/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.wildfly.plugins 7 | wildfly-jar-examples-parent 8 | 12.0.1.Final-SNAPSHOT 9 | 10 | wildfly-jar-arquillian-tests-parent 11 | pom 12 | 13 | WildFly Bootable JAR - arquillian tests parent 14 | Arquillian to test WildFly bootable JAR 15 | 16 | 17 | jaxrs 18 | hollow-jar 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/authentication/extra-content/standalone/configuration/bootable-groups.properties: -------------------------------------------------------------------------------- 1 | testuser=Users -------------------------------------------------------------------------------- /examples/authentication/extra-content/standalone/configuration/bootable-users.properties: -------------------------------------------------------------------------------- 1 | testuser=bootable_password 2 | -------------------------------------------------------------------------------- /examples/authentication/runtime-authentication.cli: -------------------------------------------------------------------------------- 1 | /subsystem=elytron/properties-realm=bootable-realm:add(users-properties={path=bootable-users.properties, plain-text=true}, groups-properties={path=bootable-groups.properties}) 2 | /subsystem=elytron/security-domain=BootableDomain:add(default-realm=bootable-realm, permission-mapper=default-permission-mapper, realms=[{realm=bootable-realm, role-decoder=groups-to-roles}]) 3 | /subsystem=undertow/application-security-domain=other:add(security-domain=BootableDomain) 4 | -------------------------------------------------------------------------------- /examples/authentication/src/main/java/org/wildfly/plugins/demo/auth/TestServlet.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.auth; 2 | 3 | import jakarta.servlet.annotation.HttpMethodConstraint; 4 | import jakarta.servlet.annotation.ServletSecurity; 5 | import jakarta.servlet.annotation.WebServlet; 6 | import jakarta.servlet.http.HttpServlet; 7 | import jakarta.servlet.http.HttpServletRequest; 8 | import jakarta.servlet.http.HttpServletResponse; 9 | 10 | 11 | 12 | import java.io.IOException; 13 | import java.io.PrintWriter; 14 | 15 | @WebServlet(urlPatterns = "/hello") 16 | @ServletSecurity(httpMethodConstraints = { @HttpMethodConstraint(value = "GET", rolesAllowed = { "Users" }) }) 17 | public class TestServlet extends HttpServlet { 18 | 19 | @Override 20 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { 21 | PrintWriter writer = resp.getWriter(); 22 | writer.println("Hello " + req.getUserPrincipal().getName()); 23 | writer.close(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /examples/authentication/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | BASIC 10 | Example Realm 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/byteman/README.md: -------------------------------------------------------------------------------- 1 | # byteman java agent usage 2 | 3 | Trace enter and exit of doGet method. In order to resolve byteman classes, you must 4 | add -Djboss.modules.system.pkgs=org.jboss.byteman when launching the bootable jar. 5 | 6 | * Download and install byteman 7 | * cd jaxrs 8 | * mvn clean package 9 | * java -javaagent:${BYTEMAN_HOME}/lib/byteman.jar=script:../byteman/byteman.btm -Djboss.modules.system.pkgs=org.jboss.byteman -jar target/jaxrs-bootable.jar 10 | * Access to the application: http://127.0.0.1:8080/hello 11 | * Instrumented class logs are printed. 12 | -------------------------------------------------------------------------------- /examples/byteman/byteman.btm: -------------------------------------------------------------------------------- 1 | RULE trace doGet entry 2 | 3 | CLASS HelloWorldEndpoint 4 | 5 | METHOD doGet 6 | 7 | AT ENTRY 8 | IF true 9 | 10 | DO traceln("entering doGet") 11 | 12 | ENDRULE 13 | 14 | 15 | 16 | RULE trace doGet exit 17 | 18 | CLASS HelloWorldEndpoint 19 | 20 | METHOD doGet 21 | 22 | AT EXIT 23 | 24 | IF true 25 | 26 | DO traceln("exiting doGet") 27 | 28 | ENDRULE 29 | -------------------------------------------------------------------------------- /examples/dev-mode/README.md: -------------------------------------------------------------------------------- 1 | # Development mode (watch of your source files) 2 | 3 | A mode that allows you to build the bootable jar once and to start it. The changes made to your source files 4 | are detected and your application is re-built/re-deployed. Changes to the pom.xml file (update layers, feature-packs, ...) makes the server to be rebuilt. 5 | 6 | * cd jaxrs 7 | * mvn wildfly-jar:dev-watch (this goal builds your application, build an hollow bootable JAR and start it) 8 | * Do changes in your sources, your application is rebuilt and redeployed. 9 | * When done: Ctrl-C in the console to kill the running goal and bootable JAR. 10 | 11 | 12 | # Development mode (with re-packaging) 13 | 14 | A mode that allows you to build the bootable jar once and to start it. Make changes to your 15 | code then rebuild. Newly packaged application is reloaded by the running server. 16 | 17 | * cd jaxrs 18 | * mvn wildfly-jar:dev (build hollow server and start it) 19 | * mvn package -Ddev (notice the deployment scanner that discover the deployed application) 20 | * Do changes in code. 21 | * mvn package -Ddev (notice the deployment scanner that discover the refreshed deployed application) 22 | * When done: mvn wildfly-jar:shutdown -------------------------------------------------------------------------------- /examples/ejb-in-ear/ejb/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | org.wildfly.plugins 8 | ejb-in-ear 9 | 12.0.1.Final-SNAPSHOT 10 | 11 | 12 | ejb-in-ear-ejb 13 | ejb 14 | 15 | WildFly Bootable Jar - EJB in EAR - ejb 16 | This project demonstrates how to package an EJB and WAR in an EAR; this is the EJB POM file 17 | 18 | 19 | 20 | 21 | jakarta.platform 22 | jakarta.jakartaee-api 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.apache.maven.plugins 30 | maven-ejb-plugin 31 | 3.1.0 32 | 33 | 3.2 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /examples/ejb-in-ear/ejb/src/main/java/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /examples/ejb-in-ear/ejb/src/main/java/org/wildfly/plugins/demo/ejb/GreeterEJB.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.ejb; 2 | 3 | import jakarta.ejb.Stateless; 4 | 5 | /** 6 | * A simple Hello World EJB. The EJB does not use an interface. 7 | * 8 | * @author paul.robinson@redhat.com, 2011-12-21 9 | */ 10 | @Stateless 11 | public class GreeterEJB { 12 | /** 13 | * This method takes a name and returns a personalised greeting. 14 | * 15 | * @param name 16 | * the name of the person to be greeted 17 | * @return the personalised greeting. 18 | */ 19 | public String sayHello(String name) { 20 | return "Hello " + name; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/ejb-in-ear/web/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | org.wildfly.plugins 8 | ejb-in-ear 9 | 12.0.1.Final-SNAPSHOT 10 | 11 | 12 | ejb-in-ear-web 13 | war 14 | 15 | WildFly Bootable Jar - EJB in EAR - web 16 | This project demonstrates how to package an EJB and WAR in an EAR; this is the WAR POM file 17 | 18 | 19 | 20 | jakarta.platform 21 | jakarta.jakartaee-api 22 | 23 | 24 | 25 | org.wildfly.plugins 26 | ejb-in-ear-ejb 27 | provided 28 | ejb 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /examples/ejb-in-ear/web/src/main/java/org/wildfly/plugins/demo/web/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.web; 2 | 3 | 4 | import jakarta.enterprise.context.RequestScoped; 5 | import jakarta.inject.Inject; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Path; 8 | import jakarta.ws.rs.PathParam; 9 | import jakarta.ws.rs.core.Response; 10 | 11 | import org.wildfly.plugins.demo.ejb.GreeterEJB; 12 | 13 | 14 | @Path("/hello") 15 | @RequestScoped 16 | public class HelloWorldEndpoint { 17 | 18 | @Inject 19 | private GreeterEJB greeterEJB; 20 | 21 | @GET 22 | @Path("{name}") 23 | public Response doGet(@PathParam("name") String name) { 24 | return Response.ok(greeterEJB.sayHello(name)).build(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/ejb-in-ear/web/src/main/java/org/wildfly/plugins/demo/web/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.web; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/ejb-in-ear/web/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /examples/ejb-in-war/README.md: -------------------------------------------------------------------------------- 1 | # WildFly EJB in WAR bootable JAR Example 2 | 3 | This example shows how you can use EJBs packaged in a WAR file with the Bootable JAR. The example is a simple application using EJBs and JSF. 4 | 5 | Build and run 6 | ============= 7 | 8 | * To build: `mvn package` 9 | * To run: `mvn wildfly-jar:run` 10 | * Access the application: `http://127.0.0.1:8080/` 11 | 12 | 13 | Build and run on OpenShift 14 | ========================== 15 | 16 | * mvn package -Popenshift 17 | * mkdir os && cp target/ejb-in-war-bootable.jar os/ 18 | * Import the OpenJDK 17 image to run the Java application, create the image stream and deployment: 19 | ``` 20 | oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm 21 | 22 | oc new-build --strategy source --binary --image-stream openjdk-17 --name ejb-bootable-jar 23 | 24 | oc start-build ejb-bootable-jar --from-dir ./os/ 25 | 26 | oc new-app --name ejb-bootable-jar-app ejb-bootable-jar 27 | 28 | oc expose svc/ejb-bootable-jar-app 29 | ``` 30 | * You can verify the application is working by using: 31 | `curl http://$(oc get route ejb-bootable-jar-app --template='{{ .spec.host }}')` 32 | 33 | 34 | -------------------------------------------------------------------------------- /examples/ejb-in-war/src/main/java/org/wildfly/plugins/demo/ejbinwar/controller/Greeter.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.ejbinwar.controller; 2 | 3 | import org.wildfly.plugins.demo.ejbinwar.ejb.GreeterEJB; 4 | 5 | import jakarta.ejb.EJB; 6 | import jakarta.enterprise.context.SessionScoped; 7 | import jakarta.inject.Named; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * A simple managed bean that is used to invoke the GreeterEJB and store the response. The response is obtained by invoking 13 | * getMessage(). 14 | * 15 | * @author paul.robinson@redhat.com, 2011-12-21 16 | */ 17 | @Named("greeter") 18 | @SessionScoped 19 | public class Greeter implements Serializable { 20 | 21 | /** 22 | * Default value included to remove warning. 23 | **/ 24 | private static final long serialVersionUID = 1L; 25 | 26 | /** 27 | * Injected GreeterEJB client 28 | */ 29 | @EJB 30 | private GreeterEJB greeterEJB; 31 | 32 | /** 33 | * Stores the response from the call to greeterEJB.sayHello(...) 34 | */ 35 | private String message; 36 | 37 | /** 38 | * Invoke greeterEJB.sayHello(...) and store the message 39 | * 40 | * @param name The name of the person to be greeted 41 | */ 42 | public void setName(String name) { 43 | message = greeterEJB.sayHello(name); 44 | } 45 | 46 | /** 47 | * Get the greeting message, customized with the name of the person to be greeted. 48 | * 49 | * @return message. The greeting message. 50 | */ 51 | public String getMessage() { 52 | return message; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /examples/ejb-in-war/src/main/java/org/wildfly/plugins/demo/ejbinwar/ejb/GreeterEJB.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.ejbinwar.ejb; 2 | 3 | import jakarta.ejb.Stateful; 4 | 5 | /** 6 | * A simple Hello World EJB. The EJB does not use an interface. 7 | * 8 | * @author paul.robinson@redhat.com, 2011-12-21 9 | */ 10 | @Stateful 11 | public class GreeterEJB { 12 | /** 13 | * This method takes a name and returns a personalised greeting. 14 | * 15 | * @param name the name of the person to be greeted 16 | * @return the personalised greeting. 17 | */ 18 | public String sayHello(String name) { 19 | return "Hello " + name; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/ejb-in-war/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | jakarta.faces.PROJECT_STAGE 9 | Development 10 | 11 | 12 | Faces Servlet 13 | jakarta.faces.webapp.FacesServlet 14 | 1 15 | 16 | 17 | Faces Servlet 18 | *.xhtml 19 | 20 | 21 | 22 | 30 23 | 24 | 25 | 26 | index.xhtml 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/ejb-in-war/src/main/webapp/index.xhtml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | Hello Greeting 8 | 9 | 10 | 11 | 12 | Response: 13 | 14 | 15 | 16 | 17 | 18 | Name: 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /examples/ejb-persistent-clustered-timers/helm.yaml: -------------------------------------------------------------------------------- 1 | build: 2 | uri: https://github.com/wildfly-extras/wildfly-jar-maven-plugin.git 3 | ref: 12.0.0.Final 4 | contextDir: examples 5 | mode: bootable-jar 6 | env: 7 | - name: MAVEN_ARGS_APPEND 8 | # The -P openshift profile is activated by default when the OpenJDK builder image is used, so no need to pass it 9 | # for OpenShift deployment. 10 | value: -pl ejb-persistent-clustered-timers/ -am 11 | - name: ARTIFACT_DIR 12 | value: ejb-persistent-clustered-timers/target 13 | deploy: 14 | replicas: 2 15 | env: 16 | - name: POSTGRESQL_USER 17 | value: "admin" 18 | - name: POSTGRESQL_PASSWORD 19 | value: "admin" 20 | - name: POSTGRESQL_SERVICE_HOST 21 | value: "database-server" 22 | - name: POSTGRESQL_SERVICE_PORT 23 | value: "5432" 24 | - name: POSTGRESQL_DATABASE 25 | value: "sampledb" -------------------------------------------------------------------------------- /examples/ejb-persistent-clustered-timers/src/main/java/org/wildfly/plugins/demo/ejb/timers/clustered/AutomaticRecurringTimer.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.ejb.timers.clustered; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import jakarta.ejb.Schedule; 6 | import jakarta.ejb.Singleton; 7 | import jakarta.ejb.Startup; 8 | 9 | @Singleton 10 | @Startup 11 | public class AutomaticRecurringTimer { 12 | 13 | private static final Logger logger = Logger.getLogger(AutomaticRecurringTimer.class.getName()); 14 | 15 | @Schedule(hour = "*", minute = "*", second = "*/10", info = "Every 10 secs timer", persistent = true) 16 | public void printDate() { 17 | logger.info("This is the actual timer execution, it is " + new java.util.Date().toString()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/ejb-persistent-clustered-timers/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | java:jboss/datasources/PostgreSQLDS 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /examples/ejb-persistent-clustered-timers/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /examples/elytron-oidc-client/src/main/webapp/WEB-INF/oidc.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider-url": "${org.wildfly.bootable.jar.example.oidc.provider-url}", 3 | "ssl-required": "external", 4 | "client-id": "simple-webapp", 5 | "public-client": true, 6 | "confidential-port": 0 7 | } -------------------------------------------------------------------------------- /examples/elytron-oidc-client/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | OIDC 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/elytron-oidc-client/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | Access Secured Servlet 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/gradle-mdb-rar/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /examples/gradle-mdb-rar/compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | zookeeper: 4 | container_name: "zookeeper" 5 | image: quay.io/strimzi/kafka:0.31.1-kafka-3.2.3 6 | environment: 7 | LOG_DIR: /tmp/logs 8 | command: [ 9 | "sh", "-c", 10 | "bin/zookeeper-server-start.sh config/zookeeper.properties" 11 | ] 12 | ports: 13 | - "2181:2181" 14 | kafka: 15 | container_name: "kafka" 16 | image: quay.io/strimzi/kafka:0.31.1-kafka-3.2.3 17 | environment: 18 | LOG_DIR: /tmp/logs 19 | KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 20 | KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 21 | KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 22 | command: [ 23 | "sh", "-c", 24 | "bin/kafka-server-start.sh config/server.properties --override listeners=$${KAFKA_LISTENERS} --override advertised.listeners=$${KAFKA_ADVERTISED_LISTENERS} --override zookeeper.connect=$${KAFKA_ZOOKEEPER_CONNECT}" 25 | ] 26 | depends_on: 27 | - zookeeper 28 | ports: 29 | - "9092:9092" 30 | 31 | -------------------------------------------------------------------------------- /examples/gradle-mdb-rar/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly-extras/wildfly-jar-maven-plugin/71ec0d9dbd99204a0a9af36e0d320e8b0e73a3ab/examples/gradle-mdb-rar/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/gradle-mdb-rar/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /examples/gradle-mdb-rar/src/main/java/org/wildfly/wildfly/plugins/demo/kafka/JaxRsActivator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * 4 | * Copyright 2022 Red Hat, Inc., and individual contributors 5 | * as indicated by the @author tags. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | package org.wildfly.wildfly.plugins.demo.kafka; 20 | 21 | import jakarta.ws.rs.ApplicationPath; 22 | import jakarta.ws.rs.core.Application; 23 | 24 | /** 25 | * 26 | * @author Emmanuel Hugonnet (c) 2022 Red Hat, Inc. 27 | */ 28 | @ApplicationPath("/rest") 29 | public class JaxRsActivator extends Application { 30 | /* class body intentionally left blank */ 31 | } -------------------------------------------------------------------------------- /examples/gradle-mdb-rar/src/main/resources/deploy-kafka-rar.cli: -------------------------------------------------------------------------------- 1 | 2 | deploy --name=kafka-rar.rar --runtime-name=kafka-rar.rar ${basedir}/target/build/kafka-rar-1.0.0.rar 3 | /subsystem=resource-adapters/resource-adapter=kafka:add(archive=kafka-rar.rar, transaction-support="XATransaction") 4 | /subsystem=resource-adapters/resource-adapter=kafka/connection-definitions=kafkaCF:add(class-name="fish.payara.cloud.connectors.kafka.outbound.KafkaManagedConnectionFactory", jndi-name="java:/kafka/ConnectionFactory", elytron-enabled=true,recovery-elytron-enabled=true) 5 | /subsystem=resource-adapters/resource-adapter=kafka/connection-definitions=kafkaCF/config-properties=bootstrapServersConfig:add(value="localhost:9092") 6 | /subsystem=ejb3:write-attribute(name=default-resource-adapter-name, value=kafka) 7 | deploy ${basedir}/build/libs/gradle-demo.war 8 | -------------------------------------------------------------------------------- /examples/gradle-mdb-rar/src/main/webapp/WEB-INF/jboss-deployment-structure.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/hollow-jar/README.md: -------------------------------------------------------------------------------- 1 | # WildFly bootable hollow jar example 2 | 3 | Build a bootable JAR containing no deployment for both bare-metal and OpenShift. 4 | 5 | Build and run 6 | ============= 7 | 8 | * To build: `mvn package` 9 | * To run: `mvn wildfly-jar:run` 10 | 11 | Build and run in OpenShift 12 | ======================= 13 | 14 | To build the bootable JAR for OpenShift: 15 | 16 | `mvn package -Popenshift` 17 | 18 | When building a bootable JAR for OpenShift, a set of WildFly CLI commands are applied to the server configuration in order to adjust it to the OpenShift context. The applied script can be retrieved in `target/bootable-jar-build-artifacts/generated-cli-script.txt` file. 19 | 20 | You can check the community documentation to retrieve information on the cloud specific changes. -------------------------------------------------------------------------------- /examples/https/extra-content/standalone/configuration/keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly-extras/wildfly-jar-maven-plugin/71ec0d9dbd99204a0a9af36e0d320e8b0e73a3ab/examples/https/extra-content/standalone/configuration/keystore.jks -------------------------------------------------------------------------------- /examples/https/src/main/java/org/wildfly/plugins/demo/https/TestServlet.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.https; 2 | 3 | import jakarta.servlet.annotation.WebServlet; 4 | import jakarta.servlet.http.HttpServlet; 5 | import jakarta.servlet.http.HttpServletRequest; 6 | import jakarta.servlet.http.HttpServletResponse; 7 | 8 | import java.io.IOException; 9 | import java.io.PrintWriter; 10 | 11 | @WebServlet(urlPatterns = "/hello") 12 | public class TestServlet extends HttpServlet { 13 | 14 | @Override 15 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { 16 | PrintWriter writer = resp.getWriter(); 17 | writer.println("Hello world"); 18 | writer.close(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /examples/jaxrs/README.md: -------------------------------------------------------------------------------- 1 | # JAX-RS WildFly bootable jar example 2 | 3 | Build a bootable JAR containing a JAX-RS resource. 4 | 5 | Build and run 6 | ============= 7 | 8 | * To build: `mvn package` 9 | * To run: `mvn wildfly-jar:run` 10 | * Access the application: `http://127.0.0.1:8080/hello` 11 | -------------------------------------------------------------------------------- /examples/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jaxrs; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | 10 | @Path("/hello") 11 | public class HelloWorldEndpoint { 12 | @GET 13 | @Produces("text/plain") 14 | public Response doGet() { 15 | return Response.ok("Hello from WildFly bootable jar!").build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jaxrs; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/jaxws/README.md: -------------------------------------------------------------------------------- 1 | # JAX-WS WildFly bootable jar example 2 | 3 | Build a bootable JAR containing a JAX-WS resource. 4 | 5 | Build and run 6 | ============= 7 | 8 | * To build: `mvn package` 9 | * To run: `mvn wildfly-jar:run` 10 | * Access the WSDL from any SOAP Client: `http://localhost:8080/jaxws-pojo-endpoint/JSEBean?wsdl` 11 | 12 | * Send a SOAP Request. Ex.: 13 | 14 | ` 15 | 16 | 17 | 18 | John 19 | 20 | 21 | ` 22 | 23 | -------------------------------------------------------------------------------- /examples/jaxws/src/main/java/org/wildfly/plugins/demo/jaxws/JSEBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual 4 | * contributors by the @authors tag. See the copyright.txt in the 5 | * distribution for a full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.demo.jaxws; 18 | 19 | import jakarta.jws.WebMethod; 20 | import jakarta.jws.WebService; 21 | import jakarta.jws.soap.SOAPBinding; 22 | 23 | /** 24 | * 25 | * @author rsearls@redhat.com 26 | */ 27 | @WebService 28 | @SOAPBinding(style = SOAPBinding.Style.RPC) 29 | public class JSEBean { 30 | @WebMethod 31 | public String echo(String input) { 32 | return "JSEBean pojo: " + input; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/jaxws/src/main/webapp/WEB-INF/jboss-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | jaxws-pojo-endpoint 21 | 22 | -------------------------------------------------------------------------------- /examples/jib-layers/README.md: -------------------------------------------------------------------------------- 1 | # JAX-RS WildFly bootable jar Jib generated image 2 | 3 | We are using the packaged JAR and WAR support of Java Image Builder Jib. 4 | This example separates the creation of a hollow bootable JAR Jib image from the application JIB image. This allows for efficient application image build. The bootable JAR is built only once. 5 | 6 | WARNING: due to https://github.com/GoogleContainerTools/jib/issues/4134 you must use Docker. 7 | 8 | * To build the hollow JAR JIB image 9 | 10 | * cd server-layer 11 | * mvn package 12 | (The generated image wildfly/jaxrs-server-jib is the FROM image of the application JIB image built in next step). 13 | 14 | * To build the application JIB image 15 | 16 | * cd app-layer 17 | * mvn package 18 | 19 | * To run: docker run -p 8080:8080 wildfly/jaxrs-layers-jib 20 | 21 | * Access the application: http://localhost:8080/hello 22 | -------------------------------------------------------------------------------- /examples/jib-layers/app-layer/src/main/java/org/wildfly/plugins/demo/applayer/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.applayer; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | 10 | @Path("/hello") 11 | public class HelloWorldEndpoint { 12 | @GET 13 | @Produces("text/plain") 14 | public Response doGet() { 15 | return Response.ok("Hello from WildFly bootable jar!").build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/jib-layers/app-layer/src/main/java/org/wildfly/plugins/demo/applayer/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.applayer; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/jib-layers/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.wildfly.plugins 7 | wildfly-jar-examples-parent 8 | 12.0.1.Final-SNAPSHOT 9 | 10 | jib-layers-parent 11 | pom 12 | 13 | WildFly Bootable JAR - JAX-RS with jib layers parent 14 | JAX-RS running with jib Example parent 15 | 16 | 17 | server-layer 18 | app-layer 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/jib/README.md: -------------------------------------------------------------------------------- 1 | # JAX-RS WildFly bootable jar jib generated image 2 | 3 | We are using the packaged jar support of Java Image Builder Jib. 4 | In this approach, the bootable jar is rebuilt each time the app is built, sub-optimal. 5 | For a decoupling of server packaging and app packaging check ../jib-layers example. 6 | 7 | Build and run 8 | ============= 9 | 10 | * To build: `mvn package` (If using podman add: `-Djib.dockerClient.executable=$(which podman)` 11 | * To run: `docker|podman run -p 8080:8080 wildfly/jaxrs-jib` 12 | * Access the application: `http://localhost:8080/hello` 13 | 14 | Build and run in OpenShift 15 | ======================= 16 | * Push the image to a docker repository (can update pom.xml to do that directory in jib plugin config). 17 | * oc new-app 18 | * Create a service (selector deploymentconfig: jaxrs-jib, port 8080) 19 | * Expose the service 20 | * Access the application: http://\/hello 21 | -------------------------------------------------------------------------------- /examples/jib/src/main/java/org/wildfly/plugins/demo/jib/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jib; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | 10 | @Path("/hello") 11 | public class HelloWorldEndpoint { 12 | @GET 13 | @Produces("text/plain") 14 | public Response doGet() { 15 | return Response.ok("Hello from WildFly bootable jar!").build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/jib/src/main/java/org/wildfly/plugins/demo/jib/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jib; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/jkube/README.md: -------------------------------------------------------------------------------- 1 | # WildFly bootable JAR JKube example 2 | 3 | This is a project to use Eclipse JKube plugin to build and deploy a bootable JAR on OpenShift. 4 | 5 | JKube documentation can be found on https://www.eclipse.org/jkube/ 6 | 7 | JKube build and deployment for OpenShift 8 | ======================================== 9 | 10 | The following command will create and deploy the Bootable JAR on OpenShift: 11 | 12 | `mvn oc:deploy` 13 | 14 | Make sure you are logged in to your OpenShift Cluster before you try build/deploy 15 | 16 | Jakarta EE9, JKube build and deployment for OpenShift 17 | ======================================== 18 | 19 | The following command will create and deploy the Bootable JAR built using the `wildfly-preview` galleon feature-pack on OpenShift: 20 | 21 | `mvn oc:deploy -Pjakarta-ee9` 22 | 23 | Make sure you are logged in to your OpenShift Cluster before you try build/deploy -------------------------------------------------------------------------------- /examples/jkube/src/main/java/org/wildfly/plugins/demo/jkube/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jkube; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | 10 | @Path("/hello") 11 | public class HelloWorldEndpoint { 12 | @GET 13 | @Produces("text/plain") 14 | public Response doGet() { 15 | return Response.ok("Hello from WildFly bootable jar!").build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/jkube/src/main/java/org/wildfly/plugins/demo/jkube/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jkube; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/jsf-ejb-jpa/README.md: -------------------------------------------------------------------------------- 1 | # WildFly JSF with EJBs and persistence bootable JAR example 2 | 3 | This example shows how to combine JSF EJB and JPA. The example is a simple CRUD application that access to an in memory H2 data base. The H2 datasource is created by a CLI script executed by the wildfly-jar plugin at build time. 4 | 5 | Build and run 6 | ============= 7 | 8 | * To build: `mvn package` 9 | * To run: `mvn wildfly-jar:run` 10 | * Access the application on a web browser: `http://127.0.0.1:8080/` 11 | 12 | 13 | Build and run on OpenShift 14 | ========================== 15 | 16 | * mvn package -Popenshift 17 | * mkdir os && cp target/jsf-ejb-jpa-bootable.jar os/ 18 | * Import the OpenJDK 17 image to run the Java application, create the image stream and deployment: 19 | ``` 20 | oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm 21 | 22 | oc new-build --strategy source --binary --image-stream openjdk-17 --name jsf-ejb-jpa-bootable-jar 23 | 24 | oc start-build jsf-ejb-jpa-bootable-jar --from-dir ./os/ 25 | 26 | oc new-app --name jsf-ejb-jpa-bootable-jar-app jsf-ejb-jpa-bootable-jar 27 | 28 | oc expose svc/jsf-ejb-jpa-bootable-jar-app 29 | ``` 30 | * You can verify the application is working by using: 31 | `curl http://$(oc get route jsf-ejb-jpa-bootable-jar-app --template='{{ .spec.host }}')` 32 | 33 | -------------------------------------------------------------------------------- /examples/jsf-ejb-jpa/src/main/java/org/wildfly/plugins/demo/jsf/Task.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jsf; 2 | 3 | import static jakarta.persistence.GenerationType.IDENTITY; 4 | 5 | import jakarta.persistence.Entity; 6 | import jakarta.persistence.GeneratedValue; 7 | import jakarta.persistence.GenerationType; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.NamedQuery; 10 | import jakarta.persistence.Table; 11 | 12 | @Entity 13 | @Table(name = "tasks") 14 | @NamedQuery(name = Task.FIND_ALL, query = "SELECT t FROM Task t") 15 | public class Task { 16 | public static final String FIND_ALL = "demo.jsf.Task.ALL"; 17 | 18 | @Id 19 | @GeneratedValue(strategy = IDENTITY) 20 | private Long id; 21 | 22 | private String title; 23 | 24 | public Task() { 25 | } 26 | 27 | public Long getId() { 28 | return id; 29 | } 30 | 31 | public String getTitle() { 32 | return title; 33 | } 34 | 35 | public void setId(Long id) { 36 | this.id = id; 37 | } 38 | 39 | public void setTitle(String title) { 40 | this.title = title; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/jsf-ejb-jpa/src/main/java/org/wildfly/plugins/demo/jsf/TaskController.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jsf; 2 | 3 | import java.util.List; 4 | 5 | import jakarta.ejb.EJBException; 6 | import jakarta.ejb.Stateless; 7 | import jakarta.persistence.EntityManager; 8 | import jakarta.persistence.EntityNotFoundException; 9 | import jakarta.persistence.PersistenceContext; 10 | 11 | @Stateless 12 | public class TaskController { 13 | 14 | @PersistenceContext 15 | private EntityManager em; 16 | 17 | public List loadAll() { 18 | return em.createNamedQuery(Task.FIND_ALL).getResultList(); 19 | } 20 | 21 | public Task add(String title) { 22 | final Task newTask = new Task(); 23 | newTask.setTitle(title); 24 | 25 | this.em.persist(newTask); 26 | this.em.flush(); 27 | this.em.refresh(newTask); 28 | 29 | return newTask; 30 | } 31 | 32 | public Task delete(Long id) { 33 | try { 34 | Task ref = this.em.getReference(Task.class, id); 35 | this.em.remove(ref); 36 | return ref; 37 | } catch (EntityNotFoundException enf) { 38 | throw new EJBException(enf); 39 | } 40 | } 41 | 42 | public Task update(Long id, String title) { 43 | try { 44 | final Task ref = this.em.getReference(Task.class, id); 45 | ref.setTitle(title); 46 | return this.em.merge(ref); 47 | } catch (EntityNotFoundException enf) { 48 | throw new EJBException(enf); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /examples/jsf-ejb-jpa/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | java:jboss/datasources/JsfDS 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/jsf-ejb-jpa/src/main/resources/META-INF/sql/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO tasks (title) VALUES ('This is the task-1'); 2 | INSERT INTO tasks (title) VALUES ('This is the task-2'); 3 | INSERT INTO tasks (title) VALUES ('This is the task-3'); 4 | INSERT INTO tasks (title) VALUES ('This is the task-4'); 5 | INSERT INTO tasks (title) VALUES ('This is the task-5'); -------------------------------------------------------------------------------- /examples/jsf-ejb-jpa/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /examples/jsf-ejb-jpa/src/main/webapp/WEB-INF/jsf-ejb-jpa-ds.xml: -------------------------------------------------------------------------------- 1 | 4 | 8 | jdbc:h2:mem:jsf-ds;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1 9 | h2 10 | 11 | sa 12 | sa 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/jsf-ejb-jpa/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | jakarta.faces.PROJECT_STAGE 11 | Development 12 | 13 | 14 | Faces Servlet 15 | jakarta.faces.webapp.FacesServlet 16 | 1 17 | 18 | 19 | Faces Servlet 20 | *.xhtml 21 | 22 | 23 | 24 | 30 25 | 26 | 27 | 28 | index.xhtml 29 | 30 | 31 | -------------------------------------------------------------------------------- /examples/jsf-ejb-jpa/src/main/webapp/resources/css/styles.css: -------------------------------------------------------------------------------- 1 | label { 2 | display: inline-block; 3 | width: 100px; 4 | text-align: right; 5 | margin-right: 10px; 6 | } 7 | 8 | input[type="submit"] { 9 | margin-left: 10px 10 | } 11 | 12 | input[type="text"] { 13 | margin-bottom: 5px; 14 | } 15 | 16 | .results { 17 | border-collapse: collapse; 18 | border: 1px solid #D6DDE6; 19 | width: 100%; 20 | } 21 | 22 | .results th { 23 | border: 1px solid #828282; 24 | background-color: #BCBCBC; 25 | font-weight: bold; 26 | text-align: left; 27 | padding-left: 0.3em; 28 | } 29 | 30 | #outputGroup { 31 | clear: both; 32 | width: 100%; 33 | } 34 | 35 | div { 36 | margin-bottom: 15px; 37 | float: left; 38 | } 39 | 40 | div.main { 41 | padding: 2%; 42 | max-width: 800px; 43 | } -------------------------------------------------------------------------------- /examples/logging-json/README.md: -------------------------------------------------------------------------------- 1 | # Logging configuration WildFly bootable jar with JSON logging example 2 | 3 | This example shows how to add JSON formatted log messages in the logging subsystem. A custom `logging.properties` 4 | file is used for boot logging. The file is overridden during the build of the bootable JAR with the 5 | `` configuration parameter. 6 | 7 | --- 8 | **NOTE** 9 | This is not a common use-case. 10 | --- 11 | 12 | ## Build and run 13 | 14 | * To build: `mvn package` 15 | (During build, the script logging-json-handler.cli is applied). This is required to synchronize our `logging.properties` 16 | configuration with the servers logging configuration. 17 | * To run: `mvn wildfly-jar:run` 18 | (Notice xnio,logging and bootablejar traces displayed in the console). 19 | * Access the application: `http://127.0.0.1:8080/` 20 | * Notice the logs from a `org.jboss.logmanager.handlers.FileAppender` being displayed. -------------------------------------------------------------------------------- /examples/logging-json/src/main/java/org/wildfly/plugins/demo/logging/model/LogMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * 4 | * Copyright 2020 Red Hat, Inc., and individual contributors 5 | * as indicated by the @author tags. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package org.wildfly.plugins.demo.logging.model; 21 | 22 | /** 23 | * @author James R. Perkins 24 | */ 25 | public class LogMessage { 26 | private String level; 27 | private String message; 28 | private boolean addException; 29 | 30 | public String getLevel() { 31 | return level; 32 | } 33 | 34 | public void setLevel(final String level) { 35 | this.level = level; 36 | } 37 | 38 | public String getMessage() { 39 | return message; 40 | } 41 | 42 | public void setMessage(final String message) { 43 | this.message = message; 44 | } 45 | 46 | public boolean isAddException() { 47 | return addException; 48 | } 49 | 50 | public void setAddException(final boolean addException) { 51 | this.addException = addException; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /examples/logging-json/src/main/java/org/wildfly/plugins/demo/logging/rest/JaxRsActivator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * 4 | * Copyright 2020 Red Hat, Inc., and individual contributors 5 | * as indicated by the @author tags. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package org.wildfly.plugins.demo.logging.rest; 21 | 22 | import java.util.Collections; 23 | import java.util.Map; 24 | import jakarta.ws.rs.ApplicationPath; 25 | import jakarta.ws.rs.core.Application; 26 | 27 | /** 28 | * @author James R. Perkins 29 | */ 30 | @ApplicationPath("/rest") 31 | public class JaxRsActivator extends Application { 32 | } 33 | -------------------------------------------------------------------------------- /examples/logging-json/src/main/java/org/wildfly/plugins/demo/logging/util/Resources.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * 4 | * Copyright 2020 Red Hat, Inc., and individual contributors 5 | * as indicated by the @author tags. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | package org.wildfly.plugins.demo.logging.util; 20 | 21 | import jakarta.enterprise.context.ApplicationScoped; 22 | import jakarta.enterprise.inject.Produces; 23 | import jakarta.enterprise.inject.spi.InjectionPoint; 24 | 25 | import org.jboss.logging.Logger; 26 | 27 | /** 28 | * @author James R. Perkins 29 | */ 30 | @ApplicationScoped 31 | public class Resources { 32 | 33 | @Produces 34 | public Logger produceLog(InjectionPoint injectionPoint) { 35 | return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /examples/logging-json/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly-extras/wildfly-jar-maven-plugin/71ec0d9dbd99204a0a9af36e0d320e8b0e73a3ab/examples/logging-json/src/main/resources/META-INF/beans.xml -------------------------------------------------------------------------------- /examples/logging/README.md: -------------------------------------------------------------------------------- 1 | # Logging configuration WildFly bootable jar example 2 | 3 | An example showing how to change the Bootable Jar server logging configuration. 4 | 5 | Build and run 6 | ============= 7 | 8 | * To build: `mvn package` 9 | (During build, the script logging.cli is applied). 10 | * To run: `mvn wildfly-jar:run`. 11 | * Note you should see the logs being output in JSON format. 12 | * Access the application: `http://127.0.0.1:8080/hello` 13 | * Notice the `org.wildfly.plugins.demo.logging.HelloWorldEndpoint` debug trace in the console. 14 | -------------------------------------------------------------------------------- /examples/logging/src/main/java/org/wildfly/plugins/demo/logging/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.logging; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | import org.jboss.logging.Logger; 10 | 11 | @Path("/hello") 12 | public class HelloWorldEndpoint { 13 | 14 | private static Logger log = Logger.getLogger(HelloWorldEndpoint.class.getName()); 15 | @GET 16 | @Produces("text/plain") 17 | public Response doGet() { 18 | log.debug("HelloWorldEndpoint.doGet called"); 19 | return Response.ok("Hello from WildFly bootable jar!").build(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/logging/src/main/java/org/wildfly/plugins/demo/logging/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.logging; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/microprofile-config/src/main/java/org/wildfly/plugins/demo/microprofile/config/MicroProfileConfigEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.microprofile.config; 2 | 3 | 4 | import jakarta.inject.Inject; 5 | import jakarta.ws.rs.ApplicationPath; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Path; 8 | import jakarta.ws.rs.Produces; 9 | import jakarta.ws.rs.core.Application; 10 | import jakarta.ws.rs.core.Response; 11 | 12 | import org.eclipse.microprofile.config.inject.ConfigProperty; 13 | 14 | 15 | @Path("/") 16 | public class MicroProfileConfigEndpoint { 17 | 18 | 19 | @Inject 20 | @ConfigProperty(name = "config1", defaultValue = "Default value for config1 comes from my code") 21 | String config1; 22 | 23 | @Inject 24 | @ConfigProperty(name = "config2", defaultValue = "Default value for config2 comes from my code") 25 | String config2; 26 | 27 | @Inject 28 | @ConfigProperty(name = "config3", defaultValue = "Default value for config3 comes from my code") 29 | String config3; 30 | 31 | @GET 32 | @Produces("text/plain") 33 | public Response doGet() { 34 | 35 | StringBuilder out = new StringBuilder("config1 = " + config1); 36 | out.append("\nconfig2 = " + config2); 37 | out.append("\nconfig3 = " + config3); 38 | 39 | return Response.ok(out).build(); 40 | } 41 | 42 | @ApplicationPath("/") 43 | public static class RestApplication extends Application { 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /examples/microprofile-config/src/main/resources/META-INF/microprofile-config.properties: -------------------------------------------------------------------------------- 1 | config2=Value for config2 comes from a properties file inside the application 2 | -------------------------------------------------------------------------------- /examples/microprofile-config/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | 22 | -------------------------------------------------------------------------------- /examples/postgresql/README.md: -------------------------------------------------------------------------------- 1 | # Postgresql WildFly bootable jar OpenShift example 2 | 3 | Openshift binary build and deployment 4 | ===================================== 5 | 6 | Create and configure a PostgreSQL data base server: 7 | 8 | ``` 9 | oc new-app --name database-server \ 10 | --env POSTGRESQL_USER=admin \ 11 | --env POSTGRESQL_PASSWORD=admin \ 12 | --env POSTGRESQL_DATABASE=sampledb \ 13 | postgresql 14 | ``` 15 | 16 | * mvn package -Popenshift 17 | * mkdir os && cp target/postgresql-bootable.jar os/ 18 | * Import the OpenJDK 17 image to run the Java application, create the image stream and deployment: 19 | ``` 20 | oc import-image ubi8/openjdk-17 --from=registry.redhat.io/ubi8/openjdk-17 --confirm 21 | 22 | oc new-build --strategy source --binary --image-stream openjdk-17 --name wf-postgresql 23 | 24 | oc start-build wf-postgresql --from-dir ./os/ 25 | 26 | oc new-app --name wf-postgresql-app \ 27 | --env POSTGRESQL_USER=admin \ 28 | --env POSTGRESQL_PASSWORD=admin \ 29 | --env POSTGRESQL_SERVICE_HOST=database-server \ 30 | --env POSTGRESQL_SERVICE_PORT=5432 \ 31 | --env POSTGRESQL_DATABASE=sampledb \ 32 | wf-postgresql 33 | 34 | oc expose svc/wf-postgresql-app 35 | ``` 36 | * Add a new task: 37 | ``` 38 | curl -X POST http://$(oc get route wf-postgresql-app --template='{{ .spec.host }}')/tasks/title/foo` 39 | 40 | * Get all the tasks: 41 | `curl http://$(oc get route wf-postgresql-app --template='{{ .spec.host }}')` 42 | -------------------------------------------------------------------------------- /examples/postgresql/src/main/java/org/wildfly/plugins/demo/tasksrs/model/TaskDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual 4 | * contributors by the @authors tag. See the copyright.txt in the 5 | * distribution for a full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.demo.tasksrs.model; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * Basic operations for manipulation of tasks 23 | * 24 | * @author Lukas Fryc 25 | * 26 | */ 27 | public interface TaskDao { 28 | 29 | void createTask(TaskUser user, Task task); 30 | 31 | List getAll(TaskUser user); 32 | 33 | List getRange(TaskUser user, int offset, int count); 34 | 35 | List getForTitle(TaskUser user, String title); 36 | 37 | void deleteTask(Task task); 38 | } 39 | -------------------------------------------------------------------------------- /examples/postgresql/src/main/java/org/wildfly/plugins/demo/tasksrs/model/TaskUserDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual 4 | * contributors by the @authors tag. See the copyright.txt in the 5 | * distribution for a full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.demo.tasksrs.model; 18 | 19 | /** 20 | * Basic operations for manipulation with users 21 | * 22 | * @author Lukas Fryc 23 | * 24 | */ 25 | public interface TaskUserDao { 26 | 27 | TaskUser getForUsername(String username); 28 | 29 | void createUser(TaskUser user); 30 | } 31 | -------------------------------------------------------------------------------- /examples/postgresql/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | java:jboss/datasources/PostgreSQLDS 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /examples/postgresql/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 22 | 23 | -------------------------------------------------------------------------------- /examples/postgresql/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 17 | 20 | 21 | 22 | jakarta.ws.rs.core.Application 23 | /* 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/remote-microprofile-config/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.access.redhat.com/ubi8/openjdk-11:latest 2 | COPY --chown=jboss:root target/*.jar /deployments/. 3 | RUN chmod -R ug+rwX /deployments/. 4 | -------------------------------------------------------------------------------- /examples/remote-microprofile-config/src/main/java/org/wildfly/plugins/demo/microprofile/config/MicroProfileConfigEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.microprofile.config; 2 | 3 | 4 | import jakarta.inject.Inject; 5 | import jakarta.ws.rs.ApplicationPath; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Path; 8 | import jakarta.ws.rs.Produces; 9 | import jakarta.ws.rs.core.Application; 10 | import jakarta.ws.rs.core.Response; 11 | 12 | import org.eclipse.microprofile.config.inject.ConfigProperty; 13 | 14 | 15 | @Path("/") 16 | public class MicroProfileConfigEndpoint { 17 | 18 | 19 | @Inject 20 | @ConfigProperty(name = "config1", defaultValue = "Default value for config1 comes from my code") 21 | String config1; 22 | 23 | @Inject 24 | @ConfigProperty(name = "config2", defaultValue = "Default value for config2 comes from my code") 25 | String config2; 26 | 27 | @Inject 28 | @ConfigProperty(name = "config3", defaultValue = "Default value for config3 comes from my code") 29 | String config3; 30 | 31 | @GET 32 | @Produces("text/plain") 33 | public Response doGet() { 34 | 35 | StringBuilder out = new StringBuilder("config1 = " + config1); 36 | out.append("\nconfig2 = " + config2); 37 | out.append("\nconfig3 = " + config3); 38 | 39 | return Response.ok(out).build(); 40 | } 41 | 42 | @ApplicationPath("/") 43 | public static class RestApplication extends Application { 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /examples/remote-microprofile-config/src/main/resources/META-INF/microprofile-config.properties: -------------------------------------------------------------------------------- 1 | config2=Value for config2 comes from a properties file inside the application XXX 2 | -------------------------------------------------------------------------------- /examples/remote-microprofile-config/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | 22 | -------------------------------------------------------------------------------- /examples/scripts/add-user.cli: -------------------------------------------------------------------------------- 1 | # Create a user store 2 | /subsystem=elytron/filesystem-realm=exampleFsRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) 3 | 4 | # Add user admin identity and password admin 5 | /subsystem=elytron/filesystem-realm=exampleFsRealm:add-identity(identity=admin) 6 | /subsystem=elytron/filesystem-realm=exampleFsRealm:set-password(clear={password="admin"}, identity=admin) 7 | 8 | # Create the security domain and http-authentication-factory 9 | /subsystem=elytron/security-domain=exampleSD:add(realms=[{realm=exampleFsRealm}], permission-mapper=default-permission-mapper, default-realm=exampleFsRealm) 10 | /subsystem=elytron/http-authentication-factory=example-http-auth:add(http-server-mechanism-factory=global,security-domain=exampleSD,mechanism-configurations=[{mechanism-name=DIGEST,mechanism-realm-configurations=[{realm-name=exampleFsRealm}]}]) 11 | 12 | # Set the auth factory on the management interface 13 | /core-service=management/management-interface=http-interface:write-attribute(name=http-authentication-factory,value=example-http-auth) -------------------------------------------------------------------------------- /examples/scripts/anonymous-management.cli: -------------------------------------------------------------------------------- 1 | /core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade.sasl-authentication-factory) 2 | -------------------------------------------------------------------------------- /examples/scripts/authentication.cli: -------------------------------------------------------------------------------- 1 | /subsystem=elytron/properties-realm=bootable-realm:add(users-properties={relative-to=jboss.server.config.dir, path=bootable-users.properties, plain-text=true}, groups-properties={relative-to=jboss.server.config.dir, path=bootable-groups.properties}) 2 | /subsystem=elytron/security-domain=BootableDomain:add(default-realm=bootable-realm, permission-mapper=default-permission-mapper, realms=[{realm=bootable-realm, role-decoder=groups-to-roles}]) 3 | /subsystem=undertow/application-security-domain=other:add(security-domain=BootableDomain) 4 | -------------------------------------------------------------------------------- /examples/scripts/cli.properties: -------------------------------------------------------------------------------- 1 | keystore.path=/etc/wf-secrets/keystore.jks 2 | keystore.password=password 3 | undertow.server=default-server 4 | config.path=/etc/config 5 | config.ordinal=200 6 | -------------------------------------------------------------------------------- /examples/scripts/configure-oidc.cli: -------------------------------------------------------------------------------- 1 | /subsystem=elytron-oidc-client/secure-deployment=simple-webapp.war:add(realm=WildFly, resource=simple-webapp, public-client=true, auth-server-url=http://localhost:8090/auth/, ssl-required=EXTERNAL) -------------------------------------------------------------------------------- /examples/scripts/disable-http.cli: -------------------------------------------------------------------------------- 1 | # Disable http 2 | /subsystem=undertow/server=${undertow.server}/http-listener=default:write-attribute(name=enabled, value=false) 3 | -------------------------------------------------------------------------------- /examples/scripts/ejb-persistent-clustered-timers.cli: -------------------------------------------------------------------------------- 1 | batch 2 | /subsystem=ejb3/service=timer-service/database-data-store=ejb-timers-ds:add(datasource-jndi-name=java:jboss/datasources/PostgreSQLDS, database=postgresql, partition=ejb-timers-ds-part) 3 | /subsystem=ejb3/service=timer-service:write-attribute(name=default-data-store, value=ejb-timers-ds) 4 | run-batch 5 | -------------------------------------------------------------------------------- /examples/scripts/https.cli: -------------------------------------------------------------------------------- 1 | #SSL 2 | /subsystem=elytron/key-store=keystore:add(relative-to=jboss.server.config.dir, path=keystore.jks, credential-reference={clear-text=${keystore.password}}) 3 | /subsystem=elytron/key-manager=key-manager:add(key-store=keystore, credential-reference={clear-text=${keystore.password}}) 4 | /subsystem=elytron/server-ssl-context=server-ssl-context:add(key-manager=key-manager) 5 | #HTTPS 6 | # Disable http 7 | /subsystem=undertow/server=${undertow.server}/http-listener=default:write-attribute(name=enabled, value=false) 8 | /subsystem=undertow/server=${undertow.server}/https-listener=https:add(ssl-context=server-ssl-context, socket-binding=https, proxy-address-forwarding=true) -------------------------------------------------------------------------------- /examples/scripts/logging-json-handler.cli: -------------------------------------------------------------------------------- 1 | /subsystem=logging/json-formatter=json:add(exception-output-type=formatted) 2 | /subsystem=logging/file-handler=json-file:add(file={relative-to=jboss.server.log.dir, path=json.log}, append=true, autoflush=true, named-formatter=json) 3 | /subsystem=logging/root-logger=ROOT:add-handler(name=json-file) 4 | 5 | -------------------------------------------------------------------------------- /examples/scripts/logging.cli: -------------------------------------------------------------------------------- 1 | /subsystem=logging/logger=org.wildfly.plugins.demo:add(level=ALL) 2 | /subsystem=logging/json-formatter=json-formatter:add(exception-output-type=formatted, pretty-print=false, meta-data={version="1"}, key-overrides={timestamp="@timestamp"}) 3 | /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=ALL) 4 | /subsystem=logging/console-handler=CONSOLE:write-attribute(name=named-formatter, value=json-formatter) 5 | 6 | -------------------------------------------------------------------------------- /examples/scripts/mp-config.cli: -------------------------------------------------------------------------------- 1 | # config map 2 | /subsystem=microprofile-config-smallrye/config-source=os-map:add(dir={path=${config.path}}, ordinal=${config.ordinal}) 3 | -------------------------------------------------------------------------------- /examples/scripts/os-clustering-dns-ping.cli: -------------------------------------------------------------------------------- 1 | if (outcome == success) of /subsystem=jgroups/stack=tcp/protocol=kubernetes.KUBE_PING:read-resource 2 | /subsystem=jgroups/stack=tcp/protocol=kubernetes.KUBE_PING:remove 3 | end-if 4 | 5 | if (outcome == success) of /subsystem=jgroups/stack=tcp:read-resource 6 | /subsystem=jgroups/stack=tcp/protocol=dns.DNS_PING:add(add-index=0) 7 | # This env variable is set by Helm Chart 8 | /subsystem=jgroups/stack=tcp/protocol=dns.DNS_PING:write-attribute(name=properties, value={dns_query=${env.OPENSHIFT_DNS_PING_SERVICE_NAME}, async_discovery_use_separate_thread_per_request=true}) 9 | end-if 10 | 11 | -------------------------------------------------------------------------------- /examples/scripts/os-https.cli: -------------------------------------------------------------------------------- 1 | #SSL 2 | # When the keystore file doesn't exist (will exist in the POD), we need to set required=false and type attributes. 3 | /subsystem=elytron/key-store=keystore:add(path="${keystore.path}", required=false, type=JKS, credential-reference={clear-text=${keystore.password}}) 4 | /subsystem=elytron/key-manager=key-manager:add(key-store=keystore, credential-reference={clear-text=${keystore.password}}) 5 | /subsystem=elytron/server-ssl-context=server-ssl-context:add(key-manager=key-manager) 6 | #HTTPS 7 | # Disable http 8 | /subsystem=undertow/server=${undertow.server}/http-listener=default:write-attribute(name=enabled, value=false) 9 | /subsystem=undertow/server=${undertow.server}/https-listener=https:add(ssl-context=server-ssl-context, socket-binding=https, proxy-address-forwarding=true) -------------------------------------------------------------------------------- /examples/secmanager/README.md: -------------------------------------------------------------------------------- 1 | # Security Manager WildFly bootable jar example 2 | 3 | An example of how to use security manager permissions. 4 | 5 | Build and run 6 | ============= 7 | 8 | During packaging the permission to read properties is granted to deployments. 9 | 10 | * To build: `mvn package` 11 | * To run: `java -jar target/sec-manager-bootable.jar -secmgr` 12 | * Access the application: 13 | * http://127.0.0.1:8080/hello/read - Should succeed as the read action is allowed. 14 | * http://127.0.0.1:8080/hello/write - Should fail with an `AccessControlException` as the write permission was not granted. 15 | -------------------------------------------------------------------------------- /examples/secmanager/src/main/java/org/wildfly/plugins/demo/secmgr/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.secmgr; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | @Path("/hello") 10 | public class HelloWorldEndpoint { 11 | 12 | @GET 13 | @Path("/read") 14 | @Produces("text/plain") 15 | public Response read() { 16 | System.getProperty("FOO"); 17 | return Response.ok("Successfully read system property \"FOO\"").build(); 18 | } 19 | 20 | @GET 21 | @Path("/write") 22 | @Produces("text/plain") 23 | public Response write() { 24 | System.setProperty("FOO", "VALUE"); 25 | return Response.ok("Successfully write system property \"FOO\"").build(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/secmanager/src/main/java/org/wildfly/plugins/demo/secmgr/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.secmgr; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/secmanager/src/main/webapp/META-INF/permissions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | java.util.PropertyPermission 6 | * 7 | read 8 | 9 | -------------------------------------------------------------------------------- /examples/slim/README.md: -------------------------------------------------------------------------------- 1 | # WildFly slim bootable jar and local maven repository generation Example 2 | 3 | This is an example of using `jboss-maven-dist` plugin option to store all the JBoss Modules maven artifacts used by the Bootable Jar in an external maven repository, reducing the size of the generated JAR file. 4 | 5 | When you are building this example, all the JBoss Modules artifacts will be stored on the `my-maven-repo` directory. You can make a reference to them by specifying the maven repository to use. 6 | 7 | Build and run 8 | ============= 9 | 10 | * To build: `mvn package` 11 | * To run: `java -Dmaven.repo.local=/examples/slim/target/my-maven-repo -jar target/slim-bootable.jar` 12 | * Access the application: `http://127.0.0.1:8080/hello` 13 | 14 | JKube build and deployment for OpenShift 15 | ======================================== 16 | 17 | JKube automatically detects the generated maven local cache and installs it in the generated Docker image. In addition, the system property `-Dmaven.repo.local` 18 | is added when launching the server. 19 | 20 | The following command will create and deploy the Bootable JAR on OpenShift: 21 | 22 | `mvn oc:deploy -Popenshift` 23 | 24 | Make sure you are logged in to your OpenShift Cluster before you try build/deploy -------------------------------------------------------------------------------- /examples/slim/src/main/java/org/wildfly/plugins/demo/slim/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.slim; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | 10 | @Path("/hello") 11 | public class HelloWorldEndpoint { 12 | @GET 13 | @Produces("text/plain") 14 | public Response doGet() { 15 | return Response.ok("Hello from WildFly bootable jar!").build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/slim/src/main/java/org/wildfly/plugins/demo/slim/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.slim; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /examples/web-clustering-dns-ping/helm.yaml: -------------------------------------------------------------------------------- 1 | build: 2 | uri: https://github.com/wildfly-extras/wildfly-jar-maven-plugin.git 3 | ref: 12.0.0.Final 4 | contextDir: examples 5 | mode: bootable-jar 6 | bootableJar: 7 | builderImage: registry.access.redhat.com/ubi8/openjdk-17:latest 8 | env: 9 | - name: MAVEN_ARGS_APPEND 10 | value: -pl web-clustering-dns-ping/ -am 11 | - name: ARTIFACT_DIR 12 | value: web-clustering-dns-ping/target 13 | deploy: 14 | replicas: 2 15 | env: 16 | - name: JGROUPS_CLUSTER_PASSWORD 17 | value: "mypassword" 18 | -------------------------------------------------------------------------------- /examples/web-clustering-dns-ping/src/main/java/org/wildfly/plugins/demo/web/clustering/User.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.web.clustering; 2 | 3 | import java.io.Serializable; 4 | 5 | public class User implements Serializable { 6 | private final long created; 7 | 8 | User(long created) { 9 | this.created = created; 10 | } 11 | public long getCreated() { 12 | return created; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/web-clustering-dns-ping/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /examples/web-clustering/src/main/java/org/wildfly/plugins/demo/web/clustering/User.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.web.clustering; 2 | 3 | import java.io.Serializable; 4 | 5 | public class User implements Serializable { 6 | private final long created; 7 | 8 | User(long created) { 9 | this.created = created; 10 | } 11 | public long getCreated() { 12 | return created; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/web-clustering/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /examples/web-console/README.md: -------------------------------------------------------------------------------- 1 | # Web Console WildFly bootable jar example 2 | 3 | Provision a server with a JAX-RS resource and activates the HAL Web Console. A CLI script adds the user admin/admin in order to have access to the web console. 4 | 5 | Build and run 6 | ============= 7 | 8 | * To build: `mvn package` 9 | * To run: `mvn wildfly-jar:run` 10 | * Access the Web Console: `http://127.0.0.1:9990` (user admin, password admin) 11 | * Access the application: `http://127.0.0.1:8080/hello` 12 | 13 | 14 | ## Notes 15 | * Remember the Bootable Jar is started in read-only mode and any change applied by using the Web Console will not be persisted if your application is stopped and launched again. 16 | * Add the `request-controller` Galleon layer if you need to use the [Suspend, Resume and Graceful shutdown](https://docs.wildfly.org/20/Admin_Guide.html#Suspend) server capabilities. 17 | * The server cannot be re-started automatically during a shutdown. The bootable jar process will exit without restarting. 18 | -------------------------------------------------------------------------------- /examples/web-console/src/main/java/org/wildfly/plugins/demo/web/console/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.web.console; 2 | 3 | 4 | import jakarta.ws.rs.Path; 5 | import jakarta.ws.rs.core.Response; 6 | import jakarta.ws.rs.GET; 7 | import jakarta.ws.rs.Produces; 8 | 9 | 10 | @Path("/hello") 11 | public class HelloWorldEndpoint { 12 | @GET 13 | @Produces("text/plain") 14 | public Response doGet() { 15 | return Response.ok("Hello from WildFly bootable jar!").build(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/web-console/src/main/java/org/wildfly/plugins/demo/web/console/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.web.console; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /extensions/cloud/src/main/resources/META-INF/services/org.wildfly.core.jar.boot.RuntimeExtension: -------------------------------------------------------------------------------- 1 | org.wildfly.plugins.bootablejar.extensions.cloud.CloudExtension -------------------------------------------------------------------------------- /extensions/cloud/src/test/resources/openshift.properties: -------------------------------------------------------------------------------- 1 | foo.bar=toto 2 | -------------------------------------------------------------------------------- /extensions/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 4.0.0 22 | 23 | 24 | org.wildfly.plugins 25 | wildfly-jar-parent 26 | 12.0.1.Final-SNAPSHOT 27 | 28 | 29 | wildfly-jar-extensions-parent 30 | pom 31 | 32 | WildFly Bootable JAR runtime extensions Parent 33 | 2019 34 | 35 | 36 | Apache License 2.0 37 | https://repository.jboss.org/licenses/apache-2.0.txt 38 | repo 39 | 40 | 41 | 42 | 43 | cloud 44 | 45 | 46 | -------------------------------------------------------------------------------- /perf-tests/README.md: -------------------------------------------------------------------------------- 1 | ## WildFly bootable jar perf tests 2 | 3 | In order to enable test execution set -Dskip.perf.tests=false 4 | 5 | * plugin-memory: Run mutliple executions of the plugin the same JVM. 6 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugins/bootablejar/maven/cli/CLIExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.cli; 18 | 19 | import java.util.List; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public interface CLIExecutor extends AutoCloseable { 25 | 26 | 27 | void handle(String command) throws Exception; 28 | 29 | String getOutput() throws Exception; 30 | 31 | void generateBootLoggingConfig() throws Exception; 32 | 33 | void execute(List commands) throws Exception; 34 | } 35 | -------------------------------------------------------------------------------- /plugin/src/main/java/org/wildfly/plugins/bootablejar/maven/common/FeaturePack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.common; 18 | 19 | import org.jboss.galleon.api.GalleonFeaturePack; 20 | 21 | public class FeaturePack extends GalleonFeaturePack { 22 | 23 | private String includedDefaultConfig; 24 | public FeaturePack() { 25 | // Default to false with WildFly Bootable JAR. 26 | setInheritPackages(false); 27 | } 28 | public String getIncludedDefaultConfig() { 29 | return includedDefaultConfig; 30 | } 31 | 32 | public void setIncludedDefaultConfig(String includedDefaultConfig) { 33 | this.includedDefaultConfig = includedDefaultConfig; 34 | } 35 | 36 | public String getGAC() { 37 | StringBuilder builder = new StringBuilder(); 38 | builder.append(getGroupId()).append(":").append(getArtifactId()); 39 | String type = getExtension() == null ? getType() : getExtension(); 40 | if (getClassifier() != null) { 41 | builder.append(":").append(getClassifier()); 42 | } 43 | return builder.toString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /plugin/src/main/resources/org/wildfly/plugins/bootablejar/maven/cloud/logging.properties: -------------------------------------------------------------------------------- 1 | # Note this file has been generated and will be overwritten if a 2 | # logging subsystem has been defined in the XML configuration. 3 | 4 | # Additional loggers to configure (the root logger is always configured) 5 | loggers=com.arjuna,jacorb,org.jboss.as.config,org.apache.tomcat.util.modeler,sun.rmi,jacorb.config 6 | 7 | logger.level=INFO 8 | logger.handlers=CONSOLE 9 | 10 | logger.com.arjuna.level=WARN 11 | logger.com.arjuna.useParentHandlers=true 12 | 13 | logger.jacorb.level=WARN 14 | logger.jacorb.useParentHandlers=true 15 | 16 | logger.org.jboss.as.config.level=DEBUG 17 | logger.org.jboss.as.config.useParentHandlers=true 18 | 19 | logger.org.apache.tomcat.util.modeler.level=WARN 20 | logger.org.apache.tomcat.util.modeler.useParentHandlers=true 21 | 22 | logger.sun.rmi.level=WARN 23 | logger.sun.rmi.useParentHandlers=true 24 | 25 | logger.jacorb.config.level=ERROR 26 | logger.jacorb.config.useParentHandlers=true 27 | 28 | # Additional handlers to configure 29 | handlers=CONSOLE 30 | 31 | 32 | handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler 33 | handler.CONSOLE.level=ALL 34 | handler.CONSOLE.formatter=COLOR-PATTERN 35 | handler.CONSOLE.properties=autoFlush,target,enabled 36 | handler.CONSOLE.autoFlush=true 37 | handler.CONSOLE.target=SYSTEM_OUT 38 | handler.CONSOLE.enabled=true 39 | 40 | formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter 41 | formatter.COLOR-PATTERN.properties=pattern 42 | formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%E%n 43 | 44 | -------------------------------------------------------------------------------- /plugin/src/main/resources/org/wildfly/plugins/bootablejar/maven/cloud/openshift-clustering-script.cli: -------------------------------------------------------------------------------- 1 | if (outcome == success) of /subsystem=jgroups/channel=ee:read-resource 2 | /subsystem=jgroups/channel=ee:write-attribute(name=cluster) 3 | /subsystem=jgroups/channel=ee:write-attribute(name=stack,value=tcp) 4 | end-if 5 | 6 | if (outcome == success) of /subsystem=jgroups/stack=udp/protocol=PING:read-resource 7 | /subsystem=jgroups/stack=udp/protocol=PING:remove 8 | end-if 9 | 10 | if (outcome == success) of /subsystem=jgroups/stack=tcp/protocol=MPING:read-resource 11 | /subsystem=jgroups/stack=tcp/protocol=MPING:remove 12 | end-if 13 | 14 | if (outcome == success) of /subsystem=jgroups/stack=tcp:read-resource 15 | /subsystem=jgroups/stack=tcp/protocol=kubernetes.KUBE_PING:add(add-index=0) 16 | end-if 17 | 18 | if (outcome == success) of /subsystem=jgroups/stack=udp:read-resource 19 | /subsystem=jgroups/stack=udp/protocol=kubernetes.KUBE_PING:add(add-index=0) 20 | end-if -------------------------------------------------------------------------------- /plugin/src/main/resources/org/wildfly/plugins/bootablejar/maven/cloud/openshift-https-script.cli: -------------------------------------------------------------------------------- 1 | # HTTPS changes 2 | 3 | if (outcome == success) of /subsystem=undertow/server=default-server/https-listener=https:read-resource 4 | /subsystem=undertow/server=default-server/https-listener=https:remove 5 | end-if 6 | 7 | if (outcome == success) of /core-service=management/security-realm=ApplicationRealm/server-identity=ssl:read-resource 8 | /core-service=management/security-realm=ApplicationRealm/server-identity=ssl:remove 9 | end-if 10 | 11 | -------------------------------------------------------------------------------- /plugin/src/main/resources/org/wildfly/plugins/bootablejar/maven/cloud/openshift-infinispan-script.cli: -------------------------------------------------------------------------------- 1 | # Infinispan 2 | # Add a distributed cache optimized for the cloud called 'sessions' if we already have the dist distributed cache. 3 | if (outcome == success) of /subsystem=infinispan/cache-container=web/distributed-cache=dist:read-resource 4 | /subsystem=infinispan/cache-container=web/distributed-cache=sessions:add 5 | /subsystem=infinispan/cache-container=web/distributed-cache=sessions/component=expiration:add(interval=0) 6 | /subsystem=infinispan/cache-container=web:write-attribute(name=default-cache,value=sessions) 7 | end-if -------------------------------------------------------------------------------- /plugin/src/main/resources/org/wildfly/plugins/bootablejar/maven/cloud/openshift-logging-script.cli: -------------------------------------------------------------------------------- 1 | # Logging changes 2 | 3 | if (outcome == success) of /subsystem=logging/root-logger=ROOT:read-resource 4 | /subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=INFO) 5 | /subsystem=logging/root-logger=ROOT:write-attribute(name=handlers,value=[CONSOLE]) 6 | end-if 7 | 8 | if (outcome == success) of /subsystem=logging/periodic-rotating-file-handler=FILE:read-resource 9 | /subsystem=logging/periodic-rotating-file-handler=FILE:remove 10 | end-if 11 | 12 | if (outcome == success) of /subsystem=logging/pattern-formatter=PATTERN:read-resource 13 | /subsystem=logging/pattern-formatter=PATTERN:remove 14 | end-if 15 | 16 | if (outcome == success) of /subsystem=logging/console-handler=CONSOLE:read-resource 17 | /subsystem=logging/console-handler=CONSOLE:undefine-attribute(name=level) 18 | end-if 19 | 20 | -------------------------------------------------------------------------------- /plugin/src/main/resources/org/wildfly/plugins/bootablejar/maven/cloud/openshift-management-script.cli: -------------------------------------------------------------------------------- 1 | # Management changes 2 | 3 | if (outcome == success) of /core-service=management/management-interface=http-interface:read-resource 4 | /core-service=management/management-interface=http-interface:write-attribute(name=console-enabled,value=false) 5 | end-if 6 | 7 | -------------------------------------------------------------------------------- /plugin/src/main/resources/org/wildfly/plugins/bootablejar/maven/cloud/openshift-tx-script.cli: -------------------------------------------------------------------------------- 1 | if (outcome == success) of /subsystem=transactions:read-resource 2 | /subsystem=transactions:write-attribute(name=node-identifier,value=${jboss.tx.node.id:1}) 3 | /subsystem=transactions:write-attribute(name=recovery-listener,value=true) 4 | end-if -------------------------------------------------------------------------------- /plugin/src/main/resources/org/wildfly/plugins/bootablejar/maven/cloud/openshift-undertow-script.cli: -------------------------------------------------------------------------------- 1 | # Undertow changes 2 | 3 | if (outcome == success) of /subsystem=undertow/server=default-server/http-listener=default:read-resource 4 | /subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding, value=true) 5 | end-if 6 | 7 | -------------------------------------------------------------------------------- /plugin/src/main/resources/org/wildfly/plugins/bootablejar/maven/cloud/openshift-webservices-script.cli: -------------------------------------------------------------------------------- 1 | # Web Services changes 2 | 3 | if (outcome == success) of /subsystem=webservices:read-resource 4 | /subsystem=webservices:write-attribute(name=modify-wsdl-address,value=true) 5 | /subsystem=webservices:write-attribute(name=wsdl-host,value=jbossws.undefined.host) 6 | end-if 7 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/CustomFileNameTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import java.nio.file.Files; 20 | import java.nio.file.Path; 21 | 22 | import org.junit.Test; 23 | 24 | /** 25 | * @author jdenise 26 | */ 27 | public class CustomFileNameTestCase extends AbstractBootableJarMojoTestCase { 28 | 29 | public CustomFileNameTestCase() { 30 | super("test11-pom.xml", true, null); 31 | } 32 | 33 | @Test 34 | public void testCustomFileName() throws Exception { 35 | BuildBootableJarMojo mojo = lookupMojo("package"); 36 | assertNotNull(mojo); 37 | assertNotNull(mojo.outputFileName); 38 | mojo.execute(); 39 | final Path dir = getTestDir(); 40 | Path jar = dir.resolve("target").resolve("foo.jar"); 41 | assertTrue(Files.exists(jar)); 42 | checkDeployment(dir, "foo.jar", true); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/DefaultConfigurationWithFPTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import java.nio.file.Path; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * @author jdenise 25 | */ 26 | public class DefaultConfigurationWithFPTestCase extends AbstractBootableJarMojoTestCase { 27 | 28 | public DefaultConfigurationWithFPTestCase() { 29 | super("test18-pom.xml", true, null); 30 | } 31 | 32 | @Test 33 | public void testConfiguration() throws Exception { 34 | BuildBootableJarMojo mojo = lookupMojo("package"); 35 | assertNotNull(mojo); 36 | assertTrue(mojo.featurePacks.get(0).getLocation().equals(System.getProperty(WILDFLY_FPL))); 37 | assertTrue(mojo.excludedLayers.isEmpty()); 38 | assertTrue(mojo.layers.isEmpty()); 39 | mojo.execute(); 40 | final Path dir = getTestDir(); 41 | checkJar(dir, true, true, null, null, mojo.recordState); 42 | checkDeployment(dir, true); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/DevAppTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import java.nio.file.Files; 20 | import java.nio.file.Path; 21 | 22 | import org.junit.Test; 23 | 24 | /** 25 | * @author jdenise 26 | */ 27 | public class DevAppTestCase extends AbstractBootableJarMojoTestCase { 28 | 29 | public DevAppTestCase() { 30 | super("test7-pom.xml", true, null); 31 | } 32 | 33 | @Test 34 | public void testDevApp() throws Exception { 35 | try { 36 | BuildBootableJarMojo mojo = lookupMojo("package"); 37 | assertNotNull(mojo); 38 | System.setProperty("dev", ""); 39 | mojo.execute(); 40 | final Path dir = getTestDir(); 41 | assertFalse(Files.exists(dir.resolve("target").resolve(TEST_FILE))); 42 | assertTrue(Files.exists(dir.resolve("target").resolve("deployments").resolve("ROOT.war"))); 43 | } finally { 44 | System.clearProperty("dev"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/DevWatchEjbTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | /** 20 | * @author jdenise 21 | */ 22 | public class DevWatchEjbTestCase extends DevWatchJarTestCase { 23 | 24 | public DevWatchEjbTestCase() { 25 | super("ejb", "DevWatchEjb", "test3"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/HollowJarWithDeploymentTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import java.nio.file.Path; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * @author jdenise 25 | */ 26 | public class HollowJarWithDeploymentTestCase extends AbstractBootableJarMojoTestCase { 27 | 28 | public HollowJarWithDeploymentTestCase() { 29 | super("test9-pom.xml", true, null); 30 | } 31 | 32 | @Test 33 | public void testHollowJarWithDeployment() throws Exception { 34 | BuildBootableJarMojo mojo = lookupMojo("package"); 35 | assertNotNull(mojo); 36 | assertTrue(mojo.hollowJar); 37 | mojo.execute(); 38 | final Path dir = getTestDir(); 39 | checkDeployment(dir, false, "--deployment=" + dir.resolve("target").resolve("test.war").toString()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/IncludedDefaultConfigurationNoLayersTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import java.nio.file.Path; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * @author jdenise 25 | */ 26 | public class IncludedDefaultConfigurationNoLayersTestCase extends AbstractBootableJarMojoTestCase { 27 | 28 | public IncludedDefaultConfigurationNoLayersTestCase() { 29 | super("test17-pom.xml", true, null); 30 | } 31 | 32 | @Test 33 | public void testConfiguration() throws Exception { 34 | BuildBootableJarMojo mojo = lookupMojo("package"); 35 | assertNotNull(mojo); 36 | assertTrue(mojo.featurePacks.get(0).getLocation().equals(System.getProperty(WILDFLY_FPL))); 37 | assertTrue(mojo.excludedLayers.isEmpty()); 38 | assertTrue(mojo.layers.isEmpty()); 39 | mojo.execute(); 40 | final Path dir = getTestDir(); 41 | checkJar(dir, true, true, null, null, mojo.recordState); 42 | checkDeployment(dir, true); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/InvalidCLIPropertiesTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public class InvalidCLIPropertiesTestCase extends AbstractBootableJarMojoTestCase { 25 | public InvalidCLIPropertiesTestCase() { 26 | super("invalid10-pom.xml", true, null, "add-prop.cli"); 27 | } 28 | 29 | @Test 30 | public void test() 31 | throws Exception { 32 | BuildBootableJarMojo mojo = lookupMojo("package"); 33 | assertNotNull(mojo); 34 | boolean failed = false; 35 | try { 36 | mojo.execute(); 37 | failed = true; 38 | } catch(Exception ex) { 39 | // OK expected 40 | System.err.println("EXPECTED exception"); 41 | ex.printStackTrace(); 42 | } 43 | if (failed) { 44 | throw new Exception("Should have failed"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/InvalidCLIScriptTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public class InvalidCLIScriptTestCase extends AbstractBootableJarMojoTestCase { 25 | public InvalidCLIScriptTestCase() { 26 | super("invalid9-pom.xml", true, null, "add-prop.cli"); 27 | } 28 | 29 | @Test 30 | public void test() 31 | throws Exception { 32 | BuildBootableJarMojo mojo = lookupMojo("package"); 33 | assertNotNull(mojo); 34 | boolean failed = false; 35 | try { 36 | mojo.execute(); 37 | failed = true; 38 | } catch(Exception ex) { 39 | // OK expected 40 | System.err.println("EXPECTED exception"); 41 | ex.printStackTrace(); 42 | } 43 | if (failed) { 44 | throw new Exception("Should have failed"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/InvalidExcludeRequiredLayerTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public class InvalidExcludeRequiredLayerTestCase extends AbstractBootableJarMojoTestCase { 25 | public InvalidExcludeRequiredLayerTestCase() { 26 | super("invalid6-pom.xml", true, null); 27 | } 28 | 29 | @Test 30 | public void test() 31 | throws Exception { 32 | BuildBootableJarMojo mojo = lookupMojo("package"); 33 | assertNotNull(mojo); 34 | boolean failed = false; 35 | try { 36 | mojo.execute(); 37 | failed = true; 38 | } catch(Exception ex) { 39 | // OK expected 40 | System.err.println("EXPECTED exception"); 41 | ex.printStackTrace(); 42 | } 43 | if (failed) { 44 | throw new Exception("Should have failed"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/InvalidFPLandFPListTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public class InvalidFPLandFPListTestCase extends AbstractBootableJarMojoTestCase { 25 | public InvalidFPLandFPListTestCase() { 26 | super("invalid2-pom.xml", true, null); 27 | } 28 | 29 | @Test 30 | public void test() 31 | throws Exception { 32 | BuildBootableJarMojo mojo = lookupMojo("package"); 33 | assertNotNull(mojo); 34 | boolean failed = false; 35 | try { 36 | mojo.execute(); 37 | failed = true; 38 | } catch(Exception ex) { 39 | // OK expected 40 | System.err.println("EXPECTED exception"); 41 | ex.printStackTrace(); 42 | } 43 | if (failed) { 44 | throw new Exception("Should have failed"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/InvalidIncludeExcludeLayerTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public class InvalidIncludeExcludeLayerTestCase extends AbstractBootableJarMojoTestCase { 25 | public InvalidIncludeExcludeLayerTestCase() { 26 | super("invalid7-pom.xml", true, null); 27 | } 28 | 29 | @Test 30 | public void test() 31 | throws Exception { 32 | BuildBootableJarMojo mojo = lookupMojo("package"); 33 | assertNotNull(mojo); 34 | boolean failed = false; 35 | try { 36 | mojo.execute(); 37 | failed = true; 38 | } catch(Exception ex) { 39 | // OK expected 40 | System.err.println("EXPECTED exception"); 41 | ex.printStackTrace(); 42 | } 43 | if (failed) { 44 | throw new Exception("Should have failed"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/InvalidNoFPTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public class InvalidNoFPTestCase extends AbstractBootableJarMojoTestCase { 25 | public InvalidNoFPTestCase() { 26 | super("invalid1-pom.xml", true, null); 27 | } 28 | 29 | @Test 30 | public void test() 31 | throws Exception { 32 | BuildBootableJarMojo mojo = lookupMojo("package"); 33 | assertNotNull(mojo); 34 | boolean failed = false; 35 | try { 36 | mojo.execute(); 37 | failed = true; 38 | } catch(Exception ex) { 39 | // OK expected 40 | System.err.println("EXPECTED exception"); 41 | ex.printStackTrace(); 42 | } 43 | if (failed) { 44 | throw new Exception("Should have failed"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/InvalidNotProvisonedExcludedLayerTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public class InvalidNotProvisonedExcludedLayerTestCase extends AbstractBootableJarMojoTestCase { 25 | public InvalidNotProvisonedExcludedLayerTestCase() { 26 | super("invalid5-pom.xml", true, null); 27 | } 28 | 29 | @Test 30 | public void test() 31 | throws Exception { 32 | BuildBootableJarMojo mojo = lookupMojo("package"); 33 | assertNotNull(mojo); 34 | boolean failed = false; 35 | try { 36 | mojo.execute(); 37 | failed = true; 38 | } catch(Exception ex) { 39 | // OK expected 40 | System.err.println("EXPECTED exception"); 41 | ex.printStackTrace(); 42 | } 43 | if (failed) { 44 | throw new Exception("Should have failed"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/InvalidProvisioningFileandLayersTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public class InvalidProvisioningFileandLayersTestCase extends AbstractBootableJarMojoTestCase { 25 | public InvalidProvisioningFileandLayersTestCase() { 26 | super("invalid3-pom.xml", true, "provisioning1.xml"); 27 | } 28 | 29 | @Test 30 | public void test() 31 | throws Exception { 32 | BuildBootableJarMojo mojo = lookupMojo("package"); 33 | assertNotNull(mojo); 34 | boolean failed = false; 35 | try { 36 | mojo.execute(); 37 | failed = true; 38 | } catch(Exception ex) { 39 | // OK expected 40 | System.err.println("EXPECTED exception"); 41 | ex.printStackTrace(); 42 | } 43 | if (failed) { 44 | throw new Exception("Should have failed"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/InvalidUnkonwnLayerTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * @author jdenise 23 | */ 24 | public class InvalidUnkonwnLayerTestCase extends AbstractBootableJarMojoTestCase { 25 | public InvalidUnkonwnLayerTestCase() { 26 | super("invalid4-pom.xml", true, null); 27 | } 28 | 29 | @Test 30 | public void test() 31 | throws Exception { 32 | BuildBootableJarMojo mojo = lookupMojo("package"); 33 | assertNotNull(mojo); 34 | boolean failed = false; 35 | try { 36 | mojo.execute(); 37 | failed = true; 38 | } catch(Exception ex) { 39 | // OK expected 40 | System.err.println("EXPECTED exception"); 41 | ex.printStackTrace(); 42 | } 43 | if (failed) { 44 | throw new Exception("Should have failed"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/LayersConfigurationTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import java.nio.file.Path; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * @author jdenise 25 | */ 26 | public class LayersConfigurationTestCase extends AbstractBootableJarMojoTestCase { 27 | 28 | public LayersConfigurationTestCase() { 29 | super("test8-pom.xml", true, null); 30 | } 31 | 32 | @Test 33 | public void testLayersConfiguration() throws Exception { 34 | BuildBootableJarMojo mojo = lookupMojo("package"); 35 | assertNotNull(mojo); 36 | assertFalse(mojo.layers.isEmpty()); 37 | assertEquals(2, mojo.layers.size()); 38 | assertEquals("jaxrs", mojo.layers.get(0)); 39 | assertEquals("management", mojo.layers.get(1)); 40 | mojo.recordState = true; 41 | mojo.execute(); 42 | String[] layers = {"jaxrs", "management"}; 43 | final Path dir = getTestDir(); 44 | checkJar(dir, true, true, layers, null, mojo.recordState); 45 | checkDeployment(dir, true); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/OpenShiftConfigurationTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import java.nio.file.Path; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * @author jdenise 25 | */ 26 | public class OpenShiftConfigurationTestCase extends AbstractBootableJarMojoTestCase { 27 | 28 | public OpenShiftConfigurationTestCase() { 29 | super("test10-pom.xml", true, null); 30 | } 31 | 32 | @Test 33 | public void testOpenshiftConfiguration() throws Exception { 34 | BuildBootableJarMojo mojo = lookupMojo("package"); 35 | assertNotNull(mojo); 36 | assertFalse(mojo.layers.isEmpty()); 37 | assertNotNull(mojo.cloud); 38 | assertEquals(1, mojo.layers.size()); 39 | assertEquals("jaxrs", mojo.layers.get(0)); 40 | mojo.recordState = true; 41 | mojo.execute(); 42 | String[] layers = {"jaxrs", HEALTH, "core-tools"}; 43 | final Path dir = getTestDir(); 44 | checkJar(dir, true, true, layers, null, mojo.recordState); 45 | checkDeployment(dir, true); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/ProvisioningConfigurationTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import java.nio.file.Path; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * @author jdenise 25 | */ 26 | public class ProvisioningConfigurationTestCase extends AbstractBootableJarMojoTestCase { 27 | 28 | public ProvisioningConfigurationTestCase() { 29 | super("test4-pom.xml", true, "provisioning1.xml"); 30 | } 31 | 32 | @Test 33 | public void testProvisioningConfiguration() throws Exception { 34 | BuildBootableJarMojo mojo = lookupMojo("package"); 35 | assertNotNull(mojo); 36 | assertFalse(mojo.contextRoot); 37 | mojo.recordState = true; 38 | mojo.execute(); 39 | String[] layers = {"web-server", "management"}; 40 | final Path dir = getTestDir(); 41 | checkJar(dir, true, false, layers, null, mojo.recordState); 42 | checkDeployment(dir, false); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/SkipTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import java.nio.file.Files; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * @author jdenise 25 | */ 26 | public class SkipTestCase extends AbstractBootableJarMojoTestCase { 27 | 28 | public SkipTestCase() { 29 | super("test5-pom.xml", false, null); 30 | } 31 | 32 | @Test 33 | public void testSkip() throws Exception { 34 | BuildBootableJarMojo mojo = lookupMojo("package"); 35 | assertNotNull(mojo); 36 | assertTrue(mojo.skip); 37 | mojo.execute(); 38 | assertFalse(Files.exists(getTestDir().resolve("target").resolve(TEST_FILE))); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/UpgradeArtifactInvalidFPTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.apache.maven.plugin.MojoExecutionException; 20 | import org.junit.Assert; 21 | import org.junit.Test; 22 | 23 | /** 24 | * @author jdenise 25 | */ 26 | public class UpgradeArtifactInvalidFPTestCase extends AbstractBootableJarMojoTestCase { 27 | 28 | public UpgradeArtifactInvalidFPTestCase() { 29 | super("invalid-fp-upgrade-artifact-pom.xml", true, null); 30 | } 31 | 32 | @Test 33 | public void testUpgrade() throws Exception { 34 | BuildBootableJarMojo mojo = lookupMojo("package"); 35 | try { 36 | mojo.execute(); 37 | throw new Exception("Should have failed"); 38 | } catch (MojoExecutionException ex) { 39 | // XXX OK, expected 40 | Assert.assertTrue(ex.toString().contains("Zip artifact org.wildfly:wildfly-galleon-pack not found in dependencies")); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/UpgradeArtifactInvalidTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.apache.maven.plugin.MojoExecutionException; 20 | import org.junit.Assert; 21 | import org.junit.Test; 22 | 23 | /** 24 | * @author jdenise 25 | */ 26 | public class UpgradeArtifactInvalidTestCase extends AbstractBootableJarMojoTestCase { 27 | 28 | public UpgradeArtifactInvalidTestCase() { 29 | super("invalid-upgrade-artifact-pom.xml", true, null); 30 | } 31 | 32 | @Test 33 | public void testUpgrade() throws Exception { 34 | BuildBootableJarMojo mojo = lookupMojo("package"); 35 | try { 36 | mojo.execute(); 37 | throw new Exception("Should have failed"); 38 | } catch (MojoExecutionException ex) { 39 | // XXX OK, expected 40 | Assert.assertTrue(ex.toString().contains("No version for artifact io.undertow:undertow-core")); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/src/test/java/org/wildfly/plugins/bootablejar/maven/goals/UpgradeArtifactUnknownArtifactTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Red Hat, Inc. and/or its affiliates 3 | * and other contributors as indicated by the @author tags. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.wildfly.plugins.bootablejar.maven.goals; 18 | 19 | import org.apache.maven.plugin.MojoExecutionException; 20 | 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | 24 | /** 25 | * @author jdenise 26 | */ 27 | public class UpgradeArtifactUnknownArtifactTestCase extends AbstractBootableJarMojoTestCase { 28 | 29 | public UpgradeArtifactUnknownArtifactTestCase() { 30 | super("invalid-upgrade-unknown-artifact-pom.xml", true, null); 31 | } 32 | 33 | @Test 34 | public void testUpgrade() throws Exception { 35 | BuildBootableJarMojo mojo = lookupMojo("package"); 36 | try { 37 | mojo.execute(); 38 | throw new Exception("Should have failed"); 39 | } catch (MojoExecutionException ex) { 40 | Assert.assertTrue(ex.toString().contains("Overridden artifact jakarta.platform:jakarta.jakartaee-api not know in provisioned feature-packs")); 41 | // XXX OK, expected 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/src/test/resources/cli/add-prop.cli: -------------------------------------------------------------------------------- 1 | /system-property=foobootable:add(value=bar) -------------------------------------------------------------------------------- /tests/src/test/resources/cli/add-prop2.cli: -------------------------------------------------------------------------------- 1 | /system-property=foobootable2:add(value=bar) -------------------------------------------------------------------------------- /tests/src/test/resources/poms/client-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test-client 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/invalid-upgrade-artifact-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | jaxrs 22 | 23 | 24 | 25 | 26 | io.undertow 27 | undertow-core 28 | 29 | 30 | 31 | true 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/invalid1-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/invalid2-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | 22 | TEST_REPLACE 23 | 24 | 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/invalid3-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | jaxrs 21 | 22 | 23 | true 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/invalid4-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | 23 | 24 | 25 | foo 26 | 27 | 28 | true 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/invalid5-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | 28 | observability 29 | 30 | 31 | true 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/invalid6-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | 23 | 24 | 25 | jaxrs-server 26 | 27 | 28 | web-server 29 | 30 | 31 | true 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/invalid7-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | 23 | 24 | 25 | jaxrs 26 | management 27 | 28 | 29 | management 30 | 31 | 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/invalid8-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | 23 | 24 | 25 | jaxrs-server 26 | jpa-distributed 27 | 28 | 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test1-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test10-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | jaxrs 22 | 23 | 24 | deployment-scanner 25 | 26 | 27 | 28 | true 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test11-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | foo.jar 20 | TEST_REPLACE 21 | 22 | jaxrs 23 | 24 | 25 | deployment-scanner 26 | 27 | 28 | 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test12-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | TEST_DEFAULT_CONFIG_REPLACE 23 | 24 | 25 | 26 | h2-default-datasource 27 | 28 | 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test13-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | 22 | true 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test14-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | patch.cli 21 | 22 | true 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test15-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test3 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | jaxrs 22 | management 23 | 24 | patch.cli 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test16-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test3 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | jaxrs 22 | management 23 | 24 | patch.cli 25 | true 26 | 27 | true 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test17-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | TEST_DEFAULT_CONFIG_REPLACE 23 | 24 | 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test18-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | 23 | 24 | 25 | true 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test19-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | 23 | 24 | 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test20-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | 20 | 21 | TEST_REPLACE 22 | TEST_DEFAULT_CONFIG_REPLACE 23 | 24 | 25 | 26 | 27 | true 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test21-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test1 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | 22 | deployment-scanner 23 | 24 | 25 | true 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test22-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | datasources-web-server 22 | webservices 23 | 24 | 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test3-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test3 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | cloud-profile 22 | management 23 | 24 | 25 | ee-security 26 | 27 | true 28 | 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test4-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test4 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | false 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test5-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test5 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | true 21 | 22 | jaxrs 23 | management 24 | 25 | 26 | deployment-scanner 27 | 28 | false 29 | 30 | true 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test6-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test6 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | jaxrs 22 | management 23 | 24 | 25 | 26 | deployment-scanner 27 | 28 | build-artifacts 29 | 30 | true 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test7-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test7 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | jaxrs 22 | management 23 | 24 | 25 | deployment-scanner 26 | 27 | 28 | true 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test8-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test2 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | jaxrs 22 | management 23 | 24 | 25 | deployment-scanner 26 | 27 | 28 | true 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /tests/src/test/resources/poms/test9-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | org.wildfly.plugins.tests 7 | 1.0.0.Final-SNAPSHOT 8 | test6 9 | war 10 | 11 | WildFly bootable jar Example for tests 12 | 13 | 14 | test 15 | 16 | 17 | wildfly-jar-maven-plugin 18 | 19 | TEST_REPLACE 20 | 21 | jaxrs 22 | management 23 | 24 | 25 | 26 | deployment-scanner 27 | 28 | true 29 | 30 | true 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/ejb/src/main/java/org/wildfly/plugins/demo/ejb/GreeterEJB.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.ejb; 2 | 3 | import jakarta.ejb.Stateless; 4 | 5 | @Stateless(name = "FOO") 6 | public class GreeterEJB { 7 | /** 8 | * This method takes a name and returns a personalised greeting. 9 | * 10 | * @param name 11 | * the name of the person to be greeted 12 | * @return the personalised greeting. 13 | */ 14 | public String sayHello(String name) { 15 | return "Hello " + name; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/ejb/src/main/java/org/wildfly/plugins/demo/ejb/TestEJB.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.ejb; 2 | 3 | public class TestEJB { 4 | /** 5 | * This method takes a name and returns a personalised greeting. 6 | * 7 | * @param name 8 | * the name of the person to be greeted 9 | * @return the personalised greeting. 10 | */ 11 | public String sayHello(String name) { 12 | return "Hello " + name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/ejb/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/ejb/src/main/resources/META-INF/ejb-jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 24 | 25 | 26 | BABAR 27 | org.wildfly.plugins.demo.ejb.TestEJB 28 | Stateless 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jar/src/main/java/org/wildfly/plugins/demo/ejb/GreeterEJB.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.ejb; 2 | 3 | import jakarta.ejb.Stateless; 4 | 5 | @Stateless(name = "FOO") 6 | public class GreeterEJB { 7 | /** 8 | * This method takes a name and returns a personalised greeting. 9 | * 10 | * @param name 11 | * the name of the person to be greeted 12 | * @return the personalised greeting. 13 | */ 14 | public String sayHello(String name) { 15 | return "Hello " + name; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jar/src/main/java/org/wildfly/plugins/demo/ejb/TestEJB.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.ejb; 2 | 3 | public class TestEJB { 4 | /** 5 | * This method takes a name and returns a personalised greeting. 6 | * 7 | * @param name 8 | * the name of the person to be greeted 9 | * @return the personalised greeting. 10 | */ 11 | public String sayHello(String name) { 12 | return "Hello " + name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jar/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jar/src/main/resources/META-INF/ejb-jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 24 | 25 | 26 | BABAR 27 | org.wildfly.plugins.demo.ejb.TestEJB 28 | Stateless 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jaxrs/extra-content/somefile.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jaxrs/scripts/logging.cli: -------------------------------------------------------------------------------- 1 | /subsystem=logging/logger=org.jboss.as.server.deployment.scanner:add() 2 | /subsystem=logging/logger=org.jboss.as.server.deployment.scanner:write-attribute(name=level,value=ALL) 3 | /subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=ALL) 4 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/HelloWorldEndpoint.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jaxrs; 2 | 3 | 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.util.Properties; 7 | import jakarta.ws.rs.Path; 8 | import jakarta.ws.rs.core.Response; 9 | import jakarta.ws.rs.GET; 10 | import jakarta.ws.rs.Produces; 11 | 12 | 13 | @Path("/hello") 14 | public class HelloWorldEndpoint { 15 | @GET 16 | @Produces("text/plain") 17 | public Response doGet() throws IOException { 18 | Properties props; 19 | try (InputStream inputStream = HelloWorldEndpoint.class.getResourceAsStream("/myresources.properties")) { 20 | props = new Properties(); 21 | props.load(inputStream); 22 | } 23 | System.out.println("CLASSLOADER " + HelloWorldEndpoint.class.getClassLoader()); 24 | InputStream inputStream2 = HelloWorldEndpoint.class.getResourceAsStream("/myresources2.properties"); 25 | Properties props2 = null; 26 | if (inputStream2 != null) { 27 | try { 28 | props2 = new Properties(); 29 | props2.load(inputStream2); 30 | } finally { 31 | inputStream2.close(); 32 | } 33 | } 34 | for(String k : props.stringPropertyNames()) { 35 | System.out.println("KEY " + k + "=" + props.getProperty(k)); 36 | } 37 | //return Response.ok("Hello from " + "XXXWildFly bootable jar!").build(); 38 | return Response.ok("Hello from " + props.getProperty("msg") + (props2 == null ? "" : " " + props2.getProperty("msg"))).build(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jaxrs/src/main/java/org/wildfly/plugins/demo/jaxrs/RestApplication.java: -------------------------------------------------------------------------------- 1 | package org.wildfly.plugins.demo.jaxrs; 2 | 3 | import jakarta.ws.rs.ApplicationPath; 4 | import jakarta.ws.rs.core.Application; 5 | 6 | @ApplicationPath("/rest/") 7 | public class RestApplication extends Application { 8 | } 9 | -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jaxrs/src/main/resources/myresources.properties: -------------------------------------------------------------------------------- 1 | msg=WildFly bootable jar! -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jaxrs/src/main/webapp/WEB-INF/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly-extras/wildfly-jar-maven-plugin/71ec0d9dbd99204a0a9af36e0d320e8b0e73a3ab/tests/src/test/resources/projects/jaxrs/src/main/webapp/WEB-INF/empty.txt -------------------------------------------------------------------------------- /tests/src/test/resources/projects/jaxrs/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | Hello from static index.html file 2 | -------------------------------------------------------------------------------- /tests/src/test/resources/provisioning/provisioning1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | -------------------------------------------------------------------------------- /tests/src/test/resources/test.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfly-extras/wildfly-jar-maven-plugin/71ec0d9dbd99204a0a9af36e0d320e8b0e73a3ab/tests/src/test/resources/test.war --------------------------------------------------------------------------------