Examples of JDKWireFactoryFactory


Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

        MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor();
        source.addRequestHandler(sourceRequestHandler);
        source.addResponseHandler(sourceResponseHandler);
        source.addInterceptor(sourceInterceptor);

        SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory();
        Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>();
        sourceInvocationConfigs.put(hello, source);
        WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"),
                sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory);
        sourceFactory.setConfiguration(sourceConfig);
        sourceFactory.setBusinessInterface(SimpleTarget.class);
       
        TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello);
        MockHandler targetRequestHandler = new MockHandler();
        MockHandler targetResponseHandler = new MockHandler();
        MockSyncInterceptor targetInterceptor = new MockSyncInterceptor();
        target.addRequestHandler(targetRequestHandler);
        target.addResponseHandler(targetResponseHandler);
        target.addInterceptor(targetInterceptor);
        target.addInterceptor(new InvokerInterceptor());

        TargetWireFactory targetFactory = new JDKWireFactoryFactory().createTargetWireFactory();
        Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>();
        targetInvocationConfigs.put(hello, target);
        WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"),
                targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory);
        targetFactory.setConfiguration(targetConfig);
View Full Code Here

Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

        Assert.assertTrue(comp3.isDestroyed());
        scope.stop();
    }

    private List<ContextFactory<Context>> createConfigurations() throws BuilderException, ConfigurationLoadException {
        WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry());
        JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService);
        AtomicComponent component = MockFactory.createComponent("TestService1", SessionScopeComponentImpl.class, Scope.SESSION);
        ComponentTypeIntrospector introspector = MockFactory.getIntrospector();
        ComponentType type = introspector.introspect(SessionScopeComponentImpl.class);
        component.getImplementation().setComponentType(type);
View Full Code Here

Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

        configs.add((ContextFactory<Context>) component.getContextFactory());
        return configs;
    }

    private ContextFactory<Context> createConfiguration(String name) throws BuilderException, ConfigurationLoadException {
        WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry());
        JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService);
        AtomicComponent component = MockFactory.createComponent(name, SessionScopeInitDestroyComponent.class, Scope.SESSION);
        ComponentTypeIntrospector introspector = MockFactory.getIntrospector();
        ComponentType type = introspector.introspect(SessionScopeInitDestroyComponent.class);
        component.getImplementation().setComponentType(type);
View Full Code Here

Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

    public void testBuilder() throws Exception {
        MockSyncInterceptor mockInterceptor = new MockSyncInterceptor();
        MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, true);
        PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry();
        policyRegistry.registerSourceBuilder(interceptorBuilder);
        WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry);
        JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService);

        JavaTargetWireBuilder javaWireBuilder = new JavaTargetWireBuilder();
        ScopeStrategy strategy = new DefaultScopeStrategy();
        DefaultWireBuilder wireBuilder = new DefaultWireBuilder();
View Full Code Here

Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

    private CompositeContext createContext() {
        CompositeContextImpl context = new CompositeContextImpl();
        context.setName("system.context");
        List<ContextFactoryBuilder>builders = MockFactory.createSystemBuilders();
        WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry());
        builders.add(new JavaContextFactoryBuilder(wireService));
        List<WireBuilder> wireBuilders = new ArrayList<WireBuilder>();
        wireBuilders.add(new JavaTargetWireBuilder());
        context.setConfigurationContext(new MockConfigContext(builders,wireBuilders));
        return context;
View Full Code Here

Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

     * Creats an assembly containing a module-scoped component definition, a session-scoped component definition, and a
     * request-scoped component definition
     *
     */
    private List<Extensible> createAssembly() throws BuilderException, ConfigurationLoadException {
        WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry());
        JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService);
        AtomicComponent component = MockFactory.createComponent("TestService1", ModuleScopeComponentImpl.class, Scope.MODULE);
        AtomicComponent sessionComponent = MockFactory.createComponent("TestService2", SessionScopeComponentImpl.class,
                Scope.SESSION);
        AtomicComponent requestComponent = MockFactory.createComponent("TestService3", SessionScopeComponentImpl.class,
View Full Code Here

Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

    private List<ContextFactory<Context>> createConfigurations()
            throws NoSuchMethodException, BuilderException, ConfigurationLoadException {
        AtomicComponent component = MockFactory.createComponent("TestService1", StatelessComponentImpl.class,
                Scope.INSTANCE);
        WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry());
        JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService);
        builder.build(component);
        List<ContextFactory<Context>> configs = new ArrayList();
        configs.add((ContextFactory<Context>) component.getContextFactory());
        return configs;
View Full Code Here

Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

    private ContextFactory<Context> createConfiguration(String name)
            throws NoSuchMethodException, BuilderException, ConfigurationLoadException {
        AtomicComponent component = MockFactory.createComponent(name, StatelessComponentImpl.class,
                Scope.INSTANCE);
        WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(),new DefaultPolicyBuilderRegistry());
        JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService);
        builder.build(component);
        return (ContextFactory<Context>) component.getContextFactory();
    }
View Full Code Here

Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

    public void testNoTargetInterceptorOrHandler() throws Exception {
        MessageFactory msgFactory = new MessageFactoryImpl();

        SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello);

        SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory();
        Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>();
        sourceInvocationConfigs.put(hello, source);
        WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"),
                sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory);
        sourceFactory.setConfiguration(sourceConfig);
View Full Code Here

Examples of org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory

        return configs;
    }

    protected void setUp() throws Exception {
        super.setUp();
        WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(),new DefaultPolicyBuilderRegistry());
        builder = new JavaContextFactoryBuilder(wireService);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.