Skip to content

Commit

Permalink
test(tomcat10): Restore Engine Integration Tests
Browse files Browse the repository at this point in the history
Context: Tomcat 10, CDI and Weld Tests
Fix: This commit includes a fix for the tests to load weld under the Tomcat lib folder instead of placing it into the WEB-INF/lib folder of the individual wars used by the tests.

Related-to: #4434
  • Loading branch information
tasso94 authored Jul 24, 2024
1 parent 58a6857 commit b48a2e3
Show file tree
Hide file tree
Showing 26 changed files with 257 additions and 62 deletions.
14 changes: 1 addition & 13 deletions qa/integration-tests-engine-jakarta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -713,20 +713,8 @@
<!-- TODO Please delete the following exclusions after the Tomcat 10 issue with Arquillian -->
<!-- See Relevant issue: https://github.com/camunda/camunda-bpm-platform/issues/4434 -->
<exclude>**/CallActivityContextSwitchTest.java</exclude>
<exclude>**/TestMultipleClasspathRoots.java</exclude>
<exclude>**/TestResourceName.java</exclude>
<exclude>**/TestWarDeploymentDeployChangedOnlyWithJarAsLib.java</exclude>
<exclude>**/TestWarDeploymentWithDiagram.java</exclude>
<exclude>**/TestWarDeploymentWithoutDiagram.java</exclude>
<exclude>**/TestWarDeploymentWithoutProcessDefinitions.java</exclude>
<exclude>**/TestWarDeploymentWithoutProcessesXml.java</exclude>
<exclude>**/CdiBeanCallActivityResolutionTest.java</exclude>
<exclude>**/CdiBeanCaseTaskResolutionTest.java</exclude>
<exclude>**/CallActivityContextSwitchTest.java</exclude>
<exclude>**/FailingJobBoundaryTimerWithDelegateVariablesTest.java</exclude>
<exclude>**/SignalEventCatchBoundaryWithVariablesTest.java</exclude>
<exclude>**/TimerRecalculationTest.java</exclude>
<exclude>**/CdiProcessApplicationEventSupportTest.java</exclude>

<!-- TODO and weld-servlet-shaded is resolved with integration-tests-engine-jakarta -->

</excludes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
version="4.0" bean-discovery-mode="all">
</beans>
</beans>
2 changes: 1 addition & 1 deletion qa/integration-tests-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@
</goals>
<configuration>
<sources>
<source>src/test/java-tomcat</source>
<source>src/test/java-tomcat9</source>
</sources>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@
*/
public class TestContainer {

/**
* In some scenarios, Tomcat 10 and Weld 5 have issues when the Weld library is embedded into the WAR.
* To solve these issues, Weld is added to the Tomcat server libs folder.
*/
public static void addContainerSpecificResourcesEmbedCdiLib(WebArchive webArchive) {
addContainerSpecificResources(webArchive);
webArchive.addAsLibraries(DeploymentHelper.getWeld());
}

public static void addContainerSpecificResources(WebArchive webArchive) {
webArchive
.addAsManifestResource("context.xml")
.addAsLibraries(DeploymentHelper.getWeld())
.addClass(TestProcessApplication.class)
.addAsWebInfResource("web.xml");
.addAsManifestResource("context.xml")
.addClass(TestProcessApplication.class)
.addAsWebInfResource("web.xml");
}

public static void addContainerSpecificResourcesWithoutWeld(WebArchive webArchive) {
Expand All @@ -40,11 +48,19 @@ public static void addContainerSpecificResourcesWithoutWeld(WebArchive webArchiv
.addAsWebInfResource("web-without-weld.xml", "web.xml");
}

/**
* In some scenarios, Tomcat 10 and Weld 5 have issues when the Weld library is embedded into the WAR.
* To solve these issues, Weld is added to the Tomcat server libs folder.
*/
public static void addContainerSpecificResourcesForNonPaEmbedCdiLib(WebArchive webArchive) {
addContainerSpecificResourcesForNonPa(webArchive);
webArchive.addAsLibraries(DeploymentHelper.getWeld());
}

public static void addContainerSpecificResourcesForNonPa(WebArchive webArchive) {
webArchive
.addAsManifestResource("context.xml")
.addAsLibraries(DeploymentHelper.getWeld())
.addAsWebInfResource("web.xml");
.addAsManifestResource("context.xml")
.addAsWebInfResource("web.xml");
}

public static void addContainerSpecificResourcesForNonPaWithoutWeld(WebArchive webArchive) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.integrationtest.util;

/**
* @author Thorben Lindhauer
*
*/
public class TestConstants {

public final static String APP_NAME = "";
public final static String PROCESS_ENGINE_SERVICE_JNDI_NAME = "java:comp/env/ProcessEngineService";
public final static String PROCESS_APPLICATION_SERVICE_JNDI_NAME = "java:comp/env/ProcessApplicationService";

public static String getAppName() {
return APP_NAME;
}

public String getEngineService() {
return PROCESS_ENGINE_SERVICE_JNDI_NAME;
}

public String getProcessApplicationService() {
return PROCESS_APPLICATION_SERVICE_JNDI_NAME;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.integrationtest.util;

import org.jboss.shrinkwrap.api.spec.WebArchive;

/**
* Tomcat test container.
*
* @author Daniel Meyer
*/
public class TestContainer {

/**
* In some scenarios, Tomcat 10 and Weld 5 have issues when the Weld library is embedded into the WAR.
* To solve these issues, Weld is added to the Tomcat server libs folder.
*/
public static void addContainerSpecificResourcesEmbedCdiLib(WebArchive webArchive) {
addContainerSpecificResources(webArchive);
}

public static void addContainerSpecificResources(WebArchive webArchive) {
webArchive
.addAsManifestResource("context.xml")
.addClass(TestProcessApplication.class)
.addAsWebInfResource("web.xml")
.addAsLibraries(DeploymentHelper.getWeld());
}

public static void addContainerSpecificResourcesWithoutWeld(WebArchive webArchive) {
webArchive
.addAsManifestResource("context.xml")
.addClass(TestProcessApplication.class)
.addAsWebInfResource("web-without-weld.xml", "web.xml");
}

/**
* In some scenarios, Tomcat 10 and Weld 5 have issues when the Weld library is embedded into the WAR.
* To solve these issues, Weld is added to the Tomcat server libs folder.
*/
public static void addContainerSpecificResourcesForNonPaEmbedCdiLib(WebArchive webArchive) {
addContainerSpecificResourcesForNonPa(webArchive);
}

public static void addContainerSpecificResourcesForNonPa(WebArchive webArchive) {
webArchive
.addAsManifestResource("context.xml")
.addAsWebInfResource("web.xml")
.addAsLibraries(DeploymentHelper.getWeld());
}

public static void addContainerSpecificResourcesForNonPaWithoutWeld(WebArchive webArchive) {
webArchive
.addAsManifestResource("context.xml")
.addAsWebInfResource("web-without-weld.xml", "web.xml");
}

public static void addContainerSpecificProcessEngineConfigurationClass(WebArchive deployment) {
// nothing to do
}

public static void addSpinJacksonJsonDataFormat(WebArchive webArchive) {
webArchive.addAsLibraries(DeploymentHelper.getSpinJacksonJsonDataFormatForServer("tomcat"));
}

public static void addJodaTimeJacksonModule(WebArchive webArchive) {
webArchive.addAsLibraries(DeploymentHelper.getJodaTimeModuleForServer("tomcat"));
}

public static void addCommonLoggingDependency(WebArchive webArchive) {
// nothing to do
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.integrationtest.util;

import org.camunda.bpm.application.ProcessApplication;
import org.camunda.bpm.application.impl.ServletProcessApplication;

/**
* @author Daniel Meyer
*
*/
@ProcessApplication
// Using fully-qualified class name instead of import statement to allow for automatic Jakarta transformation
public class TestProcessApplication extends org.camunda.bpm.application.impl.ServletProcessApplication {

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
*/
public class TestContainer {

public static void addContainerSpecificResourcesEmbedCdiLib(WebArchive webArchive) {
addContainerSpecificResources(webArchive);
}

public static void addContainerSpecificResources(WebArchive archive) {
addContainerSpecificResourcesWithoutWeld(archive);
}
Expand All @@ -34,6 +38,10 @@ public static void addContainerSpecificResourcesWithoutWeld(WebArchive webArchiv
webArchive.addClass(TestProcessApplication.class);
}

public static void addContainerSpecificResourcesForNonPaEmbedCdiLib(WebArchive webArchive) {
addContainerSpecificResourcesForNonPa(webArchive);
}

public static void addContainerSpecificResourcesForNonPa(WebArchive webArchive) {
addContainerSpecificResourcesForNonPaWithoutWeld(webArchive);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
*/
public class TestContainer {

public static void addContainerSpecificResourcesEmbedCdiLib(WebArchive webArchive) {
addContainerSpecificResources(webArchive);
}

public static void addContainerSpecificResources(WebArchive webArchive) {
addContainerSpecificResourcesWithoutWeld(webArchive);
}
Expand All @@ -33,6 +37,10 @@ public static void addContainerSpecificResourcesWithoutWeld(WebArchive webArchiv
webArchive.addAsLibraries(DeploymentHelper.getEjbClient());
}

public static void addContainerSpecificResourcesForNonPaEmbedCdiLib(WebArchive webArchive) {
addContainerSpecificResourcesForNonPa(webArchive);
}

public static void addContainerSpecificResourcesForNonPa(WebArchive webArchive) {
addContainerSpecificResourcesForNonPaWithoutWeld(webArchive);
}
Expand All @@ -56,4 +64,4 @@ public static void addJodaTimeJacksonModule(WebArchive webArchive) {
public static void addCommonLoggingDependency(WebArchive webArchive) {
webArchive.addAsManifestResource("jboss-deployment-structure-with-commons-logging.xml", "jboss-deployment-structure.xml");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static WebArchive processArchive() {
.addAsWebInfResource("org/camunda/bpm/integrationtest/beans.xml", "beans.xml")
.addAsLibraries(DeploymentHelper.getEngineCdi())
.addClass(AbstractFoxPlatformIntegrationTest.class);

TestContainer.addContainerSpecificResources(deployment);

return deployment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static WebArchive clientDeployment() {
.addClass(AbstractFoxPlatformIntegrationTest.class)
.addAsLibraries(DeploymentHelper.getEngineCdi());

TestContainer.addContainerSpecificResourcesForNonPa(deployment);
TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment);

return deployment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static WebArchive clientDeployment() {
.addClass(DependentScopedBean.class)
.addAsLibraries(DeploymentHelper.getEngineCdi());

TestContainer.addContainerSpecificResourcesForNonPa(deployment);
TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment);

return deployment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static WebArchive clientDeployment() {
.addClass(DependentScopedBean.class)
.addAsLibraries(DeploymentHelper.getEngineCdi());

TestContainer.addContainerSpecificResourcesForNonPa(deployment);
TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment);

return deployment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static WebArchive clientDeployment() {
.addClass(AbstractFoxPlatformIntegrationTest.class)
.addAsLibraries(DeploymentHelper.getEngineCdi());

TestContainer.addContainerSpecificResourcesForNonPa(deployment);
TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment);

return deployment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static WebArchive clientDeployment() {
.addClass(AbstractFoxPlatformIntegrationTest.class)
.addAsLibraries(DeploymentHelper.getEngineCdi());

TestContainer.addContainerSpecificResourcesForNonPa(deployment);
TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment);

return deployment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static WebArchive clientDeployment() {
.addClass(AbstractFoxPlatformIntegrationTest.class)
.addAsLibraries(DeploymentHelper.getEngineCdi());

TestContainer.addContainerSpecificResourcesForNonPa(deployment);
TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment);

return deployment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;


/**
* <p>Deploys two different applications, a process archive and a cleint application.</p>
*
Expand Down Expand Up @@ -61,7 +60,7 @@ public static WebArchive clientDeployment() {
.addClass(AbstractFoxPlatformIntegrationTest.class)
.addAsLibraries(DeploymentHelper.getEngineCdi());

TestContainer.addContainerSpecificResources(webArchive);
TestContainer.addContainerSpecificResourcesEmbedCdiLib(webArchive);

return webArchive;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static WebArchive clientDeployment() {
.addClass(DependentScopedBean.class)
.addAsLibraries(DeploymentHelper.getEngineCdi());

TestContainer.addContainerSpecificResourcesForNonPa(deployment);
TestContainer.addContainerSpecificResourcesForNonPaEmbedCdiLib(deployment);

return deployment;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ protected static Asset modelAsAsset(BpmnModelInstance modelInstance) {
return new ByteArrayAsset(bytes);
}

}
}
Loading

0 comments on commit b48a2e3

Please sign in to comment.