use of org.springframework.beans.factory.parsing.ComponentDefinition in project spring-framework by spring-projects.
the class JmsNamespaceHandlerTests method testSourceExtraction.
@Test
public void testSourceExtraction() {
Iterator<ComponentDefinition> iterator = context.getRegisteredComponents();
while (iterator.hasNext()) {
ComponentDefinition compDef = iterator.next();
assertNotNull("CompositeComponentDefinition '" + compDef.getName() + "' has no source attachment", compDef.getSource());
validateComponentDefinition(compDef);
}
}
use of org.springframework.beans.factory.parsing.ComponentDefinition in project spring-framework by spring-projects.
the class TxNamespaceHandlerEventTests method componentEventReceived.
@Test
public void componentEventReceived() {
ComponentDefinition component = this.eventListener.getComponentDefinition("txAdvice");
assertThat(component, instanceOf(BeanComponentDefinition.class));
}
use of org.springframework.beans.factory.parsing.ComponentDefinition in project spring-framework by spring-projects.
the class AopNamespaceHandlerEventTests method testAdvisorEventsWithDirectPointcut.
@Test
public void testAdvisorEventsWithDirectPointcut() throws Exception {
this.reader.loadBeanDefinitions(DIRECT_POINTCUT_EVENTS_CONTEXT);
ComponentDefinition[] componentDefinitions = this.eventListener.getComponentDefinitions();
assertEquals("Incorrect number of events fired", 2, componentDefinitions.length);
assertTrue("No holder with nested components", componentDefinitions[0] instanceof CompositeComponentDefinition);
CompositeComponentDefinition compositeDef = (CompositeComponentDefinition) componentDefinitions[0];
assertEquals("aop:config", compositeDef.getName());
ComponentDefinition[] nestedComponentDefs = compositeDef.getNestedComponents();
assertEquals("Incorrect number of inner components", 2, nestedComponentDefs.length);
AdvisorComponentDefinition acd = null;
for (int i = 0; i < nestedComponentDefs.length; i++) {
ComponentDefinition componentDefinition = nestedComponentDefs[i];
if (componentDefinition instanceof AdvisorComponentDefinition) {
acd = (AdvisorComponentDefinition) componentDefinition;
break;
}
}
assertNotNull("AdvisorComponentDefinition not found", acd);
assertEquals(2, acd.getBeanDefinitions().length);
assertEquals(1, acd.getBeanReferences().length);
assertTrue("No advice bean found", componentDefinitions[1] instanceof BeanComponentDefinition);
BeanComponentDefinition adviceDef = (BeanComponentDefinition) componentDefinitions[1];
assertEquals("countingAdvice", adviceDef.getBeanName());
}
use of org.springframework.beans.factory.parsing.ComponentDefinition in project spring-framework by spring-projects.
the class EventPublicationTests method beanEventReceived.
@Test
public void beanEventReceived() throws Exception {
ComponentDefinition componentDefinition1 = this.eventListener.getComponentDefinition("testBean");
assertTrue(componentDefinition1 instanceof BeanComponentDefinition);
assertEquals(1, componentDefinition1.getBeanDefinitions().length);
BeanDefinition beanDefinition1 = componentDefinition1.getBeanDefinitions()[0];
assertEquals(new TypedStringValue("Rob Harrop"), beanDefinition1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue());
assertEquals(1, componentDefinition1.getBeanReferences().length);
assertEquals("testBean2", componentDefinition1.getBeanReferences()[0].getBeanName());
assertEquals(1, componentDefinition1.getInnerBeanDefinitions().length);
BeanDefinition innerBd1 = componentDefinition1.getInnerBeanDefinitions()[0];
assertEquals(new TypedStringValue("ACME"), innerBd1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue());
assertTrue(componentDefinition1.getSource() instanceof Element);
ComponentDefinition componentDefinition2 = this.eventListener.getComponentDefinition("testBean2");
assertTrue(componentDefinition2 instanceof BeanComponentDefinition);
assertEquals(1, componentDefinition1.getBeanDefinitions().length);
BeanDefinition beanDefinition2 = componentDefinition2.getBeanDefinitions()[0];
assertEquals(new TypedStringValue("Juergen Hoeller"), beanDefinition2.getPropertyValues().getPropertyValue("name").getValue());
assertEquals(0, componentDefinition2.getBeanReferences().length);
assertEquals(1, componentDefinition2.getInnerBeanDefinitions().length);
BeanDefinition innerBd2 = componentDefinition2.getInnerBeanDefinitions()[0];
assertEquals(new TypedStringValue("Eva Schallmeiner"), innerBd2.getPropertyValues().getPropertyValue("name").getValue());
assertTrue(componentDefinition2.getSource() instanceof Element);
}
use of org.springframework.beans.factory.parsing.ComponentDefinition in project spring-framework by spring-projects.
the class JeeNamespaceHandlerEventTests method testRemoteSlsbComponentEventReceived.
@Test
public void testRemoteSlsbComponentEventReceived() {
ComponentDefinition component = this.eventListener.getComponentDefinition("simpleRemoteEjb");
assertTrue(component instanceof BeanComponentDefinition);
}
Aggregations