Package org.jboss.shrinkwrap.descriptor.api.webapp25

Examples of org.jboss.shrinkwrap.descriptor.api.webapp25.WebAppDescriptor


        validateTest(expectedOutput);
    }

    @Deployment(testable = false)
    public static WebArchive createDeployment() {
        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
                .version(WebAppVersionType._3_0)
                .createFilter()
                    .filterName("filter").filterClass(PojoServletFilter.class.getName()).up()
                .createFilterMapping()
                    .filterName("filter").urlPattern("/" + TEST_NAME).up();

        addEnvEntry(descriptor, "returnEmail", "java.lang.String", "tomee@apache.org");
        addEnvEntry(descriptor, "connectionPool", "java.lang.Integer", "20");
        addEnvEntry(descriptor, "startCount", "java.lang.Long", "200000");
        addEnvEntry(descriptor, "initSize", "java.lang.Short", "5");
        addEnvEntry(descriptor, "enableEmail", "java.lang.Boolean", "true");
        addEnvEntry(descriptor, "totalQuantity", "java.lang.Byte", "5");
        addEnvEntry(descriptor, "optionDefault", "java.lang.Character", "X");
        addEnvEntry(descriptor, "auditWriter", "java.lang.Class", "java.lang.String");
//        addEnvEntry(descriptor, "defaultCode", "java.lang.Enum", "Code.OK");

        WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
            .addClass(Code.class)
            .addClass(PojoServletFilter.class)
                .addClass(Car.class)
                .addClass(CompanyLocal.class)
                .addClass(Company.class)
                .addClass(DefaultCompany.class)
                .addClass(SuperMarket.class)
                .setWebXML(new StringAsset(descriptor.exportAsString()))
                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));



        return archive;
View Full Code Here


public abstract class TestSetup {
    @ArquillianResource
    private URL url;

    public WebArchive createDeployment(Class...archiveClasses) {
        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
                .version("3.0");
        decorateDescriptor(descriptor);

        WebArchive archive = ShrinkWrap.create(WebArchive.class, getTestContextName() + ".war")
                .setWebXML(new StringAsset(descriptor.exportAsString()))
                .addAsLibraries(JarLocation.jarLocation(Test.class))
                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
       
        if (archiveClasses != null) {
            for (Class c: archiveClasses) {
View Full Code Here

        validateTest(expectedOutput);
    }

    @Deployment(testable = false)
    public static WebArchive createDeployment() {
        final WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
                .version("3.0")
                .createListener()
                    .listenerClass(PojoServletContextListener.class.getName()).up()
                .createListener()
                    .listenerClass(PojoServletSessionListener.class.getName()).up()
                .createServlet()
                    .servletName("check").servletClass(ServletToCheckListener.class.getName()).up()
                .createServletMapping()
                    .servletName("check").urlPattern("/" + TEST_NAME).up();

        addEnvEntry(descriptor, "returnEmail", "java.lang.String", "tomee@apache.org");
        addEnvEntry(descriptor, "connectionPool", "java.lang.Integer", "20");
        addEnvEntry(descriptor, "startCount", "java.lang.Long", "200000");
        addEnvEntry(descriptor, "initSize", "java.lang.Short", "5");
        addEnvEntry(descriptor, "enableEmail", "java.lang.Boolean", "true");
        addEnvEntry(descriptor, "totalQuantity", "java.lang.Byte", "5");
        addEnvEntry(descriptor, "optionDefault", "java.lang.Character", "X");
        addEnvEntry(descriptor, "auditWriter", "java.lang.Class", "java.lang.String");
        //addEnvEntry(descriptor, "defaultCode", "java.lang.Enum", "org.apache.openejb.arquillian.ServletListenerPojoInjectionTest$Code.OK");

        final WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
                .addClass(PojoServletContextListener.class)
                .addClass(PojoServletSessionListener.class)
                .addClass(ServletToCheckListener.class)
                .addClass(Car.class)
                .addClass(CompanyLocal.class)
                .addClass(Company.class)
                .addClass(DefaultCompany.class)
                .addClass(SuperMarket.class)
                .addClass(Code.class)
                .addClass(ContextAttributeName.class)
                .setWebXML(new StringAsset(descriptor.exportAsString()))
                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));


        return archive;
    }
View Full Code Here

        validateTest(expectedOutput);
    }

    @Deployment(testable = false)
    public static WebArchive createDeployment() {
        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
                .version(WebAppVersionType._3_0)
                .createServlet().servletName("servlet").servletClass(PojoServlet.class.getName()).up()
                .createServletMapping().servletName("servlet").urlPattern("/" + TEST_NAME).up();

        addEnvEntry(descriptor, "returnEmail", "java.lang.String", "tomee@apache.org");
        addEnvEntry(descriptor, "connectionPool", "java.lang.Integer", "20");
        addEnvEntry(descriptor, "startCount", "java.lang.Long", "200000");
        addEnvEntry(descriptor, "initSize", "java.lang.Short", "5");
        addEnvEntry(descriptor, "enableEmail", "java.lang.Boolean", "true");
        addEnvEntry(descriptor, "totalQuantity", "java.lang.Byte", "5");
        addEnvEntry(descriptor, "optionDefault", "java.lang.Character", "X");
        addEnvEntry(descriptor, "auditWriter", "java.lang.Class", "java.lang.String");
        addEnvEntry(descriptor, "defaultCode", Code.class.getName(), "OK");

        Node appNode = ((NodeDescriptor) descriptor).getRootNode();
        appNode.createChild("/env-entry")
                .createChild("env-entry-name").text("name").getParent()
                .createChild("lookup-name").text("java:module/ModuleName");


        WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
                .addClass(PojoServlet.class)
                .addClass(Code.class)
                .setWebXML(new StringAsset(descriptor.exportAsString()));



        return archive;
    }
View Full Code Here

        validateTest(expectedOutput);
    }

    @Deployment(testable = false)
    public static WebArchive createDeployment() {
        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
                .version(WebAppVersionType._3_0)
                .createServlet()
                    .servletName("check").servletClass(PojoServlet.class.getName()).up()
                .createServletMapping()
                    .servletName("check").urlPattern("/" + TEST_NAME).up();

        return ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
                .addClass(PojoServlet.class)
                .addClass(CompanyLocal.class)
                .addClass(Company.class)
                .addClass(DefaultCompany.class)
                .addClass(OtherCompany.class)
                .addClass(SuperMarket.class)
                .setWebXML(new StringAsset(descriptor.exportAsString()));
    }
View Full Code Here

        validateTest(expectedOutput);
    }

    @Deployment(testable = false)
    public static WebArchive createDeployment() {
        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
                .version("3.0")
                .createListener()
                    .listenerClass(PersistenceServletContextListener.class.getName()).up()
                .createListener()
                    .listenerClass(PersistenceServletSessionListener.class.getName()).up()
                .createServlet()
                    .servletName("check").servletClass(ServletToCheckListener.class.getName()).up()
                .createServletMapping()
                    .servletName("check").urlPattern("/" + TEST_NAME).up();

        WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
                .addClass(PersistenceServletContextListener.class)
                .addClass(PersistenceServletSessionListener.class)
                .addClass(ServletToCheckListener.class)
                .addClass(Address.class)
                .addClass(ContextAttributeName.class)
                .addAsManifestResource("persistence.xml", ArchivePaths.create("persistence.xml"))
                .setWebXML(new StringAsset(descriptor.exportAsString()))
                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));



        return archive;
View Full Code Here

        validateTest(expectedOutput);
    }

    @Deployment(testable = false)
    public static WebArchive createDeployment() {
        WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class)
                .version("3.0")
                .createListener()
                    .listenerClass(RemoteServletContextListener.class.getName()).up()
                .createListener()
                    .listenerClass(RemoteServletSessionListener.class.getName()).up()
                .createServlet()
                    .servletName("check").servletClass(ServletToCheckListener.class.getName()).up()
                .createServletMapping()
                    .servletName("check").urlPattern("/" + TEST_NAME).up();

        WebArchive archive = ShrinkWrap.create(WebArchive.class, TEST_NAME + ".war")
                .addClass(RemoteServletContextListener.class)
                .addClass(RemoteServletSessionListener.class)
                .addClass(ServletToCheckListener.class)
                .addClass(CompanyRemote.class)
                .addClass(DefaultCompany.class)
                .addClass(ContextAttributeName.class)
                .setWebXML(new StringAsset(descriptor.exportAsString()))
                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));



        return archive;
View Full Code Here

    */
   @Override
   public WebAppDescriptor getConfig()
   {
      FileResource<?> configFile = getConfigFile();
      WebAppDescriptor descriptor;
      if (configFile.exists())
      {

         DescriptorImporter<WebAppDescriptor> importer = Descriptors.importAs(WebAppDescriptor.class);
         InputStream inputStream = configFile.getResourceInputStream();
         try
         {
            descriptor = importer.fromStream(inputStream);
         }
         finally
         {
            Streams.closeQuietly(inputStream);
         }
      }
      else
      {
         descriptor = Descriptors.create(WebAppDescriptor.class);
         String projectName = getFaceted().getFacet(MetadataFacet.class).getProjectName();
         WebAppDescriptor unit = descriptor
                  .version("3.0")
                  .displayName(projectName)
                  .createSessionConfig()
                  .sessionTimeout(30).up();
         // FORGE-657
         unit.createMimeMapping().extension("ico").mimeType("image/x-icon");
      }
      return descriptor;
   }
View Full Code Here

      WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class);

      ServletFacet servlet = this.project.getFacet(ServletFacet.class);
      if (servlet instanceof ServletFacet_3_0)
      {
         WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile("/index.html");
      }
      else if (servlet instanceof ServletFacet_3_1)
      {
         org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                  .getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile("/index.html");
      }
      loadTemplates();

      generateTemplates(targetDir, overwrite);
      HashMap<Object, Object> context = getTemplateContext(targetDir, template);
View Full Code Here

   {
      WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class);
      ServletFacet servlet = this.project.getFacet(ServletFacet.class);
      if (servlet instanceof ServletFacet_3_0)
      {
         WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
         Node root = ((NodeDescriptor) servletConfig).getRootNode();
         removeConflictingErrorPages(root);

         // (prefer /faces/error.xhtml)

         String errorLocation = getAccessStrategy().getWebPaths(web.getWebResource(ERROR_XHTML)).get(1);
         servletConfig.createErrorPage().errorCode("404").location(errorLocation);
         servletConfig.createErrorPage().errorCode("500").location(errorLocation);

         // Use the server timezone since we accept dates in that timezone, and it makes sense to display them in the
         // same
         boolean found = false;
         for (ParamValueType<WebAppDescriptor> contextParam : servletConfig.getAllContextParam())
         {
            if (contextParam.getParamName().equals("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE"))
            {
               found = true;
            }
         }
         if (!found)
         {
            servletConfig.createContextParam()
                     .paramName("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE").paramValue("true");
         }
         servlet.saveConfig(servletConfig);
      }
      else if (servlet instanceof ServletFacet_3_1)
      {
         org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                  .getConfig();
         // (prefer /faces/error.xhtml)

         String errorLocation = getAccessStrategy().getWebPaths(web.getWebResource(ERROR_XHTML)).get(1);
         servletConfig.createErrorPage().errorCode("404").location(errorLocation);
         servletConfig.createErrorPage().errorCode("500").location(errorLocation);

         // Use the server timezone since we accept dates in that timezone, and it makes sense to display them in the
         // same
         boolean found = false;
         for (org.jboss.shrinkwrap.descriptor.api.javaee7.ParamValueType<org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor> contextParam : servletConfig
                  .getAllContextParam())
         {
            if (contextParam.getParamName().equals("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE"))
            {
               found = true;
            }
         }
         if (!found)
         {
            servletConfig.createContextParam()
                     .paramName("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE").paramValue("true");
         }
         servlet.saveConfig(servletConfig);
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.shrinkwrap.descriptor.api.webapp25.WebAppDescriptor

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.