Package org.switchyard.component.resteasy.config.model

Examples of org.switchyard.component.resteasy.config.model.RESTEasyBindingModel


        // Service exposed as WS
        _resteasyInbound = new InboundHandler(_config, _domain);
        _resteasyInbound.start();

        RESTEasyBindingModel config = new V1RESTEasyBindingModel(RESTEasyNamespace.DEFAULT.uri()) {
            @Override
            public CompositeReferenceModel getReference() {
                return new V1CompositeReferenceModel();
            }
        };
        config.setServiceName(_authConsumerService1.getServiceName());
        config.setName("auth-test");
        config.setInterfaces("org.switchyard.component.resteasy.HelloResource");
        config.setAddress("http://192.168.169.4/");

        // Service consumer or Reference binding
        OutboundHandler resteasyProxyOutbound1 = new OutboundHandler(config, null);
        resteasyProxyOutbound1.start();
        _domain.registerService(_authConsumerService1.getServiceName(), new HelloWebServiceInterface(), resteasyProxyOutbound1);

        NtlmAuthModel auth = new V1NtlmAuthModel(RESTEasyNamespace.DEFAULT.uri());
        auth.setUser("SwitchYard");
        auth.setPassword("JBoss123!");
        auth.setDomain("JBOSS");
        config.setNtlmAuthConfig(auth);
        config.setServiceName(_authConsumerService2.getServiceName());

        // Service consumer or Reference binding
        OutboundHandler resteasyProxyOutbound2 = new OutboundHandler(config, null);
        resteasyProxyOutbound2.start();
        _domain.registerService(_authConsumerService2.getServiceName(), new HelloWebServiceInterface(), resteasyProxyOutbound2);
View Full Code Here


    private static final String REST_BINDING_PROXY = "rest-binding-proxy.xml";

    @Test
    public void testReadConfigBinding() throws Exception {
        ModelPuller<RESTEasyBindingModel> puller = new ModelPuller<RESTEasyBindingModel>();
        RESTEasyBindingModel model = puller.pull(REST_BINDING, getClass());
        Assert.assertTrue(model.isModelValid());
        model = puller.pull(REST_BINDING_INVALID, getClass());
        Assert.assertFalse(model.isModelValid());
    }
View Full Code Here

    }

    @Test
    public void testReadReferenceBinding() throws Exception {
        ModelPuller<RESTEasyBindingModel> puller = new ModelPuller<RESTEasyBindingModel>();
        RESTEasyBindingModel model = puller.pull(REST_BINDING_REFERENCE, getClass());
        Assert.assertTrue(model.isModelValid());
        Assert.assertEquals(new Integer(5000), model.getTimeout());
    }
View Full Code Here

    }

    @Test
    public void authBinding() throws Exception {
        ModelPuller<RESTEasyBindingModel> puller = new ModelPuller<RESTEasyBindingModel>();
        RESTEasyBindingModel binding = puller.pull(REST_BINDING_AUTH, getClass());
        binding.assertModelValid();
        NtlmAuthModel authConfig = binding.getNtlmAuthConfig();
        Assert.assertEquals("user", authConfig.getUser());
        Assert.assertEquals("password", authConfig.getPassword());
        Assert.assertEquals("domain", authConfig.getDomain());
    }
View Full Code Here

    }

    @Test
    public void proxyConfigBinding() throws Exception {
        ModelPuller<RESTEasyBindingModel> puller = new ModelPuller<RESTEasyBindingModel>();
        RESTEasyBindingModel model = puller.pull(REST_BINDING_PROXY, getClass());
        model.assertModelValid();
        ProxyModel proxyConfig = model.getProxyConfig();
        Assert.assertNotNull(proxyConfig);
        Assert.assertEquals("host", proxyConfig.getHost());
        Assert.assertEquals("8090", proxyConfig.getPort());
        Assert.assertEquals("Beal", proxyConfig.getUser());
        Assert.assertEquals("conjecture", proxyConfig.getPassword());
View Full Code Here

        super(RESTEASY_TYPE);
    }

    @Override
    public ServiceHandler activateBinding(QName name, BindingModel config) {
        RESTEasyBindingModel binding = (RESTEasyBindingModel)config;
        binding.setEnvironment(_environment);

        if (binding.isServiceBinding()) {
            return new InboundHandler(binding, getServiceDomain());
        } else {
            return new OutboundHandler(binding, getServiceDomain());
        }
    }
View Full Code Here

        // Service exposed as WS
        _resteasyInbound = new InboundHandler(_config, _domain);
        _resteasyInbound.start();

        RESTEasyBindingModel config = new V1RESTEasyBindingModel(RESTEasyNamespace.DEFAULT.uri()) {
            @Override
            public CompositeReferenceModel getReference() {
                return new V1CompositeReferenceModel();
            }
        };
        config.setServiceName(_proxyConsumerService1.getServiceName());
        config.setName("proxy-test");
        config.setInterfaces("org.switchyard.component.resteasy.HelloResource");
        config.setAddress("http://unreachablehost");

        // Service consumer or Reference binding
        _resteasyProxyOutbound1 = new OutboundHandler(config, null);
        _resteasyProxyOutbound1.start();
        _domain.registerService(_proxyConsumerService1.getServiceName(), new HelloRESTEasyInterface(), _resteasyProxyOutbound1);

        ProxyModel proxy = new V1ProxyModel(RESTEasyNamespace.DEFAULT.uri());
        proxy.setHost(host);
        proxy.setPort("" + PROXYPORT);
        config.setAddress("http://" + host + ":" + port);
        config.setProxyConfig(proxy);
        config.setServiceName(_proxyConsumerService2.getServiceName());

        // Service consumer or Reference binding
        _resteasyProxyOutbound2 = new OutboundHandler(config, null);
        _resteasyProxyOutbound2.start();
        _domain.registerService(_proxyConsumerService2.getServiceName(), new HelloRESTEasyInterface(), _resteasyProxyOutbound2);

        proxy.setUser(PROXY_USER);
        proxy.setPassword(PROXY_PWD);
        config.setProxyConfig(proxy);
        config.setServiceName(_proxyConsumerService3.getServiceName());

        // Service consumer or Reference binding
        _resteasyProxyOutbound3 = new OutboundHandler(config, null);
        _resteasyProxyOutbound3.start();
        _domain.registerService(_proxyConsumerService3.getServiceName(), new HelloRESTEasyInterface(), _resteasyProxyOutbound3);
View Full Code Here

TOP

Related Classes of org.switchyard.component.resteasy.config.model.RESTEasyBindingModel

Copyright © 2018 www.massapicom. 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.