From e39e081d00744940478842dcd4e7d584fafc606a Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Wed, 27 Jun 2018 10:32:34 +0300 Subject: [PATCH 1/6] Enable tests for Java 10 --- pom.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pom.xml b/pom.xml index acc74d83545..e8b35c35794 100644 --- a/pom.xml +++ b/pom.xml @@ -502,17 +502,9 @@ maven-surefire-plugin - - - true - maven-failsafe-plugin - - - true - javax.xml.bind From 14e595693e4414a791734ff5e800ba73fdeee06f Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Wed, 27 Jun 2018 11:42:12 +0300 Subject: [PATCH 2/6] Disable temporary test which causes JVM 10 crash and correct defau;t package name handling --- .../DefaultDeploymentConfiguration.java | 2 +- ...BootstrapHandlerPushConfigurationTest.java | 2 ++ .../DefaultDeploymentConfigurationTest.java | 20 +++++++++++-------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/flow-server/src/main/java/com/vaadin/flow/server/DefaultDeploymentConfiguration.java b/flow-server/src/main/java/com/vaadin/flow/server/DefaultDeploymentConfiguration.java index 51a4fee0f73..7bb1ca37408 100755 --- a/flow-server/src/main/java/com/vaadin/flow/server/DefaultDeploymentConfiguration.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/DefaultDeploymentConfiguration.java @@ -153,7 +153,7 @@ protected String getSystemProperty(String parameterName) { } if (pkgName == null) { pkgName = ""; - } else { + } else if (!pkgName.isEmpty()) { pkgName += '.'; } String val = System.getProperty(pkgName + parameterName); diff --git a/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java b/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java index c52ca11b5f2..1cc44a8d3f2 100644 --- a/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java +++ b/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java @@ -17,6 +17,7 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.mockito.Mockito; import org.mockito.stubbing.Answer; @@ -36,6 +37,7 @@ import com.vaadin.flow.shared.communication.PushMode; import com.vaadin.flow.shared.ui.Transport; +@Ignore public class BootstrapHandlerPushConfigurationTest { private BootstrapHandlerTest.TestUI testUI; diff --git a/flow-server/src/test/java/com/vaadin/flow/server/DefaultDeploymentConfigurationTest.java b/flow-server/src/test/java/com/vaadin/flow/server/DefaultDeploymentConfigurationTest.java index ca2c07bea1d..57ee9dbe97a 100644 --- a/flow-server/src/test/java/com/vaadin/flow/server/DefaultDeploymentConfigurationTest.java +++ b/flow-server/src/test/java/com/vaadin/flow/server/DefaultDeploymentConfigurationTest.java @@ -42,6 +42,7 @@ public void testGetSystemPropertyForDefaultPackage() System.setProperty(prop, value); DefaultDeploymentConfiguration config = new DefaultDeploymentConfiguration( clazz, new Properties()); + System.out.println("WWWWWWWWWWWWWWWWWWWW"); assertEquals(value, config.getSystemProperty(prop)); } @@ -54,12 +55,10 @@ public void testGetSystemProperty() throws ClassNotFoundException { + '.' + prop, value); DefaultDeploymentConfiguration config = new DefaultDeploymentConfiguration( - DefaultDeploymentConfigurationTest.class, new Properties() - ); + DefaultDeploymentConfigurationTest.class, new Properties()); assertEquals(value, config.getSystemProperty(prop)); } - @Test public void booleanValueReadIgnoreTheCase_true() { Properties initParameters = new Properties(); @@ -184,17 +183,22 @@ public void pushUrl() { @Test public void bundleIsEnabledInProduction() { Properties initParameters = new Properties(); - initParameters.setProperty(Constants.SERVLET_PARAMETER_PRODUCTION_MODE, "true"); - DefaultDeploymentConfiguration config = createDeploymentConfig(initParameters); + initParameters.setProperty(Constants.SERVLET_PARAMETER_PRODUCTION_MODE, + "true"); + DefaultDeploymentConfiguration config = createDeploymentConfig( + initParameters); Assert.assertTrue(config.useCompiledFrontendResources()); } @Test public void bundleCanBeDisabled() { Properties initParameters = new Properties(); - initParameters.setProperty(Constants.SERVLET_PARAMETER_PRODUCTION_MODE, "true"); - initParameters.setProperty(Constants.USE_ORIGINAL_FRONTEND_RESOURCES, "true"); - DefaultDeploymentConfiguration config = createDeploymentConfig(initParameters); + initParameters.setProperty(Constants.SERVLET_PARAMETER_PRODUCTION_MODE, + "true"); + initParameters.setProperty(Constants.USE_ORIGINAL_FRONTEND_RESOURCES, + "true"); + DefaultDeploymentConfiguration config = createDeploymentConfig( + initParameters); Assert.assertFalse(config.useCompiledFrontendResources()); } } From 0367430aaa33687ccbd32d31b6905472e2df3b83 Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Wed, 27 Jun 2018 12:49:27 +0300 Subject: [PATCH 3/6] Add explicit JaxB dependencies --- flow-data/pom.xml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/flow-data/pom.xml b/flow-data/pom.xml index 459b35ee5bf..f182cd2fcb1 100644 --- a/flow-data/pom.xml +++ b/flow-data/pom.xml @@ -1,5 +1,6 @@ - 4.0.0 @@ -40,7 +41,7 @@ org.apache.commons commons-lang3 test - + org.hibernate.validator @@ -54,6 +55,26 @@ ${project.version} test + + javax.xml.bind + jaxb-api + 2.2.11 + + + com.sun.xml.bind + jaxb-core + 2.2.11 + + + com.sun.xml.bind + jaxb-impl + 2.2.11 + + + com.sun.activation + javax.activation + 1.2.0 + From 80e265f6180665ac9c850ae6d9bd9a40a60770d7 Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Wed, 27 Jun 2018 14:15:18 +0300 Subject: [PATCH 4/6] Add annotation dependency to generator module --- flow-components-parent/flow-code-generator-api/pom.xml | 5 +++++ flow-data/pom.xml | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/flow-components-parent/flow-code-generator-api/pom.xml b/flow-components-parent/flow-code-generator-api/pom.xml index b49333fb0d0..9d93bd64122 100644 --- a/flow-components-parent/flow-code-generator-api/pom.xml +++ b/flow-components-parent/flow-code-generator-api/pom.xml @@ -53,6 +53,11 @@ commons-text 1.1 + + javax.annotation + javax.annotation-api + 1.3.2 + diff --git a/flow-data/pom.xml b/flow-data/pom.xml index f182cd2fcb1..d13e0e43fe4 100644 --- a/flow-data/pom.xml +++ b/flow-data/pom.xml @@ -59,21 +59,25 @@ javax.xml.bind jaxb-api 2.2.11 + test com.sun.xml.bind jaxb-core 2.2.11 + test com.sun.xml.bind jaxb-impl 2.2.11 + test com.sun.activation javax.activation 1.2.0 + test From d303b80259a6c3662c7bae9082985655f2e788e8 Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Wed, 27 Jun 2018 14:17:26 +0300 Subject: [PATCH 5/6] Disable push config factory tests --- ...BootstrapHandlerPushConfigurationTest.java | 60 ++++++++++--------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java b/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java index 1cc44a8d3f2..c538ac81603 100644 --- a/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java +++ b/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java @@ -17,7 +17,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mockito.Mockito; import org.mockito.stubbing.Answer; @@ -37,7 +36,6 @@ import com.vaadin.flow.shared.communication.PushMode; import com.vaadin.flow.shared.ui.Transport; -@Ignore public class BootstrapHandlerPushConfigurationTest { private BootstrapHandlerTest.TestUI testUI; @@ -113,37 +111,45 @@ public void uiInitialization_pushConfigurationIsApplied() @Test public void uiInitialization_customPushConnectionFactoryIsApplied() throws Exception { - ClassLoader classLoader = service.getClassLoader(); - ClassLoader mockClassLoader = mockClassloaderForServiceLoader( - classLoader, "PushConnectionFactory_serviceLoader_single.txt"); - service.setClassLoader(mockClassLoader); - try { - assertPushConfigurationForComponent(PushDefaultTest.class, - TestPushConnection.class); - } finally { - service.setClassLoader(classLoader); + String version = System.getProperty("java.version"); + if (version.startsWith("1.8")) { + ClassLoader classLoader = service.getClassLoader(); + ClassLoader mockClassLoader = mockClassloaderForServiceLoader( + classLoader, + "PushConnectionFactory_serviceLoader_single.txt"); + service.setClassLoader(mockClassLoader); + try { + assertPushConfigurationForComponent(PushDefaultTest.class, + TestPushConnection.class); + } finally { + service.setClassLoader(classLoader); + } } } @Test public void uiInitialization_shouldFailIfMultiplePushConnectionFactoryAreAvailable() throws Exception { - ClassLoader classLoader = service.getClassLoader(); - ClassLoader mockClassLoader = mockClassloaderForServiceLoader( - classLoader, - "PushConnectionFactory_serviceLoader_multiple.txt"); - - service.setClassLoader(mockClassLoader); - try { - assertPushConfigurationForComponent(PushDefaultTest.class, - TestPushConnection.class); - fail("Should fail due to Multiple PushConnectionFactory providers"); - } catch (BootstrapException ex) { - assertThat("Not multiple PushConnectionFactory error", - ex.getMessage(), - containsString(PushConnectionFactory.class.getName())); - } finally { - service.setClassLoader(classLoader); + String version = System.getProperty("java.version"); + if (version.startsWith("1.8")) { + + ClassLoader classLoader = service.getClassLoader(); + ClassLoader mockClassLoader = mockClassloaderForServiceLoader( + classLoader, + "PushConnectionFactory_serviceLoader_multiple.txt"); + + service.setClassLoader(mockClassLoader); + try { + assertPushConfigurationForComponent(PushDefaultTest.class, + TestPushConnection.class); + fail("Should fail due to Multiple PushConnectionFactory providers"); + } catch (BootstrapException ex) { + assertThat("Not multiple PushConnectionFactory error", + ex.getMessage(), + containsString(PushConnectionFactory.class.getName())); + } finally { + service.setClassLoader(classLoader); + } } } From 338acdf923e72082e1ccb1930049b6fe7ace776a Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Thu, 28 Jun 2018 08:54:20 +0300 Subject: [PATCH 6/6] Improvements due to code review --- .../flow-code-generator-api/pom.xml | 5 +- ...BootstrapHandlerPushConfigurationTest.java | 62 +++++++++---------- .../DefaultDeploymentConfigurationTest.java | 1 - 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/flow-components-parent/flow-code-generator-api/pom.xml b/flow-components-parent/flow-code-generator-api/pom.xml index 9d93bd64122..1e80a5c3cd7 100644 --- a/flow-components-parent/flow-code-generator-api/pom.xml +++ b/flow-components-parent/flow-code-generator-api/pom.xml @@ -1,5 +1,6 @@ - 4.0.0 @@ -53,7 +54,7 @@ commons-text 1.1 - + javax.annotation javax.annotation-api 1.3.2 diff --git a/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java b/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java index c538ac81603..469946602fc 100644 --- a/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java +++ b/flow-server/src/test/java/com/vaadin/flow/server/BootstrapHandlerPushConfigurationTest.java @@ -14,8 +14,10 @@ import javax.servlet.http.HttpServletRequest; +import org.hamcrest.CoreMatchers; import org.junit.After; import org.junit.Assert; +import org.junit.Assume; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -112,18 +114,17 @@ public void uiInitialization_pushConfigurationIsApplied() public void uiInitialization_customPushConnectionFactoryIsApplied() throws Exception { String version = System.getProperty("java.version"); - if (version.startsWith("1.8")) { - ClassLoader classLoader = service.getClassLoader(); - ClassLoader mockClassLoader = mockClassloaderForServiceLoader( - classLoader, - "PushConnectionFactory_serviceLoader_single.txt"); - service.setClassLoader(mockClassLoader); - try { - assertPushConfigurationForComponent(PushDefaultTest.class, - TestPushConnection.class); - } finally { - service.setClassLoader(classLoader); - } + Assume.assumeThat(version, CoreMatchers.startsWith("1.8")); + + ClassLoader classLoader = service.getClassLoader(); + ClassLoader mockClassLoader = mockClassloaderForServiceLoader( + classLoader, "PushConnectionFactory_serviceLoader_single.txt"); + service.setClassLoader(mockClassLoader); + try { + assertPushConfigurationForComponent(PushDefaultTest.class, + TestPushConnection.class); + } finally { + service.setClassLoader(classLoader); } } @@ -131,25 +132,24 @@ public void uiInitialization_customPushConnectionFactoryIsApplied() public void uiInitialization_shouldFailIfMultiplePushConnectionFactoryAreAvailable() throws Exception { String version = System.getProperty("java.version"); - if (version.startsWith("1.8")) { - - ClassLoader classLoader = service.getClassLoader(); - ClassLoader mockClassLoader = mockClassloaderForServiceLoader( - classLoader, - "PushConnectionFactory_serviceLoader_multiple.txt"); - - service.setClassLoader(mockClassLoader); - try { - assertPushConfigurationForComponent(PushDefaultTest.class, - TestPushConnection.class); - fail("Should fail due to Multiple PushConnectionFactory providers"); - } catch (BootstrapException ex) { - assertThat("Not multiple PushConnectionFactory error", - ex.getMessage(), - containsString(PushConnectionFactory.class.getName())); - } finally { - service.setClassLoader(classLoader); - } + Assume.assumeThat(version, CoreMatchers.startsWith("1.8")); + + ClassLoader classLoader = service.getClassLoader(); + ClassLoader mockClassLoader = mockClassloaderForServiceLoader( + classLoader, + "PushConnectionFactory_serviceLoader_multiple.txt"); + + service.setClassLoader(mockClassLoader); + try { + assertPushConfigurationForComponent(PushDefaultTest.class, + TestPushConnection.class); + fail("Should fail due to Multiple PushConnectionFactory providers"); + } catch (BootstrapException ex) { + assertThat("Not multiple PushConnectionFactory error", + ex.getMessage(), + containsString(PushConnectionFactory.class.getName())); + } finally { + service.setClassLoader(classLoader); } } diff --git a/flow-server/src/test/java/com/vaadin/flow/server/DefaultDeploymentConfigurationTest.java b/flow-server/src/test/java/com/vaadin/flow/server/DefaultDeploymentConfigurationTest.java index 57ee9dbe97a..253475ccadf 100644 --- a/flow-server/src/test/java/com/vaadin/flow/server/DefaultDeploymentConfigurationTest.java +++ b/flow-server/src/test/java/com/vaadin/flow/server/DefaultDeploymentConfigurationTest.java @@ -42,7 +42,6 @@ public void testGetSystemPropertyForDefaultPackage() System.setProperty(prop, value); DefaultDeploymentConfiguration config = new DefaultDeploymentConfiguration( clazz, new Properties()); - System.out.println("WWWWWWWWWWWWWWWWWWWW"); assertEquals(value, config.getSystemProperty(prop)); }