diff --git a/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy index 8c121628a6c9..b372987b9c25 100644 --- a/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy +++ b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy @@ -167,7 +167,7 @@ class DependencyConstraints { api(group: 'org.springframework.hateoas', name: 'spring-hateoas', version: '1.4.2') api(group: 'org.springframework.ldap', name: 'spring-ldap-core', version: '2.3.7.RELEASE') api(group: 'org.springframework.shell', name: 'spring-shell', version: get('springshell.version')) - api(group: 'org.testcontainers', name: 'testcontainers', version: '1.15.3') + api(group: 'org.testcontainers', name: 'testcontainers', version: '1.21.3') api(group: 'pl.pragmatists', name: 'JUnitParams', version: '1.1.0') api(group: 'xerces', name: 'xercesImpl', version: '2.12.0') api(group: 'xml-apis', name: 'xml-apis', version: '1.4.01') diff --git a/extensions/geode-modules-assembly/release/session/bin/modify_war b/extensions/geode-modules-assembly/release/session/bin/modify_war index e07d0405ba19..7f3fc28117ef 100755 --- a/extensions/geode-modules-assembly/release/session/bin/modify_war +++ b/extensions/geode-modules-assembly/release/session/bin/modify_war @@ -286,6 +286,8 @@ OTHER_JARS=(${GEODE}/lib/geode-core-${VERSION}.jar \ ${GEODE}/lib/shiro-core-@SHIRO_VERSION@.jar \ ${GEODE}/lib/commons-validator-@COMMONS_VALIDATOR_VERSION@.jar \ ${GEODE}/lib/micrometer-core-@MICROMETER_VERSION@.jar \ + ${GEODE}/lib/micrometer-commons-@MICROMETER_VERSION@.jar \ + ${GEODE}/lib/micrometer-observation-@MICROMETER_VERSION@.jar \ ${LIB_DIR}/geode-modules-${VERSION}.jar \ ${LIB_DIR}/geode-modules-session-internal-${VERSION}.jar \ ${LIB_DIR}/slf4j-api-@SLF4J_VERSION@.jar \ diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle index 8a9d7e13392b..8549ab53e5bc 100755 --- a/geode-assembly/build.gradle +++ b/geode-assembly/build.gradle @@ -130,6 +130,16 @@ task downloadWebServers(type:Copy) { dependencies { api(platform(project(':boms:geode-all-bom'))) + // Stage the full micrometer jar set so embedded clients can start + constraints { + geodeLibdirJars('io.micrometer:micrometer-commons:' + DependencyConstraints.get('micrometer.version')) + geodeLibdirJars('io.micrometer:micrometer-observation:' + DependencyConstraints.get('micrometer.version')) + geodeLibdirJars('io.micrometer:micrometer-core:' + DependencyConstraints.get('micrometer.version')) + geodeLibdirJarsDeprecated('io.micrometer:micrometer-commons:' + DependencyConstraints.get('micrometer.version')) + geodeLibdirJarsDeprecated('io.micrometer:micrometer-observation:' + DependencyConstraints.get('micrometer.version')) + geodeLibdirJarsDeprecated('io.micrometer:micrometer-core:' + DependencyConstraints.get('micrometer.version')) + } + geodeLibdirJars(project(':geode-server-all')) diff --git a/geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java b/geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java index 93cf342f08a2..96d1015e99f8 100644 --- a/geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java +++ b/geode-assembly/src/acceptanceTest/java/org/apache/geode/rules/DockerComposeRule.java @@ -30,9 +30,9 @@ import org.junit.runner.Description; import org.junit.runners.model.Statement; import org.testcontainers.DockerClientFactory; +import org.testcontainers.containers.ComposeContainer; import org.testcontainers.containers.Container; import org.testcontainers.containers.ContainerState; -import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.output.BaseConsumer; import org.testcontainers.containers.output.FrameConsumerResultCallback; import org.testcontainers.containers.output.OutputFrame; @@ -77,7 +77,7 @@ public class DockerComposeRule extends ExternalResource { private final RuleChain delegate; private final String composeFile; private final Map> exposedServices; - private DockerComposeContainer composeContainer; + private ComposeContainer composeContainer; public DockerComposeRule(String composeFile, Map> exposedServices) { this.composeFile = composeFile; @@ -94,7 +94,7 @@ public Statement apply(Statement base, Description description) { @Override public void evaluate() throws Throwable { - composeContainer = new DockerComposeContainer<>("compose", new File(composeFile)); + composeContainer = new ComposeContainer("compose", new File(composeFile)); exposedServices.forEach((service, ports) -> ports .forEach(p -> composeContainer.withExposedService(service, p))); composeContainer.withLocalCompose(true); @@ -116,7 +116,7 @@ public void evaluate() throws Throwable { * When used with compose, testcontainers does not allow one to have a 'container_name' * attribute in the compose file. This means that container names end up looking something like: * {@code project_service_index}. When a container performs a reverse IP lookup it will get a - * hostname that looks something like {@code projectjkh_db_1.my-network}. This can be a problem + * hostname that looks something like {@code projectjkh-db-1.my-network}. This can be a problem * since this hostname is not RFC compliant as it contains underscores. This may cause problems * in particular with SSL. * @@ -126,7 +126,7 @@ public void evaluate() throws Throwable { * @throws IllegalArgumentException if the service cannot be found */ public void setContainerName(String serviceName, String newName) { - ContainerState container = composeContainer.getContainerByServiceName(serviceName + "_1") + ContainerState container = composeContainer.getContainerByServiceName(serviceName + "-1") .orElseThrow(() -> new IllegalArgumentException("Unknown service name: " + serviceName)); String containerId = container.getContainerId(); @@ -141,7 +141,7 @@ public void setContainerName(String serviceName, String newName) { * @return the stdout of the container if the command was successful, else the stderr */ public String execForService(String serviceName, String... command) { - ContainerState container = composeContainer.getContainerByServiceName(serviceName + "_1") + ContainerState container = composeContainer.getContainerByServiceName(serviceName + "-1") .orElseThrow(() -> new IllegalArgumentException("Unknown service name: " + serviceName)); Container.ExecResult result; try { @@ -159,7 +159,7 @@ public String execForService(String serviceName, String... command) { * @return the exit code of the command */ public Long loggingExecForService(String serviceName, String... command) { - ContainerState container = composeContainer.getContainerByServiceName(serviceName + "_1") + ContainerState container = composeContainer.getContainerByServiceName(serviceName + "-1") .orElseThrow(() -> new IllegalArgumentException("Unknown service name: " + serviceName)); String containerId = container.getContainerId(); @@ -208,7 +208,7 @@ public Integer getExternalPortForService(String serviceName, int port) { * @return the ip address */ public String getIpAddressForService(String serviceName, String network) { - Map networks = composeContainer.getContainerByServiceName(serviceName + "_1").get() + Map networks = composeContainer.getContainerByServiceName(serviceName + "-1").get() .getCurrentContainerInfo().getNetworkSettings().getNetworks(); for (Object object : networks.entrySet()) { String key = (String) ((Map.Entry) object).getKey(); @@ -229,7 +229,7 @@ public String getIpAddressForService(String serviceName, String network) { * @param serviceName the service to pause */ public void pauseService(String serviceName) { - ContainerState container = composeContainer.getContainerByServiceName(serviceName + "_1") + ContainerState container = composeContainer.getContainerByServiceName(serviceName + "-1") .orElseThrow(() -> new IllegalArgumentException("Unknown service name: " + serviceName)); DockerClientFactory.instance().client().pauseContainerCmd(container.getContainerId()).exec(); } @@ -240,7 +240,7 @@ public void pauseService(String serviceName) { * @param serviceName the service to unpause */ public void unpauseService(String serviceName) { - ContainerState container = composeContainer.getContainerByServiceName(serviceName + "_1") + ContainerState container = composeContainer.getContainerByServiceName(serviceName + "-1") .orElseThrow(() -> new IllegalArgumentException("Unknown service name: " + serviceName)); DockerClientFactory.instance().client().unpauseContainerCmd(container.getContainerId()).exec(); } diff --git a/geode-assembly/src/integrationTest/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java b/geode-assembly/src/integrationTest/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java index 2e352d4d6180..d93a92520f32 100644 --- a/geode-assembly/src/integrationTest/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java +++ b/geode-assembly/src/integrationTest/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java @@ -81,6 +81,8 @@ public void loginWithIncorrectAndThenCorrectPassword() throws Exception { securityProps.setProperty(SSL_PROTOCOLS, "TLSv1.2"); securityProps.setProperty(SSL_CIPHERS, "any"); + securityProps.setProperty("jmx-manager-bind-address", "127.0.0.1"); + locator.withSecurityManager(SimpleSecurityManager.class).withProperties(securityProps) .startLocator(); @@ -121,6 +123,8 @@ public void loginWithDeprecatedSSLOptions() throws Exception { securityProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE, jks.getCanonicalPath()); securityProps.setProperty(HTTP_SERVICE_SSL_TRUSTSTORE_PASSWORD, "password"); + securityProps.setProperty("jmx-manager-bind-address", "127.0.0.1"); + locator.withSecurityManager(SimpleSecurityManager.class).withProperties(securityProps) .startLocator(); diff --git a/geode-concurrency-test/src/integrationTest/java/org/apache/geode/test/concurrency/ConcurrentTestRunnerTest.java b/geode-concurrency-test/src/integrationTest/java/org/apache/geode/test/concurrency/ConcurrentTestRunnerTest.java deleted file mode 100644 index 8840cc56f1fd..000000000000 --- a/geode-concurrency-test/src/integrationTest/java/org/apache/geode/test/concurrency/ConcurrentTestRunnerTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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.apache.geode.test.concurrency; - -import static org.apache.geode.test.concurrency.Utilities.availableProcessors; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.atomic.AtomicInteger; - -import org.junit.Test; -import org.junit.runner.JUnitCore; -import org.junit.runner.RunWith; - -public class ConcurrentTestRunnerTest { - @Test - public void confirmThatInParallelRunsConcurrently() { - // We only need FailingTest to fail once for the following - // assertion to pass. ConcurrentTestRunner runs FailingTest - // 2000 times by default. It will stop running it once it - // sees it fail, which is what we want to see because it - // confirms that running inParallel actually runs concurrently. - assertThat(JUnitCore.runClasses(CheckForConcurrency.class).wasSuccessful()).isFalse(); - } - - /** - * This "test" is only meant to be run by confirmThatInParallelRunsConcurrently. - * If you run this "test" directly you can expect to see if fail. - */ - @RunWith(ConcurrentTestRunner.class) - public static class CheckForConcurrency { - @Test - public void validateConcurrentExecution(ParallelExecutor executor) - throws ExecutionException, InterruptedException { - final AtomicInteger atomicInteger = new AtomicInteger(0); - executor.inParallel(() -> { - int oldValue = atomicInteger.get(); - // We want to see the following assertion fail because that indicates - // that another thread currently modified the atomic. - assertThat(atomicInteger.compareAndSet(oldValue, oldValue + 1)).isTrue(); - }, availableProcessors()); - executor.execute(); - } - } -}