// Path: src/main/java/io/undertow/jsp/JspServletBuilder.java
// public class JspServletBuilder {
// 
// 
//     public static void setupDeployment(final DeploymentInfo deploymentInfo, final Map<String, ? extends JspPropertyGroupDescriptor> propertyGroups, final Map<String, TagLibraryInfo> tagLibraries, final InstanceManager instanceManager) {
//         deploymentInfo.addServletContextAttribute(SERVLET_VERSION, deploymentInfo.getMajorVersion() + "." + deploymentInfo.getMinorVersion());
//         deploymentInfo.addServletContextAttribute(JSP_PROPERTY_GROUPS, propertyGroups);
//         deploymentInfo.addServletContextAttribute(JSP_TAG_LIBRARIES, tagLibraries);
//         deploymentInfo.addServletContextAttribute(InstanceManager.class.getName(), instanceManager);
//         deploymentInfo.setJspConfigDescriptor(new JspConfigDescriptor() {
//             @Override
//             public Collection<TaglibDescriptor> getTaglibs() {
//                 return null;
//             }
// 
//             @Override
//             public Collection<JspPropertyGroupDescriptor> getJspPropertyGroups() {
//                 return (Collection<JspPropertyGroupDescriptor>) propertyGroups.values();
//             }
//         });
//     }
// 
//     public static ServletInfo createServlet(final String name, final String path) {
//         ServletInfo servlet = new ServletInfo(name, JspServlet.class);
//         servlet.addMapping(path);
//         //if the JSP servlet is mapped to a path that ends in /*
//         //we want to perform welcome file matches if the directory is requested
//         servlet.setRequireWelcomeFileMapping(true);
//         return servlet;
//     }
// 
// 
// }


import java.io.IOException;
import java.util.HashMap;
import javax.servlet.ServletException;
import io.undertow.jsp.HackInstanceManager;
import io.undertow.jsp.JspServletBuilder;
import io.undertow.server.handlers.PathHandler;
import io.undertow.servlet.api.DeploymentInfo;
import io.undertow.servlet.api.DeploymentManager;
import io.undertow.servlet.api.ServletContainer;
import io.undertow.servlet.test.util.TestClassIntrospector;
import io.undertow.servlet.test.util.TestResourceLoader;
import io.undertow.testutils.DefaultServer;
import io.undertow.testutils.HttpClientUtils;
import io.undertow.testutils.TestHttpClient;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.jasper.deploy.JspPropertyGroup;
import org.apache.jasper.deploy.TagLibraryInfo;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2012 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.undertow.test.jsp.lambda;



/**
 * @author Stuart Douglas
 */
@RunWith(DefaultServer.class)
public class LambdaJspTestCase {

    public static final String KEY = "io.undertow.message";

    @BeforeClass
    public static void setup() throws ServletException {

        final PathHandler servletPath = new PathHandler();
        final ServletContainer container = ServletContainer.Factory.newInstance();



        DeploymentInfo builder = new DeploymentInfo()
                .setClassLoader(LambdaJspTestCase.class.getClassLoader())
                .setContextPath("/servletContext")
                .setClassIntrospecter(TestClassIntrospector.INSTANCE)
                .setDeploymentName("servletContext.war")
                .setResourceManager(new TestResourceLoader(LambdaJspTestCase.class))
                .addServlet(JspServletBuilder.createServlet("Default Jsp Servlet", "*.jsp")
                        .addInitParam("compilerTargetVM", "1.8")
                        .addInitParam("compilerSourceVM", "1.8"));
// Path: src/main/java/io/undertow/jsp/JspServletBuilder.java
// public class JspServletBuilder {
// 
// 
//     public static void setupDeployment(final DeploymentInfo deploymentInfo, final Map<String, ? extends JspPropertyGroupDescriptor> propertyGroups, final Map<String, TagLibraryInfo> tagLibraries, final InstanceManager instanceManager) {
//         deploymentInfo.addServletContextAttribute(SERVLET_VERSION, deploymentInfo.getMajorVersion() + "." + deploymentInfo.getMinorVersion());
//         deploymentInfo.addServletContextAttribute(JSP_PROPERTY_GROUPS, propertyGroups);
//         deploymentInfo.addServletContextAttribute(JSP_TAG_LIBRARIES, tagLibraries);
//         deploymentInfo.addServletContextAttribute(InstanceManager.class.getName(), instanceManager);
//         deploymentInfo.setJspConfigDescriptor(new JspConfigDescriptor() {
//             @Override
//             public Collection<TaglibDescriptor> getTaglibs() {
//                 return null;
//             }
// 
//             @Override
//             public Collection<JspPropertyGroupDescriptor> getJspPropertyGroups() {
//                 return (Collection<JspPropertyGroupDescriptor>) propertyGroups.values();
//             }
//         });
//     }
// 
//     public static ServletInfo createServlet(final String name, final String path) {
//         ServletInfo servlet = new ServletInfo(name, JspServlet.class);
//         servlet.addMapping(path);
//         //if the JSP servlet is mapped to a path that ends in /*
//         //we want to perform welcome file matches if the directory is requested
//         servlet.setRequireWelcomeFileMapping(true);
//         return servlet;
//     }
// 
// 
// }


// Path: src/test/java/io/undertow/test/jsp/lambda/LambdaJspTestCase.java
import java.io.IOException;
import java.util.HashMap;
import javax.servlet.ServletException;
import io.undertow.jsp.HackInstanceManager;
import io.undertow.jsp.JspServletBuilder;
import io.undertow.server.handlers.PathHandler;
import io.undertow.servlet.api.DeploymentInfo;
import io.undertow.servlet.api.DeploymentManager;
import io.undertow.servlet.api.ServletContainer;
import io.undertow.servlet.test.util.TestClassIntrospector;
import io.undertow.servlet.test.util.TestResourceLoader;
import io.undertow.testutils.DefaultServer;
import io.undertow.testutils.HttpClientUtils;
import io.undertow.testutils.TestHttpClient;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.jasper.deploy.JspPropertyGroup;
import org.apache.jasper.deploy.TagLibraryInfo;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2012 Red Hat, Inc., and individual contributors
 * as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.undertow.test.jsp.lambda;



/**
 * @author Stuart Douglas
 */
@RunWith(DefaultServer.class)
public class LambdaJspTestCase {

    public static final String KEY = "io.undertow.message";

    @BeforeClass
    public static void setup() throws ServletException {

        final PathHandler servletPath = new PathHandler();
        final ServletContainer container = ServletContainer.Factory.newInstance();



        DeploymentInfo builder = new DeploymentInfo()
                .setClassLoader(LambdaJspTestCase.class.getClassLoader())
                .setContextPath("/servletContext")
                .setClassIntrospecter(TestClassIntrospector.INSTANCE)
                .setDeploymentName("servletContext.war")
                .setResourceManager(new TestResourceLoader(LambdaJspTestCase.class))
                .addServlet(JspServletBuilder.createServlet("Default Jsp Servlet", "*.jsp")
                        .addInitParam("compilerTargetVM", "1.8")
                        .addInitParam("compilerSourceVM", "1.8"));
        JspServletBuilder.setupDeployment(builder, new HashMap<String, JspPropertyGroup>(), new HashMap<String, TagLibraryInfo>(), new HackInstanceManager());