-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
780 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jboss.intersmash</groupId> | ||
<artifactId>intersmash-parent</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<name>Intersmash Demos</name> | ||
|
||
<artifactId>intersmash-demos</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>ws-bootable-jar-example</module> | ||
</modules> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
ws-bootable-jar-example | ||
======================= | ||
|
||
This module provides a simple POC webservice's jaxws application that is built as a bootable jar consisting of Wildfly and the jaxws war file, and then deployed to OpenShift, and tested. | ||
|
||
The jaxws module builds 2 archives, the webservice's war file and a bootable jar to be run on OpenShift | ||
|
||
This module demonstrates building a fresh (relatively current) version of Wildfly using Galleon for inclusion in the bootable jar, as compared to pulling a pre-existing Wildfly image from a public repository. The process enables the user to build a current version of Wildfly for testing. | ||
|
||
Module, demos, is not declared in intersmash's root pom.xml file. The module must be built separately and the example must run from directory, demos. The user will also require a test.properties file with the appropriate OpenShift reference and configuration information. The test can be run with cmd. | ||
|
||
Built the project and then the demos module with these commands. | ||
mvn clean install -DskipTests | ||
mvn clean install -DskipTests -Pdemo | ||
|
||
Run the test. | ||
mvn test -pl ws-bootable-jar-example/ -amd -Dtest=SoapWildflyBootableOpenShiftJarTest \ | ||
-Dxtf.test_properties.path=/ABSOLUTE/PATH/TO/test.properties | ||
|
||
or if test.properties resides in the demos directory cmd, | ||
|
||
mvn test -pl ws-bootable-jar-example/ -amd -Dtest=SoapWildflyBootableOpenShiftJarTest |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
~ JBoss, Home of Professional Open Source. | ||
~ Copyright 2014, Red Hat, Inc., and individual contributors | ||
~ as indicated by the @author tags. See the copyright.txt file in the | ||
~ distribution for a full listing of individual contributors. | ||
~ | ||
~ This is free software; you can redistribute it and/or modify it | ||
~ under the terms of the GNU Lesser General Public License as | ||
~ published by the Free Software Foundation; either version 2.1 of | ||
~ the License, or (at your option) any later version. | ||
~ | ||
~ This software is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
~ Lesser General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Lesser General Public | ||
~ License along with this software; if not, write to the Free | ||
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.jboss.intersmash</groupId> | ||
<artifactId>ws-bootable-jar-example</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>jaxws</artifactId> | ||
<packaging>war</packaging> | ||
|
||
<name>Intersmash Demos : (Wildfly): Webservices Bootable JAR Examples (jaxws) </name> | ||
|
||
|
||
<properties> | ||
<formatting-style-base-directory>${project.parent.parent.parent.basedir}/ide-config</formatting-style-base-directory> | ||
<version.jbossws-cxf>6.2.0.Final</version.jbossws-cxf> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>jakarta.platform</groupId> | ||
<artifactId>jakarta.jakartaee-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<!-- Import the CDI API, we use provided scope as the API is included in WildFly --> | ||
<dependency> | ||
<groupId>jakarta.inject</groupId> | ||
<artifactId>jakarta.inject-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.ws.rs</groupId> | ||
<artifactId>jakarta.ws.rs-api</artifactId> | ||
<version>${version.jakarta.ws.rs-api}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.ws.cxf</groupId> | ||
<artifactId>jbossws-cxf-client</artifactId> | ||
<version>${version.jbossws-cxf}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.jboss.slf4j</groupId> | ||
<artifactId>slf4j-jboss-logging</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.wildfly.plugins</groupId> | ||
<artifactId>wildfly-jar-maven-plugin</artifactId> | ||
<!-- Use configuration from parent (pom.xml) and append specific configuration for | ||
project - layers, cli,... --> | ||
<configuration> | ||
<cli-sessions> | ||
<cli-session> | ||
<script-files> | ||
./scripts/property.cli | ||
</script-files> | ||
</cli-session> | ||
</cli-sessions> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<!-- | ||
Intersmash projects always build and run on JDK11+, hence we need to pass JPMS options to the | ||
Surefire plugin (still true?) | ||
--> | ||
<argLine>${client.jvm.jpms.args}</argLine> | ||
<!-- Also, let's set some additional configuration that is common to all dependent modules --> | ||
<trimStackTrace>false</trimStackTrace> | ||
<failIfNoTests>false</failIfNoTests> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/system-property=jaxws-test-property:add(value=jaxws-test-value) |
30 changes: 30 additions & 0 deletions
30
demos/ws-bootable-jar-example/jaxws/src/main/java/org/jboss/jaxws/Endpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (C) 2023 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jboss.jaxws; | ||
|
||
import jakarta.jws.WebMethod; | ||
import jakarta.jws.WebService; | ||
|
||
@WebService(targetNamespace = "http://org.jboss.ws/cxf/container") | ||
public interface Endpoint { | ||
|
||
@WebMethod | ||
public String greetings(String time); | ||
|
||
@WebMethod | ||
String ping(); | ||
} |
50 changes: 50 additions & 0 deletions
50
demos/ws-bootable-jar-example/jaxws/src/main/java/org/jboss/jaxws/EndpointImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright (C) 2023 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* Copyright (C) 2023 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jboss.jaxws; | ||
|
||
import jakarta.jws.WebMethod; | ||
import jakarta.jws.WebService; | ||
|
||
@WebService(serviceName = "EndpointServiceSERVICE", name = "EndpointService", portName = "EndpointService", endpointInterface = "org.jboss.jaxws.Endpoint", targetNamespace = "http://org.jboss.ws/cxf/container") | ||
public class EndpointImpl implements Endpoint { | ||
@WebMethod | ||
@Override | ||
public String greetings(String input) { | ||
return input + ", hello from WildFly bootable jar!"; | ||
} | ||
|
||
@WebMethod | ||
@Override | ||
public String ping() { | ||
return "pong"; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
demos/ws-bootable-jar-example/jaxws/src/main/webapp/WEB-INF/jboss-web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd"> | ||
<jboss-web> | ||
<context-root></context-root> | ||
</jboss-web> |
113 changes: 113 additions & 0 deletions
113
...ample/jaxws/src/test/java/org/jboss/jaxws/SoapWildflyBootableOpenShiftJarApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/** | ||
* Copyright (C) 2023 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* Copyright (C) 2023 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.jboss.jaxws; | ||
|
||
import java.nio.file.Path; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.apache.maven.settings.building.SettingsBuildingException; | ||
import org.eclipse.aether.resolution.ArtifactResolutionException; | ||
import org.jboss.intersmash.deployments.util.maven.ArtifactProvider; | ||
import org.jboss.intersmash.tools.application.openshift.BootableJarOpenShiftApplication; | ||
import org.jboss.intersmash.tools.application.openshift.input.BinarySource; | ||
|
||
import cz.xtf.builder.builders.SecretBuilder; | ||
import cz.xtf.builder.builders.secret.SecretType; | ||
import io.fabric8.kubernetes.api.model.EnvVar; | ||
import io.fabric8.kubernetes.api.model.EnvVarBuilder; | ||
import io.fabric8.kubernetes.api.model.Secret; | ||
|
||
public class SoapWildflyBootableOpenShiftJarApplication implements BootableJarOpenShiftApplication { | ||
private String GROUPID = "org.jboss.intersmash"; | ||
private String ARTIFACTID = "jaxws"; | ||
private String VERSION = "0.0.1-SNAPSHOT"; | ||
static final String BOOTABLE_JAR_ARTIFACT_PACKAGING = "jar"; | ||
static final String ARTIFACT_CLASSIFIER = "bootable-openshift"; | ||
|
||
static final EnvVar TEST_ENV_VAR = new EnvVarBuilder().withName("test-evn-key").withValue("test-evn-value").build(); | ||
static final String TEST_SECRET_FOO = "foo"; | ||
static final String TEST_SECRET_BAR = "bar"; | ||
static final Secret TEST_SECRET = new SecretBuilder("test-secret") | ||
.setType(SecretType.OPAQUE).addData(TEST_SECRET_FOO, TEST_SECRET_BAR.getBytes()).build(); | ||
|
||
@Override | ||
public BinarySource getBuildInput() { | ||
Path file = null; | ||
try { | ||
file = ArtifactProvider.resolveArtifact( | ||
GROUPID, | ||
ARTIFACTID, | ||
VERSION, | ||
BOOTABLE_JAR_ARTIFACT_PACKAGING, | ||
ARTIFACT_CLASSIFIER).toPath(); | ||
} catch (SettingsBuildingException | ArtifactResolutionException e) { | ||
throw new RuntimeException("Can not get artifact", e); | ||
} | ||
return new BinarySourceImpl(file); | ||
} | ||
|
||
@Override | ||
public List<Secret> getSecrets() { | ||
List<Secret> secrets = new ArrayList<>(); | ||
secrets.add(TEST_SECRET); | ||
return Collections.unmodifiableList(secrets); | ||
} | ||
|
||
@Override | ||
public List<EnvVar> getEnvVars() { | ||
List<EnvVar> list = new ArrayList<>(); | ||
list.add(new EnvVarBuilder().withName(TEST_ENV_VAR.getName()) | ||
.withValue(TEST_ENV_VAR.getValue()).build()); | ||
return Collections.unmodifiableList(list); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "ws-bootable-openshift-jar"; | ||
} | ||
|
||
// todo remove local class impl once intersmash issue #85 is resolved | ||
class BinarySourceImpl implements BinarySource { | ||
Path f; | ||
|
||
public BinarySourceImpl(Path f) { | ||
this.f = f; | ||
} | ||
|
||
public Path getArchive() { | ||
return f; | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.