use of cn.taketoday.beans.factory.parsing.ComponentDefinition in project today-infrastructure by TAKETODAY.
the class AopNamespaceHandlerEventTests method pointcutEvents.
@Test
void pointcutEvents() {
this.reader.loadBeanDefinitions(POINTCUT_EVENTS_CONTEXT);
ComponentDefinition[] componentDefinitions = this.eventListener.getComponentDefinitions();
assertThat(componentDefinitions).as("Incorrect number of events fired").hasSize(1);
assertThat(componentDefinitions[0]).as("No holder with nested components").isInstanceOf(CompositeComponentDefinition.class);
CompositeComponentDefinition compositeDef = (CompositeComponentDefinition) componentDefinitions[0];
assertThat(compositeDef.getName()).isEqualTo("aop:config");
ComponentDefinition[] nestedComponentDefs = compositeDef.getNestedComponents();
assertThat(nestedComponentDefs).as("Incorrect number of inner components").hasSize(2);
PointcutComponentDefinition pcd = null;
for (ComponentDefinition componentDefinition : nestedComponentDefs) {
if (componentDefinition instanceof PointcutComponentDefinition) {
pcd = (PointcutComponentDefinition) componentDefinition;
break;
}
}
assertThat(pcd).as("PointcutComponentDefinition not found").isNotNull();
assertThat(pcd.getBeanDefinitions()).as("Incorrect number of BeanDefinitions").hasSize(1);
}
use of cn.taketoday.beans.factory.parsing.ComponentDefinition in project today-infrastructure by TAKETODAY.
the class JeeNamespaceHandlerEventTests method testLocalSlsbComponentEventReceived.
@Test
public void testLocalSlsbComponentEventReceived() {
ComponentDefinition component = this.eventListener.getComponentDefinition("simpleLocalEjb");
boolean condition = component instanceof BeanComponentDefinition;
assertThat(condition).isTrue();
}
use of cn.taketoday.beans.factory.parsing.ComponentDefinition in project today-infrastructure by TAKETODAY.
the class JeeNamespaceHandlerEventTests method testRemoteSlsbComponentEventReceived.
@Test
public void testRemoteSlsbComponentEventReceived() {
ComponentDefinition component = this.eventListener.getComponentDefinition("simpleRemoteEjb");
boolean condition = component instanceof BeanComponentDefinition;
assertThat(condition).isTrue();
}
use of cn.taketoday.beans.factory.parsing.ComponentDefinition in project today-infrastructure by TAKETODAY.
the class EventPublicationTests method beanEventReceived.
@Test
public void beanEventReceived() throws Exception {
ComponentDefinition componentDefinition1 = this.eventListener.getComponentDefinition("testBean");
boolean condition3 = componentDefinition1 instanceof BeanComponentDefinition;
assertThat(condition3).isTrue();
assertThat(componentDefinition1.getBeanDefinitions().length).isEqualTo(1);
BeanDefinition beanDefinition1 = componentDefinition1.getBeanDefinitions()[0];
assertThat(beanDefinition1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue()).isEqualTo(new TypedStringValue("Rob Harrop"));
assertThat(componentDefinition1.getBeanReferences().length).isEqualTo(1);
assertThat(componentDefinition1.getBeanReferences()[0].getBeanName()).isEqualTo("testBean2");
assertThat(componentDefinition1.getInnerBeanDefinitions().length).isEqualTo(1);
BeanDefinition innerBd1 = componentDefinition1.getInnerBeanDefinitions()[0];
assertThat(innerBd1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue()).isEqualTo(new TypedStringValue("ACME"));
boolean condition2 = componentDefinition1.getSource() instanceof Element;
assertThat(condition2).isTrue();
ComponentDefinition componentDefinition2 = this.eventListener.getComponentDefinition("testBean2");
boolean condition1 = componentDefinition2 instanceof BeanComponentDefinition;
assertThat(condition1).isTrue();
assertThat(componentDefinition1.getBeanDefinitions().length).isEqualTo(1);
BeanDefinition beanDefinition2 = componentDefinition2.getBeanDefinitions()[0];
assertThat(beanDefinition2.getPropertyValues().getPropertyValue("name")).isEqualTo(new TypedStringValue("Juergen Hoeller"));
assertThat(componentDefinition2.getBeanReferences().length).isEqualTo(0);
assertThat(componentDefinition2.getInnerBeanDefinitions().length).isEqualTo(1);
BeanDefinition innerBd2 = componentDefinition2.getInnerBeanDefinitions()[0];
assertThat(innerBd2.getPropertyValues().getPropertyValue("name")).isEqualTo(new TypedStringValue("Eva Schallmeiner"));
boolean condition = componentDefinition2.getSource() instanceof Element;
assertThat(condition).isTrue();
}
use of cn.taketoday.beans.factory.parsing.ComponentDefinition in project today-framework by TAKETODAY.
the class JeeNamespaceHandlerEventTests method testJndiLookupComponentEventReceived.
@Test
public void testJndiLookupComponentEventReceived() {
ComponentDefinition component = this.eventListener.getComponentDefinition("simple");
boolean condition = component instanceof BeanComponentDefinition;
assertThat(condition).isTrue();
}
Aggregations