This is an automated email from the ASF dual-hosted git repository. clebertsuconic pushed a commit to branch new-logging in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit d4027afa10912295fb296c1376306fbbc5cfe760 Author: Robbie Gemmell <[email protected]> AuthorDate: Thu Jul 14 16:12:23 2022 +0100 temporarily remove test to allow concentrating on other issues --- .../security/NettySecurityClientTest.java | 92 ---------------------- .../resources/restricted-security-client.policy | 84 -------------------- 2 files changed, 176 deletions(-) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java deleted file mode 100644 index 378b40f2d6..0000000000 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java +++ /dev/null @@ -1,92 +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.activemq.artemis.tests.integration.security; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLDecoder; - -import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; -import org.apache.activemq.artemis.core.server.ActiveMQServer; -import org.apache.activemq.artemis.tests.util.SpawnedTestBase; -import org.apache.activemq.artemis.utils.SpawnedVMSupport; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class NettySecurityClientTest extends SpawnedTestBase { - - private ActiveMQServer messagingService; - - @Test - public void testProducerConsumerClientWithoutSecurityManager() throws Exception { - doTestProducerConsumerClient(false); - } - - @Test - public void testProducerConsumerClientWithSecurityManager() throws Exception { - doTestProducerConsumerClient(true); - } - - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - - ConfigurationImpl config = createBasicConfig().addAcceptorConfiguration(getNettyAcceptorTransportConfiguration(true)); - messagingService = createServer(false, config); - messagingService.start(); - waitForServerToStart(messagingService); - } - - private void doTestProducerConsumerClient(final boolean withSecurityManager) throws Exception { - String[] vmargs = new String[0]; - if (withSecurityManager) { - URL securityPolicyURL = Thread.currentThread().getContextClassLoader().getResource("restricted-security-client.policy"); - vmargs = new String[]{"-Djava.security.manager", "-Djava.security.policy=" + URLDecoder.decode(securityPolicyURL.getPath(), "UTF-8")}; - } - - // spawn a JVM that creates a client with a security manager which sends and receives a - // test message - Process p = SpawnedVMSupport.spawnVM(SimpleClient.class.getName(), "-Xms512m", "-Xmx512m", vmargs, true, true, false, new String[]{NETTY_CONNECTOR_FACTORY}); - - InputStreamReader isr = new InputStreamReader(p.getInputStream()); - - BufferedReader br = new BufferedReader(isr); - String line = null; - while ((line = br.readLine()) != null) { - line = line.replace('|', '\n'); - if (line.startsWith("Listening")) { - continue; - } else if ("OK".equals(line.trim())) { - break; - } else { - //Assert.fail("Exception when starting the client: " + line); - System.out.println(line); - } - } - - SpawnedVMSupport.startLogger(SimpleClient.class.getName(), p); - - // the client VM should exit by itself. If it doesn't, that means we have a problem - // and the test will timeout - p.waitFor(); - - Assert.assertEquals("client VM did not exit cleanly", 0, p.exitValue()); - } -} diff --git a/tests/integration-tests/src/test/resources/restricted-security-client.policy b/tests/integration-tests/src/test/resources/restricted-security-client.policy deleted file mode 100644 index 45ea5298ba..0000000000 --- a/tests/integration-tests/src/test/resources/restricted-security-client.policy +++ /dev/null @@ -1,84 +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. -// -grant { - // -------------------------------------------------------------------------------- - // SEE http://docs.oracle.com/javase/1.4.2/docs/guide/security/permissions.html - // -------------------------------------------------------------------------------- - - - // allow to connect to localhost - permission java.net.SocketPermission "*:1024-", "connect"; - // Note1: normally, we don't need this permission since the applet allows reading jars loaded by the applet - // Note2: Which of the following two java.io.FilePermission is necessary depends on the exact Maven command - permission java.io.FilePermission "/etc/os-release", "read"; - permission java.io.FilePermission "/usr/lib/os-release", "read"; - permission java.io.FilePermission "${activemq.basedir}/artemis-core-client/target/classes/-", "read"; - permission java.io.FilePermission "${activemq.basedir}/artemis-core-client/target/artemis-core-client-${project.version}.jar", "read"; - permission java.util.PropertyPermission "activemq.version.property.filename", "read"; - permission java.util.PropertyPermission "activemq.artemis.client.global.thread.pool.max.size", "read"; - permission java.util.PropertyPermission "activemq.artemis.client.global.scheduled.thread.pool.core.size", "read"; - permission java.util.PropertyPermission "io.netty.eventLoopThreads", "read"; - permission java.util.PropertyPermission "io.netty.maxThreadLocalCharBufferSize", "read"; - permission java.util.PropertyPermission "io.netty.batch.bytes", "read"; - permission java.util.PropertyPermission "com.ibm.vm.bitmode", "read"; - permission java.util.PropertyPermission "io.netty.noUnsafe", "read"; - permission java.util.PropertyPermission "io.netty.tryUnsafe", "read"; - permission java.util.PropertyPermission "org.jboss.netty.tryUnsafe", "read"; - permission java.util.PropertyPermission "io.netty.noJavassist", "read"; - permission java.util.PropertyPermission "io.netty.noKeySetOptimization", "read"; - permission java.util.PropertyPermission "io.netty.selectorAutoRebuildThreshold", "read"; - permission java.util.PropertyPermission "io.netty.initialSeedUniquifier", "read"; - permission java.util.PropertyPermission "io.netty.noResourceLeakDetection", "read"; - permission java.util.PropertyPermission "io.netty.tmpdir", "read"; - permission java.util.PropertyPermission "io.netty.bitMode", "read"; - permission java.util.PropertyPermission "io.netty.leakDetectionLevel", "read"; - permission java.util.PropertyPermission "io.netty.allocator.pageSize", "read"; - permission java.util.PropertyPermission "io.netty.allocator.maxOrder", "read"; - permission java.util.PropertyPermission "io.netty.allocator.numHeapArenas", "read"; - permission java.util.PropertyPermission "io.netty.allocator.numDirectArenas", "read"; - permission java.util.PropertyPermission "io.netty.allocator.tinyCacheSize", "read"; - permission java.util.PropertyPermission "io.netty.allocator.smallCacheSize", "read"; - permission java.util.PropertyPermission "io.netty.allocator.normalCacheSize", "read"; - permission java.util.PropertyPermission "io.netty.allocator.maxCachedBufferCapacity", "read"; - permission java.util.PropertyPermission "io.netty.allocator.cacheTrimInterval", "read"; - permission java.util.PropertyPermission "io.netty.allocator.type", "read"; - permission java.util.PropertyPermission "io.netty.threadLocalDirectBufferSize", "read"; - permission java.util.PropertyPermission "io.netty.recycler.maxCapacity.default", "read"; - permission java.util.PropertyPermission "java.io.tmpdir", "read"; - permission java.util.PropertyPermission "sun.arch.data.model", "read"; - permission java.util.PropertyPermission "sun.nio.ch.bugLevel", "read"; - permission java.util.PropertyPermission "io.netty.leakDetection.level", "read"; - permission java.util.PropertyPermission "io.netty.leakDetection.maxRecords", "read"; - - permission java.util.PropertyPermission "java.util.secureRandomSeed", "read"; - permission java.util.PropertyPermission "io.netty.initialSeedUniquifier", "read"; - permission java.util.PropertyPermission "io.netty.maxDirectMemory", "read"; - permission java.util.PropertyPermission "io.netty.eventexecutor.maxPendingTasks", "read"; - permission java.util.PropertyPermission "io.netty.defaultPromise.maxListenerStackDepth", "read"; - permission java.util.PropertyPermission "io.netty.eventLoop.maxPendingTasks", "read"; - permission java.util.PropertyPermission "io.netty.processId", "read"; - permission java.util.PropertyPermission "io.netty.machineId", "read"; - permission java.util.PropertyPermission "java.net.preferIPv4Stack", "read"; - permission java.util.PropertyPermission "java.net.preferIPv6Addresses", "read"; - permission java.util.PropertyPermission "jctools.cacheLineSize", "read"; - permission java.util.PropertyPermission "org.jboss.logging.locale", "read"; - - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.misc"; - - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; -};
