+ Moving .config.java module -> .context

This commit is contained in:
Chris Beams 2009-03-23 04:48:04 +00:00
parent 63b5c48461
commit cd50e45645
62 changed files with 137 additions and 25 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="var" path="CLOVER_RUNTIME"/>
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

View File

@ -10,11 +10,21 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.cenqua.clover.core.prejavabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.cenqua.clover.core.postjavabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
@ -32,5 +42,6 @@
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>com.cenqua.clover.core.clovernature</nature>
</natures>
</projectDescription>

View File

@ -1,10 +0,0 @@
/**
* Integration tests for {@link org.springframework.context.annotation.Configuration}
* class processing.
*
* @author Chris Beams
* @see org.springframework.context.annotation.Configuration
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.support.ConfigurationClassPostProcessor
*/
package org.springframework.context.annotation.configuration;

View File

@ -1,7 +0,0 @@
/**
* Unit tests for support classes related to
* {@link org.springframework.context.annotation.Configuration} class processing.
*
* @author Chris Beams
*/
package org.springframework.context.annotation.support;

View File

@ -46,6 +46,7 @@
<dependency org="org.beanshell" name="com.springsource.bsh" rev="2.0.0.b4" conf="optional, beanshell->compile"/>
<dependency org="org.codehaus.groovy" name="com.springsource.org.codehaus.groovy" rev="1.5.1" conf="optional, groovy->compile"/>
<dependency org="org.jruby" name="com.springsource.org.jruby" rev="1.1.0" conf="optional, jruby->compile"/>
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration" conf="compile->compile"/>
<dependency org="org.springframework" name="org.springframework.aop" rev="latest.integration" conf="compile->compile"/>
<dependency org="org.springframework" name="org.springframework.beans" rev="latest.integration" conf="compile->compile"/>
<dependency org="org.springframework" name="org.springframework.core" rev="latest.integration" conf="compile->compile"/>
@ -59,7 +60,6 @@
<dependency org="org.apache.log4j" name="com.springsource.org.apache.log4j" rev="1.2.15" conf="test->runtime"/>
<dependency org="org.junit" name="com.springsource.org.junit" rev="4.5.0" conf="test->runtime"/>
<dependency org="org.easymock" name="com.springsource.org.easymock" rev="2.3.0" conf="test->compile"/>
<dependency org="org.springframework" name="org.springframework.asm" rev="latest.integration" conf="test->compile"/>
</dependencies>
</ivy-module>

View File

@ -24,7 +24,6 @@ import java.lang.annotation.Target;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.support.ConfigurationClassPostProcessor;
import org.springframework.stereotype.Component;
@ -52,7 +51,7 @@ import org.springframework.stereotype.Component;
* @author Rod Johnson
* @author Chris Beams
* @since 3.0
* @see ConfigurationClassPostProcessor
* @see org.springframework.context.annotation.support.ConfigurationClassPostProcessor;
* @see Bean
* @see Lazy
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,10 +19,14 @@ import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.*;
import java.util.HashMap;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.aop.scope.ScopedObject;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.annotation.Bean;
@ -33,7 +37,6 @@ import org.springframework.context.annotation.StandardScopes;
import org.springframework.context.annotation.support.ConfigurationClassPostProcessor;
import org.springframework.context.support.GenericApplicationContext;
import test.beans.CustomScope;
import test.beans.ITestBean;
import test.beans.TestBean;
@ -43,7 +46,6 @@ import test.beans.TestBean;
* Tests that scopes are properly supported by using a custom Scope implementations
* and scoped proxy {@link Bean} declarations.
*
* @see ScopeIntegrationTests
* @author Costin Leau
* @author Chris Beams
*/
@ -367,3 +369,70 @@ public class ScopingTests {
}
}
/**
* Simple scope implementation which creates object based on a flag.
*
* @author Costin Leau
* @author Chris Beams
*/
class CustomScope implements org.springframework.beans.factory.config.Scope {
public boolean createNewScope = true;
private Map<String, Object> beans = new HashMap<String, Object>();
/*
* (non-Javadoc)
* @see org.springframework.beans.factory.config.Scope#get(java.lang.String,
* org.springframework.beans.factory.ObjectFactory)
*/
public Object get(String name, ObjectFactory<?> objectFactory) {
if (createNewScope) {
beans.clear();
// reset the flag back
createNewScope = false;
}
Object bean = beans.get(name);
// if a new object is requested or none exists under the current
// name, create one
if (bean == null) {
beans.put(name, objectFactory.getObject());
}
return beans.get(name);
}
/*
* (non-Javadoc)
* @see org.springframework.beans.factory.config.Scope#getConversationId()
*/
public String getConversationId() {
return null;
}
/*
* (non-Javadoc)
* @see org.springframework.beans.factory.config.Scope#registerDestructionCallback(java.lang.String,
* java.lang.Runnable)
*/
public void registerDestructionCallback(String name, Runnable callback) {
// do nothing
}
/*
* (non-Javadoc)
* @see org.springframework.beans.factory.config.Scope#remove(java.lang.String)
*/
public Object remove(String name) {
return beans.remove(name);
}
public Object resolveContextualObject(String key) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -0,0 +1,26 @@
/*
* Copyright 2002-2009 the original author or authors.
*
* Licensed 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.
*/
/**
* Integration tests for {@link org.springframework.context.annotation.Configuration}
* class processing.
*
* @author Chris Beams
* @see org.springframework.context.annotation.Configuration
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.support.ConfigurationClassPostProcessor
*/
package org.springframework.context.annotation.configuration;

View File

@ -0,0 +1,23 @@
/*
* Copyright 2002-2009 the original author or authors.
*
* Licensed 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.
*/
/**
* Unit tests for support classes related to
* {@link org.springframework.context.annotation.Configuration} class processing.
*
* @author Chris Beams
*/
package org.springframework.context.annotation.support;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -49,7 +49,7 @@ import org.springframework.util.ObjectUtils;
* @author Chris Beams
*/
public final class ClassPathXmlApplicationContextTests {
private static final String PATH = "/org/springframework/context/support/";
private static final String RESOURCE_CONTEXT = PATH + "ClassPathXmlApplicationContextTests-resource.xml";
private static final String CONTEXT_WILDCARD = PATH + "test/context*.xml";