// Path: components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/WebServiceContextBean.java
// public class WebServiceContextBean implements WebServiceContext {
// 
//     MessageContext messageContext;
// 
//     public WebServiceContextBean(String id) {
//         MessageImpl message = new MessageImpl();
//         message.put("id", id);
//         messageContext = new LogicalMessageContextImpl(message);
//     }
// 
//     @Override
//     public MessageContext getMessageContext() {
//         return messageContext;
//     }
// 
//     @Override
//     public Principal getUserPrincipal() {
//         return null;
//     }
// 
//     @Override
//     public boolean isUserInRole(String role) {
//         return false;
//     }
// 
//     @Override
//     public EndpointReference getEndpointReference(Element... referenceParameters) {
//         return null;
//     }
// 
//     @Override
//     public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {
//         return null;
//     }
// }


import com.kumuluz.ee.jaxws.cxf.impl.WebServiceContextBean;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
package com.kumuluz.ee.jaxws.cxf.ws;



public class KumuluzWebServiceContextTest {

    @Test
    public void shouldUseRightContext() throws InterruptedException {

        WsThread one = new WsThread();
        WsThread two = new WsThread();

        one.start();
        two.start();
        one.join();
        two.join();

        assertTrue("Thread 1 context not properly propagated", one.isSuccessful());
        assertTrue("Thread 2 context not properly propagated", two.isSuccessful());
    }

    public static class WsThread extends Thread {
        private boolean successful = true;

        public void run() {
            String threadName = Thread.currentThread().getName();

// Path: components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/WebServiceContextBean.java
// public class WebServiceContextBean implements WebServiceContext {
// 
//     MessageContext messageContext;
// 
//     public WebServiceContextBean(String id) {
//         MessageImpl message = new MessageImpl();
//         message.put("id", id);
//         messageContext = new LogicalMessageContextImpl(message);
//     }
// 
//     @Override
//     public MessageContext getMessageContext() {
//         return messageContext;
//     }
// 
//     @Override
//     public Principal getUserPrincipal() {
//         return null;
//     }
// 
//     @Override
//     public boolean isUserInRole(String role) {
//         return false;
//     }
// 
//     @Override
//     public EndpointReference getEndpointReference(Element... referenceParameters) {
//         return null;
//     }
// 
//     @Override
//     public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {
//         return null;
//     }
// }


// Path: components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/ws/KumuluzWebServiceContextTest.java
import com.kumuluz.ee.jaxws.cxf.impl.WebServiceContextBean;
import org.junit.Test;
import static org.junit.Assert.assertTrue;

package com.kumuluz.ee.jaxws.cxf.ws;



public class KumuluzWebServiceContextTest {

    @Test
    public void shouldUseRightContext() throws InterruptedException {

        WsThread one = new WsThread();
        WsThread two = new WsThread();

        one.start();
        two.start();
        one.join();
        two.join();

        assertTrue("Thread 1 context not properly propagated", one.isSuccessful());
        assertTrue("Thread 2 context not properly propagated", two.isSuccessful());
    }

    public static class WsThread extends Thread {
        private boolean successful = true;

        public void run() {
            String threadName = Thread.currentThread().getName();

            KumuluzWebServiceContext.getInstance().setMessageContext(new WebServiceContextBean(threadName));