// Path: components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/NoWsContextAnnotatedEndpointBean.java
// @WebService
// public class NoWsContextAnnotatedEndpointBean {
// }
// 
// Path: components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/WsContextAnnotatedEndpointBean.java
// @WsContext(contextRoot = WsContextAnnotatedEndpointBean.CTX_ROOT, urlPattern = WsContextAnnotatedEndpointBean.URL_PATTERN)
// @WebService(wsdlLocation = WsContextAnnotatedEndpointBean.WSDL_URL, portName = WsContextAnnotatedEndpointBean.PORT, serviceName =
//         WsContextAnnotatedEndpointBean.SERVICE, endpointInterface = WsContextAnnotatedEndpointBean.INTERFACE)
// public class WsContextAnnotatedEndpointBean implements WsContextAnnotatedEndpoint {
// 
//     public static final String WSDL_URL = "http://cloud.si/example.wsdl";
//     public static final String CTX_ROOT = "/ws/*";
//     public static final String URL_PATTERN = "/endpoint";
//     public static final String PORT = "EndpointPort";
//     public static final String SERVICE = "ServiceName";
//     public static final String INTERFACE = "com.kumuluz.ee.jaxws.cxf.impl.WsContextAnnotatedEndpoint";
// 
// }


import com.kumuluz.ee.jaxws.cxf.impl.NoWsContextAnnotatedEndpointBean;
import com.kumuluz.ee.jaxws.cxf.impl.WsContextAnnotatedEndpointBean;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLDecoder;
import java.util.stream.Stream;
import static org.junit.Assert.*;
package com.kumuluz.ee.jaxws.cxf.processor;




public class JaxWsAnnotationProcessorUtilTest {

    private JaxWsAnnotationProcessorUtil instance = JaxWsAnnotationProcessorUtil.getInstance();

    @Test
    public void shouldReturnDefaultWsInfo() {

        String className = NoWsContextAnnotatedEndpointBean.class.getName();
        Class<?> clazz = NoWsContextAnnotatedEndpointBean.class;

        prepareEndpointList(className);
        instance.reinitialize();

        String expectedContextRoot = "/*";
        String expectedUrl = "/" + className;

        //check implementation class
        assertEquals("Ws endpoint returned wrong implementation value", clazz, instance.getEndpointList().get(0).getImplementationClass());

        //assert @WsContext
        assertEquals("Ws endpoint without defined contextRoot returned wrong value", expectedContextRoot, instance.getContextRoot());
        assertFalse(instance.getEndpointList().isEmpty());
        assertEquals("Ws endpoint without defined url returned wrong value", expectedUrl, instance.getEndpointList().get(0).getUrl());

        //assert @Webservice
        assertNull("Ws endpoint without defined wsdlLocation returned wrong value", instance.getEndpointList().get(0).wsdlLocation());
        assertNull("Ws endpoint without defined wsdlLocation returned wrong value", instance.getEndpointList().get(0).portName());
        assertNull("Ws endpoint without defined wsdlLocation returned wrong value", instance.getEndpointList().get(0).serviceName());

    }

    @Test
    public void shouldReturnConfiguredWsInfo() {

        String className = WsContextAnnotatedEndpointBean.class.getName();
        Class<?> clazz = WsContextAnnotatedEndpointBean.class;

        prepareEndpointList(className);
        instance.reinitialize();


        //check implementation class
        assertEquals("Ws endpoint returned wrong implementation value", clazz, instance.getEndpointList().get(0).getImplementationClass());

        //assert @WsContext
// Path: components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/NoWsContextAnnotatedEndpointBean.java
// @WebService
// public class NoWsContextAnnotatedEndpointBean {
// }
// 
// Path: components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/WsContextAnnotatedEndpointBean.java
// @WsContext(contextRoot = WsContextAnnotatedEndpointBean.CTX_ROOT, urlPattern = WsContextAnnotatedEndpointBean.URL_PATTERN)
// @WebService(wsdlLocation = WsContextAnnotatedEndpointBean.WSDL_URL, portName = WsContextAnnotatedEndpointBean.PORT, serviceName =
//         WsContextAnnotatedEndpointBean.SERVICE, endpointInterface = WsContextAnnotatedEndpointBean.INTERFACE)
// public class WsContextAnnotatedEndpointBean implements WsContextAnnotatedEndpoint {
// 
//     public static final String WSDL_URL = "http://cloud.si/example.wsdl";
//     public static final String CTX_ROOT = "/ws/*";
//     public static final String URL_PATTERN = "/endpoint";
//     public static final String PORT = "EndpointPort";
//     public static final String SERVICE = "ServiceName";
//     public static final String INTERFACE = "com.kumuluz.ee.jaxws.cxf.impl.WsContextAnnotatedEndpoint";
// 
// }


// Path: components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/processor/JaxWsAnnotationProcessorUtilTest.java
import com.kumuluz.ee.jaxws.cxf.impl.NoWsContextAnnotatedEndpointBean;
import com.kumuluz.ee.jaxws.cxf.impl.WsContextAnnotatedEndpointBean;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLDecoder;
import java.util.stream.Stream;
import static org.junit.Assert.*;

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




public class JaxWsAnnotationProcessorUtilTest {

    private JaxWsAnnotationProcessorUtil instance = JaxWsAnnotationProcessorUtil.getInstance();

    @Test
    public void shouldReturnDefaultWsInfo() {

        String className = NoWsContextAnnotatedEndpointBean.class.getName();
        Class<?> clazz = NoWsContextAnnotatedEndpointBean.class;

        prepareEndpointList(className);
        instance.reinitialize();

        String expectedContextRoot = "/*";
        String expectedUrl = "/" + className;

        //check implementation class
        assertEquals("Ws endpoint returned wrong implementation value", clazz, instance.getEndpointList().get(0).getImplementationClass());

        //assert @WsContext
        assertEquals("Ws endpoint without defined contextRoot returned wrong value", expectedContextRoot, instance.getContextRoot());
        assertFalse(instance.getEndpointList().isEmpty());
        assertEquals("Ws endpoint without defined url returned wrong value", expectedUrl, instance.getEndpointList().get(0).getUrl());

        //assert @Webservice
        assertNull("Ws endpoint without defined wsdlLocation returned wrong value", instance.getEndpointList().get(0).wsdlLocation());
        assertNull("Ws endpoint without defined wsdlLocation returned wrong value", instance.getEndpointList().get(0).portName());
        assertNull("Ws endpoint without defined wsdlLocation returned wrong value", instance.getEndpointList().get(0).serviceName());

    }

    @Test
    public void shouldReturnConfiguredWsInfo() {

        String className = WsContextAnnotatedEndpointBean.class.getName();
        Class<?> clazz = WsContextAnnotatedEndpointBean.class;

        prepareEndpointList(className);
        instance.reinitialize();


        //check implementation class
        assertEquals("Ws endpoint returned wrong implementation value", clazz, instance.getEndpointList().get(0).getImplementationClass());

        //assert @WsContext
        assertEquals("Ws endpoint without defined contextRoot returned wrong value", WsContextAnnotatedEndpointBean.CTX_ROOT, instance.getContextRoot());