This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.test.utils;
002
003/*
004 * Copyright 2012 The Apache Software Foundation.
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *      http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019import org.junit.runners.model.FrameworkMethod;
020import org.junit.runners.model.InitializationError;
021import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
022
023import java.io.IOException;
024import java.nio.file.Files;
025import java.nio.file.Path;
026import java.util.List;
027
028/**
029 * @author Eric
030 */
031public class ArchivaSpringJUnit4ClassRunner
032    extends SpringJUnit4ClassRunner
033{
034
035    static {
036
037        if (System.getProperty("archiva.user.configFileName")!=null && !"".equals(System.getProperty("archiva.user.configFileName").trim())) {
038            try {
039                Path file = Files.createTempFile("archiva-test-conf", ".xml");
040                System.setProperty("archiva.user.configFileName", file.toAbsolutePath().toString());
041            } catch (IOException e) {
042                e.printStackTrace();
043            }
044        }
045    }
046
047    public ArchivaSpringJUnit4ClassRunner( Class<?> clazz )
048        throws InitializationError
049    {
050        super( clazz );
051    }
052
053    @Override
054    protected List<FrameworkMethod> computeTestMethods()
055    {
056        return ListGenerator.getShuffleList( super.computeTestMethods() );
057    }
058
059
060}