Java Code Examples for org.jboss.weld.environment.se.Weld#addExtension()

The following examples show how to use org.jboss.weld.environment.se.Weld#addExtension() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsTestBase.java    From smallrye-reactive-messaging with Apache License 2.0 7 votes vote down vote up
protected Weld initWithoutConnectionFactory() {
    weld = new Weld();

    // SmallRye config
    ConfigExtension extension = new ConfigExtension();
    weld.addExtension(extension);

    weld.addBeanClass(MediatorFactory.class);
    weld.addBeanClass(MediatorManager.class);
    weld.addBeanClass(InternalChannelRegistry.class);
    weld.addBeanClass(ConfiguredChannelFactory.class);
    weld.addBeanClass(ChannelProducer.class);
    weld.addBeanClass(ExecutionHolder.class);
    weld.addBeanClass(WorkerPoolRegistry.class);
    weld.addExtension(new ReactiveMessagingExtension());
    weld.addBeanClass(JmsConnector.class);
    weld.disableDiscovery();
    return weld;
}
 
Example 2
Source File: AwsSnsTestBase.java    From smallrye-reactive-messaging with Apache License 2.0 7 votes vote down vote up
static Weld baseWeld() {
    Weld weld = new Weld();
    // SmallRye config
    ConfigExtension extension = new ConfigExtension();
    weld.addExtension(extension);

    weld.addBeanClass(MediatorFactory.class);
    weld.addBeanClass(MediatorManager.class);
    weld.addBeanClass(InternalChannelRegistry.class);
    weld.addBeanClass(ConfiguredChannelFactory.class);
    weld.addBeanClass(ChannelProducer.class);
    weld.addBeanClass(ExecutionHolder.class);
    weld.addBeanClass(WorkerPoolRegistry.class);
    weld.addExtension(new ReactiveMessagingExtension());

    weld.addBeanClass(SnsConnector.class);
    weld.disableDiscovery();

    return weld;
}
 
Example 3
Source File: EventbusTestBase.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
static Weld baseWeld() {
    Weld weld = new Weld();
    weld.addBeanClass(MediatorFactory.class);
    weld.addBeanClass(MediatorManager.class);
    weld.addBeanClass(InternalChannelRegistry.class);
    weld.addBeanClass(ConfiguredChannelFactory.class);
    weld.addBeanClass(ExecutionHolder.class);
    weld.addBeanClass(WorkerPoolRegistry.class);
    weld.addExtension(new ReactiveMessagingExtension());
    weld.addBeanClass(VertxEventBusConnector.class);

    weld.addExtension(new io.smallrye.config.inject.ConfigExtension());

    weld.disableDiscovery();
    return weld;
}
 
Example 4
Source File: MqttTestBase.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
static Weld baseWeld(MapBasedConfig config) {
    addConfig(config);
    Weld weld = new Weld();
    weld.disableDiscovery();
    weld.addBeanClass(MediatorFactory.class);
    weld.addBeanClass(MediatorManager.class);
    weld.addBeanClass(InternalChannelRegistry.class);
    weld.addBeanClass(ConfiguredChannelFactory.class);
    weld.addBeanClass(WorkerPoolRegistry.class);
    weld.addBeanClass(ExecutionHolder.class);
    weld.addPackages(EmitterImpl.class.getPackage());
    weld.addExtension(new ReactiveMessagingExtension());
    weld.addBeanClass(MqttConnector.class);

    // Add SmallRye Config
    weld.addExtension(new io.smallrye.config.inject.ConfigExtension());

    return weld;
}
 
Example 5
Source File: PubSubTestBase.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
static Weld baseWeld() {
    final Weld weld = new Weld();

    weld.addExtension(new ConfigExtension());
    weld.addBeanClass(MediatorFactory.class);
    weld.addBeanClass(MediatorManager.class);
    weld.addBeanClass(InternalChannelRegistry.class);
    weld.addBeanClass(ConfiguredChannelFactory.class);
    weld.addBeanClass(ChannelProducer.class);
    weld.addBeanClass(ExecutionHolder.class);
    weld.addBeanClass(WorkerPoolRegistry.class);
    weld.addExtension(new ReactiveMessagingExtension());

    weld.addBeanClass(PubSubManager.class);
    weld.addBeanClass(PubSubConnector.class);
    weld.disableDiscovery();

    return weld;
}
 
Example 6
Source File: KafkaTestBase.java    From smallrye-reactive-messaging with Apache License 2.0 6 votes vote down vote up
public static Weld baseWeld() {
    Weld weld = new Weld();

    // SmallRye config
    ConfigExtension extension = new ConfigExtension();
    weld.addExtension(extension);

    weld.addBeanClass(MediatorFactory.class);
    weld.addBeanClass(MediatorManager.class);
    weld.addBeanClass(InternalChannelRegistry.class);
    weld.addBeanClass(ConfiguredChannelFactory.class);
    weld.addBeanClass(ChannelProducer.class);
    weld.addBeanClass(ExecutionHolder.class);
    weld.addBeanClass(WorkerPoolRegistry.class);
    weld.addExtension(new ReactiveMessagingExtension());

    weld.addBeanClass(KafkaConnector.class);
    weld.disableDiscovery();
    return weld;
}
 
Example 7
Source File: WeldVerticle.java    From weld-vertx with Apache License 2.0 6 votes vote down vote up
@Override
public void start(Future<Void> startFuture) throws Exception {
    Weld weld = this.weld != null ? this.weld : createDefaultWeld();
    if (weld.getContainerId() == null) {
        weld.containerId(deploymentID());
    }
    weld.addExtension(new VertxExtension(vertx, context));
    configureWeld(weld);
    // Bootstrap can take some time to complete
    vertx.executeBlocking(future -> {
        try {
            this.weldContainer = weld.initialize();
            future.complete();
        } catch (Exception e) {
            future.fail(e);
        }
    }, result -> {
        if (result.succeeded()) {
            LOGGER.info("Weld verticle started for deployment {0}", deploymentID());
            startFuture.complete();
        } else {
            startFuture.fail(result.cause());
        }
    });
}
 
Example 8
Source File: WeldWebVerticle.java    From weld-vertx with Apache License 2.0 4 votes vote down vote up
@Override
protected void configureWeld(Weld weld) {
    weld.addExtension(new RouteExtension());
}
 
Example 9
Source File: WeldJunit5AutoExtension.java    From weld-junit with Apache License 2.0 3 votes vote down vote up
@Override
protected void weldInit(Object testInstance, ExtensionContext context, Weld weld, WeldInitiator.Builder weldInitiatorBuilder) {

    Class<?> testClass = testInstance.getClass();

    ClassScanning.scanForRequiredBeanClass(testClass, weld, getExplicitInjectionInfoFromStore(context));

    weld.addBeanClass(testClass);
    weld.addExtension(new TestInstanceInjectionExtension(testClass, testInstance));

    AnnotationSupport.findRepeatableAnnotations(testClass, ActivateScopes.class)
            .forEach(ann -> weldInitiatorBuilder.activate(ann.value()));

}