use of jakarta.enterprise.util.AnnotationLiteral in project cdi-tck by jakartaee.
the class InterceptorDefinitionTest method testNonBindingTypeToResolveInterceptorsFails.
@Test(expectedExceptions = { IllegalArgumentException.class })
@SpecAssertions({ @SpecAssertion(section = BM_INTERCEPTOR_RESOLUTION, id = "d") })
public void testNonBindingTypeToResolveInterceptorsFails() {
Annotation nonBinding = new AnnotationLiteral<NonBindingType>() {
};
getCurrentManager().resolveInterceptors(InterceptionType.AROUND_INVOKE, nonBinding);
}
use of jakarta.enterprise.util.AnnotationLiteral in project cdi-tck by jakartaee.
the class DecoratorDefinitionTest method testEmptyTypeSetOnResolveDecoratorsFails.
@Test(expectedExceptions = IllegalArgumentException.class)
@SpecAssertion(section = BM_DECORATOR_RESOLUTION, id = "e")
public void testEmptyTypeSetOnResolveDecoratorsFails() {
Annotation binding = new AnnotationLiteral<NonMeta>() {
};
getCurrentManager().resolveDecorators(new HashSet<Type>(), binding);
}
use of jakarta.enterprise.util.AnnotationLiteral in project cdi-tck by jakartaee.
the class DecoratorDefinitionTest method testNonBindingsOnResolveDecoratorsFails.
@Test(expectedExceptions = IllegalArgumentException.class)
@SpecAssertion(section = BM_DECORATOR_RESOLUTION, id = "d")
public void testNonBindingsOnResolveDecoratorsFails() {
Annotation binding = new AnnotationLiteral<NonMeta>() {
};
getCurrentManager().resolveDecorators(FooBar.TYPES, binding);
}
use of jakarta.enterprise.util.AnnotationLiteral in project cdi-tck by jakartaee.
the class DecoratorDefinitionTest method testDuplicateBindingsOnResolveDecoratorsFails.
@Test(expectedExceptions = IllegalArgumentException.class)
@SpecAssertion(section = BM_DECORATOR_RESOLUTION, id = "c")
public void testDuplicateBindingsOnResolveDecoratorsFails() {
Annotation binding = new AnnotationLiteral<Meta>() {
};
getCurrentManager().resolveDecorators(FooBar.TYPES, binding, binding);
}
use of jakarta.enterprise.util.AnnotationLiteral in project core by weld.
the class TransitiveResolutionTest method testDecoratorEnabledInWarButPackagedInEjbJar.
/*
* WELD-507
*/
@Test
public void testDecoratorEnabledInWarButPackagedInEjbJar() {
// Create the BDA in which we will deploy Foo. This is equivalent to a ejb
// jar
final BeanDeploymentArchiveImpl ejbJar = new BeanDeploymentArchiveImpl("ejb-jar", Blah.class, BlahDecorator.class, BlahImpl.class);
// Create the BDA in which we will deploy Bar. This is equivalent to a war
BeansXml beansXml = new BeansXmlImpl(null, null, Collections.singletonList(BlahDecorator.class.getName()), null);
final BeanDeploymentArchiveImpl war = new BeanDeploymentArchiveImpl("war", beansXml, BlahImpl2.class);
// The war can access the ejb jar
war.getBeanDeploymentArchives().add(ejbJar);
// Create a deployment, any other classes are put into the ejb-jar (not
// relevant to test)
Deployment deployment = new FlatDeployment(new BeanDeploymentArchive[] { war, ejbJar }) {
public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass) {
return ejbJar;
}
};
TestContainer container = new TestContainer(deployment);
container.startContainer();
container.ensureRequestActive();
// Get the bean manager for war and ejb jar
BeanManager warBeanManager = container.getBeanManager(war);
BeanManager ejbJarBeanManager = container.getBeanManager(ejbJar);
BasicInterceptor.reset();
Blah blah = getReference(ejbJarBeanManager, Blah.class);
blah.ping(10);
assertEquals(10, blah.getI());
BasicInterceptor.reset();
blah = getReference(warBeanManager, Blah.class, new AnnotationLiteral<Baz>() {
});
blah.ping(10);
assertEquals(11, blah.getI());
container.stopContainer();
}
Aggregations