1 package org.codehaus.plexus.component.configurator;
2
3 import org.apache.xbean.recipe.ConstructionException;
4 import org.apache.xbean.recipe.DefaultExecutionContext;
5 import org.apache.xbean.recipe.ExecutionContext;
6 import org.apache.xbean.recipe.ObjectRecipe;
7 import org.codehaus.plexus.classworlds.realm.ClassRealm;
8 import org.codehaus.plexus.component.builder.XBeanComponentBuilder;
9 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
10 import org.codehaus.plexus.component.repository.ComponentDescriptor;
11
12 public class XBeanComponentConfiguratorTest extends AbstractComponentConfiguratorTest {
13 @Override
14 protected void configureComponent(Object component, ComponentDescriptor descriptor, ClassRealm realm)
15 throws Exception {
16 XBeanComponentBuilder componentBuilder = new XBeanComponentBuilder();
17 ObjectRecipe recipe = componentBuilder.createObjectRecipe(component, descriptor, realm);
18
19
20 ExecutionContext executionContext = new DefaultExecutionContext();
21 executionContext.push(new ObjectRecipe(component.getClass()));
22
23
24 ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
25 Thread.currentThread().setContextClassLoader(realm);
26 ExecutionContext.setContext(executionContext);
27 try {
28 recipe.setProperties(component);
29 } catch (ConstructionException e) {
30 throw new ComponentConfigurationException("Failed to configure component", e);
31 } finally {
32 ExecutionContext.setContext(null);
33 Thread.currentThread().setContextClassLoader(oldClassLoader);
34 }
35 }
36
37 protected void configureComponent(
38 Object component, ComponentDescriptor descriptor, ClassRealm realm, ExpressionEvaluator expressionEvaluator)
39 throws Exception {
40 this.configureComponent(component, descriptor, realm);
41 }
42
43 public void testComponentConfigurationWithPropertiesFieldsWithExpression() throws Exception {
44
45 }
46
47 public void testComponentConfigurationWithPropertiesFieldsWithExpressions() throws Exception {
48
49 }
50
51 public void testComponentConfigurationWithAmbiguousExpressionValue() throws Exception {
52
53 }
54
55 public void testComponentConfigurationWithPrimitiveValueConversion() throws Exception {
56
57 }
58
59 public void testComponentConfigurationWithUnresolvedExpressionContentForCompositeFieldOfNonInstantiatableType()
60 throws Exception {
61
62 }
63
64 protected ComponentConfigurator getComponentConfigurator() throws Exception {
65
66 throw new UnsupportedOperationException();
67 }
68 }