/*
 * 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.geronimo.gshell.spring;

import junit.framework.TestCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Suport for Spring-based tests.
 *
 * @version $Rev$ $Date$
 */
public abstract class SpringTestSupport
    extends TestCase
{
    protected final Logger log = LoggerFactory.getLogger(getClass());

    private BeanContainerImpl container;

    protected void setUp() throws Exception {
        container = new BeanContainerImpl(getClass().getClassLoader());
        configure(container);
    }
    
    protected void tearDown() throws Exception {
        container = null;
    }

    protected void configure(final BeanContainerImpl container) throws Exception {
        container.loadBeans(getConfigLocations());
    }

    protected String[] getConfigLocations() {
        return new String[] {
            "classpath:" + getClass().getName().replace('.', '/') + "-context.xml"
        };
    }

    protected BeanContainerImpl getBeanContainer() {
        if (container == null) {
            throw new IllegalStateException();
        }
        return container;
    }
}
@@ -1588,14 +1588,19 @@
 ring
-%5B%5D
  get
+Default
 Conf
@@ -1609,17 +1609,16 @@
 Location
-s
 () %7B%0A   
@@ -1633,35 +1633,8 @@
 urn 
-new String%5B%5D %7B%0A            
 %22cla
@@ -1699,16 +1699,139 @@
 ext.xml%22
+;%0A    %7D%0A%0A    protected String%5B%5D getConfigLocations() %7B%0A        return new String%5B%5D %7B%0A            getDefaultConfigLocation()
 %0A       
@@ -2015,10 +2015,269 @@
 r;%0A    %7D
+%0A%0A    protected %3CT%3E T getBean(final Class%3CT%3E type) %7B%0A        return getBeanContainer().getBean(type);%0A    %7D%0A%0A    protected %3CT%3E T getBean(final String name, final Class%3CT%3E requiredType) %7B%0A        return getBeanContainer().getBean(name, requiredType);    %0A    %7D
 %0A%7D

Add some helpers