You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2021/05/18 04:44:54 UTC

[cassandra] branch cassandra-4.0 updated (0301fc6 -> 2ca525b)

This is an automated email from the ASF dual-hosted git repository.

bereng pushed a change to branch cassandra-4.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git.


    from 0301fc6  cqlsh: fix DESC TYPE with non-ascii character in the identifier
     new fdabda1  patch by Berenguer Blasi; reviewed by Andrés de la Peña for CASSANDRA-16654
     new 317a4a8  Merge branch 'cassandra-3.0' into cassandra-3.11
     new 2ca525b  Merge branch 'cassandra-3.11' into cassandra-4.0

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 doc/source/development/testing.rst                 |   5 +
 .../CassandraIsolatedJunit4ClassRunner.java        |   2 -
 .../org/apache/cassandra/RepeatableRunner.java     | 109 +++++++++++++++++++++
 3 files changed, 114 insertions(+), 2 deletions(-)
 create mode 100644 test/unit/org/apache/cassandra/RepeatableRunner.java

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


[cassandra] 01/01: Merge branch 'cassandra-3.11' into cassandra-4.0

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bereng pushed a commit to branch cassandra-4.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 2ca525b6b7aaac08ce311bcc70587a35881f559a
Merge: 0301fc6 317a4a8
Author: Bereng <be...@gmail.com>
AuthorDate: Tue May 18 06:39:53 2021 +0200

    Merge branch 'cassandra-3.11' into cassandra-4.0

 doc/source/development/testing.rst                 |   5 +
 .../CassandraIsolatedJunit4ClassRunner.java        |   2 -
 .../org/apache/cassandra/RepeatableRunner.java     | 109 +++++++++++++++++++++
 3 files changed, 114 insertions(+), 2 deletions(-)

diff --cc test/unit/org/apache/cassandra/CassandraIsolatedJunit4ClassRunner.java
index 90e3896,0000000..8c37be7
mode 100644,000000..100644
--- a/test/unit/org/apache/cassandra/CassandraIsolatedJunit4ClassRunner.java
+++ b/test/unit/org/apache/cassandra/CassandraIsolatedJunit4ClassRunner.java
@@@ -1,109 -1,0 +1,107 @@@
 +/*
 + * 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.cassandra;
 +
 +import java.io.IOException;
 +import java.net.URLClassLoader;
 +import java.util.function.Predicate;
 +
 +import org.junit.runners.BlockJUnit4ClassRunner;
 +import org.junit.runners.model.InitializationError;
 +
 +import org.apache.cassandra.distributed.impl.AbstractCluster;
- import org.apache.cassandra.distributed.shared.Versions;
- import org.apache.cassandra.utils.FBUtilities;
 +
 +/**
 + *
 + * This class is usually used to test singletons. It ensure singletons can be unique in each test case.
 + *
 + */
 +public class CassandraIsolatedJunit4ClassRunner extends BlockJUnit4ClassRunner
 +{
 +
 +    private static final Predicate<String> isolatedPackage = name ->
 +                                                             name.startsWith("org.apache.cassandra.") ||
 +                                                             // YAML could not be shared because
 +                                                             // org.apache.cassandra.config.Config is loaded by org.yaml.snakeyaml.YAML
 +                                                             name.startsWith("org.yaml.snakeyaml.");
 +
 +
 +    /**
 +     * Creates a CassandraIsolatedJunit4ClassRunner to run {@code klass}
 +     *
 +     * @param clazz
 +     * @throws InitializationError if the test class is malformed.
 +     */
 +    public CassandraIsolatedJunit4ClassRunner(Class<?> clazz) throws InitializationError
 +    {
 +        super(createClassLoader(clazz));
 +    }
 +
 +    private static Class<?> createClassLoader(Class<?> clazz) throws InitializationError {
 +        try {
 +            ClassLoader testClassLoader = new CassandraIsolatedClassLoader();
 +            return Class.forName(clazz.getName(), true, testClassLoader);
 +        } catch (ClassNotFoundException e) {
 +            throw new InitializationError(e);
 +        }
 +    }
 +
 +    public static class CassandraIsolatedClassLoader extends URLClassLoader
 +    {
 +        public CassandraIsolatedClassLoader()
 +        {
 +            super(AbstractCluster.CURRENT_VERSION.classpath);
 +        }
 +
 +        @Override
 +        public Class<?> loadClass(String name) throws ClassNotFoundException
 +        {
 +
 +            if (isolatedPackage.test(name))
 +            {
 +                synchronized (getClassLoadingLock(name))
 +                {
 +                    // First, check if the class has already been loaded
 +                    Class<?> c = findLoadedClass(name);
 +
 +                    if (c == null)
 +                        c = findClass(name);
 +
 +                    return c;
 +                }
 +            }
 +            else
 +            {
 +                return super.loadClass(name);
 +            }
 +        }
 +
 +        protected void finalize()
 +        {
 +            try
 +            {
 +                close();
 +            }
 +            catch (IOException e)
 +            {
 +                e.printStackTrace();
 +            }
 +        }
 +    }
 +}

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org