You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ServletIntegrationTests.java 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright 2000-2014 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.tb3;
  17. import java.io.IOException;
  18. import java.util.HashSet;
  19. import java.util.List;
  20. import java.util.Set;
  21. import org.junit.runner.RunWith;
  22. import org.junit.runners.model.InitializationError;
  23. import com.vaadin.tests.integration.AbstractServletIntegrationTest;
  24. import com.vaadin.tests.integration.ServletIntegrationJSR356WebsocketUITest;
  25. import com.vaadin.tests.integration.ServletIntegrationWebsocketUITest;
  26. import com.vaadin.tests.tb3.ServletIntegrationTests.ServletIntegrationTestSuite;
  27. @RunWith(ServletIntegrationTestSuite.class)
  28. public class ServletIntegrationTests {
  29. public static Set<String> notJSR356Compatible = new HashSet<String>();
  30. public static Set<String> notWebsocketCompatible = new HashSet<String>();
  31. static {
  32. notJSR356Compatible.add("jboss4");
  33. notJSR356Compatible.add("jboss5");
  34. notJSR356Compatible.add("jboss6");
  35. notJSR356Compatible.add("jboss7");
  36. notJSR356Compatible.add("jetty7");
  37. notJSR356Compatible.add("jetty8");
  38. notJSR356Compatible.add("glassfish3");
  39. notJSR356Compatible.add("tomcat6");
  40. notJSR356Compatible.add("tomcat7");
  41. notJSR356Compatible.add("tomcat7apacheproxy");
  42. notJSR356Compatible.add("weblogic10");
  43. notJSR356Compatible.add("osgi"); // Karaf 3, Jetty 8
  44. notWebsocketCompatible.add("glassfish2");
  45. // In theory GF3 could work but in reality broken
  46. notWebsocketCompatible.add("glassfish3");
  47. notWebsocketCompatible.add("jboss4");
  48. notWebsocketCompatible.add("jboss5");
  49. notWebsocketCompatible.add("jboss6");
  50. notWebsocketCompatible.add("jboss7");
  51. notWebsocketCompatible.add("jetty5");
  52. notWebsocketCompatible.add("jetty6");
  53. notWebsocketCompatible.add("tomcat5");
  54. notWebsocketCompatible.add("tomcat6");
  55. notWebsocketCompatible.add("tomcat7apacheproxy");
  56. notWebsocketCompatible.add("weblogic10");
  57. // Requires an update to 8.5.5 and a fix for
  58. // https://dev.vaadin.com/ticket/16354
  59. // https://developer.ibm.com/answers/questions/186066/websocket-paths-using-uri-templates-do-not-work-pr/
  60. notWebsocketCompatible.add("websphere8");
  61. }
  62. public static class ServletIntegrationTestSuite extends TB3TestSuite {
  63. public ServletIntegrationTestSuite(Class<?> klass)
  64. throws InitializationError, IOException {
  65. super(klass, AbstractServletIntegrationTest.class,
  66. "com.vaadin.tests.integration", new String[] {},
  67. new ServletTestLocator());
  68. }
  69. }
  70. public static class ServletTestLocator extends TB3TestLocator {
  71. @Override
  72. protected <T> List<Class<? extends T>> findClasses(Class<T> baseClass,
  73. String basePackage, String[] ignoredPackages)
  74. throws IOException {
  75. List<Class<? extends T>> allClasses = super.findClasses(baseClass,
  76. basePackage, ignoredPackages);
  77. String serverName = System.getProperty("server-name");
  78. if (notJSR356Compatible.contains(serverName)) {
  79. allClasses
  80. .remove(ServletIntegrationJSR356WebsocketUITest.class);
  81. }
  82. if (notWebsocketCompatible.contains(serverName)) {
  83. allClasses.remove(ServletIntegrationWebsocketUITest.class);
  84. }
  85. return allClasses;
  86. }
  87. }
  88. }