From db4b9958f5b5b350d05a2231c812b56228559045 Mon Sep 17 00:00:00 2001 From: tasso94 <3015690+tasso94@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:31:10 +0100 Subject: [PATCH] chore(engine): bump spring dependency to version 6 related to camunda/camunda-bpm-platform#4869 --- engine/pom.xml | 9 +++- .../BpmPlatformXmlLocationTest.java | 21 +++++--- .../deployment/MockInitialContextFactory.java | 42 ---------------- .../deployment/MockInitialContextRule.java | 50 ------------------- .../HistoryCleanupOnEngineBootstrapTest.java | 2 +- engine/src/test/resources/jndi.properties | 2 + .../impl/security/filter/PathFilterRule.java | 3 +- 7 files changed, 27 insertions(+), 102 deletions(-) delete mode 100644 engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/MockInitialContextFactory.java delete mode 100644 engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/MockInitialContextRule.java create mode 100644 engine/src/test/resources/jndi.properties diff --git a/engine/pom.xml b/engine/pom.xml index 8f79fe1a029..92051c09225 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -26,7 +26,7 @@ org.springframework spring-framework-bom - ${version.spring.framework} + ${version.spring.framework6} pom import @@ -333,6 +333,13 @@ ${project.version} test + + + com.github.h-thurow + simple-jndi + 0.24.0 + test + diff --git a/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/BpmPlatformXmlLocationTest.java b/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/BpmPlatformXmlLocationTest.java index 86088acc2aa..6e7320203f5 100644 --- a/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/BpmPlatformXmlLocationTest.java +++ b/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/BpmPlatformXmlLocationTest.java @@ -35,9 +35,9 @@ import java.net.URLDecoder; import org.camunda.bpm.container.impl.tomcat.deployment.TomcatParseBpmPlatformXmlStep; -import org.junit.Rule; +import org.junit.After; +import org.junit.Before; import org.junit.Test; -import org.springframework.mock.jndi.SimpleNamingContext; /** * Checks the correct retrieval of bpm-platform.xml file through JNDI, @@ -63,8 +63,19 @@ public class BpmPlatformXmlLocationTest { private static final String BPM_PLATFORM_XML_LOCATION_URL_HTTP_PROTOCOL = "http://localhost:8080/camunda/" + BPM_PLATFORM_XML_FILE; private static final String BPM_PLATFORM_XML_LOCATION_URL_HTTPS_PROTOCOL = "https://localhost:8080/camunda/" + BPM_PLATFORM_XML_FILE; - @Rule - public MockInitialContextRule initialContextRule = new MockInitialContextRule(new SimpleNamingContext()); + protected Context context; + + @Before + public void setUp() throws NamingException { + context = new InitialContext(); + } + + @After + public void close() throws NamingException { + if (context != null) { + context.close(); + } + } @Test public void checkValidBpmPlatformXmlResourceLocationForUrl() throws NamingException, MalformedURLException { @@ -121,7 +132,6 @@ public void checkValidBpmPlatformXmlResourceLocation() throws NamingException, M @Test public void getBpmPlatformXmlLocationFromJndi() throws NamingException, MalformedURLException { - Context context = new InitialContext(); context.bind("java:comp/env/" + BPM_PLATFORM_XML_LOCATION, BPM_PLATFORM_XML_FILE_ABSOLUTE_LOCATION); URL url = new TomcatParseBpmPlatformXmlStep().lookupBpmPlatformXmlLocationFromJndi(); @@ -184,7 +194,6 @@ public void getBpmPlatformXmlFromCatalinaConfDirectory() throws MalformedURLExce @Test public void lookupBpmPlatformXml() throws NamingException, MalformedURLException { - Context context = new InitialContext(); context.bind("java:comp/env/" + BPM_PLATFORM_XML_LOCATION, BPM_PLATFORM_XML_FILE_ABSOLUTE_LOCATION); URL url = new TomcatParseBpmPlatformXmlStep().lookupBpmPlatformXml(); diff --git a/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/MockInitialContextFactory.java b/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/MockInitialContextFactory.java deleted file mode 100644 index b7eb156e93b..00000000000 --- a/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/MockInitialContextFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.container.impl.jmx.deployment; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.spi.InitialContextFactory; - -import java.util.Hashtable; - -public class MockInitialContextFactory implements InitialContextFactory { - - private static final ThreadLocal currentContext = new ThreadLocal(); - - @Override - public Context getInitialContext(Hashtable environment) throws NamingException { - return currentContext.get(); - } - - public static void setCurrentContext(Context context) { - currentContext.set(context); - } - - public static void clearCurrentContext() { - currentContext.remove(); - } - -} diff --git a/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/MockInitialContextRule.java b/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/MockInitialContextRule.java deleted file mode 100644 index e86c54069b2..00000000000 --- a/engine/src/test/java/org/camunda/bpm/container/impl/jmx/deployment/MockInitialContextRule.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.container.impl.jmx.deployment; - -import javax.naming.Context; - -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; - -public class MockInitialContextRule implements TestRule { - - private final Context context; - - public MockInitialContextRule(Context context) { - this.context = context; - } - - @Override - public Statement apply(final Statement base, Description description) { - return new Statement() { - @Override - public void evaluate() throws Throwable { - System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockInitialContextFactory.class.getName()); - MockInitialContextFactory.setCurrentContext(context); - try { - base.evaluate(); - } finally { - System.clearProperty(Context.INITIAL_CONTEXT_FACTORY); - MockInitialContextFactory.clearCurrentContext(); - } - } - }; - } - -} diff --git a/engine/src/test/java/org/camunda/bpm/engine/test/api/history/HistoryCleanupOnEngineBootstrapTest.java b/engine/src/test/java/org/camunda/bpm/engine/test/api/history/HistoryCleanupOnEngineBootstrapTest.java index baabadd3e0c..336dd33b82e 100644 --- a/engine/src/test/java/org/camunda/bpm/engine/test/api/history/HistoryCleanupOnEngineBootstrapTest.java +++ b/engine/src/test/java/org/camunda/bpm/engine/test/api/history/HistoryCleanupOnEngineBootstrapTest.java @@ -184,7 +184,7 @@ public void testBatchWindowXmlConfigParsingException() throws ParseException { .createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/history/history-cleanup-batch-window-map-wrong-values.camunda.cfg.xml") .buildProcessEngine()) .isInstanceOf(Exception.class) - .hasMessageContaining("startTime"); + .hasMessageContaining("Error creating bean with name 'processEngineConfiguration'"); } @Test diff --git a/engine/src/test/resources/jndi.properties b/engine/src/test/resources/jndi.properties new file mode 100644 index 00000000000..910730cedf6 --- /dev/null +++ b/engine/src/test/resources/jndi.properties @@ -0,0 +1,2 @@ +java.naming.factory.initial=org.osjava.sj.SimpleContextFactory +org.osjava.sj.jndi.shared=true diff --git a/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/PathFilterRule.java b/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/PathFilterRule.java index 5643acd59af..2b98bdfa706 100644 --- a/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/PathFilterRule.java +++ b/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/PathFilterRule.java @@ -22,10 +22,9 @@ import org.camunda.bpm.webapp.impl.security.auth.Authentication; import org.camunda.bpm.webapp.impl.security.filter.RequestMatcher.Match; import org.camunda.bpm.webapp.impl.security.filter.util.FilterRules; -import org.springframework.util.PathMatcher; /** - *

A {@link SecurityFilterRule} that deleagates to a set of {@link PathMatcher}s

+ *

A {@link SecurityFilterRule} that delegates to a set of path matchers

* *

How this thing works: *